Skip to content

Commit 6c832b1

Browse files
authored
Merge pull request #6444 from BOINC/mac_fix_build_race_condition
Mac fix build race condition
2 parents a83fb2d + a7219d4 commit 6c832b1

15 files changed

+294
-139
lines changed

clientgui/mac/SetVersion.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ int main(int argc, char** argv) {
6868
printf("%s\n", myPath); // For debugging
6969
#endif
7070

71+
chdir(getenv("SRCROOT"));
72+
7173
if (!file_exists("./English.lproj")) {
7274
retval = mkdir("./English.lproj", 0755);
7375
if (retval) {

lib/hostinfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ const char* docker_type_str(DOCKER_TYPE type) {
378378
const char* docker_cmd_prefix(DOCKER_TYPE type) {
379379
static char buf[256];
380380
if (type == PODMAN) {
381-
const char* dir = "/Library/Application\ Support/BOINC\ Data/podman";
381+
const char* dir = "/Library/Application Support/BOINC Data/podman";
382382
// must end w/ space
383383
snprintf(buf, sizeof(buf),
384384
"env XDG_CONFIG_HOME=\"%s\" XDG_DATA_HOME=\"%s\" ",

mac_build/BuildMacBOINC.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,18 @@ done
220220
## That is why all the other xcodebuild calls are invoked this way.
221221

222222
if [ "${buildall}" = "1" ] || [ "${buildlibs}" = "1" ] || [ "${buildclient}" = "1" ] || [ "x${targets}" != "x" ]; then
223-
# build all or specified targets from the boinc.xcodeproj project for -all, -libs, -client, or -target
224-
eval "xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
223+
224+
echo ""
225+
## Apparently xcodebuild ignores build pre-actions, so we do this explicitly
226+
source "./Update_Info_Plists.sh"
225227
result=$?
228+
echo ""
229+
230+
if [ $result -eq 0 ]; then
231+
# build all or specified targets from the boinc.xcodeproj project for -all, -libs, -client, or -target
232+
eval "xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
233+
result=$?
234+
fi
226235
fi
227236

228237
if [ $result -eq 0 ]; then

mac_build/Update_Info_Plists.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
# This file is part of BOINC.
4+
# http://boinc.berkeley.edu
5+
# Copyright (C) 2025 University of California
6+
#
7+
# BOINC is free software; you can redistribute it and/or modify it
8+
# under the terms of the GNU Lesser General Public License
9+
# as published by the Free Software Foundation,
10+
# either version 3 of the License, or (at your option) any later version.
11+
#
12+
# BOINC is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15+
# See the GNU Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public License
18+
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
19+
#
20+
#
21+
# Update_Info_Plists.sh
22+
# by Charlie Fenton 7/11/25
23+
#
24+
25+
## Called from pre-actions in BOINC Xcode project when compiling BOINC.
26+
## Note that Xcode runs build pre-actions pnly for the currently selected
27+
## build target, not for any dependent targets that may also be built along
28+
## with the selected target. So this script is called only once for any
29+
## build operation, even the build_all target. The ovehead of running this
30+
## script is minimal, so rather than comparing all the Info.plist file's
31+
## modification dates to that of version.h, we just run this script for
32+
## every build operation.
33+
##
34+
## Usage:
35+
## export WORKSPACE_PATH=
36+
## source {path}/mac_build/Update_Info_Plists.sh
37+
## Called from pre-actions as:
38+
## source "$WORKSPACE_PATH/../../Update_Info_Plists.sh"
39+
##
40+
##
41+
originalDir=`pwd`
42+
directory=$(dirname "$WORKSPACE_PATH")
43+
directory=$(dirname "$directory")
44+
echo "Directory is " "$directory"
45+
cd "$directory"
46+
echo "About to check for " "$directory/build/Development/SetVersion"
47+
echo "compared to " "$directory/../clientgui/mac/Setversion.cpp"
48+
if [ ! -e "$directory/build/Development/SetVersion" ] || [ "$directory/../clientgui/mac/Setversion.cpp" -nt "$directory/build/Development/SetVersion" ]; then
49+
echo "About to run xcodebuild"
50+
xcodebuild -project boinc.xcodeproj -target SetVersion -configuration Development
51+
if [ $? -ne 0 ]; then
52+
echo "ERROR: xcodebuild failed"
53+
cd "${originalDir}"
54+
return 1
55+
fi
56+
echo "After xcodebuild, about to check for " "$directory/build/Development/SetVersion"
57+
if [ ! -e "$directory/build/Development/SetVersion" ]; then
58+
return 1
59+
fi
60+
fi
61+
###$directory="$directory/build/Development"
62+
echo "Running SetVersion"
63+
"$directory/build/Development/SetVersion"
64+
cd "${originalDir}"
65+
return 0

0 commit comments

Comments
 (0)