Skip to content

Commit af94619

Browse files
stuartcarnieakien-mga
authored andcommitted
Apple: add visionOS and tvOS build support; unify build container
Remove `ios` image, superseded by `appleembedded`.
1 parent d41c1cc commit af94619

File tree

12 files changed

+750
-66
lines changed

12 files changed

+750
-66
lines changed

Dockerfile.appleembedded

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
ARG img_version
2+
FROM godot-osx:${img_version}
3+
4+
RUN dnf -y install --setopt=install_weak_deps=False \
5+
automake autoconf gcc gcc-c++ gcc-objc gcc-objc++ cmake libicu-devel libtool libxml2-devel openssl-devel perl python yasm
6+
7+
ENV IOS_SDK=18.5
8+
ENV TVOS_SDK=18.5
9+
ENV XROS_SDK=2.5
10+
11+
# Extract the SDKs for iOS, tvOS and XROS, including the simulator SDKs
12+
# into separate layers, so this work is not repeated each time the image is built.
13+
RUN mkdir -p /root/SDKs
14+
RUN cd /root/SDKs && tar xf /root/files/iPhoneOS${IOS_SDK}.sdk.tar.xz
15+
RUN cd /root/SDKs && tar xf /root/files/iPhoneSimulator${IOS_SDK}.sdk.tar.xz
16+
RUN cd /root/SDKs && tar xf /root/files/AppleTVOS${TVOS_SDK}.sdk.tar.xz
17+
RUN cd /root/SDKs && tar xf /root/files/AppleTVSimulator${TVOS_SDK}.sdk.tar.xz
18+
RUN cd /root/SDKs && tar xf /root/files/XROS${XROS_SDK}.sdk.tar.xz
19+
RUN cd /root/SDKs && tar xf /root/files/XRSimulator${XROS_SDK}.sdk.tar.xz
20+
21+
RUN git clone --depth 1 --no-checkout https://github.com/tpoechtrager/cctools-port.git && \
22+
cd /root/cctools-port && \
23+
git fetch --depth 1 origin 7224fd5c9390ea15cff6ee69ff92ea677b40014b && \
24+
git checkout 7224fd5c9390ea15cff6ee69ff92ea677b40014b
25+
26+
COPY files/appleembedded/build.sh /root/cctools-port/usage_examples/ios_toolchain/build.sh
27+
COPY files/appleembedded/wrapper.c /root/cctools-port/usage_examples/ios_toolchain/wrapper.c
28+
29+
RUN chmod +x /root/cctools-port/usage_examples/ios_toolchain/build.sh
30+
31+
RUN cd /root/cctools-port && \
32+
usage_examples/ios_toolchain/build.sh arm64 && \
33+
mkdir -p /root/ioscross/arm64 && \
34+
mv usage_examples/ios_toolchain/target/* /root/ioscross/arm64 && \
35+
mkdir /root/ioscross/arm64/usr && \
36+
ln -s /root/ioscross/arm64/bin /root/ioscross/arm64/usr/bin
37+
38+
RUN cd /root/cctools-port && \
39+
usage_examples/ios_toolchain/build.sh x86_64 && \
40+
mkdir -p /root/ioscross/x86_64 && \
41+
mv usage_examples/ios_toolchain/target/* /root/ioscross/x86_64 && \
42+
mkdir /root/ioscross/x86_64/usr && \
43+
ln -s /root/ioscross/x86_64/bin /root/ioscross/x86_64/usr/bin
44+
45+
RUN PATH=/root/ioscross/arm64/bin:$PATH /root/files/appleembedded/check-arm.sh
46+
47+
ENV OSXCROSS_IOS=not_nothing
48+
ENV OSXCROSS_TVOS=not_nothing
49+
ENV OSXCROSS_VISIONOS=not_nothing
50+
ENV OSXCROSS_APPLEEMBEDDED=not_nothing
51+
52+
ENV PATH="/root/ioscross/arm64/bin:/root/ioscross/x86_64/bin:${PATH}"
53+
54+
CMD /bin/bash

Dockerfile.ios

Lines changed: 0 additions & 39 deletions
This file was deleted.

Dockerfile.osx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ RUN dnf -y install --setopt=install_weak_deps=False \
99
git clone --progress https://github.com/tpoechtrager/osxcross && \
1010
cd /root/osxcross && \
1111
git checkout 310196974007fc916f9be1877731b716a4854f72 && \
12+
# Patch to fix visionOS support.
13+
# See: https://github.com/llvm/llvm-project/issues/142502
14+
patch -p1 < /root/files/patches/osxcross-fix-visionos.patch && \
1215
ln -s /root/files/MacOSX${OSX_SDK}.sdk.tar.xz /root/osxcross/tarballs && \
1316
export UNATTENDED=1 && \
1417
export SDK_VERSION=${OSX_SDK} && \

Dockerfile.xcode

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,10 @@ RUN dnf -y install --setopt=install_weak_deps=False \
1111
ENV XCODE_SDKV=
1212
ENV OSX_SDKV=
1313
ENV IOS_SDKV=
14+
ENV TVOS_SDKV=
15+
ENV VISIONOS_SDKV=
1416

15-
CMD mkdir -p /root/xcode && \
16-
cd /root/xcode && \
17-
xar -xf /root/files/Xcode_${XCODE_SDKV}.xip && \
18-
/root/pbzx/pbzx -n Content | cpio -i && \
19-
export OSX_SDK=MacOSX${OSX_SDKV}.sdk && \
20-
cp -r Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /tmp/${OSX_SDK} && \
21-
cd /tmp && \
22-
tar -cJf /root/files/${OSX_SDK}.tar.xz ${OSX_SDK} && \
23-
rm -rf ${OSX_SDK} && \
24-
cd /root/xcode && \
25-
export IOS_SDK=iPhoneOS${IOS_SDKV}.sdk && \
26-
export IOS_SIMULATOR_SDK=iPhoneSimulator${IOS_SDKV}.sdk && \
27-
cp -r Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk /tmp/${IOS_SDK} && \
28-
cd /tmp && \
29-
tar -cJf /root/files/${IOS_SDK}.tar.xz ${IOS_SDK} && \
30-
rm -rf ${IOS_SDK} && \
31-
cd /root/xcode && \
32-
cp -r Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk /tmp/${IOS_SIMULATOR_SDK} && \
33-
cd /tmp && \
34-
tar -cJf /root/files/${IOS_SIMULATOR_SDK}.tar.xz ${IOS_SIMULATOR_SDK} && \
35-
rm -rf ${IOS_SIMULATOR_SDK}
17+
COPY extract_xcode_sdks.sh /root/extract_xcode_sdks.sh
18+
RUN chmod +x /root/extract_xcode_sdks.sh
19+
20+
CMD /root/extract_xcode_sdks.sh

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ These are the expected container image sizes, so you can plan your disk usage in
7373
localhost/godot-web 4.5-f42 2.35 GB
7474
localhost/godot-android 4.5-f42 4.19 GB
7575
localhost/godot-osx 4.5-f42 5.30 GB
76-
localhost/godot-ios 4.5-f42 6.11 GB
76+
localhost/godot-appleembedded 4.5-f42 14.1 GB
7777

7878
In addition to this, generating containers will also require some host disk space
7979
(up to 10 GB) for the dependencies (Xcode).
@@ -93,4 +93,4 @@ These are the toolchains currently in use for Godot 4.3 and later:
9393
- Android: Android NDK 28.1.13356709, build-tools 35.0.0, platform android-35, CMake 3.31.6, JDK 21
9494
- Apple: Xcode 16.4 with Apple Clang (LLVM 19.1.4), cctools 1024.3, ld64 955.13
9595
* macOS: MacOSX SDK 15.5
96-
* iOS: iPhoneOS SDK 18.5
96+
* Apple Embedded: iPhoneOS and iPhoneSimulator SDKs 18.5, AppleTVOS and AppleTVSimulator SDKs 18.5, XROS and XRSimulator SDKs 2.5

build.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,30 @@ podman_build android
6161
XCODE_SDK=16.4
6262
OSX_SDK=15.5
6363
IOS_SDK=18.5
64-
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+
TVOS_SDK=18.5
65+
VISIONOS_SDK=2.5
66+
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 ] \
67+
|| [ ! -e "${files_root}"/AppleTVOS${TVOS_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/AppleTVSimulator${TVOS_SDK}.sdk.tar.xz ] \
68+
|| [ ! -e "${files_root}"/XROS${VISIONOS_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/XRSimulator${VISIONOS_SDK}.sdk.tar.xz ]; then
6569
if [ ! -r "${files_root}"/Xcode_${XCODE_SDK}.xip ]; then
6670
echo
6771
echo "Error: 'files/Xcode_${XCODE_SDK}.xip' is required for Apple platforms, but was not found or couldn't be read."
6872
echo "It can be downloaded from https://developer.apple.com/download/more/ with a valid apple ID."
6973
exit 1
7074
fi
7175

72-
echo "Building OSX and iOS SDK packages. This will take a while"
76+
echo "Extracting Apple SDK packages. This will take a while."
7377
podman_build xcode
7478
"$podman" run -it --rm \
7579
-v "${files_root}":/root/files:z \
7680
-e XCODE_SDKV="${XCODE_SDK}" \
7781
-e OSX_SDKV="${OSX_SDK}" \
7882
-e IOS_SDKV="${IOS_SDK}" \
83+
-e TVOS_SDKV="${TVOS_SDK}" \
84+
-e VISIONOS_SDKV="${VISIONOS_SDK}" \
7985
godot-xcode:${img_version} \
8086
2>&1 | tee logs/xcode_packer.log
8187
fi
8288

8389
podman_build osx
84-
podman_build ios
90+
podman_build appleembedded

extract_xcode_sdks.sh

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# Configurable variables (can be set via env)
6+
XCODE_APP_PATH="${XCODE_APP_PATH:-/root/xcode/Xcode.app}"
7+
XCODE_XIP_PATH="${XCODE_XIP_PATH:-/root/files/Xcode_${XCODE_SDKV}.xip}"
8+
EXTRACT_FROM_XIP="${EXTRACT_FROM_XIP:-1}"
9+
10+
OUT_DIR="${OUT_DIR:-/root/files}"
11+
12+
# SDK versions (should be set via env or Dockerfile)
13+
OSX_SDKV="${OSX_SDKV:-}"
14+
IOS_SDKV="${IOS_SDKV:-}"
15+
TVOS_SDKV="${TVOS_SDKV:-}"
16+
VISIONOS_SDKV="${VISIONOS_SDKV:-}"
17+
18+
# Which SDKs to extract (set to 1 to enable)
19+
# Note: These defaults are overridden below based on execution context
20+
21+
# Optionally extract Xcode.app from .xip if needed
22+
if [[ "$EXTRACT_FROM_XIP" == "1" ]]; then
23+
mkdir -p /root/xcode
24+
cd /root/xcode
25+
xar -xf "$XCODE_XIP_PATH"
26+
/root/pbzx/pbzx -n Content | cpio -i
27+
XCODE_APP_PATH="/root/xcode/Xcode.app"
28+
fi
29+
30+
if [[ "${EXTRACT_FROM_XIP:-1}" == "1" ]]; then
31+
EXTRACT_MACOS="${EXTRACT_MACOS:-1}"
32+
EXTRACT_IOS="${EXTRACT_IOS:-1}"
33+
EXTRACT_IOS_SIM="${EXTRACT_IOS_SIM:-1}"
34+
EXTRACT_TVOS="${EXTRACT_TVOS:-1}"
35+
EXTRACT_TVOS_SIM="${EXTRACT_TVOS_SIM:-1}"
36+
EXTRACT_VISIONOS="${EXTRACT_VISIONOS:-1}"
37+
EXTRACT_VISIONOS_SIM="${EXTRACT_VISIONOS_SIM:-1}"
38+
else
39+
# When called manually, require explicit SDK selection
40+
EXTRACT_MACOS="${EXTRACT_MACOS:-0}"
41+
EXTRACT_IOS="${EXTRACT_IOS:-0}"
42+
EXTRACT_IOS_SIM="${EXTRACT_IOS_SIM:-0}"
43+
EXTRACT_TVOS="${EXTRACT_TVOS:-0}"
44+
EXTRACT_TVOS_SIM="${EXTRACT_TVOS_SIM:-0}"
45+
EXTRACT_VISIONOS="${EXTRACT_VISIONOS:-0}"
46+
EXTRACT_VISIONOS_SIM="${EXTRACT_VISIONOS_SIM:-0}"
47+
fi
48+
49+
extract_and_pack() {
50+
local sdk_dir="$1"
51+
local sdk_name="$2"
52+
local versioned_name="$3"
53+
local tar_name="$4"
54+
55+
if [[ -d "$sdk_dir/$sdk_name" ]]; then
56+
57+
# Use tar to copy and preserve everything, then repackage
58+
echo "=== Copying SDK using tar to preserve special files ==="
59+
cd "$sdk_dir"
60+
tar -cf - "$sdk_name" | (cd "/tmp" && tar -xf -)
61+
62+
# Rename to versioned name
63+
mv "/tmp/$sdk_name" "/tmp/$versioned_name"
64+
65+
# Verify SDKSettings.json exists and has content
66+
if [[ -f "/tmp/$versioned_name/SDKSettings.json" ]]; then
67+
echo "=== SDKSettings.json found, size: $(wc -c < "/tmp/$versioned_name/SDKSettings.json") bytes ==="
68+
echo "=== MD5 check ==="
69+
echo "Source file MD5: $(md5sum "$sdk_dir/$sdk_name/SDKSettings.json" | cut -d' ' -f1)"
70+
echo "Copied file MD5: $(md5sum "/tmp/$versioned_name/SDKSettings.json" | cut -d' ' -f1)"
71+
else
72+
echo "⚠️ Warning: SDKSettings.json not found in extracted SDK"
73+
fi
74+
75+
# Create tar with versioned directory name
76+
tar -cJf "$OUT_DIR/$tar_name" -C "/tmp" "$versioned_name"
77+
78+
# Clean up temporary directory
79+
rm -rf "/tmp/$versioned_name"
80+
81+
echo "✓ Packed $tar_name"
82+
else
83+
echo "✗ SDK not found: $sdk_dir/$sdk_name"
84+
exit 1
85+
fi
86+
}
87+
88+
# macOS SDK
89+
if [[ "$EXTRACT_MACOS" == "1" ]]; then
90+
extract_and_pack \
91+
"$XCODE_APP_PATH/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" \
92+
"MacOSX.sdk" \
93+
"MacOSX${OSX_SDKV}.sdk" \
94+
"MacOSX${OSX_SDKV}.sdk.tar.xz"
95+
fi
96+
97+
# iOS SDK
98+
if [[ "$EXTRACT_IOS" == "1" ]]; then
99+
extract_and_pack \
100+
"$XCODE_APP_PATH/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs" \
101+
"iPhoneOS.sdk" \
102+
"iPhoneOS${IOS_SDKV}.sdk" \
103+
"iPhoneOS${IOS_SDKV}.sdk.tar.xz"
104+
fi
105+
106+
# iOS Simulator SDK
107+
if [[ "$EXTRACT_IOS_SIM" == "1" ]]; then
108+
extract_and_pack \
109+
"$XCODE_APP_PATH/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs" \
110+
"iPhoneSimulator.sdk" \
111+
"iPhoneSimulator${IOS_SDKV}.sdk" \
112+
"iPhoneSimulator${IOS_SDKV}.sdk.tar.xz"
113+
fi
114+
115+
# tvOS SDK
116+
if [[ "$EXTRACT_TVOS" == "1" ]]; then
117+
extract_and_pack \
118+
"$XCODE_APP_PATH/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs" \
119+
"AppleTVOS.sdk" \
120+
"AppleTVOS${TVOS_SDKV}.sdk" \
121+
"AppleTVOS${TVOS_SDKV}.sdk.tar.xz"
122+
fi
123+
124+
# tvOS Simulator SDK
125+
if [[ "$EXTRACT_TVOS_SIM" == "1" ]]; then
126+
extract_and_pack \
127+
"$XCODE_APP_PATH/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs" \
128+
"AppleTVSimulator.sdk" \
129+
"AppleTVSimulator${TVOS_SDKV}.sdk" \
130+
"AppleTVSimulator${TVOS_SDKV}.sdk.tar.xz"
131+
fi
132+
133+
# visionOS SDK
134+
if [[ "$EXTRACT_VISIONOS" == "1" ]]; then
135+
extract_and_pack \
136+
"$XCODE_APP_PATH/Contents/Developer/Platforms/XROS.platform/Developer/SDKs" \
137+
"XROS.sdk" \
138+
"XROS${VISIONOS_SDKV}.sdk" \
139+
"XROS${VISIONOS_SDKV}.sdk.tar.xz"
140+
fi
141+
142+
# visionOS Simulator SDK
143+
if [[ "$EXTRACT_VISIONOS_SIM" == "1" ]]; then
144+
extract_and_pack \
145+
"$XCODE_APP_PATH/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs" \
146+
"XRSimulator.sdk" \
147+
"XRSimulator${VISIONOS_SDKV}.sdk" \
148+
"XRSimulator${VISIONOS_SDKV}.sdk.tar.xz"
149+
fi
150+
151+
echo "Done extracting selected SDKs."

0 commit comments

Comments
 (0)