|
jbailey@22
|
1 |
#! /bin/sh |
|
rekkanoryo@603
|
2 |
# Guifications - The end-all, be-all notification framework |
|
rekkanoryo@665
|
3 |
# Copyright (C) 2003-2008 Gary Kramlich <grim@reaperworld.com> |
|
rekkanoryo@603
|
4 |
# |
|
rekkanoryo@603
|
5 |
# This program is free software; you can redistribute it and/or modify it |
|
rekkanoryo@603
|
6 |
# under the terms of the GNU General Public License as published by the Free |
|
rekkanoryo@603
|
7 |
# Software Foundation; either version 2 of the License, or (at your option) |
|
rekkanoryo@603
|
8 |
# any later version. |
|
rekkanoryo@603
|
9 |
# |
|
rekkanoryo@603
|
10 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
|
rekkanoryo@603
|
11 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
rekkanoryo@603
|
12 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
rekkanoryo@603
|
13 |
# more details. |
|
rekkanoryo@603
|
14 |
# |
|
rekkanoryo@603
|
15 |
# You should have received a copy of the GNU General Public License along with |
|
rekkanoryo@603
|
16 |
# this program; if not, write to the Free Software Foundation, Inc., 51 |
|
rekkanoryo@603
|
17 |
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
jbailey@22
|
18 |
|
|
rekkanoryo@603
|
19 |
############################################################################### |
|
rekkanoryo@603
|
20 |
# Usage |
|
rekkanoryo@603
|
21 |
############################################################################### |
|
rekkanoryo@603
|
22 |
# This script uses a config file that can be used to stash common arguments |
|
rekkanoryo@603
|
23 |
# passed to configure or environment variables that need to be set before |
|
rekkanoryo@603
|
24 |
# configure is called. The configuration file is a simple shell script that |
|
rekkanoryo@603
|
25 |
# gets sourced. |
|
rekkanoryo@603
|
26 |
# |
|
rekkanoryo@603
|
27 |
# By default, the config file that is used is named 'autogen.args'. This can |
|
rekkanoryo@603
|
28 |
# be configured below. |
|
rekkanoryo@603
|
29 |
# |
|
rekkanoryo@603
|
30 |
# Available options that are handled are as follow: |
|
rekkanoryo@603
|
31 |
# ACLOCAL_FLAGS - command line arguments to pass to aclocal |
|
rekkanoryo@603
|
32 |
# AUTOCONF_FLAGS - command line arguments to pass to autoconf |
|
rekkanoryo@603
|
33 |
# AUTOHEADER_FLAGS - command line arguments to pass to autoheader |
|
rekkanoryo@603
|
34 |
# AUTOMAKE_FLAGS - command line arguments to pass to automake flags |
|
rekkanoryo@603
|
35 |
# CONFIGURE_FLAGS - command line arguments to pass to configure |
|
rekkanoryo@603
|
36 |
# INTLTOOLIZE_FLAGS - command line arguments to pass to intltoolize |
|
rekkanoryo@603
|
37 |
# LIBTOOLIZE_FLAGS - command line arguments to pass to libtoolize |
|
rekkanoryo@603
|
38 |
# |
|
rlaager@979
|
39 |
# Other helpful notes: |
|
rekkanoryo@603
|
40 |
# If you're using a different c compiler, you can override the environment |
|
rekkanoryo@603
|
41 |
# variable in 'autogen.args'. For example, say you're using distcc, just add |
|
rekkanoryo@603
|
42 |
# the following to 'autogen.args': |
|
rekkanoryo@603
|
43 |
# |
|
rekkanoryo@603
|
44 |
# CC="distcc" |
|
rekkanoryo@603
|
45 |
# |
|
rekkanoryo@603
|
46 |
# This will work for any influential environment variable to configure. |
|
rekkanoryo@603
|
47 |
############################################################################### |
|
rekkanoryo@603
|
48 |
PACKAGE="Purple Plugin Pack" |
|
rekkanoryo@603
|
49 |
ARGS_FILE="autogen.args" |
|
rlaager@979
|
50 |
export CFLAGS |
|
rlaager@979
|
51 |
export LDFLAGS |
|
rekkanoryo@603
|
52 |
|
|
nosnilmot@977
|
53 |
libtoolize="libtoolize" |
|
nosnilmot@977
|
54 |
case $(uname -s) in |
|
nosnilmot@977
|
55 |
Darwin*) |
|
nosnilmot@977
|
56 |
libtoolize="glibtoolize" |
|
nosnilmot@977
|
57 |
;; |
|
nosnilmot@977
|
58 |
*) |
|
nosnilmot@977
|
59 |
esac |
|
nosnilmot@977
|
60 |
|
|
rekkanoryo@603
|
61 |
############################################################################### |
|
rekkanoryo@603
|
62 |
# Some helper functions |
|
rekkanoryo@603
|
63 |
############################################################################### |
|
rekkanoryo@603
|
64 |
check () { |
|
rekkanoryo@603
|
65 |
CMD=$1 |
|
rekkanoryo@603
|
66 |
|
|
nosnilmot@977
|
67 |
printf "%s" "checking for ${CMD}... " |
|
grim@867
|
68 |
BIN=`which ${CMD} 2>/dev/null` |
|
rekkanoryo@603
|
69 |
|
|
rekkanoryo@603
|
70 |
if [ x"${BIN}" = x"" ] ; then |
|
rekkanoryo@603
|
71 |
echo "not found." |
|
rekkanoryo@603
|
72 |
echo "${CMD} is required to build ${PACKAGE}!" |
|
rekkanoryo@603
|
73 |
exit 1; |
|
rekkanoryo@603
|
74 |
fi |
|
rekkanoryo@603
|
75 |
|
|
rekkanoryo@603
|
76 |
echo "${BIN}" |
|
jbailey@22
|
77 |
} |
|
jbailey@22
|
78 |
|
|
rekkanoryo@603
|
79 |
run_or_die () { # beotch |
|
rekkanoryo@603
|
80 |
CMD=$1 |
|
rekkanoryo@603
|
81 |
shift |
|
rekkanoryo@603
|
82 |
|
|
grim@855
|
83 |
OUTPUT=`mktemp autogen-XXXXXX` |
|
grim@794
|
84 |
|
|
nosnilmot@977
|
85 |
printf "%s" "running ${CMD} ${@}... " |
|
grim@794
|
86 |
${CMD} ${@} >${OUTPUT} 2>&1 |
|
grim@794
|
87 |
|
|
rekkanoryo@603
|
88 |
if [ $? != 0 ] ; then |
|
rekkanoryo@603
|
89 |
echo "failed." |
|
grim@794
|
90 |
cat ${OUTPUT} |
|
grim@794
|
91 |
rm -f ${OUTPUT} |
|
rekkanoryo@603
|
92 |
exit 1 |
|
rekkanoryo@603
|
93 |
else |
|
rekkanoryo@603
|
94 |
echo "done." |
|
rlaager@978
|
95 |
cat ${OUTPUT} |
|
rlaager@980
|
96 |
|
|
grim@794
|
97 |
rm -f ${OUTPUT} |
|
rekkanoryo@603
|
98 |
fi |
|
jbailey@22
|
99 |
} |
|
jbailey@22
|
100 |
|
|
rekkanoryo@603
|
101 |
############################################################################### |
|
rekkanoryo@603
|
102 |
# We really start here, yes, very sneaky! |
|
rekkanoryo@603
|
103 |
############################################################################### |
|
nosnilmot@861
|
104 |
FIGLET=`which figlet 2> /dev/null` |
|
rekkanoryo@603
|
105 |
if [ x"${FIGLET}" != x"" ] ; then |
|
rekkanoryo@603
|
106 |
${FIGLET} -f small ${PACKAGE} |
|
rekkanoryo@603
|
107 |
echo "build system is being generated" |
|
rekkanoryo@603
|
108 |
else |
|
rekkanoryo@603
|
109 |
echo "autogenerating build system for '${PACKAGE}'" |
|
rekkanoryo@603
|
110 |
fi |
|
jbailey@22
|
111 |
|
|
rekkanoryo@603
|
112 |
############################################################################### |
|
rekkanoryo@603
|
113 |
# Look for our args file |
|
rekkanoryo@603
|
114 |
############################################################################### |
|
nosnilmot@977
|
115 |
printf "%s" "checking for ${ARGS_FILE}: " |
|
rekkanoryo@603
|
116 |
if [ -f ${ARGS_FILE} ] ; then |
|
rekkanoryo@603
|
117 |
echo "found." |
|
nosnilmot@977
|
118 |
printf "%s" "sourcing ${ARGS_FILE}: " |
|
rlaager@979
|
119 |
. "`dirname "$0"`"/${ARGS_FILE} |
|
rekkanoryo@603
|
120 |
echo "done." |
|
rekkanoryo@603
|
121 |
else |
|
rekkanoryo@603
|
122 |
echo "not found." |
|
rekkanoryo@603
|
123 |
fi |
|
jbailey@22
|
124 |
|
|
rekkanoryo@603
|
125 |
############################################################################### |
|
rekkanoryo@603
|
126 |
# Check for our required helpers |
|
rekkanoryo@603
|
127 |
############################################################################### |
|
nosnilmot@977
|
128 |
check "$libtoolize"; LIBTOOLIZE=${BIN}; |
|
rlaager@979
|
129 |
check "intltoolize"; INTLTOOLIZE=${BIN}; |
|
rekkanoryo@603
|
130 |
check "aclocal"; ACLOCAL=${BIN}; |
|
rekkanoryo@603
|
131 |
check "autoheader"; AUTOHEADER=${BIN}; |
|
rekkanoryo@603
|
132 |
check "automake"; AUTOMAKE=${BIN}; |
|
rekkanoryo@603
|
133 |
check "autoconf"; AUTOCONF=${BIN}; |
|
nosnilmot@861
|
134 |
check "python"; PYTHON=${BIN}; |
|
grim@796
|
135 |
|
|
grim@796
|
136 |
############################################################################### |
|
grim@796
|
137 |
# Build pluginpack.m4 |
|
grim@796
|
138 |
############################################################################### |
|
grim@796
|
139 |
CONFIG_FILE="plugin_pack.m4" |
|
grim@796
|
140 |
|
|
nosnilmot@977
|
141 |
printf "%s" "creating ${CONFIG_FILE} ..." |
|
nosnilmot@861
|
142 |
${PYTHON} plugin_pack.py config_file > ${CONFIG_FILE} |
|
grim@796
|
143 |
echo " done." |
|
jbailey@22
|
144 |
|
|
rekkanoryo@603
|
145 |
############################################################################### |
|
rekkanoryo@603
|
146 |
# Run all of our helpers |
|
rekkanoryo@603
|
147 |
############################################################################### |
|
nosnilmot@975
|
148 |
run_or_die ${LIBTOOLIZE} ${LIBTOOLIZE_FLAGS:-"-c -f --automake"} |
|
nosnilmot@975
|
149 |
run_or_die ${INTLTOOLIZE} ${INTLTOOLIZE_FLAGS:-"-c -f --automake"} |
|
rekkanoryo@981
|
150 |
run_or_die ${ACLOCAL} ${ACLOCAL_FLAGS} |
|
rekkanoryo@603
|
151 |
run_or_die ${AUTOHEADER} ${AUTOHEADER_FLAGS} |
|
nosnilmot@975
|
152 |
run_or_die ${AUTOMAKE} ${AUTOMAKE_FLAGS:-"-a -c --gnu"} |
|
nosnilmot@861
|
153 |
run_or_die ${AUTOCONF} ${AUTOCONF_FLAGS} |
|
jbailey@22
|
154 |
|
|
rekkanoryo@603
|
155 |
############################################################################### |
|
rekkanoryo@603
|
156 |
# Run configure |
|
rekkanoryo@603
|
157 |
############################################################################### |
|
deryni@976
|
158 |
echo "running ./configure ${CONFIGURE_FLAGS} $@" |
|
deryni@976
|
159 |
./configure ${CONFIGURE_FLAGS} $@ |