From: Pádraig Brady Date: Sun, 14 Mar 2021 22:43:42 +0000 (+0000) Subject: maint: propagate DEPENDENCIES to libs in single binary mode X-Git-Tag: v9.0~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90c4ef1f7d21a4df0429f93b43efbe1dc8c572f2;p=thirdparty%2Fcoreutils.git maint: propagate DEPENDENCIES to libs in single binary mode build-aux/gen-single-binary.sh (override_single): A new function to refactor the existing mappings for dir, vdir, and arch. This function now also sets the DEPENDENCIES variable so that these dependencies can be maintained later in the script, where we now propagate the automake generated $(src_$cmd_DEPENDENCIES) to our equivalent src_libsinglebin_$cmd_a_DEPENDENCIES. This will ensure that any required libs are built, which we require in a following change to cksum that builds part of it as a separate library. --- diff --git a/build-aux/gen-single-binary.sh b/build-aux/gen-single-binary.sh index 4e07cfdaa3..6570615355 100755 --- a/build-aux/gen-single-binary.sh +++ b/build-aux/gen-single-binary.sh @@ -58,19 +58,19 @@ done < $LOCAL_MK me=`echo "$0" | sed 's,.*/,,'` echo "## Automatically generated by $me. DO NOT EDIT BY HAND!" -# Override the sources for dir and vdir. We use a smaller version of dir and -# vdir that relies on the ls main. -src_dir_SOURCES="src/coreutils-dir.c" -src_dir_LDADD="$src_dir_LDADD src/libsinglebin_ls.a" -echo src_libsinglebin_dir_a_DEPENDENCIES = src/libsinglebin_ls.a -src_vdir_SOURCES="src/coreutils-vdir.c" -src_vdir_LDADD="$src_vdir_LDADD src/libsinglebin_ls.a" -echo src_libsinglebin_vdir_a_DEPENDENCIES = src/libsinglebin_ls.a - -# Override the sources for arch likewise, using the main from uname. -src_arch_SOURCES="src/coreutils-arch.c" -src_arch_LDADD="$src_arch_LDADD src/libsinglebin_uname.a" -echo src_libsinglebin_arch_a_DEPENDENCIES = src/libsinglebin_uname.a +# Override the sources for some tools, to use smaller variants +override_single() { + from="$1"; to="$2"; + + eval "src_${from}_SOURCES='src/coreutils-${from}.c'" + eval "src_from_LDADD=\$src_${from}_LDADD" + eval "src_${from}_LDADD='$src_from_LDADD src/libsinglebin_${to}.a'" + eval "src_libsinglebin_${from}_a_DEPENDENCIES='src/libsinglebin_${to}.a'" + echo "src_libsinglebin_${from}_a_DEPENDENCIES = src/libsinglebin_${to}.a" +} +override_single dir ls +override_single vdir ls +override_single arch uname for cmd in $ALL_PROGRAMS; do echo "# Command $cmd" @@ -88,6 +88,13 @@ for cmd in $ALL_PROGRAMS; do echo "${base}_ldadd = $value" fi + # DEPENDENCIES + var=src_libsinglebin_${cmd}_a_DEPENDENCIES + eval "value=\$$var" + if [ "x$value" = "x" ]; then + echo "$var = \$(src_${cmd}_DEPENDENCIES)" + fi + # CFLAGS # Hack any other program defining a main() replacing its main by # single_binary_main_$PROGRAM_NAME.