Add constant FLINT_MAX_DOCID
[xapian.git] / bootstrap
blob3cc162e8a1fd27dd8b9adf8630bd895dc87f1672
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 echo "$0 [--ftp] [--without-autotools|--clean]"
24 exit 0
27 trap 'echo "Bootstrap failed"' EXIT
28 set -e
30 # The variables which specify the autotools to use. And doxygen.
31 autotools="AUTORECONF AUTOCONF AUTOHEADER AUTOM4TE AUTOMAKE ACLOCAL LIBTOOLIZE DOXYGEN"
33 # Tool for downloading a file from a URL (currently wget or curl).
34 FETCH_URL_TOOL=
36 check_sha1sum() {
37 checksum=$1
38 tarball=$2
40 if [ -z "$SHA1SUM_TOOL" ] ; then
41 for SHA1SUM_TOOL in \
42 '${SHA1SUM-sha1sum} 2>/dev/null|cut -d\ -f1' \
43 '${SHASUM-shasum} 2>/dev/null|cut -d\ -f1' \
44 '$(OPENSSL-openssl} sha1 2>/dev/null|sed "s/.* //"' \
45 '' ; do
46 if [ -z "$SHA1SUM_TOOL" ] ; then
47 echo <<'END'
48 Need sha1sum or shasum or openssl installed to check SHA1 checksums.
49 Set environment variable SHA1SUM, SHASUM or OPENSSL if the tool isn't on
50 your PATH.
51 END
52 exit 1
54 r=`:|eval "$SHA1SUM_TOOL"`
55 [ X"$r" != Xda39a3ee5e6b4b0d3255bfef95601890afd80709 ] || break
56 done
58 r=`< $tarball eval "$SHA1SUM_TOOL"`
59 if [ X"$r" != X"$checksum" ] ; then
60 echo "$tarball: computed SHA1 checksum did NOT match"
61 echo "computed: $r with $SHA1SUM_TOOL"
62 echo "expected: $checksum"
63 ls -l $tarball
64 file $tarball || true
65 mv "$tarball" "$tarball.$r"
66 echo "Renamed $tarball to $tarball.$r"
67 exit 1
71 lazy_build() {
72 package=$1
73 basename=$package-$2
74 ext=$3
75 checksum=$4
76 if [ "$ext" = "tar.xz" ] ; then
77 if [ -z "$xz_ok" ] ; then
78 if ${XZ-xz} --version > /dev/null 2>&1 ; then
79 xz_ok=1
80 else
81 xz_ok=0
84 if [ "$xz_ok" = 0 ] ; then
85 shift 2
86 ext=$3
87 checksum=$4
90 if [ "$ext" = "tar.bz2" ] ; then
91 if [ -z "$bz2_ok" ] ; then
92 # bzip2 --version doesn't exit with code 0 in upstream version (though
93 # Debian at least patch this bug), so use --help to check it.
94 if bzip2 --help > /dev/null 2>&1 ; then
95 bz2_ok=1
96 else
97 bz2_ok=0
100 if [ "$bz2_ok" = 0 ] ; then
101 shift 2
102 ext=$3
103 checksum=$4
106 tarball=$basename.$ext
107 case $basename in
108 *[24680][a-z]) basename=`echo "$basename"|sed 's/[a-z]$//'` ;;
109 esac
111 # Create the stamp file in INST so that rerunning bootstrap after
112 # "rm -rf INST" recovers nicely.
113 stamp=../INST/$package.stamp
115 # Download the tarball if required.
116 if [ ! -f "$tarball" ] ; then
117 if [ -z "$FETCH_URL_TOOL" ] ; then
118 if ${WGET-wget} --version > /dev/null 2>&1 ; then
119 FETCH_URL_TOOL="${WGET-wget} -O-"
120 elif ${CURL-curl} --version > /dev/null 2>&1 || [ "$?" = 2 ] ; then
121 # curl --version exits with code 2.
122 # -L is needed to follow HTTP redirects.
123 FETCH_URL_TOOL="${CURL-curl} -L"
124 elif ${LWP_REQUEST-lwp-request} -v > /dev/null 2>&1 || [ "$?" = 9 -o "$?" = 255 ] ; then
125 # lwp-request -v exits with code 9 (5.810) or 255 (6.03)
126 FETCH_URL_TOOL="${LWP_REQUEST-lwp-request} -mGET"
127 else
128 cat <<END >&2
129 Neither wget nor curl nor lwp-request found - install one of them or if already
130 installed, set WGET, CURL or LWP_REQUEST to the full path. Alternatively,
131 download $url
132 to directory `pwd`
133 then rerun this script.
135 exit 1
138 case $basename in
139 doxygen-*)
140 if [ "$use_ftp" = yes ] ; then
141 url="ftp://ftp.stack.nl/pub/users/dimitri/$tarball"
142 else
143 url="http://ftp.stack.nl/pub/users/dimitri/$tarball"
144 fi ;;
145 file-*)
146 if [ "$use_ftp" = yes ] ; then
147 url="ftp://ftp.astron.com/pub/file/$tarball"
148 else
149 url="http://fossies.org/unix/misc/$tarball"
150 fi ;;
151 *[13579][a-z])
152 # GNU alpha release
153 if [ "$use_ftp" = yes ] ; then
154 url="ftp://alpha.gnu.org/gnu/$package/$tarball"
155 else
156 url="http://alpha.gnu.org/gnu/$package/$tarball"
157 fi ;;
159 if [ "$use_ftp" = yes ] ; then
160 url="ftp://ftp.gnu.org/gnu/$package/$tarball"
161 else
162 url="http://ftpmirror.gnu.org/$package/$tarball"
163 fi ;;
164 esac
165 rm -f download.tmp
166 echo "Downloading <$url>"
167 $FETCH_URL_TOOL "$url" > download.tmp && mv download.tmp "$tarball"
170 if [ -f "$stamp" ] ; then
171 find_stdout=`find "$tarball" ../patches/"$package"/* -newer "$stamp" -print 2> /dev/null||true`
172 else
173 find_stdout=force
176 if [ -n "$find_stdout" ] ; then
177 # Verify the tarball's checksum before building it.
178 check_sha1sum "$checksum" "$tarball"
180 # Remove tarballs of other versions.
181 for f in "$package"-* ; do
182 [ "$f" = "$tarball" ] || rm -rf "$f"
183 done
185 case $ext in
186 tar.xz)
187 ${XZ-xz} -dc "$tarball"| tar xf - ;;
188 tar.bz2)
189 bzip2 -dc "$tarball"| tar xf - ;;
191 gzip -dc "$tarball"| tar xf - ;;
192 esac
194 cd "$basename"
196 if [ ! -f "../../patches/$package/series" ] ; then
197 cat <<END >&2
198 No patch series file 'patches/$package/series' - if there are no patches,
199 this should just be an empty file.
201 exit 1
203 echo "Applying patches from $package/series"
204 sed -n 's/[ ]*\(#.*\)\?$//;/./p' "../../patches/$package/series" | \
205 while read p ; do
206 echo "Applying patch $package/$p"
207 patch -p1 < "../../patches/$package/$p"
208 done
210 # Fix doxygen/Qt stupid and pointless enumerating of Mac OS X releases
211 # which stops it building on each new OS X release.
212 if [ -f qtools/qglobal.h ] ; then
213 sed 's!^[ ]*#[ ]*\(error\|warning\).*Mac *OS *X is unsupported!// &!' \
214 qtools/qglobal.h > qtools/qglobal.hT
215 mv qtools/qglobal.hT qtools/qglobal.h
218 if test -n "$AUTOCONF" ; then
219 ./configure --prefix "$instdir" AUTOCONF="$AUTOCONF"
220 else
221 ./configure --prefix "$instdir"
223 make
224 make install
225 cd ..
226 rm -rf "$basename"
228 touch "$stamp"
232 handle_git_external() {
233 path=$1
234 if [ ! -f "$path/.nobootstrap" ] ; then
235 rev=$2
236 url=$3
237 if [ ! -d "$path" ] ; then
238 git clone --no-checkout -- "$url" "$path"
239 elif (cd "$path" && git reflog "$rev" -- 2>/dev/null) ; then
240 : # Already have that revision locally
241 else
242 (cd "$path" && git fetch)
244 (cd "$path" && git checkout "$rev")
248 update_config() {
249 from=$1
250 to=$2
251 ts_from=`perl -ne '/^timestamp=(\W?)([-\d]+)$1/ and do {$_=$2;y/-//d;print;exit}' "$from"`
252 ts_to=`perl -ne '/^timestamp=(\W?)([-\d]+)$1/ and do {$_=$2;y/-//d;print;exit}' "$to"`
253 if [ "$ts_from" -gt "$ts_to" ] ; then
254 echo "Updating $to ($ts_to) with $from ($ts_from)"
255 # rm first in case the existing file is a symlink.
256 rm -f "$to"
257 cp "$from" "$to"
261 curdir=`pwd`
263 # cd to srcdir if we aren't already there.
264 srcdir=`echo "$0"|sed 's!/*[^/]*$!!'`
265 case $srcdir in
266 ""|.)
267 srcdir=. ;;
269 cd "$srcdir" ;;
270 esac
272 if [ ! -d .git ] ; then
273 echo "$0: No '.git' directory found - this script should be run from a"
274 echo "git repo cloned from git://git.xapian.org/xapian or a mirror of it"
275 exit 1
278 for emptydir in xapian-applications/omega/m4 xapian-bindings/m4 ; do
279 if test -d "$emptydir" ; then
281 else
282 parent=`echo "$emptydir"|sed 's,/[^/]*$,,'`
283 if test -d "$parent" ; then
284 mkdir "$emptydir"
287 done
289 if [ -f .git/info/exclude ] ; then
290 sed '/^\(swig\|xapian-applications\/omega\/common$\)/d' .git/info/exclude > .git/info/exclude~
291 else
292 [ -d .git/info ] || mkdir .git/info
294 cat <<END >> .git/info/exclude~
295 swig
296 xapian-applications/omega/common
298 if [ -f .git/info/exclude ] &&
299 cmp .git/info/exclude~ .git/info/exclude > /dev/null ; then
300 rm .git/info/exclude~
301 else
302 mv .git/info/exclude~ .git/info/exclude
305 # If this tree is checked out from the github mirror, use the same access
306 # method for swig, so we avoid firewall issues. If there's no default
307 # remote, the git config command will exit with status 1, so ignore that
308 # failure.
309 origin_url=`git config remote.origin.url||:`
310 case $origin_url in
311 *[@/]github.com[:/]*)
312 swig_origin_url=`echo "X$origin_url"|sed 's/^X//;s!\([@/]github.com[:/]\).*!\1!'` ;;
314 swig_origin_url=git://github.com/ ;;
315 esac
316 swig_origin_url=${swig_origin_url}swig/swig.git
317 handle_git_external swig 210266cd7004108b074fac9da4fc97d1df0adc53 "$swig_origin_url"
319 # If someone's created a directory for common, leave it be.
320 if [ ! -d xapian-applications/omega/common ] ; then
321 handle_git_external xapian-applications/omega/.common.git 3e1602681002833b38b1bc2355fb557f35c70536 .
322 ln -sf .common.git/xapian-core/common xapian-applications/omega/common
325 # Prefer http downloads as they are more likely to work through firewalls.
326 use_ftp=no
327 if [ "$1" = "--ftp" ] ; then
328 shift
329 use_ftp=yes
332 if [ "$1" = "--without-autotools" ] ; then
333 shift
334 else
335 if [ "$1" = "--clean" ] ; then
336 shift
337 rm -rf INST
340 [ -d INST ] || mkdir INST
341 instdir=`pwd`/INST
343 [ -d BUILD ] || mkdir BUILD
344 cd BUILD
346 # The last field is the SHA1 checksum of the tarball.
347 lazy_build doxygen 1.8.5 \
348 src.tar.gz 1fc5ceec21122fe5037edee4c308ac94b59ee33e
349 lazy_build autoconf 2.68 \
350 tar.xz 63a3b495400c1c053f2f6b62efb7a5c0ad4156c9 \
351 tar.bz2 b534c293b22048c022b1ff3a372b9c03f26170b4 \
352 tar.gz 843f7dfcc6addf129dc2c8b12f7d72d371478f42
353 AUTOCONF=$instdir/bin/autoconf \
354 lazy_build automake 1.11.6 tar.gz 29d7832b148e2157e03ad0d3620fbb7f5a13bc21
355 lazy_build libtool 2.4.6 \
356 tar.xz 3e7504b832eb2dd23170c91b6af72e15b56eb94e \
357 tar.gz 25b6931265230a06f0fc2146df64c04e5ae6ec33
358 if [ "$1" = "--deps=libmagic" ] ; then
359 shift
360 lazy_build file 5.25 \
361 tar.gz fea78106dd0b7a09a61714cdbe545135563e84bd
364 for v in $autotools ; do
365 tool=`echo "$v"|tr A-Z a-z`
366 eval "$v=\"\$instdir\"/bin/$tool;export $v"
367 done
369 cd ..
372 case `${LIBTOOLIZE-libtoolize} --version` in
374 echo "${LIBTOOLIZE-libtoolize} not found"
375 exit 1 ;;
376 "libtoolize (GNU libtool) 1.4.*")
377 echo "${LIBTOOLIZE-libtoolize} is from libtool 1.4 which is too old - libtool 2.2 is required."
378 echo "If you have both installed, set LIBTOOLIZE to point to the correct version."
379 exit 1 ;;
380 "libtoolize (GNU libtool) 1.5.*")
381 echo "${LIBTOOLIZE-libtoolize} is from libtool 1.5 which is too old - libtool 2.2 is required."
382 echo "If you have both installed, set LIBTOOLIZE to point to the correct version."
383 exit 1 ;;
384 esac
386 ACLOCAL="${ACLOCAL-aclocal} -I `pwd`/xapian-core/m4-macros"
388 intree_swig=no
389 modules=
390 for module in xapian-core xapian-applications/omega swig xapian-bindings ; do
391 d=$module
392 if [ -f "$d/configure.ac" -o -f "$d/configure.in" ] ; then
394 else
395 # Skip any directories we can't bootstrap.
396 continue
398 if [ -f "$d/.nobootstrap" ] ; then
399 # Report why to save head scratching when someone forgets they created
400 # a .nobootstrap file.
401 echo "Skipping '$module' due to presence of '$d/.nobootstrap'."
402 continue
404 if [ "$d" = swig ] && [ -f "xapian-bindings/.nobootstrap" ] ; then
405 # No point bootstrapping SWIG if we aren't going to use it.
406 echo "Skipping '$d' due to presence of 'xapian-bindings/.nobootstrap'."
407 continue
409 echo "Bootstrapping \`$module'"
410 [ -f "$d/preautoreconf" ] && "$d/preautoreconf"
412 # If we have a custom INSTALL file, preserve it since autoreconf insists on
413 # replacing INSTALL with "generic installation instructions" when --force
414 # is used. Be careful to replace it if autoreconf fails.
415 if [ -f "$d/INSTALL" ] ; then
416 if grep 'generic installation instructions' "$d/INSTALL" >/dev/null 2>&1 ; then
418 else
419 mv -f "$d/INSTALL" "$d/INSTALL.preserved-by-bootstrap"
423 autoreconf_rc=
424 if [ swig = "$module" ] ; then
425 # SWIG provides its own bootstrapping script.
426 curdir=`pwd`
427 cd "$d"
428 ./autogen.sh || autoreconf_rc=$?
429 cd "$curdir"
430 # Use the uninstalled wrapper for the in-tree copy of SWIG.
431 intree_swig=yes
432 else
433 # Use --install as debian's autoconf wrapper uses 2.5X if it sees it
434 # (but it doesn't check for -i).
436 # Use --force so that we update files if autoconf, automake, or libtool
437 # has been upgraded.
438 ${AUTORECONF-autoreconf} --install --force "$d" || autoreconf_rc=$?
440 if [ -f "$d/INSTALL.preserved-by-bootstrap" ] ; then
441 mv -f "$d/INSTALL.preserved-by-bootstrap" "$d/INSTALL"
443 if [ -n "$autoreconf_rc" ] ; then
444 exit $autoreconf_rc
446 for f in config.guess config.sub ; do
447 if [ -f "$d/$f" ] ; then
448 update_config "config/$f" "$d/$f"
450 done
451 modules="$modules $module"
452 done
454 # Search::Xapian doesn't use autotools.
455 if [ -f "$srcdir/search-xapian/Makefile.PL" ] ; then
456 cd "$srcdir/search-xapian"
457 perl generate-perl-exceptions
458 cd "$curdir"
459 modules="$modules search-xapian"
462 # Generate the top-level configure script.
463 rm -f configure.tmp
464 cat <<'TOP_OF_CONFIGURE' > configure.tmp
465 #!/bin/sh
466 # configure each submodule in a xapian source tree
467 # Generated by Xapian top-level bootstrap script.
469 # Copyright (C) 2003,2004,2007,2008 Olly Betts
471 # This program is free software; you can redistribute it and/or
472 # modify it under the terms of the GNU General Public License as
473 # published by the Free Software Foundation; either version 2 of the
474 # License, or (at your option) any later version.
476 # This program is distributed in the hope that it will be useful,
477 # but WITHOUT ANY WARRANTY; without even the implied warranty of
478 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
479 # GNU General Public License for more details.
481 # You should have received a copy of the GNU General Public License
482 # along with this program; if not, write to the Free Software
483 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
484 # USA
486 trap 'echo "configure failed"' EXIT
487 set -e
489 # Produced escaped version of command suitable for pasting back into sh
490 cmd=$0
491 for a ; do
492 case $a in
493 *[^-A-Za-z0-9_+=:@/.,]*)
494 esc_a=`echo "$a"|sed 's!\([^-A-Za-z0-9_+=:@/.,]\)!\\\\\\1!g'`
495 cmd="$cmd $esc_a" ;;
497 cmd="$cmd $a" ;;
498 esac
499 done
501 here=`pwd`
502 TOP_OF_CONFIGURE
504 # Produce an absolute path to srcdir.
505 srcdir_abs=`pwd`
506 # This section is unquoted so we can substitute variables.
507 cat <<MIDDLE_OF_CONFIGURE >> configure.tmp
508 srcdir="$srcdir_abs"
509 modules="$modules"
510 MIDDLE_OF_CONFIGURE
512 vars=
513 if [ yes = "$intree_swig" ] ; then
514 # We want the path to SWIG to point into srcdir, which isn't known until
515 # configure-time, so we need to expand $here in configure. We can't just set
516 # SWIG here and let the case below handle it as that would escape the value
517 # such that $here didn't get expanded at all.
518 echo ': ${SWIG="$here/swig/preinst-swig"}' >> configure.tmp
519 echo "export SWIG" >> configure.tmp
520 vars=' SWIG=$here/swig/preinst-swig'
521 # Kill any existing setting of SWIG so that we don't try to handle it again
522 # below.
523 SWIG=
525 for tool in SWIG $autotools ; do
526 eval "val=\$$tool"
527 if [ -n "$val" ] ; then
528 echo ': ${'"$tool='$val'"'}' >> configure.tmp
529 echo "export $tool" >> configure.tmp
530 vars="$vars $tool='"`echo "$val"|sed 's/\(['"\\'"']\)/\\\1/g'`"'"
532 done
533 if [ -n "$vars" ] ; then
534 # $vars will always have a leading space.
535 echo "set$vars "'"$@"' >> configure.tmp
538 cat <<'END_OF_CONFIGURE' >> configure.tmp
539 dirs=
540 revdirs=
541 XAPIAN_CONFIG=$here/xapian-core/xapian-config
542 for d in $modules ; do
543 if [ "$here" = "$srcdir" ] ; then
544 configure=./configure
545 configure_from_here=$d/configure
546 else
547 configure=$srcdir/$d/configure
548 configure_from_here=$configure
550 if [ -f "$configure_from_here" ] ; then
551 if [ -d "$d" ] ; then : ; else
552 case $d in
553 xapian-applications/*) [ -d xapian-applications ] || mkdir xapian-applications ;;
554 esac
555 mkdir "$d"
557 echo "Configuring \`$d'"
558 # Use a shared config.cache for speed and to save a bit of diskspace, but
559 # don't share it with SWIG just in case it manages to probe and cache
560 # different answers (e.g. because it uses a C compiler).
561 case $d in
562 swig)
563 cd "$d" && "$configure" ${1+"$@"}
565 xapian-core)
566 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking --cache-file="$here/config.cache" ${1+"$@"}
568 xapian-applications/omega)
569 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking XAPIAN_CONFIG="$XAPIAN_CONFIG" CPPFLAGS="-I$srcdir/INST/include" LDFLAGS="-L$srcdir/INST/lib" ${1+"$@"}
572 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking --cache-file="$here/config.cache" XAPIAN_CONFIG="$XAPIAN_CONFIG" ${1+"$@"}
574 esac
575 cd "$here"
576 dirs="$dirs $d"
577 revdirs="$d $revdirs"
578 elif [ search-xapian = "$d" ] ; then
579 if [ "$here" = "$srcdir" ] ; then
580 makefilepl=Makefile.PL
581 else
582 [ -d "$d" ] || mkdir "$d"
583 makefilepl=$srcdir/$d/Makefile.PL
585 cd "$d"
586 if [ -f "$makefilepl" ] ; then
587 echo "Configuring \`$d'"
588 # Extract any parameters which we know Makefile.PL understands from
589 # from those passed to us.
590 unset cxx_arg
591 unset cxxflags_arg
592 unset cppflags_arg
593 for arg
595 case $arg in
596 CXX=*)
597 cxx_arg=$arg ;;
598 CXXFLAGS=*)
599 cxxflags_arg=$arg ;;
600 CPPFLAGS=*)
601 cppflags_arg=$arg ;;
602 esac
603 done
604 perl "$makefilepl" XAPIAN_CONFIG="$XAPIAN_CONFIG" ${cxx_arg+"$cxx_arg"} \
605 ${cxxflags_arg+"$cxxflags_arg"} ${cppflags_arg+"$cppflags_arg"}
606 dirs="$dirs $d"
607 revdirs="$d $revdirs"
609 cd "$here"
611 done
613 rm -f Makefile.tmp
614 cat <<EOF > Makefile.tmp
615 # Makefile generated by:
616 CONFIGURE_COMMAND := $cmd
618 if [ "$srcdir" != . ] ; then
619 cat <<EOF >> Makefile.tmp
621 VPATH = $srcdir
624 targets='all install uninstall install-strip clean distclean mostlyclean maintainer-clean dist check distcheck'
625 for target in $targets ; do
626 echo
627 echo "$target:"
628 case $target in
629 uninstall|*clean)
630 # When uninstalling or cleaning, process directories in reverse order, so
631 # that we process a directory after any directories which might use it.
632 list=$revdirs ;;
634 list=$dirs ;;
635 esac
636 for d in $list ; do
637 case $d,$target in
638 swig,install*|swig,uninstall)
639 # Nothing to do with swig when installing/uninstalling.
641 swig,dist|swig,check|swig,distcheck|swig,all)
642 # Need to ensure swig is built before "make dist", "make check", etc.
643 echo " cd $d && \$(MAKE)" ;;
644 swig,mostlyclean|search-xapian,mostlyclean)
645 echo " cd $d && \$(MAKE) clean" ;;
646 search-xapian,install-strip)
647 echo " cd $d && \$(MAKE) install" ;;
648 search-xapian,maintainer-clean)
649 echo " cd $d && \$(MAKE) realclean" ;;
650 search-xapian,dist)
651 echo " cd $d && \$(MAKE) dist GZIP=-f" ;;
652 search-xapian,distcheck)
653 echo " cd $d && \$(MAKE) disttest && \$(MAKE) dist GZIP=-f" ;;
654 xapian-bindings,distcheck)
655 # FIXME: distcheck doesn't currently work for xapian-bindings because
656 # xapian-core isn't installed.
657 echo " cd $d && \$(MAKE) check && \$(MAKE) dist" ;;
659 echo " cd $d && \$(MAKE) $target" ;;
660 esac
661 done
662 case $target in
663 distclean|maintainer-clean) echo " rm -f Makefile config.cache" ;;
664 esac
665 done >> Makefile.tmp
666 cat <<EOF >> Makefile.tmp
668 recheck:
669 \$(CONFIGURE_COMMAND)
671 Makefile: $srcdir/configure
672 \$(CONFIGURE_COMMAND)
674 $srcdir/configure: \\
675 END_OF_CONFIGURE
677 : > configure.tmp2
679 # We want to rerun bootstrap if a series file changes (patch added or removed)
680 # or an existing patch changes. Since we always have an series file (even if
681 # it is empty), this also handles us adding the first patch for something.
682 patches=
683 for d in patches/* ; do
684 series=$d/series
685 echo "$series:" >> configure.tmp2
686 cat << END
687 $series\\\\
689 sed -n 's/[ ]*\(#.*\)\?$//;/./p' "$series" |\
690 while read p ; do
691 patch=$d/$p
692 cat << END
693 $patch\\\\
695 # Because there's a pipeline, this is a subshell, so use a temporary file
696 # rather than a variable to compile a list of patches to use below.
697 echo "$patch:" >> configure.tmp2
698 done
699 done >> configure.tmp
701 cat <<'END_OF_CONFIGURE' >> configure.tmp
702 $srcdir/bootstrap
703 $srcdir/bootstrap
705 .PHONY: $targets recheck
707 # Dummy dependencies to allow removing patches we no longer need.
708 END_OF_CONFIGURE
710 cat configure.tmp2 >> configure.tmp
712 cat <<'END_OF_CONFIGURE' >> configure.tmp
714 mv -f Makefile.tmp Makefile
715 trap - EXIT
716 echo "Configured successfully - now run \"${MAKE-make}\""
717 END_OF_CONFIGURE
719 rm -f configure.tmp2
721 chmod +x configure.tmp
722 mv -f configure.tmp configure
724 trap - EXIT
725 echo "Bootstrapped successfully - now run \"$srcdir/configure\" and \"${MAKE-make}\""