diff --git a/tools/build-containers/Dockerfile.android b/tools/build-containers/Dockerfile.android index 8d458637..28806af9 100644 --- a/tools/build-containers/Dockerfile.android +++ b/tools/build-containers/Dockerfile.android @@ -1,16 +1,18 @@ ARG img_version FROM godot-fedora:${img_version} +ENV ANDROID_SDK_ROOT=/root/sdk +ENV ANDROID_NDK_VERSION=21.4.7075529 +ENV ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION} + RUN dnf -y install --setopt=install_weak_deps=False \ gcc gcc-c++ java-1.8.0-openjdk-devel ncurses-compat-libs && \ - mkdir sdk && cd sdk && \ - curl -LO https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \ - unzip sdk-tools-linux-4333796.zip && \ - rm sdk-tools-linux-4333796.zip && \ - yes | tools/bin/sdkmanager --licenses && \ - tools/bin/sdkmanager ndk-bundle 'build-tools;28.0.3' 'platforms;android-28' 'cmake;3.10.2.4988404' - -ENV ANDROID_HOME=/root/sdk/ -ENV ANDROID_NDK_ROOT=/root/sdk/ndk-bundle/ + mkdir -p sdk && cd sdk && \ + export CMDLINETOOLS=commandlinetools-linux-7302050_latest.zip && \ + curl -LO https://dl.google.com/android/repository/${CMDLINETOOLS} && \ + unzip ${CMDLINETOOLS} && \ + rm ${CMDLINETOOLS} && \ + yes | cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_SDK_ROOT}" --licenses && \ + cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_SDK_ROOT}" "ndk;${ANDROID_NDK_VERSION}" 'cmdline-tools;latest' 'build-tools;30.0.3' 'platforms;android-29' 'cmake;3.18.1' CMD /bin/bash diff --git a/tools/build-containers/Dockerfile.base b/tools/build-containers/Dockerfile.base index d9a55255..6fb326ee 100644 --- a/tools/build-containers/Dockerfile.base +++ b/tools/build-containers/Dockerfile.base @@ -1,9 +1,10 @@ -FROM fedora:31 +FROM fedora:34 WORKDIR /root RUN dnf -y upgrade --setopt=install_weak_deps=False && \ dnf -y install --setopt=install_weak_deps=False \ - bash bzip2 curl git make patch pkgconfig python3 scons unzip which xz + bash bzip2 curl file findutils git make nano patch pkgconfig python3-pip unzip which xz yasm && \ + pip install scons==4.1.0 CMD /bin/bash diff --git a/tools/build-containers/Dockerfile.ios b/tools/build-containers/Dockerfile.ios index 36f6ba0c..059f9f21 100644 --- a/tools/build-containers/Dockerfile.ios +++ b/tools/build-containers/Dockerfile.ios @@ -1,30 +1,47 @@ ARG img_version FROM godot-osx:${img_version} +ENV IOS_SDK=14.4 + RUN dnf -y install --setopt=install_weak_deps=False \ automake autoconf clang gcc gcc-c++ gcc-objc gcc-objc++ cmake libicu-devel libtool libxml2-devel llvm-devel openssl-devel perl python yasm && \ git clone --progress https://github.com/tpoechtrager/cctools-port.git && \ cd /root/cctools-port && \ - git checkout 8239a5211bcf07d6b9d359782e1a889ec1d7cce5 && \ - sed -i 's#./autogen.sh#libtoolize -c -i --force\n./autogen.sh#' usage_examples/ios_toolchain/build.sh && \ - usage_examples/ios_toolchain/build.sh /root/files/iPhoneOS12.4.sdk.tar.xz arm64 && \ + git checkout 236a426c1205a3bfcf0dbb2e2faf2296f0a100e5 && \ + # arm64 device + usage_examples/ios_toolchain/build.sh /root/files/iPhoneOS${IOS_SDK}.sdk.tar.xz arm64 && \ mkdir -p /root/ioscross/arm64 && \ mv usage_examples/ios_toolchain/target/* /root/ioscross/arm64 && \ mkdir /root/ioscross/arm64/usr && \ ln -s /root/ioscross/arm64/bin /root/ioscross/arm64/usr/bin && \ + # arm64 simulator + # Disabled for now as it doesn't work with cctools-port and current LLVM: + # Cf. https://github.com/tpoechtrager/cctools-port/issues/102 + #sed -i 's/miphoneos-version-min/mios-simulator-version-min/g' usage_examples/ios_toolchain/wrapper.c && \ + #usage_examples/ios_toolchain/build.sh /root/files/iPhoneSimulator${IOS_SDK}.sdk.tar.xz arm64 && \ + #mkdir -p /root/ioscross/arm64_sim && \ + #mv usage_examples/ios_toolchain/target/* /root/ioscross/arm64_sim && \ + #mkdir /root/ioscross/arm64_sim/usr && \ + #ln -s /root/ioscross/arm64_sim/bin /root/ioscross/arm64_sim/usr/bin && \ + # x86_64 simulator sed -i 's#^TRIPLE=.*#TRIPLE="x86_64-apple-darwin11"#' usage_examples/ios_toolchain/build.sh && \ - usage_examples/ios_toolchain/build.sh /root/files/iPhoneSimulator12.4.sdk.tar.xz x86_64 && \ - mkdir -p /root/ioscross/x86_64 && \ - mv usage_examples/ios_toolchain/target/* /root/ioscross/x86_64 && \ - mkdir /root/ioscross/x86_64/usr && \ - ln -s /root/ioscross/x86_64/bin /root/ioscross/x86_64/usr/bin + usage_examples/ios_toolchain/build.sh /root/files/iPhoneSimulator${IOS_SDK}.sdk.tar.xz x86_64 && \ + mkdir -p /root/ioscross/x86_64_sim && \ + mv usage_examples/ios_toolchain/target/* /root/ioscross/x86_64_sim && \ + mkdir /root/ioscross/x86_64_sim/usr && \ + ln -s /root/ioscross/x86_64_sim/bin /root/ioscross/x86_64_sim/usr/bin ENV OSXCROSS_IOS=not_nothing ENV IOSCROSS_ROOT=/root/ioscross -ENV PATH="/root/ioscross/arm64/bin:/root/ioscross/x86_64/bin:${PATH}" +ENV PATH="/root/ioscross/arm64/bin:/root/ioscross/arm64_sim/bin:/root/ioscross/x86_64_sim/bin:${PATH}" + # Until we can build the cross-compiler, we include a pre-made build in the container. RUN mkdir -p /root/aot-compilers/iphone-arm64 && \ - tar xvf /root/files/aarch64-apple-darwin-mono-sgen.tar.xz -C /root/aot-compilers/iphone-arm64 + curl -LO https://github.com/godotengine/godot-mono-builds/releases/download/release-c3a9d31/ios-cross-arm64.zip && \ + dnf -y install --setopt=install_weak_deps=False p7zip && \ + 7za e ios-cross-arm64.zip ios-cross-arm64-release/bin/aarch64-apple-darwin-mono-sgen -o/root/aot-compilers/iphone-arm64 && \ + rm ios-cross-arm64.zip + CMD /bin/bash diff --git a/tools/build-containers/Dockerfile.javascript b/tools/build-containers/Dockerfile.javascript index 18ae0297..5ccc1853 100644 --- a/tools/build-containers/Dockerfile.javascript +++ b/tools/build-containers/Dockerfile.javascript @@ -1,13 +1,13 @@ ARG img_version FROM godot-fedora:${img_version} +ENV EMSCRIPTEN_CLASSICAL=2.0.25 + RUN dnf -y install --setopt=install_weak_deps=False \ - gcc gcc-c++ java-openjdk yasm && \ - git clone --progress https://github.com/emscripten-core/emsdk && \ - cd emsdk && \ - git checkout a5082b232617c762cb65832429f896c838df2483 && \ - ./emsdk install 1.38.47-upstream && \ - ./emsdk activate 1.38.47-upstream && \ - echo "source /root/emsdk/emsdk_env.sh" >> /root/.bashrc + java-openjdk && \ + git clone --branch ${EMSCRIPTEN_CLASSICAL} --progress https://github.com/emscripten-core/emsdk emsdk_${EMSCRIPTEN_CLASSICAL} && \ + emsdk_${EMSCRIPTEN_CLASSICAL}/emsdk install ${EMSCRIPTEN_CLASSICAL} && \ + emsdk_${EMSCRIPTEN_CLASSICAL}/emsdk activate ${EMSCRIPTEN_CLASSICAL} + echo "source /root/emsdk_${EMSCRIPTEN_CLASSICAL}/emsdk/emsdk_env.sh" >> /root/.bashrc CMD /bin/bash diff --git a/tools/build-containers/Dockerfile.linux b/tools/build-containers/Dockerfile.linux index 3c0ef6de..4125508e 100644 --- a/tools/build-containers/Dockerfile.linux +++ b/tools/build-containers/Dockerfile.linux @@ -2,7 +2,6 @@ ARG img_version FROM godot-fedora:${img_version} RUN dnf -y install --setopt=install_weak_deps=False \ - gcc-c++ xorg-x11-server-Xvfb libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel alsa-lib-devel pulseaudio-libs-devel libudev-devel mesa-libGL-devel mesa-libGLU-devel mesa-dri-drivers yasm - + gcc-c++ libxcrypt-compat xorg-x11-server-Xvfb libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel alsa-lib-devel pulseaudio-libs-devel libudev-devel mesa-libGL-devel mesa-libGLU-devel mesa-dri-drivers yasm CMD /bin/bash diff --git a/tools/build-containers/Dockerfile.osx b/tools/build-containers/Dockerfile.osx index 041ae826..3bb1e645 100644 --- a/tools/build-containers/Dockerfile.osx +++ b/tools/build-containers/Dockerfile.osx @@ -5,9 +5,12 @@ RUN dnf -y install --setopt=install_weak_deps=False \ automake autoconf bzip2-devel clang libicu-devel libtool libxml2-devel llvm-devel openssl-devel yasm && \ git clone --progress https://github.com/tpoechtrager/osxcross.git && \ cd /root/osxcross && \ - git checkout 542acc2ef6c21aeb3f109c03748b1015a71fed63 && \ - ln -s /root/files/MacOSX10.14.sdk.tar.xz /root/osxcross/tarballs && \ - UNATTENDED=1 ./build.sh + git checkout de6c72eff2d6013f5af46fba1fa205654c5cf5e2 && \ + ln -s /root/files/MacOSX11.1.sdk.tar.xz /root/osxcross/tarballs && \ + url -LO https://github.com/tpoechtrager/osxcross/pull/286.patch && \ + patch -p1 < 286.patch && \ + UNATTENDED=1 ./build.sh && \ + ./build_compiler_rt.sh ENV OSXCROSS_ROOT=/root/osxcross ENV PATH="/root/osxcross/target/bin:${PATH}" diff --git a/tools/build-containers/Dockerfile.xcode b/tools/build-containers/Dockerfile.xcode index ad7391af..c8de369c 100644 --- a/tools/build-containers/Dockerfile.xcode +++ b/tools/build-containers/Dockerfile.xcode @@ -2,13 +2,7 @@ ARG img_version FROM godot-fedora:${img_version} RUN dnf -y install --setopt=install_weak_deps=False \ - autoconf automake libtool clang cmake fuse fuse-devel libxml2-devel libicu-devel compat-openssl10-devel bzip2-devel kmod cpio && \ - git clone --progress https://github.com/mackyle/xar.git && \ - cd xar/xar && \ - git checkout 66d451dab1ef859dd0c83995f2379335d35e53c9 && \ - ./autogen.sh --prefix=/usr && \ - make -j && make install && \ - cd /root && \ + autoconf automake xar xar-devel xz-devel libtool clang cmake fuse fuse-devel libxml2-devel libicu-devel compat-openssl10-devel bzip2-devel kmod cpio && \ git clone --progress https://github.com/NiklasRosenstein/pbzx && \ cd pbzx && \ git checkout 2a4d7c3300c826d918def713a24d25c237c8ed53 && \ @@ -16,28 +10,30 @@ RUN dnf -y install --setopt=install_weak_deps=False \ CMD mkdir -p /root/xcode && \ cd /root/xcode && \ - xar -xf /root/files/Xcode_10.3.xip && \ + xar -xf /root/files/Xcode_12.4.xip && \ /root/pbzx/pbzx -n Content | cpio -i && \ - cp -r Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /tmp/MacOSX10.14.sdk && \ - mkdir -p /tmp/MacOSX10.14.sdk/usr/include/c++ && \ - cp -r Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /tmp/MacOSX10.14.sdk/usr/include/c++/ && \ - mkdir -p mkdir -p /tmp/MacOSX10.14.sdk/usr/share/man && \ + export OSX_SDK=MacOSX11.1.sdk && \ + cp -r Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /tmp/${OSX_SDK} && \ + mkdir -p mkdir -p /tmp/${OSX_SDK}/usr/share/man && \ cp -rf Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man1 \ Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man3 \ - Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man5 /tmp/MacOSX10.14.sdk/usr/share/man/ && \ + Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man5 /tmp/${OSX_SDK}/usr/share/man/ && \ cd /tmp && \ - tar -cJf /root/files/MacOSX10.14.sdk.tar.xz MacOSX10.14.sdk && \ - rm -rf MacOSX10.14 && \ + tar -cJf /root/files/${OSX_SDK}.tar.xz ${OSX_SDK} && \ + rm -rf ${OSX_SDK} && \ cd /root/xcode && \ - cp -r Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk /tmp/iPhoneOS12.4.sdk && \ - mkdir -p /tmp/iPhoneOS12.4.sdk/usr/include/c++ && \ - cp -r Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /tmp/iPhoneOS12.4.sdk/usr/include/c++/ && \ + export IOS_SDK=iPhoneOS14.4.sdk && \ + export IOS_SIMULATOR_SDK=iPhoneSimulator14.4.sdk && \ + cp -r Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk /tmp/${IOS_SDK} && \ + mkdir -p /tmp/${IOS_SDK}/usr/include/c++ && \ + cp -r Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /tmp/${IOS_SDK}/usr/include/c++/ && \ cd /tmp && \ - tar -cJf /root/files/iPhoneOS12.4.sdk.tar.xz iPhoneOS12.4.sdk && \ - rm -rf iPhoneOS12.4.sdk && \ + tar -cJf /root/files/${IOS_SDK}.tar.xz ${IOS_SDK} && \ + rm -rf ${IOS_SDK} && \ cd /root/xcode && \ - cp -r Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk /tmp/iPhoneOS12.4.sdk && \ - mkdir -p /tmp/iPhoneOS12.4.sdk/usr/include/c++ && \ - cp -r Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /tmp/iPhoneOS12.4.sdk/usr/include/c++/ && \ + cp -r Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk /tmp/${IOS_SDK} && \ + mkdir -p /tmp/${IOS_SDK}/usr/include/c++ && \ + cp -r Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /tmp/${IOS_SDK}/usr/include/c++/ && \ cd /tmp && \ - tar -cJf /root/files/iPhoneSimulator12.4.sdk.tar.xz iPhoneOS12.4.sdk + tar -cJf /root/files/${IOS_SIMULATOR_SDK}.tar.xz ${IOS_SDK} && \ + rm -rf ${IOS_SDK} diff --git a/tools/build-containers/files/msvc-fixup.sh b/tools/build-containers/files/msvc-fixup.sh old mode 100644 new mode 100755 diff --git a/tools/build-containers/files/patches/fix-fuse-check.diff b/tools/build-containers/files/patches/fix-fuse-check.diff deleted file mode 100644 index 7691d57b..00000000 --- a/tools/build-containers/files/patches/fix-fuse-check.diff +++ /dev/null @@ -1,27 +0,0 @@ -diff -u a/tools/gen_sdk_package_darling_dmg.sh b/tools/gen_sdk_package_darling_dmg.sh ---- a/tools/gen_sdk_package_darling_dmg.sh 2018-12-20 16:06:04.744507679 +0000 -+++ b/tools/gen_sdk_package_darling_dmg.sh 2018-12-20 16:06:39.000379232 +0000 -@@ -33,22 +33,6 @@ - [ -n "$CC" ] && require $CC - [ -n "$CXX" ] && require $CXX - --set +e -- --command -v lsb_release 2>&1 > /dev/null -- --if [[ $? -eq 0 ]] && [[ -n $(lsb_release -a 2>&1 | grep -i ubuntu) ]]; then -- echo "Using ubuntu, skipping fuse module check" --else -- modinfo fuse &>/dev/null --fi -- --if [ $? -ne 0 ]; then -- echo "Required kernel module 'fuse' not loaded" 1>&2 -- echo "Please run 'insmod fuse' as root" 1>&2 -- exit 1 --fi -- - set -e - - pushd $BUILD_DIR &>/dev/null - diff --git a/tools/build-containers/files/patches/osxcross-pr284-compiler-rt.patch b/tools/build-containers/files/patches/osxcross-pr284-compiler-rt.patch new file mode 100644 index 00000000..f38c2833 --- /dev/null +++ b/tools/build-containers/files/patches/osxcross-pr284-compiler-rt.patch @@ -0,0 +1,118 @@ +From b875d7c1360c8ff2077463d7a5a12e1cff1cc683 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= +Date: Mon, 12 Jul 2021 13:34:32 +0200 +Subject: [PATCH] compiler-rt: Add option to automate install process + +Also mention that compiler-rt can be needed to build code using +`__builtin_available()`. + +Fixes #278. +--- + README.COMPILER-RT.md | 4 ++++ + README.md | 3 +++ + build_compiler_rt.sh | 33 ++++++++++++++++++++++++--------- + 3 files changed, 31 insertions(+), 9 deletions(-) + +diff --git a/README.COMPILER-RT.md b/README.COMPILER-RT.md +index b2754dfcf..dced89686 100644 +--- a/README.COMPILER-RT.md ++++ b/README.COMPILER-RT.md +@@ -10,6 +10,10 @@ Ensure you have finished `build.sh`, + + then run: `./build_compiler_rt.sh`. + ++By default, installation steps for compiler-rt will be printed to the terminal ++to run manually, but you can automate the installation process by defining ++`ENABLE_COMPILER_RT_INSTALL`. ++ + You can verify compiler-rt is working by invoking the following command: + + echo "int main(void){return 0;}" | xcrun clang -xc -o/dev/null -v - 2>&1 | \ +diff --git a/README.md b/README.md +index 60d19f917..f32bf626c 100644 +--- a/README.md ++++ b/README.md +@@ -33,6 +33,9 @@ It also includes scripts for optionally building + * the "compiler-rt" runtime library, and + * the `llvm-dsymutil` tool required for debugging. + ++Note: The "compiler-rt" library can be needed to link code that uses the ++`__builtin_available()` runtime version check. ++ + + ### WHAT CAN BE BUILT WITH IT? ### + +diff --git a/build_compiler_rt.sh b/build_compiler_rt.sh +index 8f47262a2..508742cab 100755 +--- a/build_compiler_rt.sh ++++ b/build_compiler_rt.sh +@@ -182,22 +182,39 @@ fi + rm -f $BUILD_DIR/.compiler-rt_build_complete + + ++# Installation. Can be either automated (ENABLE_COMPILER_RT_INSTALL) or will ++# print the commands that the user should run manually. ++ ++function print_or_run() { ++ if [ -z "$ENABLE_COMPILER_RT_INSTALL" ]; then ++ echo "$@" ++ else ++ $@ ++ fi ++} ++ + echo "" + echo "" + echo "" +-echo "Please run the following commands by hand to install compiler-rt:" ++if [ -z "$ENABLE_COMPILER_RT_INSTALL" ]; then ++ echo "Please run the following commands by hand to install compiler-rt:" ++else ++ echo "Installing compiler-rt headers and libraries to the following paths:" ++ echo " ${CLANG_INCLUDE_DIR}" ++ echo " ${CLANG_DARWIN_LIB_DIR}" ++fi + echo "" + +-echo "mkdir -p ${CLANG_INCLUDE_DIR}" +-echo "mkdir -p ${CLANG_DARWIN_LIB_DIR}" +-echo "cp -rv $BUILD_DIR/compiler-rt/compiler-rt/include/sanitizer ${CLANG_INCLUDE_DIR}" ++print_or_run mkdir -p ${CLANG_INCLUDE_DIR} ++print_or_run mkdir -p ${CLANG_DARWIN_LIB_DIR} ++print_or_run cp -rv $BUILD_DIR/compiler-rt/compiler-rt/include/sanitizer ${CLANG_INCLUDE_DIR} + + if [ $USE_CMAKE -eq 1 ]; then + + ### CMAKE ### + +- echo "cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR}" +- echo "cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR}" ++ print_or_run cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR} ++ print_or_run cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR} + + ### CMAKE END ### + +@@ -209,7 +226,7 @@ else + + function print_install_command() { + if [ -f "$1" ]; then +- echo "cp $PWD/compiler-rt/$1 ${CLANG_DARWIN_LIB_DIR}/$2" ++ print_or_run cp $PWD/compiler-rt/$1 ${CLANG_DARWIN_LIB_DIR}/$2 + fi + } + +@@ -219,14 +236,12 @@ else + print_install_command "cc_kext/libcompiler_rt.a" "libclang_rt.cc_kext.a" + print_install_command "profile_osx/libcompiler_rt.a" "libclang_rt.profile_osx.a" + +- + print_install_command "ubsan_osx_dynamic/libcompiler_rt.dylib" \ + "libclang_rt.ubsan_osx_dynamic.dylib" + + print_install_command "asan_osx_dynamic/libcompiler_rt.dylib" \ + "libclang_rt.asan_osx_dynamic.dylib" + +- + popd &>/dev/null + + ### MAKE END ###