Added some of the build containers from the engine.

This commit is contained in:
Relintai 2024-09-12 18:44:22 +02:00
parent dd3b5c4bf9
commit 1e2ba5d9df
12 changed files with 612 additions and 0 deletions

12
misc/build_containers/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
*.tar
*.tar.gz
*.tar.bz2
*.tar.xz
*.exe
*.swp
*.dmg
*.zip
*.xip
files/mono-*/
logs/

View File

@ -0,0 +1,9 @@
FROM fedora:39
WORKDIR /root
RUN dnf -y install --setopt=install_weak_deps=False \
bash bzip2 curl file findutils git make nano patch pkgconfig python3-pip unzip which xz yasm && \
pip install scons==4.6.0
CMD /bin/bash

View File

@ -0,0 +1,39 @@
ARG img_version
FROM pandemonium-fedora:${img_version}
# Todo host the buildroot files somewhere
ENV GODOT_SDK_LINUX_X86_64=/root/x86_64-godot-linux-gnu_sdk-buildroot
ENV GODOT_SDK_LINUX_X86_32=/root/i686-godot-linux-gnu_sdk-buildroot
ENV GODOT_SDK_LINUX_ARM64=/root/aarch64-godot-linux-gnu_sdk-buildroot
ENV GODOT_SDK_LINUX_ARM32=/root/arm-godot-linux-gnueabihf_sdk-buildroot
ENV BASE_PATH=${PATH}
RUN dnf install -y wayland-devel && \
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2024-01-17/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
tar xf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
rm -f x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
cd x86_64-godot-linux-gnu_sdk-buildroot && \
./relocate-sdk.sh && \
cd /root && \
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2024-01-17/i686-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
tar xf i686-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
rm -f i686-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
cd i686-godot-linux-gnu_sdk-buildroot && \
./relocate-sdk.sh && \
cd /root && \
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2024-01-17/aarch64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
tar xf aarch64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
rm -f aarch64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
cd aarch64-godot-linux-gnu_sdk-buildroot && \
./relocate-sdk.sh && \
cd /root && \
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2024-01-17/arm-godot-linux-gnueabihf_sdk-buildroot.tar.bz2 && \
tar xf arm-godot-linux-gnueabihf_sdk-buildroot.tar.bz2 && \
rm -f arm-godot-linux-gnueabihf_sdk-buildroot.tar.bz2 && \
cd arm-godot-linux-gnueabihf_sdk-buildroot && \
./relocate-sdk.sh
CMD /bin/bash

View File

