From 0e5c54dd4fb4ea300dd9091e0ab1bd01eb08aa2a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 10 Nov 2023 16:46:11 +0000 Subject: [PATCH] _build.sh: add `CW_PKG_FLATTEN` option [ci skip] Use a solution that doesn't need `find -execdir`, because that is not supported by busybox (alpine): ``` find: unrecognized: -execdir BusyBox v1.36.1 (2023-07-27 17:12:24 UTC) multi-call binary. ``` https://github.com/curl/curl-for-win/actions/runs/6827484086/job/18569701123#step:3:5661 Also useful for trurl CI job: https://github.com/curl/trurl/pull/249 --- _build.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/_build.sh b/_build.sh index 36966b619..ca3f44044 100755 --- a/_build.sh +++ b/_build.sh @@ -87,6 +87,9 @@ set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o p # CW_PKG_NODELETE # Leave the unified package tree on the disk. Default: 0 # +# CW_PKG_FLATTEN +# Flatten unified package dir layout for executables. Default: 0 +# # SIGN_CODE_GPG_PASS, SIGN_CODE_KEY_PASS: for code signing # SIGN_PKG_KEY_ID, SIGN_PKG_GPG_PASS, SIGN_PKG_KEY_PASS: for package signing # DEPLOY_GPG_PASS, DEPLOY_KEY_PASS: for publishing results @@ -1626,3 +1629,24 @@ rm -f "${SIGN_CODE_KEY}" # Upload/deploy binaries . ./_ul.sh + +# Leave "flat" layout for curl tool if requested +if [ "${CW_PKG_FLATTEN:-}" = '1' ]; then + find \ + curl-*-*-*/bin \ + curl-*-*-*/lib -type f \( \ + -name 'curl*' -o \ + -name 'trurl*' -o \ + -name 'libcurl*.dll' -o \ + -name 'libcurl*.dylib' -o \ + -name 'libcurl.so*' \) \ + | sort | while read -r f; do + mv "${f}" "$(dirname "${f}")/.." + done + find . + if [ "${_OS}" = 'mac' ]; then + find curl-*-*-* -name 'trurl' -exec install_name_tool -change \ + '@executable_path/../lib/libcurl.4.dylib' \ + '@executable_path/libcurl.4.dylib' '{}' \; + fi +fi