projects/guix·blob python-team · refs

95 lines · 3.4 KiB

1From bf900311b84185b01dd4d03c0ff6f3a6e0ade2ed Mon Sep 17 00:00:00 2001
2From: Maxim Cournoyer <[email protected]>
3Date: Wed, 16 Jul 2025 09:55:22 +0900
4Subject: [PATCH] bootstrap: Use gnulib-tool from PATH if available.
5
6Some distributions such as GNU Guix include in their package for
7gnulib a 'gnulib-tool' command under their $bindir
8prefix (e.g. '/bin') for users to use, along the unmodified full
9sources. The idea is that any wrapping or distribution modifications
10for the *execution* of the script at run time is done on these
11commands, while the rest of the source should be in their
12pristine (unmodified) version. Adjust the 'gnulib-tool' discovery
13mechanism to support such installation layout.
14
15* build-aux/bootstrap (autogen) <gnulib_tool>: Prefer to use from
16PATH, else from $GNULIB_SRCDIR/../../bin/gnulib-tool, else from
17$GNULIB_SRCDIR/gnulib-tool. Invoke script via 'sh' from PATH, for
18portability.
19* gnulib-tool.sh (func_gnulib_dir): Honor GNULIB_SRCDIR to locate
20gnulib's main directory.
21(func_version): Explicitly invoke git-version-gen via 'sh' to avoid
22relying on the exact location of 'sh' hard-coded in the script
23shebang.
24---
25 build-aux/bootstrap | 13 ++++++++++---
26 gnulib-tool.sh | 8 ++++++--
27 2 files changed, 16 insertions(+), 5 deletions(-)
28
29diff --git a/build-aux/bootstrap b/build-aux/bootstrap
30index dc9fb43834..5b2984316c 100755
31--- a/build-aux/bootstrap
32+++ b/build-aux/bootstrap
33@@ -3,7 +3,7 @@
34
35 # Bootstrap this package from checked-out sources.
36
37-scriptversion=2025-06-10.02; # UTC
38+scriptversion=2025-07-16.00; # UTC
39
40 # Copyright (C) 2003-2025 Free Software Foundation, Inc.
41 #
42@@ -1211,7 +1211,14 @@ autogen()
43 fi
44
45 if $use_gnulib; then
46- gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
47+ gnulib_tool=$(command -v gnulib-tool)
48+ if test -x "$gnulib_tool"; then
49+ : # done
50+ elif test -x $GNULIB_SRCDIR/../../bin/gnulib-tool; then
51+ gnulib_tool=$GNULIB_SRCDIR/../../bin/gnulib-tool
52+ else
53+ gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
54+ fi
55 <$gnulib_tool || return
56 fi
57
58@@ -1297,7 +1304,7 @@ autogen()
59 esac
60 fi
61 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
62- $gnulib_tool $gnulib_tool_options --import $gnulib_modules \
63+ sh $gnulib_tool $gnulib_tool_options --import $gnulib_modules \
64 || die "gnulib-tool failed"
65
66 if test $with_gettext = yes && test ! -f $m4_base/gettext.m4; then
67diff --git a/gnulib-tool.sh b/gnulib-tool.sh
68index e0a8cbba82..c4b05195b5 100755
69--- a/gnulib-tool.sh
70+++ b/gnulib-tool.sh
71@@ -360,7 +360,7 @@ q
72 date=`cd "$gnulib_dir" && git log -n 1 --format=medium --date=iso ChangeLog | sed -n -e "$sed_extract_first_date"`
73 # Use GNU date to compute the time in GMT.
74 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
75- version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
76+ version=' '`cd "$gnulib_dir" && sh ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
77 else
78 # gnulib copy without versioning information.
79 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
80@@ -518,7 +518,11 @@ func_gnulib_dir ()
81 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
82 esac
83 done
84- gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
85+ if test -n "$GNULIB_SRCDIR"; then
86+ gnulib_dir=$GNULIB_SRCDIR
87+ else
88+ gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
89+ fi
90 }
91
92 # func_tmpdir
93--
942.50.1
95