build_and_install.sh: Work around build failures caused by an Xcode bug.

Fixes #712.
This commit is contained in:
Kyle Neideck 2024-03-07 08:28:30 +11:00
parent 014a6eecc8
commit 7d700b3de5
No known key found for this signature in database
GPG key ID: CAA8D9B8E39EC18C

View file

@ -19,7 +19,7 @@
#
# build_and_install.sh
#
# Copyright © 2016-2022 Kyle Neideck
# Copyright © 2016-2022, 2024 Kyle Neideck
# Copyright © 2016 Nick Jacques
#
# Builds and installs BGMApp, BGMDriver and BGMXPCHelper. Requires xcodebuild and Xcode.
@ -641,6 +641,16 @@ if [[ "${XCODEBUILD_ACTION}" == "install" ]]; then
SUDO="sudo"
ACTIONING="Installing"
DSTROOT_ARG="DSTROOT=/"
# Work around an Xcode (15.2) bug where xcodebuild incorrectly detects a dependency cycle if
# DSTROOT is set to /.
for v in /Volumes/*; do
if [[ "$(realpath "$v")" == "/" ]]; then
DSTROOT_ARG="DSTROOT=$v"
echo "Set DSTROOT_ARG to ${DSTROOT_ARG} to work around an Xcode bug." >> ${LOG_FILE}
break
fi
done
echo "DSTROOT_ARG: ${DSTROOT_ARG}." >> ${LOG_FILE}
elif [[ "${XCODEBUILD_ACTION}" == "archive" ]]; then
SUDO=""
ACTIONING="Building and archiving"