Skip to content

Commit 1d11c01

Browse files
committed
Update bootstrap script for gnulib
Assisted-by: Cursor
1 parent 6499615 commit 1d11c01

3 files changed

Lines changed: 45 additions & 3 deletions

File tree

‎bootstrap‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#! /bin/sh
22

3-
echo "Deleting all autogenerated stuff..."
3+
set -e
4+
5+
echo "Bootstrap: Setting up patchutils build environment..."
6+
7+
# Check if we need to update gnulib files
8+
update_gnulib=false
9+
if [ "$1" = "--update-gnulib" ] || [ "$1" = "-u" ]; then
10+
update_gnulib=true
11+
echo "Updating gnulib modules..."
12+
fi
13+
14+
echo "Cleaning autogenerated files..."
415

516
rm -f *.o *.so config.sub config.guess config.cache
617
rm -f config.log config.h config.status config.h.in
@@ -14,6 +25,37 @@ rm -rf autom4te.cache/
1425
rm -f INSTALL
1526
rm -f test-driver
1627

28+
# Update gnulib if requested or if gnulib files seem missing/outdated
29+
if [ "$update_gnulib" = true ] || [ ! -f "lib/Makefile.am" ] || [ ! -f "m4/gnulib-comp.m4" ]; then
30+
echo "Updating gnulib modules..."
31+
32+
# Try to use system gnulib-tool first
33+
if command -v gnulib-tool >/dev/null 2>&1; then
34+
echo "Using system gnulib-tool..."
35+
if ! gnulib-tool --update 2>/dev/null; then
36+
echo "System gnulib-tool failed, trying alternative approach..."
37+
# Fallback to downloading gnulib if system tool doesn't work
38+
if [ ! -d "/tmp/gnulib" ]; then
39+
echo "Downloading gnulib..."
40+
git clone --depth 1 https://git.savannah.gnu.org/git/gnulib.git /tmp/gnulib
41+
fi
42+
/tmp/gnulib/gnulib-tool --update
43+
fi
44+
else
45+
echo "gnulib-tool not found, downloading gnulib..."
46+
if [ ! -d "/tmp/gnulib" ]; then
47+
git clone --depth 1 https://git.savannah.gnu.org/git/gnulib.git /tmp/gnulib
48+
fi
49+
/tmp/gnulib/gnulib-tool --update
50+
fi
51+
echo "Gnulib modules updated."
52+
fi
53+
54+
echo "Running autoreconf..."
1755
autoreconf --install --verbose
1856

57+
echo ""
58+
echo "Bootstrap completed successfully!"
1959
echo "Now you may run ./configure"
60+
echo ""
61+
echo "Tip: Use './bootstrap --update-gnulib' to update gnulib modules"

‎lib/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# --m4-base=m4 \
4343
# --doc-base=doc \
4444
# --tests-base=tests \
45-
# --aux-dir=build-aux \
45+
# --aux-dir=. \
4646
# --no-conditional-dependencies \
4747
# --no-libtool \
4848
# --macro-prefix=gl \

‎m4/gnulib-cache.m4‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# --m4-base=m4 \
3434
# --doc-base=doc \
3535
# --tests-base=tests \
36-
# --aux-dir=build-aux \
36+
# --aux-dir=. \
3737
# --no-conditional-dependencies \
3838
# --no-libtool \
3939
# --macro-prefix=gl \

0 commit comments

Comments
 (0)