Skip to content

Commit 457a961

Browse files
committed
build: support specifying subset of platforms
1 parent 3f5bb52 commit 457a961

File tree

1 file changed

+39
-26
lines changed

1 file changed

+39
-26
lines changed

build.sh

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
source $(dirname "$0")/setup.sh
44

5+
platforms="linux,windows,web,android,osx,ios,msvc"
6+
57
if [ -z "$1" -o -z "$2" ]; then
6-
echo "Usage: $0 <godot branch> <base distro>"
8+
echo "Usage: $0 <godot branch> <base distro> [<platforms>]"
79
echo
810
echo "Example: $0 3.x f35"
911
echo
@@ -13,6 +15,10 @@ if [ -z "$1" -o -z "$2" ]; then
1315
echo "base distro:"
1416
echo " Informational, tracks the base Linux distro these containers are based on."
1517
echo
18+
echo "(Optional) platforms:"
19+
echo " Comma-separated list of platforms."
20+
echo " Defaults to: $platforms"
21+
echo
1622
echo "The resulting image version will be <godot branch>-<base distro>."
1723
exit 1
1824
fi
@@ -21,7 +27,14 @@ godot_branch=$1
2127
base_distro=$2
2228
img_version=$godot_branch-$base_distro
2329
files_root="$(cd dirname "$0"; pwd)/files"
24-
build_msvc=0
30+
31+
if [ ! -z "$3" ]; then
32+
case "$3" in
33+
free) platforms="linux,windows,web,android";;
34+
nonfree) platforms="osx,ios,msvc";;
35+
*) platforms="$3";;
36+
esac
37+
fi
2538

2639
# Confirm settings
2740
echo "Docker image tag: ${img_version}"
@@ -51,36 +64,36 @@ podman_build() {
5164

5265
podman_build export
5366

54-
podman_build linux
55-
podman_build windows
67+
for platform in linux windows web android; do
68+
if grep -q "$platform" <<< "$platforms"; then podman_build "$platform"; fi
69+
done
5670

57-
podman_build web
58-
podman_build android
71+
if grep -q osx <<< "$platforms" || grep -q ios <<< "$platforms"; then
72+
XCODE_SDK=14.1
73+
OSX_SDK=13.0
74+
IOS_SDK=16.1
75+
if [ ! -e "${files_root}"/MacOSX${OSX_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneOS${IOS_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneSimulator${IOS_SDK}.sdk.tar.xz ]; then
76+
if [ ! -e "${files_root}"/Xcode_${XCODE_SDK}.xip ]; then
77+
echo "files/Xcode_${XCODE_SDK}.xip is required. It can be downloaded from https://developer.apple.com/download/more/ with a valid apple ID."
78+
exit 1
79+
fi
5980

60-
XCODE_SDK=14.1
61-
OSX_SDK=13.0
62-
IOS_SDK=16.1
63-
if [ ! -e "${files_root}"/MacOSX${OSX_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneOS${IOS_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneSimulator${IOS_SDK}.sdk.tar.xz ]; then
64-
if [ ! -e "${files_root}"/Xcode_${XCODE_SDK}.xip ]; then
65-
echo "files/Xcode_${XCODE_SDK}.xip is required. It can be downloaded from https://developer.apple.com/download/more/ with a valid apple ID."
66-
exit 1
81+
echo "Building OSX and iOS SDK packages. This will take a while"
82+
podman_build xcode
83+
$podman run -it --rm \
84+
-v "${files_root}":/root/files:z \
85+
-e XCODE_SDKV="${XCODE_SDK}" \
86+
-e OSX_SDKV="${OSX_SDK}" \
87+
-e IOS_SDKV="${IOS_SDK}" \
88+
godot-xcode:${img_version} \
89+
2>&1 | tee logs/xcode_packer.log
6790
fi
6891

69-
echo "Building OSX and iOS SDK packages. This will take a while"
70-
podman_build xcode
71-
"$podman" run -it --rm \
72-
-v "${files_root}":/root/files:z \
73-
-e XCODE_SDKV="${XCODE_SDK}" \
74-
-e OSX_SDKV="${OSX_SDK}" \
75-
-e IOS_SDKV="${IOS_SDK}" \
76-
godot-xcode:${img_version} \
77-
2>&1 | tee logs/xcode_packer.log
92+
podman_build osx
93+
podman_build ios
7894
fi
7995

80-
podman_build osx
81-
podman_build ios
82-
83-
if [ "${build_msvc}" != "0" ]; then
96+
if grep -q msvc <<< "$platforms"; then
8497
if [ ! -e "${files_root}"/msvc2017.tar ]; then
8598
echo
8699
echo "files/msvc2017.tar is missing. This file can be created on a Windows 7 or 10 machine by downloading the 'Visual Studio Tools' installer."

0 commit comments

Comments
 (0)