Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap libltdl to fix libtool v2.4 + automake v1.17 build #1877

Closed
15 changes: 15 additions & 0 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ jobs:
export CPPFLAGS="-I$HOMEBREW_PREFIX/include${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L$HOMEBREW_PREFIX/lib${LDFLAGS:+ $LDFLAGS}"
export CFLAGS="-Wno-compound-token-split-by-macro${CFLAGS:+ $CFLAGS}" # needed fir ltdl with Xcode

# libtool package referenced below fails to copy its configure*
# files, possibly due to a packaging/brewing bug. The following sed
# command restores installed libtoolize code to its earlier (and
# working) variation.
echo "brew libtool package details:"
brew info libtool --json | grep -E 'rebuild|tap_git_head'
# This hack was tested on libtoolize package with the following output:
# "rebuild": 2,
# "tap_git_head": "5cede8ea3b7b12c7f68215f75a951430b38d945f",
Comment on lines +167 to +171
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do not want to see this noise in CI logs, I will remove it. I added it to make package changes easier to detect while this temporary sed workaround is in place.

#
editable=$HOMEBREW_CELLAR/libtool/2.4.7/bin/glibtoolize
sed -i.bak 's@ltdl_ac_aux_dir=""@ltdl_ac_aux_dir="../build-aux"@' $editable || true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sooner or later, this hack will fail. I did not make it conditional on brew libtool package variation because doing so is difficult (for me) and the failure is very unlikely to produce false positives; CI tests will just start failing again instead. We will simply remove this hack when it is no longer needed.

diff -u $editable.bak $editable || true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sed-based edit restores the earlier/working variation of libtoolize script:

-    ltdl_ac_aux_dir=""
+    ltdl_ac_aux_dir="../build-aux"

The actual name of this directory is misleading in Squid context. Ignore it.


./test-builds.sh ${{ matrix.layer.name }}

- name: Publish build logs
Expand Down
71 changes: 40 additions & 31 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,38 +116,47 @@ echo "autoconf ($acversion) : autoconf$acver"
echo "libtool ($ltversion) : ${LIBTOOL_BIN}${ltver}"
echo "libtool path : $ltpath"

for dir in \
""
do
if [ -z "$dir" ] || [ -d $dir ]; then
if (
echo "Bootstrapping $dir"
cd ./$dir
if [ -n "$dir" ] && [ -f bootstrap.sh ]; then
./bootstrap.sh
elif [ ! -f $dir/configure ]; then
# Make sure cfgaux exists
mkdir -p cfgaux

if test -n "$ltpath"; then
acincludeflag="-I $ltpath/../share/aclocal"
else
acincludeflag=""
fi

# Bootstrap the autotool subsystems
bootstrap aclocal$amver $acincludeflag
bootstrap autoheader$acver
bootstrap_libtoolize ${LIBTOOL_BIN}ize${ltver}
bootstrap automake$amver --foreign --add-missing --copy -f
bootstrap autoconf$acver --force
fi ); then
: # OK
else
exit 1
fi
if test -n "$ltpath"; then
acincludeflag="-I $ltpath/../share/aclocal"
else
acincludeflag=""
fi

# bootstrap primary or subproject sources
bootstrap_dir() {
dir="$1"
cd $dir || exit $?

bootstrap aclocal$amver $acincludeflag
bootstrap autoheader$acver

# Do not libtoolize ltdl
if grep -q '^LTDL_INIT' configure.ac
then
bootstrap_libtoolize ${LIBTOOL_BIN}ize${ltver}
fi
done

bootstrap automake$amver --foreign --add-missing --copy --force
bootstrap autoconf$acver --force

cd - > /dev/null
}

echo "Bootstrapping primary Squid sources"
mkdir -p cfgaux || exit $?
bootstrap_dir .

# The above bootstrap_libtoolize step creates or updates libltdl. It copies
# (with minor adjustments) configure.ac and configure, Makefile.am and
# Makefile.in from libtool installation, but does not regenerate copied
# configure from copied configure.ac and copied Makefile.in from Makefile.am.
# We get libltdl/configure and libltdl/Makefile.in as they were bootstrapped
# by libtool authors or package maintainers. Low-level idiosyncrasies in those
# libtool files result in mismatches between copied code expectations and
# Squid sub-project environment, leading to occasional build failures that
# this bootstrapping addresses.
echo "Bootstrapping libltdl sub-project"
bootstrap_dir libltdl

# Make a copy of SPONSORS we can package
if test -f SPONSORS.list; then
Expand Down