@ -0,0 +1,30 @@
ARG img_version
FROM pandemonium-fedora:${img_version}
ENV OSX_SDK=14.2
COPY files/* /root/files/
RUN dnf -y install --setopt=install_weak_deps=False \
automake autoconf bzip2-devel cmake gcc gcc-c++ libdispatch libicu-devel libtool \
libxml2-devel openssl-devel uuid-devel yasm && \
git clone --progress https://github.com/tpoechtrager/osxcross && \
cd /root/osxcross && \
git checkout ff8d100f3f026b4ffbe4ce96d8aac4ce06f1278b && \
curl -LO https://github.com/tpoechtrager/osxcross/pull/415.patch && \
git apply 415.patch && \
ln -s /root/files/MacOSX${OSX_SDK}.sdk.tar.xz /root/osxcross/tarballs && \
export UNATTENDED=1 && \
export SDK_VERSION=${OSX_SDK} && \
# 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=16.0.0 ENABLE_CLANG_INSTALL=1 INSTALLPREFIX=/usr ./build_apple_clang.sh && \
./build.sh && \
./build_compiler_rt.sh && \
rm -rf /root/osxcross/build && rm -rf /root/files
ENV OSXCROSS_ROOT=/root/osxcross
ENV PATH="/root/osxcross/target/bin:${PATH}"
CMD /bin/bash

View File

@ -0,0 +1,7 @@
ARG img_version
FROM pandemonium-fedora:${img_version}
RUN dnf -y install --setopt=install_weak_deps=False \
mingw32-gcc mingw32-gcc-c++ mingw32-winpthreads-static mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static
CMD /bin/bash

View File

@ -0,0 +1,10 @@
# Godot engine build containers
Based on https://github.com/godotengine/build-containers
This repository contains the Dockerfiles for the official Godot engine builds. These containers should help you build Godot for all platforms supported on any machine that can run Docker containers.
## Building
There is a 'build.sh' script included to build the containers themselves. The in-container build scripts will follow shortly.

View File

@ -0,0 +1,210 @@
#!/bin/bash
set -e
basedir=$(pwd)/
cd ../..
project_root=$(pwd)/
img_version=pe
mkdir -p logs
custom_envvars=''
if [[ -z "${OFFICIAL}" ]]; then
custom_envvars='-e BUILD_NAME=official'
fi
# Windows Build
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-windows:${img_version} \
bash /root/engine_build_scripts/windows.sh "$@" 2>&1 | tee logs/windows.log
# Linux Build
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-linux:${img_version} \
bash /root/engine_build_scripts/linux.sh "$@" 2>&1 | tee logs/linux.log
# Javascript Build
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-javascript:${img_version} \
bash /root/engine_build_scripts/javascript.sh "$@" 2>&1 | tee logs/javascript.log
# Android Build
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-android:${img_version} \
bash /root/engine_build_scripts/android.sh "$@" 2>&1 | tee logs/android.log
# OSX Build
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-osx:${img_version} \
bash /root/engine_build_scripts/osx.sh "$@" 2>&1 | tee logs/osx.log
# iOS Build
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-ios:${img_version} \
bash /root/engine_build_scripts/ios.sh "$@" 2>&1 | tee logs/ios.log
# FRT Build arm64
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-frt-arm64:${img_version} \
bash /root/engine_build_scripts/frt_arm64.sh "$@" 2>&1 | tee logs/frt_arm64.log
# FRT Build arm32
docker run ${custom_envvars} \
-v ${basedir}/engine_build_scripts:/root/engine_build_scripts \
-v ${project_root}:/root/project \
-w /root/project pandemonium-frt-arm32:${img_version} \
bash /root/engine_build_scripts/frt_arm32.sh "$@" 2>&1 | tee logs/frt_arm32.log
# Check files
cd ./bin/
files=(
# Windows
"pandemonium.windows.opt.64.exe"
"pandemonium.windows.opt.debug.64.exe"
"pandemonium.windows.opt.32.exe"
"pandemonium.windows.opt.debug.32.exe"
"pandemonium.windows.opt.tools.64.exe"
"pandemonium.windows.opt.tools.32.exe"
# Linux
"pandemonium.x11.opt.32"
"pandemonium.x11.opt.64"
"pandemonium.x11.opt.arm"
"pandemonium.x11.opt.arm64"
"pandemonium.x11.opt.debug.32"
"pandemonium.x11.opt.debug.64"
"pandemonium.x11.opt.debug.arm"
"pandemonium.x11.opt.debug.arm64"
"pandemonium.x11.opt.tools.32"
"pandemonium.x11.opt.tools.64"
"pandemonium.x11.opt.tools.arm"
"pandemonium.x11.opt.tools.arm64"
# Server (Linux)
"pandemonium_server.x11.opt.32"
"pandemonium_server.x11.opt.64"
"pandemonium_server.x11.opt.arm"
"pandemonium_server.x11.opt.arm64"
"pandemonium_server.x11.opt.debug.32"
"pandemonium_server.x11.opt.debug.64"
"pandemonium_server.x11.opt.debug.arm"
"pandemonium_server.x11.opt.debug.arm64"
"pandemonium_server.x11.opt.tools.32"
"pandemonium_server.x11.opt.tools.64"
"pandemonium_server.x11.opt.tools.arm"
"pandemonium_server.x11.opt.tools.arm64"
# HTTP Server (Linux)
"pandemonium_http_server.x11.opt.32"
"pandemonium_http_server.x11.opt.64"
"pandemonium_http_server.x11.opt.arm"
"pandemonium_http_server.x11.opt.arm64"
"pandemonium_http_server.x11.opt.debug.32"
"pandemonium_http_server.x11.opt.debug.64"
"pandemonium_http_server.x11.opt.debug.arm"
"pandemonium_http_server.x11.opt.debug.arm64"
# JS
"pandemonium.javascript.opt.zip"
"pandemonium.javascript.opt.debug.zip"
"pandemonium.javascript.opt.threads.zip"
"pandemonium.javascript.opt.debug.threads.zip"
"pandemonium.javascript.opt.tools.threads.zip"
"pandemonium.javascript.opt.gdnative.zip"
"pandemonium.javascript.opt.debug.gdnative.zip"
# Android
"android_source.zip"
"android_debug.apk"
"android_release.apk"
"android_editor.apk"
"pandemonium-lib.release.aar"
"pandemonium-lib.debug.aar"
# OSX
"pandemonium.osx.opt.universal"
"pandemonium.osx.opt.debug.universal"
"pandemonium.osx.opt.tools.universal"
# Note: These are not needed in the final release, only the universals.
"pandemonium.osx.opt.arm64"
"pandemonium.osx.opt.x86_64"
"pandemonium.osx.opt.debug.arm64"
"pandemonium.osx.opt.debug.x86_64"
"pandemonium.osx.opt.tools.arm64"
"pandemonium.osx.opt.tools.x86_64"
# iOS
"libpandemonium.iphone.opt.arm64.a"
"libpandemonium.iphone.opt.debug.arm64.a"
"libpandemonium.iphone.opt.debug.x86_64.simulator.a"
"libpandemonium.iphone.opt.x86_64.simulator.a"
# FRT
"pandemonium.frt.opt.arm32v6"
"pandemonium.frt.opt.arm32v7"
"pandemonium.frt.opt.arm64v8"
"pandemonium.frt.opt.debug.arm32v6"
"pandemonium.frt.opt.debug.arm32v7"
"pandemonium.frt.opt.debug.arm64v8"
# FRT SDL
"pandemonium.frt_sdl.opt.arm32v6"
"pandemonium.frt_sdl.opt.arm32v7"
"pandemonium.frt_sdl.opt.arm64v8"
"pandemonium.frt_sdl.opt.debug.arm32v6"
"pandemonium.frt_sdl.opt.debug.arm32v7"
"pandemonium.frt_sdl.opt.debug.arm64v8"
)
error=0
for f in ${files[*]}
do
if [ ! -e $f ]; then
error=1
echo "$f is not present!"
fi
done
if [ $error -eq 0 ]; then
echo "All files are present!"
fi
cd ..

View File

@ -0,0 +1,38 @@
#!/bin/bash
set -e
files_root=$(pwd)/files
img_version=pe
mkdir -p logs
# You can add --no-cache as an option to docker_build below to rebuild all containers from scratch
export docker_build="docker build --build-arg img_version=${img_version} "
docker build -t pandemonium-fedora:${img_version} -f Dockerfile.base . 2>&1 | tee logs/base.log
$docker_build -t pandemonium-linux:${img_version} -f Dockerfile.linux . 2>&1 | tee logs/linux.log
$docker_build -t pandemonium-windows:${img_version} -f Dockerfile.windows . 2>&1 | tee logs/windows.log
$docker_build -t pandemonium-javascript:${img_version} -f Dockerfile.javascript . 2>&1 | tee logs/javascript.log
$docker_build -t pandemonium-android:${img_version} -f Dockerfile.android . 2>&1 | tee logs/android.log
XCODE_SDK=15.2
OSX_SDK=14.2
IOS_SDK=17.2
if [ ! -e files/MacOSX${OSX_SDK}.sdk.tar.xz ] || [ ! -e files/iPhoneOS${IOS_SDK}.sdk.tar.xz ] || [ ! -e files/iPhoneSimulator${IOS_SDK}.sdk.tar.xz ]; then
if [ ! -e files/Xcode_${XCODE_SDK}.xip ]; then
echo "files/Xcode_${XCODE_SDK}.xip is required. It can be downloaded from https://developer.apple.com/download/more/ with a valid apple ID."
exit 1
fi
echo "Building OSX and iOS SDK packages. This will take a while"
$docker_build -t pandemonium-xcode-packer:${img_version} -f Dockerfile.xcode . 2>&1 | tee logs/xcode.log
docker run -it --rm -v ${files_root}:/root/files -e XCODE_SDKV="${XCODE_SDK}" -e OSX_SDKV="${OSX_SDK}" -e IOS_SDKV="${IOS_SDK}" pandemonium-xcode-packer:${img_version} 2>&1 | tee logs/xcode_packer.log
fi
$docker_build -t pandemonium-osx:${img_version} -f Dockerfile.osx . 2>&1 | tee logs/osx.log
$docker_build -t pandemonium-ios:${img_version} -f Dockerfile.ios . 2>&1 | tee logs/ios.log
docker build -t pandemonium-frt-base:${img_version} -f Dockerfile.frt_base . 2>&1 | tee logs/frt_base.log
$docker_build -t pandemonium-frt-arm32:${img_version} -f Dockerfile.frt_arm32 . 2>&1 | tee logs/frt_arm32.log
$docker_build -t pandemonium-frt-arm64:${img_version} -f Dockerfile.frt_arm64 . 2>&1 | tee logs/frt_arm64.log

View File

@ -0,0 +1,97 @@
#!/bin/bash
set -e
export PATH="${GODOT_SDK_LINUX_X86_64}/bin:${BASE_PATH}"
export HTTP_SERVER_COMMANDS=" module_bmp_enabled=no module_broken_seals_module_enabled=no module_cscript_enabled=no module_csg_enabled=no module_dds_enabled=no module_enet_enabled=no module_entity_spell_system_enabled=no module_fastnoise_enabled=no module_freetype_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_layered_tile_map_enabled=no module_material_maker_enabled=no module_mesh_data_resource_enabled=no module_mesh_utils_enabled=no module_minimp3_enabled=no module_navigation_enabled=no module_navigation_geometry_parsers_enabled=no module_network_synchronizer_enabled=no module_ogg_enabled=no module_opensimplex_enabled=no module_opus_enabled=no module_paint_enabled=no module_navigation_mesh_generator_enabled=no module_props_enabled=no module_props_2d_enabled=no module_pvr_enabled=no module_regex_enabled=no module_skeleton_2d_enabled=no module_skeleton_3d_enabled=no module_squish_enabled=no module_stb_vorbis_enabled=no module_steering_ai_enabled=no module_terraman_enabled=no module_terraman_2d_enabled=no module_texture_packer_enabled=no module_tga_enabled=no module_theora_enabled=no module_tile_map_enabled=no module_ui_extensions_enabled=no module_unit_test_enabled=no module_upnp_enabled=no module_vertex_lights_2d_enabled=no module_vertex_lights_3d_enabled=no module_vhacd_enabled=no module_vorbis_enabled=no module_voxelman_enabled=no module_wfc_enabled=no module_cvtt_enabled=no module_editor_code_editor_enabled=no module_etc_enabled=no module_gltf_enabled=no module_plugin_refresher_enabled=no module_shader_editor_enabled=no module_text_editor_enabled=no module_tinyexr_enabled=no disable_advanced_gui=yes disable_3d=yes "
# Linux http server (templates) 64bit
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server bits=64 "$@"
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release custom_modules_shared=no debug_symbols=no platform=server bits=64 "$@"
mv -f bin/pandemonium_server.x11.opt.64 bin/pandemonium_http_server.x11.opt.64
mv -f bin/pandemonium_server.x11.opt.debug.64 bin/pandemonium_http_server.x11.opt.debug.64
# Linux editor 64 bit
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 bits=64 "$@"
# Linux templates 64 bit
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 bits=64 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=x11 bits=64 "$@"
# Linux headless (editor) 64 bit
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=server bits=64 "$@"
# Linux server (templates) 64 bit
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server bits=64 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=server bits=64 "$@"
export PATH="${GODOT_SDK_LINUX_X86_32}/bin:${BASE_PATH}"
# Linux http server (templates) 32 bit
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server bits=32 "$@"
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release custom_modules_shared=no debug_symbols=no platform=server bits=32 "$@"
mv -f bin/pandemonium_server.x11.opt.32 bin/pandemonium_http_server.x11.opt.32
mv -f bin/pandemonium_server.x11.opt.debug.32 bin/pandemonium_http_server.x11.opt.debug.32
# Linux editor 32 bit
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 bits=32 "$@"
# Linux templates 32 bit
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 bits=32 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=x11 bits=32 "$@"
# Linux headless (editor) 32 bit
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=server bits=32 "$@"
# Linux server (templates) 32 bit
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server bits=32 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=server bits=32 "$@"
export PATH="${GODOT_SDK_LINUX_ARM64}/bin:${BASE_PATH}"
# Linux http server (templates) arm64
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server arch=arm64 "$@"
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release custom_modules_shared=no debug_symbols=no platform=server arch=arm64 "$@"
mv -f bin/pandemonium_server.x11.opt.arm64 bin/pandemonium_http_server.x11.opt.arm64
mv -f bin/pandemonium_server.x11.opt.debug.arm64 bin/pandemonium_http_server.x11.opt.debug.arm64
# Linux editor arm64
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 arch=arm64 "$@"
# Linux templates arm64
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 arch=arm64 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=x11 arch=arm64 "$@"
# Linux headless (editor) arm64
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=server arch=arm64 "$@"
# Linux server (templates) arm64
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server arch=arm64 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=server arch=arm64 "$@"
export PATH="${GODOT_SDK_LINUX_ARM32}/bin:${BASE_PATH}"
# Linux http server (templates) arm64
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server arch=arm "$@"
scons production=yes ${HTTP_SERVER_COMMANDS} tools=no target=release custom_modules_shared=no debug_symbols=no platform=server arch=arm "$@"
mv -f bin/pandemonium_server.x11.opt.arm bin/pandemonium_http_server.x11.opt.arm
mv -f bin/pandemonium_server.x11.opt.debug.arm bin/pandemonium_http_server.x11.opt.debug.arm
# Linux editor arm
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 arch=arm "$@"
# Linux templates arm
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=x11 arch=arm "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=x11 arch=arm "$@"
# Linux headless (editor) arm
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=server arch=arm "$@"
# Linux server (templates) arm
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=server arch=arm "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=server arch=arm "$@"

View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
# OSX editor
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=osx arch=x86_64 "$@" osxcross_sdk=darwin23.3
scons production=yes tools=yes target=release_debug custom_modules_shared=no debug_symbols=no platform=osx arch=arm64 "$@" osxcross_sdk=darwin23.3
# OSX templates release_debug
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=osx arch=x86_64 "$@" osxcross_sdk=darwin23.3
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=osx arch=arm64 "$@" osxcross_sdk=darwin23.3
# OSX templates release
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=osx arch=x86_64 "$@" osxcross_sdk=darwin23.3
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=osx arch=arm64 "$@" osxcross_sdk=darwin23.3
# OSX lipo
pushd misc/osx
./lipo.sh
popd

View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
# Windows editor (release debug) 64 bit
scons production=yes tools=yes target=release_debug debug_symbols=no platform=windows bits=64 "$@"
# Windows editor (release debug) 32 bit
scons production=yes tools=yes target=release_debug debug_symbols=no platform=windows bits=32 "$@"
# Windows templates 64 bit
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=windows bits=64 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=windows bits=64 "$@"
# Windows templates 32 bit
scons production=yes tools=no target=release_debug custom_modules_shared=no debug_symbols=no platform=windows bits=32 "$@"
scons production=yes tools=no target=release custom_modules_shared=no debug_symbols=no platform=windows bits=32 "$@"

View File

@ -0,0 +1,118 @@
From b875d7c1360c8ff2077463d7a5a12e1cff1cc683 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
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 ###