ARG img_version FROM godot-fedora:${img_version} # Additional packages for Swift # # sudo dnf install gnupg2 ENV XCODE_SDKV=26.1.1 ENV APPLE_SDKV=26.1 RUN dnf -y install --setopt=install_weak_deps=False \ automake autoconf bzip2-devel cmake gawk gcc gcc-c++ libdispatch libicu-devel libtool \ libxml2-devel openssl-devel uuid-devel yasm gpg && \ git clone --progress https://github.com/tpoechtrager/osxcross && \ cd /root/osxcross && \ git checkout 121ce150c7857a9474dfff8a8e431482806b3e1b && \ # Patch to fix visionOS support. # See: https://github.com/llvm/llvm-project/issues/142502 patch -p1 < /root/files/patches/osxcross-fix-visionos.patch && \ ln -s /root/files/MacOSX${APPLE_SDKV}.sdk.tar.xz /root/osxcross/tarballs && \ export UNATTENDED=1 && \ export SDK_VERSION=${APPLE_SDKV} && \ # Custom build Apple Clang to ensure compatibility. # Find the equivalent LLVM version for the SDK from: # https://en.wikipedia.org/wiki/Xcode#Toolchain_versions CLANG_VERSION=19.1.5 ENABLE_CLANG_INSTALL=1 INSTALLPREFIX=/usr ./build_apple_clang.sh && \ ./build.sh && \ ./build_compiler_rt.sh && \ rm -rf /root/osxcross/build ENV OSXCROSS_ROOT=/root/osxcross ENV PATH="/root/osxcross/target/bin:${PATH}" # Install Swift 6.2 toolchain RUN mkdir -p /root/Xcode.app/Contents/Developer RUN cd /root/Xcode.app/Contents/Developer && tar xf /root/files/Xcode-Developer${XCODE_SDKV}.tar.xz --strip-components=1 RUN curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \ tar zxf swiftly-$(uname -m).tar.gz && \ ./swiftly init --platform ubi9 --quiet-shell-followup -y && \ . "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" && \ hash -r RUN /root/files/swift/create-sdk-bundle.sh /root/Xcode.app/Contents/Developer /root/.swiftpm/swift-sdks CMD /bin/bash