Mercurial > octave-nkf
comparison bootstrap @ 17299:a801d0ab5830
bootstrap: Update from gnulib sources, make portable to OpenBSD (bug #35580)
* bootstrap: Update from gnulib sources, remove local modifications.
* bootstrap.conf: Include use_git and GNULIB_SRCDIR overrides that were
in bootstrap. Set SKIP_PO to bypass updating translations since we have
none.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Tue, 20 Aug 2013 21:55:14 -0400 |
parents | b91fc9348e2e |
children | 2de0eb7405e4 |
comparison
equal
deleted
inserted
replaced
17298:fb7bd09c0c0e | 17299:a801d0ab5830 |
---|---|
1 #! /bin/sh | 1 #! /bin/sh |
2 # Print a version string. | 2 # Print a version string. |
3 scriptversion=2012-07-19.14; # UTC | 3 scriptversion=2013-08-15.22; # UTC |
4 | 4 |
5 # Bootstrap this package from checked-out sources. | 5 # Bootstrap this package from checked-out sources. |
6 | 6 |
7 # Copyright (C) 2003-2012 Free Software Foundation, Inc. | 7 # Copyright (C) 2003-2013 Free Software Foundation, Inc. |
8 | 8 |
9 # This program is free software: you can redistribute it and/or modify | 9 # This program is free software: you can redistribute it and/or modify |
10 # it under the terms of the GNU General Public License as published by | 10 # it under the terms of the GNU General Public License as published by |
11 # the Free Software Foundation, either version 3 of the License, or | 11 # the Free Software Foundation, either version 3 of the License, or |
12 # (at your option) any later version. | 12 # (at your option) any later version. |
138 # Fallback for downloading .po files (if rsync fails). | 138 # Fallback for downloading .po files (if rsync fails). |
139 po_download_command_format2=\ | 139 po_download_command_format2=\ |
140 "wget --mirror -nd -q -np -A.po -P '%s' \ | 140 "wget --mirror -nd -q -np -A.po -P '%s' \ |
141 http://translationproject.org/latest/%s/" | 141 http://translationproject.org/latest/%s/" |
142 | 142 |
143 # Prefer a non-empty tarname (4th argument of AC_INIT if given), else | |
144 # fall back to the package name (1st argument with munging) | |
143 extract_package_name=' | 145 extract_package_name=' |
144 /^AC_INIT(/{ | 146 /^AC_INIT(\[*/{ |
145 /.*,.*,.*, */{ | 147 s/// |
146 s/// | 148 /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{ |
147 s/[][]//g | 149 s//\1/ |
148 s/)$// | 150 s/[],)].*// |
149 p | 151 p |
150 q | 152 q |
151 } | 153 } |
152 s/AC_INIT(\[*// | 154 s/[],)].*// |
153 s/]*,.*// | |
154 s/^GNU // | 155 s/^GNU // |
155 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ | 156 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ |
156 s/[^A-Za-z0-9_]/-/g | 157 s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g |
157 p | 158 p |
158 } | 159 } |
159 ' | 160 ' |
160 package=$(sed -n "$extract_package_name" configure.ac) \ | 161 package=$(sed -n "$extract_package_name" configure.ac) \ |
161 || die 'cannot find package name in configure.ac' | 162 || die 'cannot find package name in configure.ac' |
203 | 204 |
204 # Set this to true in bootstrap.conf to enable --bootstrap-sync by | 205 # Set this to true in bootstrap.conf to enable --bootstrap-sync by |
205 # default. | 206 # default. |
206 bootstrap_sync=false | 207 bootstrap_sync=false |
207 | 208 |
208 # Don't use git to update gnulib sources. We keep gnulib under a | 209 # Use git to update gnulib sources |
209 # Mercurial subrepository instead | 210 use_git=true |
210 use_git=false | |
211 GNULIB_SRCDIR=gnulib-hg | |
212 | 211 |
213 # find_tool ENVVAR NAMES... | 212 # find_tool ENVVAR NAMES... |
214 # ------------------------- | 213 # ------------------------- |
215 # Search for a required program. Use the value of ENVVAR, if set, | 214 # Search for a required program. Use the value of ENVVAR, if set, |
216 # otherwise find the first of the NAMES that can be run (i.e., | 215 # otherwise find the first of the NAMES that can be run (i.e., |
223 find_tool_envvar=$1 | 222 find_tool_envvar=$1 |
224 shift | 223 shift |
225 find_tool_names=$@ | 224 find_tool_names=$@ |
226 eval "find_tool_res=\$$find_tool_envvar" | 225 eval "find_tool_res=\$$find_tool_envvar" |
227 if test x"$find_tool_res" = x; then | 226 if test x"$find_tool_res" = x; then |
228 for i | 227 for i; do |
229 do | |
230 if ($i --version </dev/null) >/dev/null 2>&1; then | 228 if ($i --version </dev/null) >/dev/null 2>&1; then |
231 find_tool_res=$i | 229 find_tool_res=$i |
232 break | 230 break |
233 fi | 231 fi |
234 done | 232 done |
235 else | 233 fi |
236 find_tool_error_prefix="\$$find_tool_envvar: " | 234 if test x"$find_tool_res" = x; then |
237 fi | 235 warn_ "one of these is required: $find_tool_names;" |
238 test x"$find_tool_res" != x \ | 236 die "alternatively set $find_tool_envvar to a compatible tool" |
239 || die "one of these is required: $find_tool_names" | 237 fi |
240 ($find_tool_res --version </dev/null) >/dev/null 2>&1 \ | |
241 || die "${find_tool_error_prefix}cannot run $find_tool_res --version" | |
242 eval "$find_tool_envvar=\$find_tool_res" | 238 eval "$find_tool_envvar=\$find_tool_res" |
243 eval "export $find_tool_envvar" | 239 eval "export $find_tool_envvar" |
244 } | 240 } |
245 | |
246 # Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6. | |
247 find_tool SHA1SUM sha1sum gsha1sum shasum | |
248 | 241 |
249 # Override the default configuration, if necessary. | 242 # Override the default configuration, if necessary. |
250 # Make sure that bootstrap.conf is sourced from the current directory | 243 # Make sure that bootstrap.conf is sourced from the current directory |
251 # if we were invoked as "sh bootstrap". | 244 # if we were invoked as "sh bootstrap". |
252 case "$0" in | 245 case "$0" in |
255 esac | 248 esac |
256 | 249 |
257 # Extra files from gnulib, which override files from other sources. | 250 # Extra files from gnulib, which override files from other sources. |
258 test -z "${gnulib_extra_files}" && \ | 251 test -z "${gnulib_extra_files}" && \ |
259 gnulib_extra_files=" | 252 gnulib_extra_files=" |
260 $build_aux/install-sh | 253 build-aux/install-sh |
261 $build_aux/mdate-sh | 254 build-aux/mdate-sh |
262 $build_aux/texinfo.tex | 255 build-aux/texinfo.tex |
263 $build_aux/depcomp | 256 build-aux/depcomp |
264 $build_aux/config.guess | 257 build-aux/config.guess |
265 $build_aux/config.sub | 258 build-aux/config.sub |
266 doc/INSTALL | 259 doc/INSTALL |
267 " | 260 " |
268 | 261 |
269 if test "$vc_ignore" = auto; then | 262 if test "$vc_ignore" = auto; then |
270 vc_ignore= | 263 vc_ignore= |
306 | 299 |
307 if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then | 300 if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then |
308 die "Bootstrapping from a non-checked-out distribution is risky." | 301 die "Bootstrapping from a non-checked-out distribution is risky." |
309 fi | 302 fi |
310 | 303 |
311 # Ensure that lines starting with ! sort last, per gitignore conventions | 304 # Strip blank and comment lines to leave significant entries. |
312 # for whitelisting exceptions after a more generic blacklist pattern. | 305 gitignore_entries() { |
313 sort_patterns() { | 306 sed '/^#/d; /^$/d' "$@" |
314 sort -u "$@" | sed '/^!/ { | 307 } |
315 H | 308 |
316 d | 309 # If $STR is not already on a line by itself in $FILE, insert it at the start. |
317 } | 310 # Entries are inserted at the start of the ignore list to ensure existing |
318 $ { | 311 # entries starting with ! are not overridden. Such entries support |
319 P | 312 # whitelisting exceptions after a more generic blacklist pattern. |
320 x | 313 insert_if_absent() { |
321 s/^\n// | |
322 }' | sed '/^$/d' | |
323 } | |
324 | |
325 # If $STR is not already on a line by itself in $FILE, insert it, | |
326 # sorting the new contents of the file and replacing $FILE with the result. | |
327 insert_sorted_if_absent() { | |
328 file=$1 | 314 file=$1 |
329 str=$2 | 315 str=$2 |
330 test -f $file || touch $file | 316 test -f $file || touch $file |
331 echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \ | 317 test -r $file || die "Error: failed to read ignore file: $file" |
332 || { echo "$str" | sort_patterns - $file > $file.bak \ | 318 duplicate_entries=$(gitignore_entries $file | sort | uniq -d) |
333 && mv $file.bak $file; } \ | 319 if [ "$duplicate_entries" ] ; then |
334 || die "insert_sorted_if_absent $file $str: failed" | 320 die "Error: Duplicate entries in $file: " $duplicate_entries |
321 fi | |
322 linesold=$(gitignore_entries $file | wc -l) | |
323 linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) | |
324 if [ $linesold != $linesnew ] ; then | |
325 { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ | |
326 || die "insert_if_absent $file $str: failed" | |
327 fi | |
335 } | 328 } |
336 | 329 |
337 # Adjust $PATTERN for $VC_IGNORE_FILE and insert it with | 330 # Adjust $PATTERN for $VC_IGNORE_FILE and insert it with |
338 # insert_sorted_if_absent. | 331 # insert_if_absent. |
339 insert_vc_ignore() { | 332 insert_vc_ignore() { |
340 vc_ignore_file="$1" | 333 vc_ignore_file="$1" |
341 pattern="$2" | 334 pattern="$2" |
342 case $vc_ignore_file in | 335 case $vc_ignore_file in |
343 *.gitignore) | 336 *.gitignore) |
344 # A .gitignore entry that does not start with '/' applies | 337 # A .gitignore entry that does not start with '/' applies |
345 # recursively to subdirectories, so prepend '/' to every | 338 # recursively to subdirectories, so prepend '/' to every |
346 # .gitignore entry. | 339 # .gitignore entry. |
347 pattern=$(echo "$pattern" | sed s,^,/,);; | 340 pattern=$(echo "$pattern" | sed s,^,/,);; |
348 esac | 341 esac |
349 insert_sorted_if_absent "$vc_ignore_file" "$pattern" | 342 insert_if_absent "$vc_ignore_file" "$pattern" |
350 } | 343 } |
351 | 344 |
352 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. | 345 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. |
353 found_aux_dir=no | 346 found_aux_dir=no |
354 grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ | 347 grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ |
468 } ;; | 461 } ;; |
469 esac | 462 esac |
470 if [ "$req_ver" = "-" ]; then | 463 if [ "$req_ver" = "-" ]; then |
471 # Merely require app to exist; not all prereq apps are well-behaved | 464 # Merely require app to exist; not all prereq apps are well-behaved |
472 # so we have to rely on $? rather than get_version. | 465 # so we have to rely on $? rather than get_version. |
473 $app --version >/dev/null 2>&1 | 466 $app --version >/dev/null 2>&1 </dev/null |
474 if [ 126 -le $? ]; then | 467 if [ 126 -le $? ]; then |
475 warn_ "Error: '$app' not found" | 468 warn_ "Error: '$app' not found" |
476 ret=1 | 469 ret=1 |
477 fi | 470 fi |
478 else | 471 else |
502 printf %s "$buildreq" | 495 printf %s "$buildreq" |
503 echo "----------------------" | 496 echo "----------------------" |
504 # can't depend on column -t | 497 # can't depend on column -t |
505 } | 498 } |
506 | 499 |
500 # Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6. | |
501 # Also find the compatible sha1 utility on the BSDs | |
502 if test x"$SKIP_PO" = x; then | |
503 find_tool SHA1SUM sha1sum gsha1sum shasum sha1 | |
504 fi | |
505 | |
507 use_libtool=0 | 506 use_libtool=0 |
508 # We'd like to use grep -E, to see if any of LT_INIT, | 507 # We'd like to use grep -E, to see if any of LT_INIT, |
509 # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, | 508 # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, |
510 # but that's not portable enough (e.g., for Solaris). | 509 # but that's not portable enough (e.g., for Solaris). |
511 grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ | 510 grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ |
550 fi | 549 fi |
551 | 550 |
552 echo "$0: Bootstrapping from checked-out $package sources..." | 551 echo "$0: Bootstrapping from checked-out $package sources..." |
553 | 552 |
554 # See if we can use gnulib's git-merge-changelog merge driver. | 553 # See if we can use gnulib's git-merge-changelog merge driver. |
555 if test -d .git && (git --version) >/dev/null 2>/dev/null ; then | 554 if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then |
556 if git config merge.merge-changelog.driver >/dev/null ; then | 555 if git config merge.merge-changelog.driver >/dev/null ; then |
557 : | 556 : |
558 elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then | 557 elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then |
559 echo "$0: initializing git-merge-changelog driver" | 558 echo "$0: initializing git-merge-changelog driver" |
560 git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' | 559 git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' |
573 | 572 |
574 git_modules_config () { | 573 git_modules_config () { |
575 test -f .gitmodules && git config --file .gitmodules "$@" | 574 test -f .gitmodules && git config --file .gitmodules "$@" |
576 } | 575 } |
577 | 576 |
578 gnulib_path=$(git_modules_config submodule.gnulib.path) | 577 if $use_git; then |
579 test -z "$gnulib_path" && gnulib_path=gnulib | 578 gnulib_path=$(git_modules_config submodule.gnulib.path) |
580 | 579 test -z "$gnulib_path" && gnulib_path=gnulib |
581 # Get gnulib files. | 580 fi |
581 | |
582 # Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a | |
583 # submodule, for use in the rest of the script. | |
582 | 584 |
583 case ${GNULIB_SRCDIR--} in | 585 case ${GNULIB_SRCDIR--} in |
584 -) | 586 -) |
587 # Note that $use_git is necessarily true in this case. | |
585 if git_modules_config submodule.gnulib.url >/dev/null; then | 588 if git_modules_config submodule.gnulib.url >/dev/null; then |
586 echo "$0: getting gnulib files..." | 589 echo "$0: getting gnulib files..." |
587 git submodule init || exit $? | 590 git submodule init || exit $? |
588 git submodule update || exit $? | 591 git submodule update || exit $? |
589 | 592 |
600 trap - 1 2 13 15 | 603 trap - 1 2 13 15 |
601 fi | 604 fi |
602 GNULIB_SRCDIR=$gnulib_path | 605 GNULIB_SRCDIR=$gnulib_path |
603 ;; | 606 ;; |
604 *) | 607 *) |
605 # Use GNULIB_SRCDIR as a reference. | 608 # Use GNULIB_SRCDIR directly or as a reference. |
606 if test -d "$GNULIB_SRCDIR"/.git && \ | 609 if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ |
607 git_modules_config submodule.gnulib.url >/dev/null; then | 610 git_modules_config submodule.gnulib.url >/dev/null; then |
608 echo "$0: getting gnulib files..." | 611 echo "$0: getting gnulib files..." |
609 if git submodule -h|grep -- --reference > /dev/null; then | 612 if git submodule -h|grep -- --reference > /dev/null; then |
610 # Prefer the one-liner available in git 1.6.4 or newer. | 613 # Prefer the one-liner available in git 1.6.4 or newer. |
611 git submodule update --init --reference "$GNULIB_SRCDIR" \ | 614 git submodule update --init --reference "$GNULIB_SRCDIR" \ |
627 GNULIB_SRCDIR=$gnulib_path | 630 GNULIB_SRCDIR=$gnulib_path |
628 fi | 631 fi |
629 ;; | 632 ;; |
630 esac | 633 esac |
631 | 634 |
635 # $GNULIB_SRCDIR now points to the version of gnulib to use, and | |
636 # we no longer need to use git or $gnulib_path below here. | |
637 | |
632 if $bootstrap_sync; then | 638 if $bootstrap_sync; then |
633 cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { | 639 cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { |
634 echo "$0: updating bootstrap and restarting..." | 640 echo "$0: updating bootstrap and restarting..." |
641 case $(sh -c 'echo "$1"' -- a) in | |
642 a) ignored=--;; | |
643 *) ignored=ignored;; | |
644 esac | |
635 exec sh -c \ | 645 exec sh -c \ |
636 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ | 646 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ |
637 -- "$GNULIB_SRCDIR/build-aux/bootstrap" \ | 647 $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ |
638 "$0" "$@" --no-bootstrap-sync | 648 "$0" "$@" --no-bootstrap-sync |
639 } | 649 } |
640 fi | 650 fi |
641 | 651 |
642 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool | 652 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool |
680 case $po in x) continue;; esac | 690 case $po in x) continue;; esac |
681 new_po="$ref_po_dir/$po.po" | 691 new_po="$ref_po_dir/$po.po" |
682 cksum_file="$ref_po_dir/$po.s1" | 692 cksum_file="$ref_po_dir/$po.s1" |
683 if ! test -f "$cksum_file" || | 693 if ! test -f "$cksum_file" || |
684 ! test -f "$po_dir/$po.po" || | 694 ! test -f "$po_dir/$po.po" || |
685 ! $SHA1SUM -c --status "$cksum_file" \ | 695 ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then |
686 < "$new_po" > /dev/null; then | |
687 echo "$me: updated $po_dir/$po.po..." | 696 echo "$me: updated $po_dir/$po.po..." |
688 cp "$new_po" "$po_dir/$po.po" \ | 697 cp "$new_po" "$po_dir/$po.po" \ |
689 && $SHA1SUM < "$new_po" > "$cksum_file" | 698 && $SHA1SUM < "$new_po" > "$cksum_file" || return |
690 fi | 699 fi |
691 done | 700 done |
692 } | 701 } |
693 | 702 |
694 case $SKIP_PO in | 703 case $SKIP_PO in |
889 # between successive runs of this script. | 898 # between successive runs of this script. |
890 find "$m4_base" "$source_base" \ | 899 find "$m4_base" "$source_base" \ |
891 -depth \( -name '*.m4' -o -name '*.[ch]' \) \ | 900 -depth \( -name '*.m4' -o -name '*.[ch]' \) \ |
892 -type l -xtype l -delete > /dev/null 2>&1 | 901 -type l -xtype l -delete > /dev/null 2>&1 |
893 | 902 |
903 # Invoke autoreconf with --force --install to ensure upgrades of tools | |
904 # such as ylwrap. | |
905 AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS" | |
906 | |
894 # Some systems (RHEL 5) are using ancient autotools, for which the | 907 # Some systems (RHEL 5) are using ancient autotools, for which the |
895 # --no-recursive option had not been invented. Detect that lack and | 908 # --no-recursive option had not been invented. Detect that lack and |
896 # omit the option when it's not supported. FIXME in 2017: remove this | 909 # omit the option when it's not supported. FIXME in 2017: remove this |
897 # hack when RHEL 5 autotools are updated, or when they become irrelevant. | 910 # hack when RHEL 5 autotools are updated, or when they become irrelevant. |
898 no_recursive= | |
899 case $($AUTORECONF --help) in | 911 case $($AUTORECONF --help) in |
900 *--no-recursive*) no_recursive=--no-recursive;; | 912 *--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";; |
901 esac | 913 esac |
902 | 914 |
903 # Tell autoreconf not to invoke autopoint or libtoolize; they were run above. | 915 # Tell autoreconf not to invoke autopoint or libtoolize; they were run above. |
904 echo "running: AUTOPOINT=true LIBTOOLIZE=true " \ | 916 echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS" |
905 "$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS" | 917 AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \ |
906 AUTOPOINT=true LIBTOOLIZE=true \ | |
907 $AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \ | |
908 || die "autoreconf failed" | 918 || die "autoreconf failed" |
909 | 919 |
910 # Get some extra files from gnulib, overriding existing files. | 920 # Get some extra files from gnulib, overriding existing files. |
911 for file in $gnulib_extra_files; do | 921 for file in $gnulib_extra_files; do |
912 case $file in | 922 case $file in |