From 13dc8be238027fba6ec9ac0d71910158d3acba8c Mon Sep 17 00:00:00 2001 From: Mitch Capper Date: Mon, 2 Dec 2024 05:09:12 -0800 Subject: [PATCH] Libtool fixes at runtime, including new compiler fixes --- build/f_gawk_build.sh | 2 ++ build/f_libhsts_build.sh | 1 + build/f_libpsl_build.sh | 1 + build/f_wolfcrypt_build.sh | 1 + helpers_gnu.sh | 16 ++++++++++++++++ 5 files changed, 21 insertions(+) diff --git a/build/f_gawk_build.sh b/build/f_gawk_build.sh index 98f951e..fc2ab89 100644 --- a/build/f_gawk_build.sh +++ b/build/f_gawk_build.sh @@ -61,7 +61,9 @@ fi if [[ -z $SKIP_STEP || $SKIP_STEP == "bootstrap" ]]; then gnulib_add_addl_modules_to_bootstrap; gnulib_ensure_buildaux_scripts_copied; + libtoolize --install --verbose #this is normally part of autoreconf to install the build-aux we removed earlier like ltmain.sh as we need the right version while bootstrap will run autoreconf it wont do the install at the parent dir level. We also want this run before the bootstrap so as to not override gnulibs installs setup_gnulibtool_py_autoconfwrapper #needed for generated .mk/.ac files but if just stock then the below line likely works + libtool_fixes "build-aux/ltmain.sh" "m4/libtool.m4" ./bootstrap --no-bootstrap-sync --no-git --gnulib-srcdir=gnulib --skip-po --force gnulib_ensure_buildaux_scripts_copied --forced; SKIP_STEP="" diff --git a/build/f_libhsts_build.sh b/build/f_libhsts_build.sh index 9a54c95..24d1962 100644 --- a/build/f_libhsts_build.sh +++ b/build/f_libhsts_build.sh @@ -31,6 +31,7 @@ fi if [[ -z $SKIP_STEP || $SKIP_STEP == "autoconf" ]]; then #not empty allowed as if we bootstrapped above we dont need to run nautoconf gnulib_ensure_buildaux_scripts_copied autoreconf --symlink --verbose --install + libtool_fixes "build-aux/ltmain.sh" "m4/libtool.m4" SKIP_STEP="" fi diff --git a/build/f_libpsl_build.sh b/build/f_libpsl_build.sh index 8f083c6..914a302 100644 --- a/build/f_libpsl_build.sh +++ b/build/f_libpsl_build.sh @@ -52,6 +52,7 @@ fi gnulib_add_addl_modules_to_bootstrap; gnulib_ensure_buildaux_scripts_copied; setup_gnulibtool_py_autoconfwrapper #needed for generated .mk/.ac files but if just stock then the below line likely works + libtool_fixes "build-aux/ltmain.sh" "m4/libtool.m4" ./bootstrap --no-bootstrap-sync --no-git --gnulib-srcdir=gnulib --skip-po SKIP_STEP="" fi diff --git a/build/f_wolfcrypt_build.sh b/build/f_wolfcrypt_build.sh index dca2bac..e82ab85 100644 --- a/build/f_wolfcrypt_build.sh +++ b/build/f_wolfcrypt_build.sh @@ -35,6 +35,7 @@ fi if [[ -z $SKIP_STEP || $SKIP_STEP == "autoconf" ]]; then #not empty allowed as if we bootstrapped above we dont need to run nautoconf sed -i -E 's#(ESTS\],\[test .x)#\1ZZZ#g' configure.ac #disable unit tests that will fail sed -i -E 's#autoreconf --install --force#autoreconf --install#g' autogen.sh + libtool_fixes "build-aux/ltmain.sh" "m4/libtool.m4" gnulib_ensure_buildaux_scripts_copied; ./autogen.sh SKIP_STEP="" diff --git a/helpers_gnu.sh b/helpers_gnu.sh index 5044950..d46d007 100644 --- a/helpers_gnu.sh +++ b/helpers_gnu.sh @@ -128,6 +128,22 @@ function gnulib_add_addl_modules_to_bootstrap(){ echo "${BOOT_FILE/TOREPLACEZSTR/"$CUR_MODULES"$'\n'}" > bootstrap.conf fi } + +function libtool_fixes(){ + # even when symlink is used for autotools the m4 macro and the build-aux/ltmain.sh are still copied so fine to edit directly + # first the newer libtools have more windows support but that makes things actually a bit harder as it has some issues + # first it puts the export symbol commands in a .exp file but that is used by the compiler too so .expsym is better and used elsewhere + # Secondly it does -Fe [arg] but it needs to be next to the -Fe[arg] +# local POS_FILES=("build-aux/ltmain.sh" "m4/libtool.m4") +# for fl in "${POS_FILES[@]}"; do +# if [[ -e "$fl" ]]; then + + sed -i -E "s/(\\.exp)/\1sym/g;s/expsymsym/expsym/g;s/-Fe /-Fe/g" "$@" + sed -i -E "s/func_convert_core_msys_to_w32 \(/func_convert_core_msys_to_w32 (){ func_convert_core_msys_to_w32_result=\$1; }\\nfunc_convert_core_msys_to_w32_old (/" "$@" + #sed -i -E "s#(gnulib_tool=.+gnulib-tool)\$#\1.py#" bootstrap +# fi + #done +} function setup_gnulibtool_py_autoconfwrapper(){ if [[ $BLD_CONFIG_GNU_LIBS_AUTORECONF_WRAPPER -eq 1 ]]; then local TARGET_FL="${BLD_CONFIG_BUILD_AUX_FOLDER}/AUTORECONF_prewrapper.sh"