From b9266a5ea9bce0e4f64a874497827233b799971a Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Mon, 29 Aug 2022 22:58:59 +0200 Subject: [PATCH 1/2] Build: Mac: Fix universal build to contain both archs One of the last-minute changes broke the universal build and resulted in a universal build which only contained a single architecture. The reason was that the added `distclean` action removed the artifact for the first architecture. This change moves the intermediate artifacts to a temporary, already defined directory which is definitely not touched by `make distclean`. Related: https://github.com/jamulussoftware/jamulus/pull/2808#discussion_r956749658 Related: https://github.com/jamulussoftware/jamulus/pull/2808#issuecomment-1230842458 --- mac/deploy_mac.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mac/deploy_mac.sh b/mac/deploy_mac.sh index a513676f14..9227e5c29f 100755 --- a/mac/deploy_mac.sh +++ b/mac/deploy_mac.sh @@ -57,14 +57,14 @@ build_app() { make -f "${build_path}/Makefile" -C "${build_path}" -j "${job_count}" target_name=$(sed -nE 's/^QMAKE_TARGET *= *(.*)$/\1/p' "${build_path}/Makefile") if [[ ${#target_archs_array[@]} -gt 1 ]]; then - # When building for multiple architectures, move the binary to a safe place to avoid overwriting by the other passes. - mv "${build_path}/${target_name}.app/Contents/MacOS/${target_name}" "${build_path}/${target_name}.app/Contents/MacOS/${target_name}.arch_${target_arch}" + # When building for multiple architectures, move the binary to a safe place to avoid overwriting/cleaning by the other passes. + mv "${build_path}/${target_name}.app/Contents/MacOS/${target_name}" "${deploy_path}/${target_name}.arch_${target_arch}" fi done if [[ ${#target_archs_array[@]} -gt 1 ]]; then - echo "Building universal binary from: " "${build_path}/${target_name}.app/Contents/MacOS/${target_name}.arch_"* - lipo -create -output "${build_path}/${target_name}.app/Contents/MacOS/${target_name}" "${build_path}/${target_name}.app/Contents/MacOS/${target_name}.arch_"* - rm -f "${build_path}/${target_name}.app/Contents/MacOS/${target_name}.arch_"* + echo "Building universal binary from: " "${deploy_path}/${target_name}.arch_"* + lipo -create -output "${build_path}/${target_name}.app/Contents/MacOS/${target_name}" "${deploy_path}/${target_name}.arch_"* + rm -f "${deploy_path}/${target_name}.arch_"* file "${build_path}/${target_name}.app/Contents/MacOS/${target_name}" fi From c9c18f16fbfd97a69012745d7e7cd9082139ad0e Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Mon, 29 Aug 2022 23:04:26 +0200 Subject: [PATCH 2/2] Build: Mac: Fail if universal build lacks an expected architecture This should prevent any silent build failures result in an incomplete output. --- mac/deploy_mac.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mac/deploy_mac.sh b/mac/deploy_mac.sh index 9227e5c29f..a0537ce76c 100755 --- a/mac/deploy_mac.sh +++ b/mac/deploy_mac.sh @@ -65,7 +65,16 @@ build_app() { echo "Building universal binary from: " "${deploy_path}/${target_name}.arch_"* lipo -create -output "${build_path}/${target_name}.app/Contents/MacOS/${target_name}" "${deploy_path}/${target_name}.arch_"* rm -f "${deploy_path}/${target_name}.arch_"* - file "${build_path}/${target_name}.app/Contents/MacOS/${target_name}" + + local file_output + file_output=$(file "${build_path}/${target_name}.app/Contents/MacOS/${target_name}") + echo "${file_output}" + for target_arch in "${target_archs_array[@]}"; do + if ! grep -q "for architecture ${target_arch}" <<< "${file_output}"; then + echo "Missing ${target_arch} in file output -- build went wrong?" + exit 1 + fi + done fi # Add Qt deployment dependencies