From 12aff487ead02f93d7a76de6bfd3ba13bf52eceb Mon Sep 17 00:00:00 2001 From: Ralf Hubert Date: Tue, 11 Nov 2025 12:22:30 +0100 Subject: [PATCH] autoconf: run autoconfreconfgure in build step --- classes/autoconf.yaml | 21 +++++++++++++++++---- classes/autotools.yaml | 20 +++++++++++++++++--- recipes/devel/flex.yaml | 3 +-- recipes/devel/gcc.yaml | 15 ++++++++------- recipes/libs/expat.yaml | 6 +----- recipes/libs/gdbm.yaml | 5 ++--- recipes/libs/gmp.yaml | 3 +-- recipes/libs/libffi.yaml | 3 +-- recipes/libs/libuv.yaml | 3 +-- recipes/python/python3.yaml | 4 +--- 10 files changed, 50 insertions(+), 33 deletions(-) diff --git a/classes/autoconf.yaml b/classes/autoconf.yaml index daf2df27..ecfc1c29 100644 --- a/classes/autoconf.yaml +++ b/classes/autoconf.yaml @@ -7,10 +7,9 @@ privateEnvironment: APPLY_LIBTOOL_PATCH: "no" -checkoutDeterministic: True -checkoutTools: [autotools] -checkoutToolsWeak: [m4] -checkoutSetup: | +buildTools: [autotools] +buildToolsWeak: [m4] +buildSetup: | # Other classes can add paths to this array to pick up additional aclocal # m4 files. declare -a AUTOCONF_EXTRA_PKGS @@ -87,3 +86,17 @@ checkoutSetup: | touch .autoreconf.stamp fi } + + autoconfSync () { + mkdir -p $2 + rsync -aH --delete --exclude=".autoreconf.stamp" $1/ $2/ + } + + # Moves the sources of $1 to $2 and calls autoconfReconfigure + # The remaining arguments are passed to 'autoconfReconfigure' + autoconfSyncReconfigure () { + autoconfSync $1 $2 + pushd $2 + autoconfReconfigure ${@:3} + popd + } diff --git a/classes/autotools.yaml b/classes/autotools.yaml index dc0b6149..7606a577 100644 --- a/classes/autotools.yaml +++ b/classes/autotools.yaml @@ -10,6 +10,8 @@ buildSetup: | local INSTALL_TAGET=install local INSTALL_OPTIONS=( ) local SHARED_STATIC=( ) + local AUTOCONF_OPTS=() + local AUTOCONF_SYNC_RECONFIGURE=0 # Explicitly build everything static on host builds and shared on # cross-builds. The package may disable this behaviour if the configure @@ -33,7 +35,7 @@ buildSetup: | # parse arguments OPTIND=1 local opt - while getopts "i:m:o:O:s" opt ; do + while getopts "i:m:o:O:sS:" opt ; do case "$opt" in i) INSTALL_TAGET="$OPTARG" @@ -47,6 +49,12 @@ buildSetup: | O) INSTALL_OPTIONS+=( "$OPTARG" ) ;; + s) + AUTOCONF_SYNC_RECONFIGURE=1 + ;; + S) + AUTOCONF_OPTS+=( "-$OPTARG" ) + ;; \?) echo "Invalid option: -$OPTARG" >&2 exit 1 @@ -55,12 +63,18 @@ buildSetup: | done shift $(( OPTIND -1 )) + local AUTOTOOLS_SRC=$1 + if [ ${AUTOCONF_SYNC_RECONFIGURE:-} -eq 1 ]; then + AUTOTOOLS_SRC=$(pwd)/src + autoconfSyncReconfigure $1 $AUTOTOOLS_SRC ${AUTOCONF_OPTS[@]} + fi + rm -rf install mkdir -p build install pushd build - if [[ $1/configure -nt .configure.stamp ]] ; then - $1/configure \ + if [[ ${AUTOTOOLS_SRC}/configure -nt .configure.stamp ]] ; then + ${AUTOTOOLS_SRC}/configure \ ${AUTOCONF_BUILD:+--build=${AUTOCONF_BUILD}} \ ${AUTOCONF_HOST:+--host=${AUTOCONF_HOST}} \ ${AUTOCONF_TARGET:+--target=${AUTOCONF_TARGET}} \ diff --git a/recipes/devel/flex.yaml b/recipes/devel/flex.yaml index 07024bc1..0bfb6d57 100644 --- a/recipes/devel/flex.yaml +++ b/recipes/devel/flex.yaml @@ -14,14 +14,13 @@ checkoutTools: [gettext] checkoutToolsWeak: [m4] checkoutScript: | patchApplySeries $<@flex/*.patch@> - autoconfReconfigure # prevent Makefile from updating the file because it's older than "configure" touch doc/stamp-vti buildTools: [bison, host-toolchain] buildScript: | export M4=m4 - autotoolsBuild $1 \ + autotoolsBuild -s $1 \ --disable-nls packageScript: | diff --git a/recipes/devel/gcc.yaml b/recipes/devel/gcc.yaml index 4db55d2a..6d74f12c 100644 --- a/recipes/devel/gcc.yaml +++ b/recipes/devel/gcc.yaml @@ -62,18 +62,19 @@ checkoutDeterministic: True checkoutScript: | patchApplySeries $<@gcc/*.patch@> - for i in gcc libstdc++-v3 ; do - pushd $i - autoconfReconfigure -u - popd - done - buildVars: [AUTOCONF_BUILD, AUTOCONF_HOST, AUTOCONF_TARGET, GCC_TARGET_ABI, GCC_TARGET_ARCH, GCC_TARGET_FLOAT_ABI, GCC_TARGET_FPU, GCC_MULTILIB, GCC_EXTRA_OPTIONS] buildToolsWeak: [m4] buildScript: | - GCC_SRC=$1 + GCC_SRC=$(pwd)/src + autoconfSync $1 $GCC_SRC + for i in gcc libstdc++-v3 ; do + pushd $GCC_SRC/$i + autoconfReconfigure -u + popd + done + mkdir -p build install configureGcc() diff --git a/recipes/libs/expat.yaml b/recipes/libs/expat.yaml index 2bc4e51a..a3a959fb 100644 --- a/recipes/libs/expat.yaml +++ b/recipes/libs/expat.yaml @@ -10,12 +10,8 @@ checkoutSCM: digestSHA256: a00ae8a6b96b63a3910ddc1100b1a7ef50dc26dceb65ced18ded31ab392f132b stripComponents: 1 -checkoutDeterministic: True -checkoutScript: | - autoconfReconfigure - buildScript: | - autotoolsBuild $1 --without-docbook + autotoolsBuild -s $1 --without-docbook multiPackage: dev: diff --git a/recipes/libs/gdbm.yaml b/recipes/libs/gdbm.yaml index 72099fff..780bf39f 100644 --- a/recipes/libs/gdbm.yaml +++ b/recipes/libs/gdbm.yaml @@ -9,15 +9,14 @@ checkoutSCM: digestSHA1: "50ba1b1d45ce33fd44e4fdaaf3b55a9d8f3dc418" stripComponents: 1 -checkoutTools: [gettext] checkoutDeterministic: True checkoutScript: | - autoconfReconfigure # prevent Makefile from updating the file because it's older than "configure" touch doc/stamp-vti +buildTools: [gettext] buildScript: | - autotoolsBuild $1 \ + autotoolsBuild -s $1 \ --enable-libgdbm-compat multiPackage: diff --git a/recipes/libs/gmp.yaml b/recipes/libs/gmp.yaml index 0c6f3871..cf07baa7 100644 --- a/recipes/libs/gmp.yaml +++ b/recipes/libs/gmp.yaml @@ -17,12 +17,11 @@ checkoutScript: | patchApplySeries $<@gmp/*.patch@> updateConfigFile config.guess configfsf.guess updateConfigFile config.sub configfsf.sub - autoconfReconfigure buildTools: [host-toolchain] buildToolsWeak: [m4] buildScript: | - autotoolsBuild $1 + autotoolsBuild -s $1 multiPackage: dev: diff --git a/recipes/libs/libffi.yaml b/recipes/libs/libffi.yaml index 69ad87f1..518b347a 100644 --- a/recipes/libs/libffi.yaml +++ b/recipes/libs/libffi.yaml @@ -12,10 +12,9 @@ checkoutSCM: checkoutDeterministic: True checkoutScript: | patchApplySeries $<@libffi/*.diff@> - autoconfReconfigure -a buildScript: | - autotoolsBuild $1 + autotoolsBuild -s -Sa $1 multiPackage: dev: diff --git a/recipes/libs/libuv.yaml b/recipes/libs/libuv.yaml index cc196eae..d4e9d72b 100644 --- a/recipes/libs/libuv.yaml +++ b/recipes/libs/libuv.yaml @@ -20,10 +20,9 @@ checkoutScript: | [ -e m4/libuv-extra-automake-flags.m4 ] || \ echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [serial-tests])" \ >m4/libuv-extra-automake-flags.m4 - autoconfReconfigure buildScript: | - autotoolsBuild "$1" + autotoolsBuild -s "$1" multiPackage: dev: diff --git a/recipes/python/python3.yaml b/recipes/python/python3.yaml index 8b0b880c..f898d468 100644 --- a/recipes/python/python3.yaml +++ b/recipes/python/python3.yaml @@ -15,14 +15,12 @@ checkoutSCM: checkoutDeterministic: True checkoutScript: | patchApplySeries $<@python3/*@> - autoconfReconfigure # We cannot use out-of-tree builds directly from the source workspace because # the build somehow manages to create .pyc files in the sources. Setting # PYTHONDONTWRITEBYTECODE does not suffice. buildScript: | - mkdir -p src - rsync -aH --delete $1/ src/ + autoconfSyncReconfigure $1 src multiPackage: "":