Stop using gnulib's flexmember module.
[upkg.git] / bootstrap
blob2ab4a587fc333cc5efb54514d68aae19c249889c
1 #!/bin/sh
3 # Copyright © 2011-2012, 2015, 2021-2023 Nick Bowler
5 # Simple script to get started from a fresh git checkout.
7 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
8 # This is free software: you are free to do what the fuck you want to.
9 # There is NO WARRANTY, to the extent permitted by law.
11 scriptname=$0
13 err() { printf '%s: %s\n' "$scriptname" "$*" 1>&2; }
14 die() { err "$@"; exit 1; }
16 : ${LIBTOOLIZE=libtoolize}
17 : ${AUTORECONF=autoreconf}
18 : ${AUTOMAKE=automake}
19 : ${GNULIB=gnulib}
20 : ${GIT=git}
21 : ${PERL=perl}
23 $GIT submodule update --init || err "Failed to update submodules from git."
25 if test -x $GNULIB/gnulib-tool; then
26 $GNULIB/gnulib-tool --update -S || die "Failed to update Gnulib."
27 else
28 err "Gnulib sources are not properly installed in $GNULIB/"
29 cat >&2 <<'EOF'
31 To bootstrap this package using an external Gnulib, you can set the GNULIB
32 environment variable to indicate the location of the Gnulib sources.
33 EOF
35 test ! -f configure || cat >&2 <<'EOF'
37 However, it seems this package is already bootstrapped. It should not
38 normally be necessary to run this script from a release tarball.
39 EOF
40 exit 1
43 $PERL common/scripts/fix-gnulib.pl -o lib/gnulib.mk -i lib/gnulib.mk.in \
44 || die "Failed to fixup Gnulib makefile fragment."
46 # Frustratingly, libtoolize has changed the name of its nonrecursive ltdl
47 # makefile output, which broke all packages depending on previous documented
48 # behaviour. Work around the issue by renaming the output.
49 rm -f libltdl/ltdl.mk
50 $LIBTOOLIZE -f || die "Failed to run libtoolize."
51 test ! -f libltdl/Makefile.inc || mv -f libltdl/Makefile.inc libltdl/ltdl.mk.in
52 test ! -f libltdl/ltdl.mk || mv -f libltdl/ltdl.mk libltdl/ltdl.mk.in
54 $PERL common/scripts/fix-ltdl.pl -o libltdl/ltdl.mk -i libltdl/ltdl.mk.in \
55 || die "Failed to fixup libltdl makefile fragment."
57 # Punt some automake-generated files so that Gentoo's wrapper script doesn't
58 # try to detect the automake version in use.
59 rm -f Makefile.in aclocal.m4
60 LIBTOOLIZE=true $AUTORECONF -fis || exit
62 amdir=`$AUTOMAKE --print-libdir`
63 if test -f "$amdir/INSTALL"; then
64 ln -sf "$amdir/INSTALL" INSTALL