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"
6 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Olly Betts
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of the
11 # License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24 if [ "$1" = "--help" ] ; then
26 $0 [--ftp] [--download-tools=(always|ifneeded|never)] [--clean] [MODULE...]
28 The default is to bootstrap all known modules. Any modules which have a
29 file called ".nobootstrap" in their top-level will be skipped.
34 trap 'echo "Bootstrap failed"' EXIT
37 # The variables which specify the autotools to use.
38 autotools
="AUTORECONF AUTOCONF AUTOHEADER AUTOM4TE AUTOMAKE ACLOCAL LIBTOOLIZE"
40 # Tool for downloading a file from a URL (currently wget or curl).
44 # This function is expected to be used in 'if' so we can't rely on set -e
45 # being in effect here.
49 if [ -z "$SHA1SUM_TOOL" ] ; then
51 '${SHA1SUM-sha1sum} 2>/dev/null|cut -d\ -f1' \
52 '${SHASUM-shasum} 2>/dev/null|cut -d\ -f1' \
53 '${OPENSSL-openssl} sha1 2>/dev/null|sed "s/.* //"' \
55 if [ -z "$SHA1SUM_TOOL" ] ; then
57 Need sha1sum or shasum or openssl installed to check SHA1 checksums.
58 Set environment variable SHA1SUM, SHASUM or OPENSSL if the tool isn't on
63 # Sanity check by hashing empty input.
64 r
=`:|eval "$SHA1SUM_TOOL"`
65 [ X
"$r" != Xda39a3ee5e6b4b0d3255bfef95601890afd80709
] ||
break
68 r
=`< $tarball eval "$SHA1SUM_TOOL"`
69 if [ X
"$r" != X
"$checksum" ] ; then
70 echo "$tarball: computed SHA1 checksum did NOT match"
71 echo "computed: $r with $SHA1SUM_TOOL"
72 echo "expected: $checksum"
75 mv "$tarball" "$tarball.$r"
76 echo "Renamed $tarball to $tarball.$r"
82 # This function is expected to be used in 'if' so we can't rely on set -e
83 # being in effect here.
91 if [ "$1" != "$v" ] ; then
92 if [ -z "$1" ] ||
[ "$1" -lt "$v" ] ; then
104 # This function is expected to be used in 'if' so we can't rely on set -e
105 # being in effect here.
110 case $download_tools in
116 if [ -n $binary ] ; then
117 if [ -s "../patches/$package/series" ] ; then
118 echo "There are patches to apply to $package so it has to be built"
120 # Check if a new enough version is already installed.
121 version_installed
=`"$binary" --version 2>/dev/null|sed '1,1 s/.* //p;d'`
122 if [ -n "$version_installed" ] ; then
123 # Fast track equality.
124 if [ "$version_installed" = "$version" ] ; then
125 echo "$binary $version_installed installed, exactly what's needed"
128 if check_at_least
"$version_installed" "$version" ; then
129 echo "$binary $version_installed installed >= $version required"
138 basename=$package-$version
142 if [ "$ext" = "tar.xz" ] ; then
143 if [ -z "$xz_ok" ] ; then
144 if ${XZ-xz} --version > /dev
/null
2>&1 ; then
150 if [ "$xz_ok" = 0 ] ; then
156 if [ "$ext" = "tar.bz2" ] ; then
157 if [ -z "$bz2_ok" ] ; then
158 # bzip2 --version doesn't exit with code 0 in upstream version (though
159 # Debian at least patch this bug), so use --help to check it.
160 if bzip2 --help > /dev
/null
2>&1 ; then
166 if [ "$bz2_ok" = 0 ] ; then
172 tarball
=$basename.
$ext
174 *[24680][a-z
]) basename=`echo "$basename"|sed 's/[a-z]$//'` ;;
177 # Create the stamp file in INST so that rerunning bootstrap after
178 # "rm -rf INST" recovers nicely.
179 stamp
=..
/INST
/$package.stamp
181 # Download the tarball if required.
182 if [ ! -f "$tarball" ] ; then
183 if [ -z "$FETCH_URL_TOOL" ] ; then
184 if ${WGET-wget} --version > /dev
/null
2>&1 ; then
185 FETCH_URL_TOOL
="${WGET-wget} -O-"
186 elif ${CURL-curl} --version > /dev
/null
2>&1 ||
[ "$?" = 2 ] ; then
187 # curl --version exits with code 2.
188 # -L is needed to follow HTTP redirects.
189 FETCH_URL_TOOL
="${CURL-curl} -L"
190 elif ${LWP_REQUEST-lwp-request} -v > /dev
/null
2>&1 ||
[ "$?" = 9 -o "$?" = 255 ] ; then
191 # lwp-request -v exits with code 9 (5.810) or 255 (6.03)
192 FETCH_URL_TOOL
="${LWP_REQUEST-lwp-request} -mGET"
195 Neither wget nor curl nor lwp-request found - install one of them or if already
196 installed, set WGET, CURL or LWP_REQUEST to the full path. Alternatively,
199 then rerun this script.
206 if [ "$use_ftp" = yes ] ; then
207 url
="ftp://ftp.astron.com/pub/file/$tarball"
209 url
="http://fossies.org/unix/misc/$tarball"
213 if [ "$use_ftp" = yes ] ; then
214 url
="ftp://alpha.gnu.org/gnu/$package/$tarball"
216 url
="http://alpha.gnu.org/gnu/$package/$tarball"
219 if [ "$use_ftp" = yes ] ; then
220 url
="ftp://ftp.gnu.org/gnu/$package/$tarball"
222 url
="http://ftpmirror.gnu.org/$package/$tarball"
226 echo "Downloading <$url>"
227 $FETCH_URL_TOOL "$url" > download.tmp ||
exit $?
228 mv download.tmp
"$tarball"
231 if [ -f "$stamp" ] ; then
232 find_stdout
=`find "$tarball" ../patches/"$package"/* -newer "$stamp" -print 2> /dev/null||true`
237 if [ -n "$find_stdout" ] ; then
238 # Verify the tarball's checksum before building it.
239 check_sha1sum
"$checksum" "$tarball"
241 # Remove tarballs of other versions.
242 for f
in "$package"-* ; do
243 [ "$f" = "$tarball" ] ||
rm -rf "$f"
248 ${XZ-xz} -dc "$tarball"|
tar xf
- ||
exit $?
;;
250 bzip2 -dc "$tarball"|
tar xf
- ||
exit $?
;;
252 gzip -dc "$tarball"|
tar xf
- ||
exit $?
;;
255 cd "$basename" ||
exit $?
257 series
="../../patches/$package/series"
258 if [ ! -f "$series" ] ; then
260 No patch series file 'patches/$package/series' - if there are no patches,
261 this should just be an empty file.
265 if [ -s "$series" ] ; then
266 echo "Applying patches from $package/series"
267 sed -n 's/[ ]*\(#.*\)\?$//;/./p' "$series" | \
269 echo "Applying patch $package/$p"
270 patch -p1 < "../../patches/$package/$p" ||
exit $?
274 echo "Configuring $package"
275 if test -n "$AUTOCONF" ; then
276 .
/configure
--prefix "$instdir" AUTOCONF
="$AUTOCONF" ||
exit $?
278 .
/configure
--prefix "$instdir" ||
exit $?
280 echo "Building $package"
282 echo "Installing $package"
283 make install ||
exit $?
284 echo "Done installing $package"
286 rm -rf "$basename" ||
exit $?
288 touch "$stamp" ||
exit $?
293 handle_git_external
() {
295 if [ ! -f "$path/.nobootstrap" ] ; then
298 if [ ! -d "$path" ] ; then
299 git clone
--no-checkout -- "$url" "$path"
300 elif (cd "$path" && git reflog
"$rev" -- 2>/dev
/null
) ; then
301 : # Already have that revision locally
303 (cd "$path" && git fetch
)
305 (cd "$path" && git checkout
"$rev")
312 ts_from
=`perl -ne '/^timestamp=(\W?)([-\d]+)$1/ and do {$_=$2;y/-//d;print;exit}' "$from"`
313 ts_to
=`perl -ne '/^timestamp=(\W?)([-\d]+)$1/ and do {$_=$2;y/-//d;print;exit}' "$to"`
314 if [ "$ts_from" -gt "$ts_to" ] ; then
315 echo "Updating $to ($ts_to) with $from ($ts_from)"
316 # rm first in case the existing file is a symlink.
324 # cd to srcdir if we aren't already there.
325 srcdir
=`echo "$0"|sed 's!/*[^/]*$!!'`
333 # Commit hash to pass to handle_git_external for swig.
334 swig_git_commit_hash
=2c910e47ae788412b95e356c99cef5862808bf9a
336 # Commit hashes to use for common in omega and letor respectively:
337 omega_common_commit_hash
=b310f9988f63cdc15b48323f9ac42f6b08c3a36c
338 letor_common_commit_hash
=b310f9988f63cdc15b48323f9ac42f6b08c3a36c
340 if [ ! -d .git
] ; then
341 echo "$0: No '.git' directory found - this script should be run from a"
342 echo "git repo cloned from git://git.xapian.org/xapian or a mirror of it"
346 for emptydir
in xapian-applications
/omega
/m4 xapian-bindings
/m4 xapian-letor
/m4 ; do
347 if test -d "$emptydir" ; then
350 parent
=`echo "$emptydir"|sed 's,/[^/]*$,,'`
351 if test -d "$parent" ; then
357 if [ -f .git
/info
/exclude
] ; then
358 sed '/^\(swig\|xapian-applications\/omega\/common$\)/d' .git
/info
/exclude
> .git
/info
/exclude~
360 [ -d .git
/info
] || mkdir .git
/info
362 cat <<END >> .git/info/exclude~
364 xapian-applications/omega/common
367 if [ -f .git
/info
/exclude
] &&
368 cmp -s .git
/info
/exclude~ .git
/info
/exclude
; then
369 rm .git
/info
/exclude~
371 mv .git
/info
/exclude~ .git
/info
/exclude
374 # If this tree is checked out from the github mirror, use the same access
375 # method for other things checked out from github (e.g. swig) so we avoid
376 # firewall issues. If there's no default remote, the git config command
377 # will exit with status 1, so ignore that failure.
378 origin_url
=`git config remote.origin.url||:`
380 *[@
/]github.com
[:/]*)
381 github_base_url
=`echo "X$origin_url"|sed 's/^X//;s!\([@/]github.com[:/]\).*!\1!'` ;;
383 github_base_url
=https
://github.com
/ ;;
385 swig_origin_url
=${github_base_url}swig
/swig.git
387 if [ -z "$XAPIAN_COMMON_CLONE_URL" ] ; then
388 xapian_common_clone_url
=.
390 xapian_common_clone_url
=$XAPIAN_COMMON_CLONE_URL
393 # Set to 'yes' to use ftp URLs where available.
395 # By default we prefer http downloads as they are more likely to work through
399 # Set to 'always' to always use a locally installed copy of the autotools
400 # or 'never' to never download.
402 # By default we check for locally installed versions and use them if they are
403 # new enough versions. But e.g. for building releases we want to use a known
405 download_tools
=ifneeded
407 while [ "$#" -gt 0 ] ; do
410 download_tools
=`echo "x$1"|sed 's/x--download-tools=//'`
434 echo "warning: Ignoring old option '$1' - new default is to use installed versions of tools if new enough. Use '--download-tools=never' to prevent ever downloading"
445 echo "Unknown option '$1'" 1>&2
455 case $download_tools in
458 echo "warning: If stuff breaks with '--download-tools=never', you get to keep the pieces"
461 echo "Invalid --download-tools value '$download_tools'"
466 [ -d INST
] || mkdir INST
469 [ -d BUILD
] || mkdir BUILD
472 # The last field is the SHA1 checksum of the tarball.
473 if lazy_build autoconf autoconf
2.69 \
474 tar.xz e891c3193029775e83e0534ac0ee0c4c711f6d23 \
475 tar.gz
562471cbcb0dd0fa42a76665acf0dbb68479b78a \
477 AUTOCONF
=$instdir/bin
/autoconf
479 AUTORECONF
=$instdir/bin
/autoreconf
481 AUTOHEADER
=$instdir/bin
/autoheader
483 AUTOM4TE
=$instdir/bin
/autom4te
486 if lazy_build automake automake
1.15.1 \
487 tar.xz
45632d466c16ecf18d9c18dc4be883cde59acb59 \
488 tar.gz d3cd5fc9bbea9f977b51799180cde5d253dcba96 \
490 ACLOCAL
=$instdir/bin
/aclocal
492 AUTOMAKE
=$instdir/bin
/automake
495 if lazy_build libtool libtool
2.4.6 \
496 tar.xz
3e7504b832eb2dd23170c91b6af72e15b56eb94e \
497 tar.gz
25b6931265230a06f0fc2146df64c04e5ae6ec33 \
499 LIBTOOLIZE
=$instdir/bin
/libtoolize
501 libtool_aclocal
=$instdir/share
/aclocal
503 libtool_aclocal
=`which libtool|sed 's!/bin/[^/]*$!/share/aclocal!'`
505 # If the aclocal we're using is in a different prefix to the libtool we're
506 # using, we probably need to tell aclocal where to look for our libtool's
507 # macros. Our directory may already by specified by other means, but it's
508 # fairly harmless to specify an explicit -I for a directory which is searched
509 # anyway - at worst it changes the search order.
510 if [ "`${ACLOCAL-aclocal} --print-ac-dir`" != "$libtool_aclocal" ] ; then
511 ACLOCAL
="${ACLOCAL-aclocal} -I $libtool_aclocal"
515 if [ "$1" = "--deps=libmagic" ] ; then
517 lazy_build
file '' 5.25 \
518 tar.gz fea78106dd0b7a09a61714cdbe545135563e84bd
523 case `${LIBTOOLIZE-libtoolize} --version` in
525 echo "${LIBTOOLIZE-libtoolize} not found"
527 "libtoolize (GNU libtool) 1.4.*")
528 echo "${LIBTOOLIZE-libtoolize} is from libtool 1.4 which is too old - libtool 2.2 is required."
529 echo "If you have both installed, set LIBTOOLIZE to point to the correct version."
531 "libtoolize (GNU libtool) 1.5.*")
532 echo "${LIBTOOLIZE-libtoolize} is from libtool 1.5 which is too old - libtool 2.2 is required."
533 echo "If you have both installed, set LIBTOOLIZE to point to the correct version."
537 ACLOCAL
="${ACLOCAL-aclocal} -I `pwd`/xapian-core/m4-macros"
542 for module
in ${@:-xapian-core xapian-applications/omega swig xapian-bindings} ; do
544 if [ "$d" = swig
] ; then
545 if [ -f "xapian-bindings/.nobootstrap" ] ; then
546 # No point bootstrapping SWIG if we aren't going to use it.
547 echo "Skipping '$d' due to presence of 'xapian-bindings/.nobootstrap'."
550 handle_git_external swig
"$swig_git_commit_hash" "$swig_origin_url"
552 if [ -f "$d/configure.ac" -o -f "$d/configure.in" ] ; then
555 # Skip any directories we can't bootstrap.
558 if [ -f "$d/.nobootstrap" ] ; then
559 # Report why to save head scratching when someone forgets they created
560 # a .nobootstrap file.
561 echo "Skipping '$module' due to presence of '$d/.nobootstrap'."
565 xapian-applications
/omega|xapian-letor
)
566 # If someone's created a directory for common, leave it be.
567 if [ -h "$d/common" ] ||
[ ! -d "$d/common" ] ; then
568 # Pick omega_common_commit_hash or letor_common_commit_hash:
569 var
=`echo "$d"|sed 's!.*[-/]!!g'`_common_commit_hash
570 hash=`eval echo \\\$"$var"`
571 handle_git_external
"$d/.common.git" "$hash" "$xapian_common_clone_url"
572 ln -sf .common.git
/xapian-core
/common
"$d/common"
577 echo "Bootstrapping \`$module'"
578 [ -f "$d/preautoreconf" ] && "$d/preautoreconf"
580 # If we have a custom INSTALL file, preserve it since autoreconf insists on
581 # replacing INSTALL with "generic installation instructions" when --force
582 # is used. Be careful to replace it if autoreconf fails.
583 if [ -f "$d/INSTALL" ] ; then
584 if grep 'generic installation instructions' "$d/INSTALL" >/dev
/null
2>&1 ; then
587 mv -f "$d/INSTALL" "$d/INSTALL.preserved-by-bootstrap"
592 if [ swig
= "$module" ] ; then
593 # SWIG provides its own bootstrapping script.
596 .
/autogen.sh || autoreconf_rc
=$?
598 # Use the uninstalled wrapper for the in-tree copy of SWIG.
601 # Use --install as debian's autoconf wrapper uses 2.5X if it sees it
602 # (but it doesn't check for -i).
604 # Use --force so that we update files if autoconf, automake, or libtool
606 ${AUTORECONF-autoreconf} --install --force "$d" || autoreconf_rc
=$?
608 if [ -f "$d/INSTALL.preserved-by-bootstrap" ] ; then
609 mv -f "$d/INSTALL.preserved-by-bootstrap" "$d/INSTALL"
611 if [ -n "$autoreconf_rc" ] ; then
614 for f
in config.guess config.sub
; do
615 if [ -f "$d/$f" ] ; then
616 update_config
"config/$f" "$d/$f"
619 modules
="$modules $module"
622 # Produce an absolute path to srcdir.
625 # Generate the top-level configure script.
627 cat <<TOP_OF_CONFIGURE > configure.tmp
629 # configure each submodule in a xapian source tree
630 # Generated by Xapian top-level bootstrap script.
632 trap 'echo "configure failed"' EXIT
640 cat <<'MIDDLE_OF_CONFIGURE' >> configure.tmp
641 # Produced escaped version of command suitable for pasting back into sh
645 *[^-A-Za-z0-9_+=:@/.,]*)
646 esc_a=`echo "$a"|sed 's!\([^-A-Za-z0-9_+=:@/.,]\)!\\\\\\1!g'`
657 if [ yes = "$intree_swig" ] ; then
658 # We want the path to SWIG to point into srcdir, which isn't known until
659 # configure-time, so we need to expand $here in configure.
660 vars
=' SWIG=$here/swig/preinst-swig'
661 elif [ -n "$SWIG" ] ; then
662 # User specified SWIG in environment, e.g. with:
663 # SWIG=/opt/swig/bin/swig ./bootstrap
664 vars
=" SWIG='"`echo "$val"|sed 's/\(['"\\'"']\)/\\\1/g'`"'"
666 for tool
in $autotools ; do
668 if [ -n "$val" ] ; then
669 echo ': ${'"$tool='$val'"'}' >> configure.tmp
670 echo "export $tool" >> configure.tmp
671 vars
="$vars $tool='"`echo "$val"|sed 's/\(['"\\'"']\)/\\\1/g'`"'"
674 if [ -n "$vars" ] ; then
675 # $vars will always have a leading space.
676 echo "set$vars "'"$@"' >> configure.tmp
679 cat <<'END_OF_CONFIGURE' >> configure.tmp
682 XAPIAN_CONFIG=$here/xapian-core/xapian-config
683 for d in $modules ; do
684 if [ "$here" = "$srcdir" ] ; then
685 configure=./configure
686 configure_from_here=$d/configure
688 configure=$srcdir/$d/configure
689 configure_from_here=$configure
691 if [ -f "$configure_from_here" ] ; then
692 if [ -d "$d" ] ; then : ; else
694 xapian-applications/*) [ -d xapian-applications ] || mkdir xapian-applications ;;
698 echo "Configuring \`$d'"
699 # Use a shared config.cache for speed and to save a bit of diskspace, but
700 # don't share it with SWIG just in case it manages to probe and cache
701 # different answers (e.g. because it uses a C compiler).
705 *--host=*|*--host" "*)
706 # We're cross-building, but SWIG needs to be built natively.
710 if [ -n "$skip" ] ; then
723 # Drop CC=xxx or CXX=xxx
725 CC_FOR_BUILD=*|CXX_FOR_BUILD=*)
726 # CC_FOR_BUILD=xxx -> CC=xxx; CXX_FOR_BUILD=xxx -> CXX=xxx
727 arg=`echo "$arg"|sed 's/_FOR_BUILD//'`
730 # Drop SWIG=xxx - not useful and could cause problems.
733 swig_configure_args="$swig_configure_args "\'`echo "x$arg"|sed "s/^x//;s/'/'\\\\\\\\''/g"`\'
735 # Also handle compilers specified in environment variables. We can
736 # just reassign them unconditionally as CC and CXX are ignored if
738 cd "$d" && CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD "$configure" `eval echo $swig_configure_args`
741 cd "$d" && "$configure" ${1+"$@"}
746 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking --cache-file="$here/config.cache" ${1+"$@"}
748 xapian-applications/omega)
749 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking XAPIAN_CONFIG="$XAPIAN_CONFIG" CPPFLAGS="-I$srcdir/INST/include" LDFLAGS="-L$srcdir/INST/lib" ${1+"$@"}
752 cd "$d" && "$configure" --enable-maintainer-mode --disable-option-checking --cache-file="$here/config.cache" XAPIAN_CONFIG="$XAPIAN_CONFIG" ${1+"$@"}
757 revdirs="$d $revdirs"
762 *" --help "*|*" --version "*)
763 # Don't generate Makefile if --help or --version specified.
770 cat <<EOF > Makefile.tmp
771 # Makefile generated by:
772 CONFIGURE_COMMAND := $cmd
774 if [ "$srcdir" != . ] ; then
775 cat <<EOF >> Makefile.tmp
780 targets='all install uninstall install-strip clean distclean mostlyclean maintainer-clean dist check distcheck'
781 for target in $targets ; do
786 # When uninstalling or cleaning, process directories in reverse order, so
787 # that we process a directory after any directories which might use it.
794 swig,install*|swig,uninstall)
795 # Nothing to do with swig when installing/uninstalling.
797 swig,dist|swig,check|swig,distcheck|swig,all)
798 # Need to ensure swig is built before "make dist", "make check", etc.
799 echo " cd $d && \$(MAKE)" ;;
801 echo " cd $d && \$(MAKE) clean" ;;
802 xapian-bindings,distcheck)
803 # FIXME: distcheck doesn't currently work for xapian-bindings because
804 # xapian-core isn't installed.
805 echo " cd $d && \$(MAKE) check && \$(MAKE) dist" ;;
807 echo " cd $d && \$(MAKE) $target" ;;
811 distclean|maintainer-clean) echo " rm -f Makefile config.cache" ;;
814 cat <<EOF >> Makefile.tmp
817 \$(CONFIGURE_COMMAND)
819 Makefile: $srcdir/configure
820 \$(CONFIGURE_COMMAND)
822 $srcdir/configure: \\
827 # We want to rerun bootstrap if a series file changes (patch added or removed)
828 # or an existing patch changes. Since we always have an series file (even if
829 # it is empty), this also handles us adding the first patch for something.
831 for d
in patches
/* ; do
833 echo "$series:" >> configure.tmp2
837 sed -n 's/[ ]*\(#.*\)\?$//;/./p' "$series" |\
843 # Because there's a pipeline, this is a subshell, so use a temporary file
844 # rather than a variable to compile a list of patches to use below.
845 echo "$patch:" >> configure.tmp2
847 done >> configure.tmp
849 cat <<'END_OF_CONFIGURE' >> configure.tmp
853 .PHONY: $targets recheck
855 # Dummy dependencies to allow removing patches we no longer need.
858 cat configure.tmp2
>> configure.tmp
860 cat <<'END_OF_CONFIGURE' >> configure.tmp
862 mv -f Makefile.tmp Makefile
864 echo "Configured successfully - now run \"${MAKE-make}\""
869 chmod +x configure.tmp
870 mv -f configure.tmp configure
872 # git defaults to showing 7 character abbreviated hashes if that's enough to be
873 # unique for a particular commit. But you can't paste these into trac as it
874 # needs at least 8 hex digits to recognise a hex string as a commit hash. You
875 # need 9 characters to be unique across all of Xapian at the time of writing,
876 # and 12 for the Linux kernel currently (a much larger number of objects than
877 # Xapian). 12 is a manageable length and decently future-proof, so let's use
879 core_abbrev_recommended
=12
880 core_abbrev
=`git config --get core.abbrev||:`
881 if [ -z "$core_abbrev" ] ; then
882 echo "*** Setting core.abbrev=$core_abbrev_recommended in repo config"
883 git config
--local core.abbrev
"$core_abbrev_recommended"
884 elif [ "$core_abbrev" -lt "$core_abbrev_recommended" ] ; then
885 if [ -z "`git config --local core.abbrev`" ] ; then
886 # Set globally to < $core_abbrev_recommended, override in this repo.
887 echo "*** Setting core.abbrev=$core_abbrev_recommended in repo config to override global core.abbrev=$core_abbrev"
888 git config
--local core.abbrev
"$core_abbrev_recommended"
891 echo "warning: core.abbrev=$core_abbrev set on this repo, at least $core_abbrev_recommended is recommended"
896 echo "Bootstrapped successfully - now run \"$srcdir/configure\" and \"${MAKE-make}\""