Fix GCC -Wimplicit-fallthrough warning
[xapian.git] / bootstrap
blob5bc9f1d6e6ded87dd588d787059f87a1ba98f98d
1 #!/bin/sh
2 # bootstrap a xapian source tree obtained from git to produce a tree like
3 # you'd get from unpacking the results of "make dist"
5 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015 Olly Betts
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20 # USA
22 if [ "$1" = "--help" ] ; then
23 cat <<__END__
24 $0 [--ftp] [--without-autotools|--clean] [MODULE...]
26 The default is to bootstrap all known modules. Any modules which have a
27 file called ".nobootstrap" in their top-level will be skipped.
28 __END__
29 exit 0
32 trap 'echo "Bootstrap failed"' EXIT
33 set -e
35 # The variables which specify the autotools to use. And doxygen.
36 autotools="AUTORECONF AUTOCONF AUTOHEADER AUTOM4TE AUTOMAKE ACLOCAL LIBTOOLIZE DOXYGEN"
38 # Tool for downloading a file from a URL (currently wget or curl).
39 FETCH_URL_TOOL=
41 check_sha1sum() {
42 checksum=$1
43 tarball=$2
45 if [ -z "$SHA1SUM_TOOL" ] ; then
46 for SHA1SUM_TOOL in \
47 '${SHA1SUM-sha1sum} 2>/dev/null|cut -d\ -f1' \
48 '${SHASUM-shasum} 2>/dev/null|cut -d\ -f1' \
49 '$(OPENSSL-openssl} sha1 2>/dev/null|sed "s/.* //"' \
50 '' ; do
51 if [ -z "$SHA1SUM_TOOL" ] ; then
52 echo <<'END'
53 Need sha1sum or shasum or openssl installed to check SHA1 checksums.
54 Set environment variable SHA1SUM, SHASUM or OPENSSL if the tool isn't on
55 your PATH.
56 END
57 exit 1
59 r=`:|eval "$SHA1SUM_TOOL"`
60 [ X"$r" != Xda39a3ee5e6b4b0d3255bfef95601890afd80709 ] || break
61 done
63 r=`< $tarball eval "$SHA1SUM_TOOL"`
64 if [ X"$r" != X"$checksum" ] ; then
65 echo "$tarball: computed SHA1 checksum did NOT match"
66 echo "computed: $r with $SHA1SUM_TOOL"
67 echo "expected: $checksum"
68 ls -l $tarball
69 file $tarball || true
70 mv "$tarball" "$tarball.$r"
71 echo "Renamed $tarball to $tarball.$r"
72 exit 1
76 lazy_build() {
77 package=$1
78 basename=$package-$2
79 ext=$3
80 checksum=$4
81 if [ "$ext" = "tar.xz" ] ; then
82 if [ -z "$xz_ok" ] ; then
83 if ${XZ-xz} --version > /dev/null 2>&1 ; then
84 xz_ok=1
85 else
86 xz_ok=0
89 if [ "$xz_ok" = 0 ] ; then
90 shift 2
91 ext=$3
92 checksum=$4
95 if [ "$ext" = "tar.bz2" ] ; then
96 if [ -z "$bz2_ok" ] ; then
97 # bzip2 --version doesn't exit with code 0 in upstream version (though
98 # Debian at least patch this bug), so use --help to check it.
99 if bzip2 --help > /dev/null 2>&1 ; then
100 bz2_ok=1
101 else
102 bz2_ok=0
105 if [ "$bz2_ok" = 0 ] ; then
106 shift 2
107 ext=$3
108 checksum=$4
111 tarball=$basename.$ext
112 case $basename in
113 *[24680][a-z]) basename=`echo "$basename"|sed 's/[a-z]$//'` ;;
114 esac
116 # Create the stamp file in INST so that rerunning bootstrap after
117 # "rm -rf INST" recovers nicely.
118 stamp=../INST/$package.stamp
120 # Download the tarball if required.
121 if [ ! -f "$tarball" ] ; then
122 if [ -z "$FETCH_URL_TOOL" ] ; then
123 if ${WGET-wget} --version > /dev/null 2>&1 ; then
124 FETCH_URL_TOOL="${WGET-wget} -O-"
125 elif ${CURL-curl} --version > /dev/null 2>&1 || [ "$?" = 2 ] ; then
126 # curl --version exits with code 2.
127 # -L is needed to follow HTTP redirects.
128 FETCH_URL_TOOL="${CURL-curl} -L"
129 elif ${LWP_REQUEST-lwp-request} -v > /dev/null 2>&1 || [ "$?" = 9 -o "$?" = 255 ] ; then
130 # lwp-request -v exits with code 9 (5.810) or 255 (6.03)
131 FETCH_URL_TOOL="${LWP_REQUEST-lwp-request} -mGET"
132 else
133 cat <<END >&2
134 Neither wget nor curl nor lwp-request found - install one of them or if already
135 installed, set WGET, CURL or LWP_REQUEST to the full path. Alternatively,
136 download $url
137 to directory `pwd`
138 then rerun this script.
140 exit 1
143 case $basename in
144 doxygen-*)
145 if [ "$use_ftp" = yes ] ; then
146 url="ftp://ftp.stack.nl/pub/users/dimitri/$tarball"
147 else
148 url="http://ftp.stack.nl/pub/users/dimitri/$tarball"
149 fi ;;
150 file-*)
151 if [ "$use_ftp" = yes ] ; then
152 url="ftp://ftp.astron.com/pub/file/$tarball"
153 else
154 url="http://fossies.org/unix/misc/$tarball"
155 fi ;;
156 *[13579][a-z])
157 # GNU alpha release
158 if [ "$use_ftp" = yes ] ; then
159 url="ftp://alpha.gnu.org/gnu/$package/$tarball"
160 else
161 url="http://alpha.gnu.org/gnu/$package/$tarball"
162 fi ;;
164 if [ "$use_ftp" = yes ] ; then
165 url="ftp://ftp.gnu.org/gnu/$package/$tarball"
166 else
167 url="http://ftpmirror.gnu.org/$package/$tarball"
168 fi ;;
169 esac
170 rm -f download.tmp
171 echo "Downloading <$url>"
172 $FETCH_URL_TOOL "$url" > download.tmp && mv download.tmp "$tarball"
175 if [ -f "$stamp" ] ; then
176 find_stdout=`find "$tarball" ../patches/"$package"/* -newer "$stamp" -print 2> /dev/null||true`
177 else
178 find_stdout=force
181 if [ -n "$find_stdout" ] ; then
182 # Verify the tarball's checksum before building it.
183 check_sha1sum "$checksum" "$tarball"
185 # Remove tarballs of other versions.
186 for f in "$package"-* ; do
187 [ "$f" = "$tarball" ] || rm -rf "$f"
188 done
190 case $ext in
191 tar.xz)
192 ${XZ-xz} -dc "$tarball"| tar xf - ;;
193 tar.bz2)
194 bzip2 -dc "$tarball"| tar xf - ;;
196 gzip -dc "$tarball"| tar xf - ;;
197 esac
199 cd "$basename"
201 if [ ! -f "../../patches/$package/series" ] ; then
202 cat <<END >&2
203 No patch series file 'patches/$package/series' - if there are no patches,
204 this should just be an empty file.
206 exit 1
208 echo "Applying patches from $package/series"
209 sed -n 's/[ ]*\(#.*\)\?$//;/./p' "../../patches/$package/series" | \
210 while read p ; do
211 echo "Applying patch $package/$p"
212 patch -p1 < "../../patches/$package/$p"
213 done
215 # Fix doxygen/Qt stupid and pointless enumerating of Mac OS X releases
216 # which stops it building on each new OS X release.
217 if [ -f qtools/qglobal.h ] ; then
218 sed 's!^[ ]*#[ ]*\(error\|warning\).*Mac *OS *X is unsupported!// &!' \
219 qtools/qglobal.h > qtools/qglobal.hT
220 mv qtools/qglobal.hT qtools/qglobal.h
223 if test -n "$AUTOCONF" ; then
224 ./configure --prefix "$instdir" AUTOCONF="$AUTOCONF"
225 else
226 ./configure --prefix "$instdir"
228 make
229 make install
230 cd ..
231 rm -rf "$basename"
233 touch "$stamp"
237 handle_git_external() {
238 path=$1
239 if [ ! -f "$path/.nobootstrap" ] ; then
240 rev=$2
241 url=$3
242 if [ ! -d "$path" ] ; then
243 git clone --no-checkout -- "$url" "$path"
244 elif (cd "$path" && git reflog "$rev" -- 2>/dev/null) ; then
245 : # Already have that revision locally
246 else
247 (cd "$path" && git fetch)
249 (cd "$path" && git checkout "$rev")
253 update_config() {
254 from=$1
255 to=$2
256 ts_from=`perl -ne '/^timestamp=(\W?)([-\d]+)$1/ and do {$_=$2;y/-//d;print;exit}' "$from"`
257 ts_to=`perl -ne '/^timestamp=(\W?)([-\d]+)$1/ and do {$_=$2;y/-//d;print;exit}' "$to"`
258 if [ "$ts_from" -gt "$ts_to" ] ; then
259 echo "Updating $to ($ts_to) with $from ($ts_from)"
260 # rm first in case the existing file is a symlink.
261 rm -f "$to"
262 cp "$from" "$to"
266 curdir=`pwd`
268 # cd to srcdir if we aren't already there.
269 srcdir=`echo "$0"|sed 's!/*[^/]*$!!'`
270 case $srcdir in
271 ""|.)
272 srcdir=. ;;
274 cd "$srcdir" ;;
275 esac
277 # Commit hash to pass to handle_git_external for swig.
278 swig_git_commit_hash=210266cd7004108b074fac9da4fc97d1df0adc53
280 if [ ! -d .git ] ; then
281 echo "$0: No '.git' directory found - this script should be run from a"
282 echo "git repo cloned from git://git.xapian.org/xapian or a mirror of it"
283 exit 1
286 for emptydir in xapian-applications/omega/m4 xapian-bindings/m4 ; do
287 if test -d "$emptydir" ; then
289 else
290 parent=`echo "$emptydir"|sed 's,/[^/]*$,,'`
291 if test -d "$parent" ; then
292 mkdir "$emptydir"
295 done
297 if [ -f .git/info/exclude ] ; then
298 sed '/^\(swig\|xapian-applications\/omega\/common$\)/d' .git/info/exclude > .git/info/exclude~
299 else
300 [ -d .git/info ] || mkdir .git/info
302 cat <<END >> .git/info/exclude~
303 swig
304 xapian-applications/omega/common
306 if [ -f .git/info/exclude ] &&
307 cmp -s .git/info/exclude~ .git/info/exclude ; then
308 rm .git/info/exclude~
309 else
310 mv .git/info/exclude~ .git/info/exclude
313 # If this tree is checked out from the github mirror, use the same access
314 # method for other things checked out from github (e.g. swig) so we avoid
315 # firewall issues. If there's no default remote, the git config command
316 # will exit with status 1, so ignore that failure.
317 origin_url=`git config remote.origin.url||:`
318 case $origin_url in
319 *[@/]github.com[:/]*)
320 github_base_url=`echo "X$origin_url"|sed 's/^X//;s!\([@/]github.com[:/]\).*!\1!'` ;;
322 github_base_url=git://github.com/ ;;
323 esac
324 swig_origin_url=${github_base_url}swig/swig.git
325 handle_git_external swig "$swig_git_commit_hash" "$swig_origin_url"
327 # If someone's created a directory for common, leave it be.
328 if [ -h xapian-applications/omega/common ] || \
329 [ ! -d xapian-applications/omega/common ] ; then
330 handle_git_external xapian-applications/omega/.common.git c327a3cb93d1fb3ee1e2a1cea5abc8b95d9e53b2 .
331 ln -sf .common.git/xapian-core/common xapian-applications/omega/common
334 # Prefer http downloads as they are more likely to work through firewalls.
335 use_ftp=no
336 if [ "$1" = "--ftp" ] ; then
337 shift
338 use_ftp=yes
341 if [ "$1" = "--without-autotools" ] ; then
342 shift
343 else
344 if [ "$1" = "--clean" ] ; then
345 shift
346 rm -rf INST
349 [ -d INST ] || mkdir INST
350 instdir=`pwd`/INST
352 [ -d BUILD ] || mkdir BUILD
353 cd BUILD
355 # The last field is the SHA1 checksum of the tarball.
356 lazy_build doxygen 1.8.5 \
357 src.tar.gz 1fc5ceec21122fe5037edee4c308ac94b59ee33e
358 lazy_build autoconf 2.68 \
359 tar.xz 63a3b495400c1c053f2f6b62efb7a5c0ad4156c9 \
360 tar.bz2 b534c293b22048c022b1ff3a372b9c03f26170b4 \
361 tar.gz 843f7dfcc6addf129dc2c8b12f7d72d371478f42
362 AUTOCONF=$instdir/bin/autoconf \
363 lazy_build automake 1.11.6 tar.gz 29d7832b148e2157e03ad0d3620fbb7f5a13bc21
364 lazy_build libtool 2.4.6 \
365 tar.xz 3e7504b832eb2dd23170c91b6af72e15b56eb94e \
366 tar.gz 25b6931265230a06f0fc2146df64c04e5ae6ec33
367 if [ "$1" = "--deps=libmagic" ] ; then
368 shift
369 lazy_build file 5.25 \
370 tar.gz fea78106dd0b7a09a61714cdbe545135563e84bd
373 for v in $autotools ; do
374 tool=`echo "$v"|tr A-Z a-z`
375 eval "$v=\"\$instdir\"/bin/$tool;export $v"
376 done
378 cd ..
381 case `${LIBTOOLIZE-libtoolize} --version` in
383 echo "${LIBTOOLIZE-libtoolize} not found"
384 exit 1 ;;
385 "libtoolize (GNU libtool) 1.4.*")
386 echo "${LIBTOOLIZE-libtoolize} is from libtool 1.4 which is too old - libtool 2.2 is required."
387 echo "If you have both installed, set LIBTOOLIZE to point to the correct version."
388 exit 1 ;;
389 "libtoolize (GNU libtool) 1.5.*")
390 echo "${LIBTOOLIZE-libtoolize} is from libtool 1.5 which is too old - libtool 2.2 is required."
391 echo "If you have both installed, set LIBTOOLIZE to point to the correct version."
392 exit 1 ;;
393 esac
395 ACLOCAL="${ACLOCAL-aclocal} -I `pwd`/xapian-core/m4-macros"
396 export ACLOCAL
398 intree_swig=no
399 modules=
400 for module in ${@:-xapian-core xapian-applications/omega swig xapian-bindings} ; do
401 d=$module
402 if [ -f "$d/configure.ac" -o -f "$d/configure.in" ] ; then
404 else
405 # Skip any directories we can't bootstrap.
406 continue
408 if [ -f "$d/.nobootstrap" ] ; then
409 # Report why to save head scratching when someone forgets they created
410 # a .nobootstrap file.
411 echo "Skipping '$module' due to presence of '$d/.nobootstrap'."
412 continue
414 if [ "$d" = swig ] && [ -f "xapian-bindings/.nobootstrap" ] ; then
415 # No point bootstrapping SWIG if we aren't going to use it.
416 echo "Skipping '$d' due to presence of 'xapian-bindings/.nobootstrap'."
417 continue
419 echo "Bootstrapping \`$module'"
420 [ -f "$d/preautoreconf" ] && "$d/preautoreconf"
422 # If we have a custom INSTALL file, preserve it since autoreconf insists on
423 # replacing INSTALL with "generic installation instructions" when --force
424 # is used. Be careful to replace it if autoreconf fails.
425 if [ -f "$d/INSTALL" ] ; then
426 if grep 'generic installation instructions' "$d/INSTALL" >/dev/null 2>&1 ; then
428 else
429 mv -f "$d/INSTALL" "$d/INSTALL.preserved-by-bootstrap"
433 autoreconf_rc=
434 if [ swig = "$module" ] ; then
435 # SWIG provides its own bootstrapping script.
436 curdir=`pwd`
437 cd "$d"
438 ./autogen.sh || autoreconf_rc=$?
439 cd "$curdir"
440 # Use the uninstalled wrapper for the in-tree copy of SWIG.
441 intree_swig=yes
442 else
443 # Use --install as debian's autoconf wrapper uses 2.5X if it sees it
444 # (but it doesn't check for -i).
446 # Use --force so that we update files if autoconf, automake, or libtool
447 # has been upgraded.
448 ${AUTORECONF-autoreconf} --install --force "$d" || autoreconf_rc=$?
450 if [ -f "$d/INSTALL.preserved-by-bootstrap" ] ; then
451 mv -f "$d/INSTALL.preserved-by-bootstrap" "$d/INSTALL"
453 if [ -n "$autoreconf_rc" ] ; then
454 exit $autoreconf_rc
456 for f in config.guess config.sub ; do
457 if [ -f "$d/$f" ] ; then
458 update_config "config/$f" "$d/$f"
460 done
461 modules="$modules $module"
462 done
464 # Search::Xapian doesn't use autotools.
465 if [ -f "$srcdir/search-xapian/Makefile.PL" ] ; then
466 cd "$srcdir/search-xapian"
467 perl generate-perl-exceptions
468 cd "$curdir"
469 modules="$modules search-xapian"
472 # Generate the top-level configure script.
473 rm -f configure.tmp
474 cat <<'TOP_OF_CONFIGURE' > configure.tmp
475 #!/bin/sh
476 # configure each submodule in a xapian source tree
477 # Generated by Xapian top-level bootstrap script.
479 # Copyright (C) 2003,2004,2007,2008 Olly Betts
481 # This program is free software; you can redistribute it and/or
482 # modify it under the terms of the GNU General Public License as
483 # published by the Free Software Foundation; either version 2 of the
484 # License, or (at your option) any later version.
486 # This program is distributed in the hope that it will be useful,
487 # but WITHOUT ANY WARRANTY; without even the implied warranty of
488 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
489 # GNU General Public License for more details.
491 # You should have received a copy of the GNU General Public License
492 # along with this program; if not, write to the Free Software
493 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
494 # USA
496 trap 'echo "configure failed"' EXIT
497 set -e
499 # Produced escaped version of command suitable for pasting back into sh
500 cmd=$0
501 for a ; do
502 case $a in
503 *[^-A-Za-z0-9_+=:@/.,]*)
504 esc_a=`echo "$a"|sed 's!\([^-A-Za-z0-9_+=:@/.,]\)!\\\\\\1!g'`
505 cmd="$cmd $esc_a" ;;
507 cmd="$cmd $a" ;;
508 esac
509 done
511 here=`pwd`
512 TOP_OF_CONFIGURE
514 # Produce an absolute path to srcdir.
515 srcdir_abs=`pwd`
516 # This section is unquoted so we can substitute variables.
517 cat <<MIDDLE_OF_CONFIGURE >> configure.tmp
518 srcdir="$srcdir_abs"
519 modules="$modules"
520 MIDDLE_OF_CONFIGURE
522 vars=
523 if [ yes = "$intree_swig" ] ; then
524 # We want the path to SWIG to point into srcdir, which isn't known until
525 # configure-time, so we need to expand $here in configure. We can't just set
526 # SWIG here and let the case below handle it as that would escape the value
527 # such that $here didn't get expanded at all.
528 echo ': ${SWIG="$here/swig/preinst-swig"}' >> configure.tmp
529 echo "export SWIG" >> configure.tmp
530 vars=' SWIG=$here/swig/preinst-swig'
531 # Kill any existing setting of SWIG so that we don't try to handle it again
532 # below.
533 SWIG=
535 for tool in SWIG $autotools ; do
536 eval "val=\$$tool"
537 if [ -n "$val" ] ; then
538 echo ': ${'"$tool='$val'"'}' >> configure.tmp
539 echo "export $tool" >> configure.tmp
540 vars="$vars $tool='"`echo "$val"|sed 's/\(['"\\'"']\)/\\\1/g'`"'"
542 done
543 if [ -n "$vars" ] ; then
544 # $vars will always have a leading space.
545 echo "set$vars "'"$@"' >> configure.tmp
548 cat <<'END_OF_CONFIGURE' >> configure.tmp
549 dirs=
550 revdirs=
551 XAPIAN_CONFIG=$here/xapian-core/xapian-config
552 for d in $modules ; do
553 if [ "$here" = "$srcdir" ] ; then
554 configure=./configure
555 configure_from_here=$d/configure
556 else
557 configure=$srcdir/$d/configure
558 configure_from_here=$configure
560 if [ -f "$configure_from_here" ] ; then
561 if [ -d "$d" ] ; then : ; else
562 case $d in
563 xapian-applications/*) [ -d xapian-applications ] || mkdir xapian-applications ;;
564 esac
565 mkdir "$d"
567 echo "Configuring \`$d'"
568 # Use a shared config.cache for speed and to save a bit of diskspace, but
569 # don't share it with SWIG just in case it manages to probe and cache
570 # different answers (e.g. because it uses a C compiler).
571 case $d in
572 swig)
573 cd "$d" && "$configure" ${1+"$@"}
575 xapian-core)
576 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking --cache-file="$here/config.cache" ${1+"$@"}
578 xapian-applications/omega)
579 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking XAPIAN_CONFIG="$XAPIAN_CONFIG" CPPFLAGS="-I$srcdir/INST/include" LDFLAGS="-L$srcdir/INST/lib" ${1+"$@"}
582 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking --cache-file="$here/config.cache" XAPIAN_CONFIG="$XAPIAN_CONFIG" ${1+"$@"}
584 esac
585 cd "$here"
586 dirs="$dirs $d"
587 revdirs="$d $revdirs"
588 elif [ search-xapian = "$d" ] ; then
589 if [ "$here" = "$srcdir" ] ; then
590 makefilepl=Makefile.PL
591 else
592 [ -d "$d" ] || mkdir "$d"
593 makefilepl=$srcdir/$d/Makefile.PL
595 cd "$d"
596 if [ -f "$makefilepl" ] ; then
597 echo "Configuring \`$d'"
598 # Extract any parameters which we know Makefile.PL understands from
599 # from those passed to us.
600 unset cxx_arg
601 unset cxxflags_arg
602 unset cppflags_arg
603 for arg
605 case $arg in
606 CXX=*)
607 cxx_arg=$arg ;;
608 CXXFLAGS=*)
609 cxxflags_arg=$arg ;;
610 CPPFLAGS=*)
611 cppflags_arg=$arg ;;
612 esac
613 done
614 perl "$makefilepl" XAPIAN_CONFIG="$XAPIAN_CONFIG" ${cxx_arg+"$cxx_arg"} \
615 ${cxxflags_arg+"$cxxflags_arg"} ${cppflags_arg+"$cppflags_arg"}
616 dirs="$dirs $d"
617 revdirs="$d $revdirs"
619 cd "$here"
621 done
623 rm -f Makefile.tmp
624 cat <<EOF > Makefile.tmp
625 # Makefile generated by:
626 CONFIGURE_COMMAND := $cmd
628 if [ "$srcdir" != . ] ; then
629 cat <<EOF >> Makefile.tmp
631 VPATH = $srcdir
634 targets='all install uninstall install-strip clean distclean mostlyclean maintainer-clean dist check distcheck'
635 for target in $targets ; do
636 echo
637 echo "$target:"
638 case $target in
639 uninstall|*clean)
640 # When uninstalling or cleaning, process directories in reverse order, so
641 # that we process a directory after any directories which might use it.
642 list=$revdirs ;;
644 list=$dirs ;;
645 esac
646 for d in $list ; do
647 case $d,$target in
648 swig,install*|swig,uninstall)
649 # Nothing to do with swig when installing/uninstalling.
651 swig,dist|swig,check|swig,distcheck|swig,all)
652 # Need to ensure swig is built before "make dist", "make check", etc.
653 echo " cd $d && \$(MAKE)" ;;
654 swig,mostlyclean|search-xapian,mostlyclean)
655 echo " cd $d && \$(MAKE) clean" ;;
656 search-xapian,install-strip)
657 echo " cd $d && \$(MAKE) install" ;;
658 search-xapian,maintainer-clean)
659 echo " cd $d && \$(MAKE) realclean" ;;
660 search-xapian,dist)
661 echo " cd $d && \$(MAKE) dist GZIP=-f" ;;
662 search-xapian,distcheck)
663 echo " cd $d && \$(MAKE) disttest && \$(MAKE) dist GZIP=-f" ;;
664 xapian-bindings,distcheck)
665 # FIXME: distcheck doesn't currently work for xapian-bindings because
666 # xapian-core isn't installed.
667 echo " cd $d && \$(MAKE) check && \$(MAKE) dist" ;;
669 echo " cd $d && \$(MAKE) $target" ;;
670 esac
671 done
672 case $target in
673 distclean|maintainer-clean) echo " rm -f Makefile config.cache" ;;
674 esac
675 done >> Makefile.tmp
676 cat <<EOF >> Makefile.tmp
678 recheck:
679 \$(CONFIGURE_COMMAND)
681 Makefile: $srcdir/configure
682 \$(CONFIGURE_COMMAND)
684 $srcdir/configure: \\
685 END_OF_CONFIGURE
687 : > configure.tmp2
689 # We want to rerun bootstrap if a series file changes (patch added or removed)
690 # or an existing patch changes. Since we always have an series file (even if
691 # it is empty), this also handles us adding the first patch for something.
692 patches=
693 for d in patches/* ; do
694 series=$d/series
695 echo "$series:" >> configure.tmp2
696 cat << END
697 $series\\\\
699 sed -n 's/[ ]*\(#.*\)\?$//;/./p' "$series" |\
700 while read p ; do
701 patch=$d/$p
702 cat << END
703 $patch\\\\
705 # Because there's a pipeline, this is a subshell, so use a temporary file
706 # rather than a variable to compile a list of patches to use below.
707 echo "$patch:" >> configure.tmp2
708 done
709 done >> configure.tmp
711 cat <<'END_OF_CONFIGURE' >> configure.tmp
712 $srcdir/bootstrap
713 $srcdir/bootstrap
715 .PHONY: $targets recheck
717 # Dummy dependencies to allow removing patches we no longer need.
718 END_OF_CONFIGURE
720 cat configure.tmp2 >> configure.tmp
722 cat <<'END_OF_CONFIGURE' >> configure.tmp
724 mv -f Makefile.tmp Makefile
725 trap - EXIT
726 echo "Configured successfully - now run \"${MAKE-make}\""
727 END_OF_CONFIGURE
729 rm -f configure.tmp2
731 chmod +x configure.tmp
732 mv -f configure.tmp configure
734 trap - EXIT
735 echo "Bootstrapped successfully - now run \"$srcdir/configure\" and \"${MAKE-make}\""