From 5b0f2e8aa65fb021f3709f5278168a7394825bca Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sun, 2 Dec 2018 20:31:39 -0800 Subject: [PATCH] builder: msys2: fix links to host binaries Factor out non-environment code from host_env()/target_env() into host_env_base()/target_env_base(). Such as that for creating symlinks to root, link host binaries to the target root, as well as calling the hook. Call the _base() functions from the msys2 overrides so that symlinks are created properly, remove redundant symlink code. --- tools/builder/core.sh | 2 +- tools/builder/mingw.sh | 38 +++++++++++++++++++++++--------------- tools/win/msys2-builder | 6 ++---- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 28a57d61..caec89d6 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -13,7 +13,7 @@ export PERL_MAKE="${PERL_MAKE:-make}" BUILD_ENV=$BUILD_ENV$(cat </dev/null || : +} + +host_env() { if [ -z "$OCC" ]; then cat </dev/null || : + host_env_base 2>/dev/null || : } -target_env() { +target_env_base() { rm -f "$BUILD_ROOT/root" ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root" + # make links to executables in the target as well + IFS=$NL + for exe in $(find "$BUILD_ROOT/host/bin" -maxdepth 1 -type f); do + IFS=$OIFS + basename=${exe##*/} + if ! path_exists "$BUILD_ROOT/target/bin/$basename"; then + ln -s "$exe" "$BUILD_ROOT/target/bin/$basename"; + fi + done + IFS=$OIFS + + target_env_hook 2>/dev/null || : +} + +target_env() { if [ -n "$OCC" ]; then cat </dev/null || : + target_env_base 2>/dev/null || : } # replace install artifact paths with absolute paths into host and target trees diff --git a/tools/win/msys2-builder b/tools/win/msys2-builder index a11d20fa..b320e27f 100755 --- a/tools/win/msys2-builder +++ b/tools/win/msys2-builder @@ -107,8 +107,6 @@ DIST_TAR_ARGS=" . "${0%/*}/../builder/mingw.sh" host_env() { - ln -sf "$BUILD_ROOT/host" "$BUILD_ROOT/root" - cat </dev/null || : } target_env() { - ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root" - cat </dev/null || : } table_line_append DIST_PRE_BUILD c2man ":; \