Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Mac: Fix universal build to contain both archs #2825

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions mac/deploy_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,24 @@ 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_"*
file "${build_path}/${target_name}.app/Contents/MacOS/${target_name}"
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_"*

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, hairy bash.

echo "Missing ${target_arch} in file output -- build went wrong?"
exit 1
fi
done
fi

# Add Qt deployment dependencies
Expand Down