3 # Synfig Bootstrap Script
6 # This script creates the configure script and Makefile.in files,
7 # and also fixes a few things in both to ensure a smooth build
8 # on all compilers and platforms.
11 # Grab the current directory and move to our own
15 # Environment Variables
16 BOOTSTRAP_NAME="$(basename $0)"
19 [ -x /bin/cygpath ] && CONFIG_DIR="`cygpath -m -s "$CONFIG_DIR"`"
20 [ -x /bin/cygpath ] && CONFIG_DIR="`cygpath -u "$CONFIG_DIR"`"
21 [ -x /bin/cygpath ] && CURR_DIR="`cygpath -m -s "$CURR_DIR"`"
22 [ -x /bin/cygpath ] && CURR_DIR="`cygpath -u "$CURR_DIR"`"
23 # Automake,Autoconf, and Libtool versions that we require
27 export WANT_AUTOMAKE=1.8
28 #export WANT_LIBTOOL_VER=1.5
29 export WANT_AUTOCONF_2_5=1
30 export WANT_AUTOCONF=2.5
32 . "$CONFIG_DIR/build.cfg"
35 s/@PACKAGE@/$PACKAGE/g;
36 s/@PACKAGE_NAME@/$PACKAGE_NAME/g;
37 s/@PACKAGE_BUGREPORT@/$PACKAGE_BUGREPORT/g;
38 s/@PACKAGE_TARNAME@/$PACKAGE_TARNAME/g;
39 s/@PACKAGE_VERSION@/$PACKAGE_VERSION/g;
40 s|@SVN_REPOSITORY@|$SVN_REPOSITORY|g;
41 s/@VERSION@/$VERSION/g;
42 s/@API_VERSION@/$API_VERSION/g;
43 s/@VERSION_MAJ@/$VERSION_MAJ/g;
44 s/@VERSION_MIN@/$VERSION_MIN/g;
45 s/@VERSION_REV@/$VERSION_REV/g;
46 s/@VERSION_REL@/$VERSION_REL/g;
50 # Define the output function
52 echo $BOOTSTRAP_NAME: $*
55 # Define the cleanup function
58 rm -fr config.cache autom4te*.cache configure.in $TEMPFILE
61 output Preparing build environment for $PACKAGE-$VERSION...
63 # Look for the CVS directory. If we don't find it, we need to
64 # ask the user if they know what they are doing.
65 ( test -d CVS || test -d .svn ) ||
67 output warning: This shell script is intended for those
68 output warning: who either know what they are doing or
69 output warning: or downloaded this program from the CVS
70 output warning: repository. See README for more details.
71 output warning: To avoid seeing this message in the future,
72 output warning: create an empty directory called 'CVS'.
73 output Waiting for 15 seconds...
77 # Create the temporary file
78 output Creating temporary file...
79 TEMPFILE=`mktemp /tmp/$BOOTSTRAP_NAME.XXXXXX` ||
81 output ERROR: Unable to create temporary file!
86 (which autoconf > /dev/null 2>&1 ) ||
88 output error: 'Could not find GNU autoconf!'
89 output You need to download and install GNU autoconf v2.52 or higher.
90 output '<ftp://ftp.gnu.org/gnu/autoconf/>'
95 # Check autoconf version
96 output Using $(autoconf --version | grep utoconf)
97 autoconf --version | grep -q "$AUTOCONF_VERSION" ||
99 output warning: Unexpected version of GNU Autoconf "(expected $AUTOCONF_VERSION)"
100 output warning: *** Bootstrap process may fail!
104 (which automake > /dev/null 2>&1 ) ||
106 output error: 'Could not find GNU automake!'
107 output You need to download and install GNU automake v1.5 or higher.
108 output '<ftp://ftp.gnu.org/gnu/automake/>'
113 # Check automake version
114 output Using $(automake --version | grep utomake)
115 automake --version | grep -q "$AUTOMAKE_VERSION" ||
117 output warning: Unexpected version of GNU Automake "(expected $AUTOMAKE_VERSION)"
118 output warning: *** Bootstrap process may fail!
122 (which libtool > /dev/null 2>&1 ) ||
124 output error: 'Could not find GNU libtool!'
125 output You need to download and install GNU libtool v1.4 or higher.
126 output '<ftp://ftp.gnu.org/gnu/libtool/>'
130 # Check libtool version
131 echo $BOOTSTRAP_NAME: Using $(libtoolize --version | grep ibtool)
132 libtoolize --version | grep -q "$LIBTOOL_VERSION" ||
134 output warning: Unexpected version of GNU Libtool "(expected $LIBTOOL_VERSION)"
135 output warning: *** Bootstrap process may fail!
138 # Versions of libtool prior to 1.4.2 have a seriously broken libltdl.
139 # If we are using this broken version, we need to patch it.
140 libtoolize --version | grep -q -e "1.4.2" -e "1.4.1" -e "1.4 " && PATCH_LTDL=1
144 for FILENAME in doxygen.cfg pkgconfig.pc project.spec ; do {
145 output Creating $FILENAME...
146 sed "$SED_SCRIPT" < "$CONFIG_DIR/$FILENAME.in" > $FILENAME;
149 output Renaming pkgconfig.pc to $PACKAGE_TARNAME.pc.in...
150 mv pkgconfig.pc "$PACKAGE_TARNAME.pc.in"
152 output Renaming project.spec to $PACKAGE.spec...
153 mv project.spec "$PACKAGE.spec"
155 output Finishing up $PACKAGE.spec...
156 echo %changelog >> "$PACKAGE.spec"
157 cat NEWS >> "$PACKAGE.spec"
159 output Creating configure.in from configure.ac...
160 sed "$SED_SCRIPT" < "$CONFIG_DIR/configure.ac" > configure.in;
162 output Generating ChangeLog from SVN
163 if test x != "x$VERSION_REL" ; then export REVISION="--revision $VERSION_REL" ; fi
164 test -f ChangeLog || svn2cl --include-rev $REVISION $SVN_REPOSITORY/trunk/ || touch ChangeLog
166 output Setting up build environment...
168 # Set the shell to output what we are doing
171 # Create all of the build environment files
173 libtoolize -c -f --ltdl &&
174 aclocal -I "$CONFIG_DIR" $ACLOCAL_FLAGS &&
176 autoconf -o configure &&
177 automake --force-missing --add-missing --include-deps &&
181 # Something went wrong...
188 # Turn off echoing of commands
191 # Reconfigure the LTDL, if necessary
192 [ $RECONFIG_LTDL"x" != "x" ] && (
193 output Reconfiguring LTDL...
197 ( echo "AC_CONFIG_AUX_DIR(../config)" >> configure.* ) &&
198 aclocal -I "../$CONFIG_DIR" &&
201 automake --force-missing --add-missing --include-deps
204 # Something went wrong...
213 # If this is the broken version of LTDL, then patch it
214 [ $PATCH_LTDL"x" != "x" ] && (
215 output Patching LTDL...
217 s/handle || /(handle \&\& handle->loader) || /;
218 s/errors > 0) \&\& file_not_found ())/errors > 0) \&\& !file_not_found ())/;
219 s/(!handle)/(!handle || !handle->loader)/;
220 s/ access (filename, R_OK)/ !access (filename, R_OK)/;
221 " < libltdl/ltdl.c > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.c
223 s/DLL_EXPORT/LTDL_DLL_EXPORT/;
224 " < libltdl/ltdl.h > $TEMPFILE && cp $TEMPFILE libltdl/ltdl.h
228 output Patching libtool...
229 patch config/ltmain.sh config/ltmain.patch
232 # Something went wrong...
239 #echo '#define LTDL_SHLIB_EXT ".so"' >> libltdl/config-h.in
242 #define LTDL_SHLIB_EXT ".dll"
245 #define LTDL_SHLIB_EXT ".so"
247 #define LTDL_SHLIB_EXT ".la"
249 #endif ' >> libltdl/config-h.in
251 # output Patching configure script to look for gcc3...
253 # s/g++ c++/g++3 g++ c++/;
254 # s/gcc cc/gcc3 gcc cc/;
255 # s:"'${prefix}/include'":"'${prefix}/include/synfig'":;
256 # s:PREFIX/include:PREFIX/include/ETL:;
257 # " < configure > $TEMPFILE
258 # cp $TEMPFILE configure
260 # Patch the Makefile.in files
261 for filename in $(find Makefile.in src -name Makefile.in) ; do {
262 echo $BOOTSTRAP_NAME: Patching $filename
264 cp $filename $TEMPFILE &&
266 # Remove brain-dead include path
269 # Gosh... I can't remember why I did this one...
270 # Everything seems to work, so I'll leave it in.
271 s;-I"'$(srcdir)'" ;-I"'$(top_srcdir)'" ;
273 # Tell the configure script where it's origin realy is
274 s;configure.in;config/configure.ac;
275 " < $TEMPFILE > $filename
279 output Failure. Unable to patch $filename.
285 output Creating Makefile...
288 ./configure --enable-maintainer-mode
292 ./configure --enable-maintainer-mode
296 ./configure --enable-maintainer-mode
300 ./configure --enable-maintainer-mode
304 ./configure --enable-maintainer-mode
316 # Move back to the current directory
319 make -C src/synfig/proto