X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=bootstrap;h=5ab4cf7ccb71482361dcac151d805a8881485410;hb=876eba21d3225fd9c3ed2479b3604562b8faa4db;hp=b6dce12ed71d88da5ab3f622148b491319da3fe1;hpb=b2f9e266fc08ea910be5cdb0744ff1805699c81f;p=debian%2Fgzip diff --git a/bootstrap b/bootstrap index b6dce12..5ab4cf7 100755 --- a/bootstrap +++ b/bootstrap @@ -1,8 +1,10 @@ #! /bin/sh +# Print a version string. +scriptversion=2010-07-06.10; # UTC # Bootstrap this package from checked-out sources. -# Copyright (C) 2003-2009 Free Software Foundation, Inc. +# Copyright (C) 2003-2010 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +19,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Written by Paul Eggert. +# Originally written by Paul Eggert. The canonical version of this +# script is maintained as build-aux/bootstrap in gnulib, however, to +# be useful to your project, you should place a copy of it under +# version control in the top-level directory of your project. The +# intent is that all customization can be done with a bootstrap.conf +# file also maintained in your version control; gnulib comes with a +# template build-aux/bootstrap.conf to get you started. + +# Please report bugs or propose patches to bug-gnulib@gnu.org. nl=' ' @@ -43,7 +53,7 @@ Options: sources reside. Use this if you already have gnulib sources on your machine, and do not want to waste your bandwidth downloading - them again. + them again. Defaults to \$GNULIB_SRCDIR. --copy Copy files instead of creating symbolic links. --force Attempt to bootstrap even if the sources seem not to have been checked out. @@ -70,13 +80,18 @@ gnulib_modules= # Any gnulib files needed that are not in modules. gnulib_files= +# A function to be called after everything else in this script. +# Override it via your own definition in bootstrap.conf. +bootstrap_epilogue() { :; } + # The command to download all .po files for a specified domain into # a specified directory. Fill in the first %s is the domain name, and # the second with the destination directory. Use rsync's -L and -r # options because the latest/%s directory and the .po files within are # all symlinks. po_download_command_format=\ -"rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'" +"rsync --delete --exclude '*.s1' -Lrtvz \ + 'translationproject.org::tp/latest/%s/' '%s'" extract_package_name=' /^AC_INIT(/{ @@ -129,7 +144,8 @@ XGETTEXT_OPTIONS='\\\ --flag=error:3:c-format --flag=error_at_line:5:c-format\\\ ' -# Package bug report address for gettext files +# Package bug report address and copyright holder for gettext files +COPYRIGHT_HOLDER='Free Software Foundation, Inc.' MSGID_BUGS_ADDRESS=bug-$package@gnu.org # Files we don't want to import. @@ -156,7 +172,6 @@ vc_ignore=auto # die otherwise. find_tool () { - # Find sha1sum, named gsha1sum on MacPorts. find_tool_envvar=$1 shift find_tool_names=$@ @@ -184,8 +199,8 @@ find_tool () eval "export $find_tool_envvar" } -# Find sha1sum, named gsha1sum on MacPorts. -find_tool SHA1SUM sha1sum gsha1sum +# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6. +find_tool SHA1SUM sha1sum gsha1sum shasum # Override the default configuration, if necessary. # Make sure that bootstrap.conf is sourced from the current directory @@ -310,10 +325,20 @@ get_version() { $app --version >/dev/null 2>&1 || return 1 $app --version 2>&1 | - sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p + sed -n '# extract version within line + s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/ + t done + + # extract version at start of line + s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/ t done + d + :done + #the following essentially does s/5.005/5.5/ + s/\.0*\([1-9]\)/.\1/g + p q' } @@ -376,7 +401,7 @@ fi cleanup_gnulib() { status=$? - rm -fr gnulib + rm -fr "$gnulib_path" exit $status } @@ -384,6 +409,9 @@ git_modules_config () { test -f .gitmodules && git config --file .gitmodules "$@" } +gnulib_path=`git_modules_config submodule.gnulib.path` +: ${gnulib_path=gnulib} + # Get gnulib files. case ${GNULIB_SRCDIR--} in @@ -393,30 +421,44 @@ case ${GNULIB_SRCDIR--} in git submodule init || exit $? git submodule update || exit $? - elif [ ! -d gnulib ]; then + elif [ ! -d "$gnulib_path" ]; then echo "$0: getting gnulib files..." trap cleanup_gnulib 1 2 13 15 - git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow= - git clone $shallow git://git.sv.gnu.org/gnulib || + shallow= + git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" || cleanup_gnulib trap - 1 2 13 15 fi - GNULIB_SRCDIR=gnulib + GNULIB_SRCDIR=$gnulib_path ;; *) - # Redirect the gnulib submodule to the directory on the command line - # if possible. + # Use GNULIB_SRCDIR as a reference. if test -d "$GNULIB_SRCDIR"/.git && \ git_modules_config submodule.gnulib.url >/dev/null; then - git submodule init - GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd` - git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR echo "$0: getting gnulib files..." - git submodule update || exit $? - GNULIB_SRCDIR=gnulib + if git submodule -h|grep -- --reference > /dev/null; then + # Prefer the one-liner available in git 1.6.4 or newer. + git submodule update --init --reference "$GNULIB_SRCDIR" \ + "$gnulib_path" || exit $? + else + # This fallback allows at least git 1.5.5. + if test -f "$gnulib_path"/gnulib-tool; then + # Since file already exists, assume submodule init already complete. + git submodule update || exit $? + else + # Older git can't clone into an empty directory. + rmdir "$gnulib_path" 2>/dev/null + git clone --reference "$GNULIB_SRCDIR" \ + "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ + && git submodule init && git submodule update \ + || exit $? + fi + fi + GNULIB_SRCDIR=$gnulib_path fi ;; esac @@ -434,22 +476,24 @@ download_po_files() { eval "$cmd" } -# Download .po files to $po_dir/.reference and copy only the new +# Mirror .po files to $po_dir/.reference and copy only the new # or modified ones into $po_dir. Also update $po_dir/LINGUAS. +# Note po files that exist locally only are left in $po_dir but will +# not be included in LINGUAS and hence will not be distributed. update_po_files() { # Directory containing primary .po files. # Overwrite them only when we're sure a .po file is new. po_dir=$1 domain=$2 - # Download *.po files into this dir. + # Mirror *.po files into this dir. # Usually contains *.s1 checksum files. ref_po_dir="$po_dir/.reference" test -d $ref_po_dir || mkdir $ref_po_dir || return download_po_files $ref_po_dir $domain \ && ls "$ref_po_dir"/*.po 2>/dev/null | - sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" + sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'` test "$langs" = '*' && langs=x @@ -622,7 +666,7 @@ slurp() { for excluded_file in $excluded_files; do test "$dir/$file" = "$excluded_file" && continue 2 done - if test $file = Makefile.am; then + if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then copied=$copied${sep}$gnulib_mk; sep=$nl remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g" sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || { @@ -640,7 +684,7 @@ slurp() { rm -f $dir/$file sed ' /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\ - AC_DEFUN([AM_INTL_SUBDIR], [ + AC_DEFUN([AM_INTL_SUBDIR], []) /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\ AC_DEFUN([gt_INTL_SUBDIR_CORE], []) $a\ @@ -728,6 +772,10 @@ find "$m4_base" "$source_base" \ # Reconfigure, getting other files. +# Skip autoheader if it's not needed. +grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null || + AUTOHEADER=true + for command in \ libtool \ "${ACLOCAL-aclocal} --force -I m4" \ @@ -769,13 +817,14 @@ if test $with_gettext = yes; then rm -f po/Makevars sed ' /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/ - /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/ + /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/ + /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'| /^XGETTEXT_OPTIONS *=/{ s/$/ \\/ a\ '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+} } - ' po/Makevars.template >po/Makevars + ' po/Makevars.template >po/Makevars || exit 1 if test -d runtime-po; then # Similarly for runtime-po/Makevars, but not quite the same. @@ -789,15 +838,21 @@ if test $with_gettext = yes; then a\ '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+} } - ' runtime-po/Makevars + ' po/Makevars.template >runtime-po/Makevars || exit 1 # Copy identical files from po to runtime-po. (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po) fi fi +bootstrap_epilogue + echo "$0: done. Now you can run './configure'." -# Local Variables: -# indent-tabs-mode: nil +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: