From a26fc11c3017aeb929fc78a313063f564a862111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 6 Apr 2020 08:44:57 +0200 Subject: [PATCH] Factor out cloning and patching for godot-mono-builds This will also be used for iOS so it makes sense to do it all together with the split out mono clone. This also allows to pin the commit used more easily. --- .gitignore | 1 + Dockerfile.android | 9 +++------ Dockerfile.javascript | 8 +++----- build.sh | 17 ++++++++++++----- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 1e4a822..f9d8f5a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ *.zip *.xip +files/mono-*/ logs/ diff --git a/Dockerfile.android b/Dockerfile.android index 47a5afe..0cd3e9e 100644 --- a/Dockerfile.android +++ b/Dockerfile.android @@ -19,16 +19,13 @@ ENV ANDROID_NDK_ROOT=/root/sdk/ndk-bundle/ RUN cp -a /root/files/${mono_version} /root && \ export MONO_SOURCE_ROOT=/root/${mono_version} && \ export make="make -j" && \ - git clone --progress https://github.com/godotengine/godot-mono-builds /root/godot-mono-builds && \ - cd /root/godot-mono-builds && \ - git checkout 710b275fbf29ddb03fd5285c51782951a110cdab && \ - python3 patch_mono.py && \ + cd /root/${mono_version}/godot-mono-builds && \ python3 android.py configure --target=all-runtime && \ python3 android.py make --target=all-runtime && \ cd /root/${mono_version} && git clean -fdx && NOCONFIGURE=1 ./autogen.sh && \ - cd /root/godot-mono-builds && \ + cd /root/${mono_version}/godot-mono-builds && \ python3 bcl.py make --product=android && \ cd /root && \ - rm -rf /root/${mono_version} /root/godot-mono-builds + rm -rf /root/${mono_version} CMD /bin/bash diff --git a/Dockerfile.javascript b/Dockerfile.javascript index a3f817d..8c205d9 100644 --- a/Dockerfile.javascript +++ b/Dockerfile.javascript @@ -19,16 +19,14 @@ RUN cp -a /root/files/${mono_version} /root && \ patch -p1 < /root/files/patches/mono-pr17094-bump-emscripten-1.38.46.patch && \ export MONO_SOURCE_ROOT=/root/${mono_version} && \ export make="make -j" && \ - git clone --progress https://github.com/godotengine/godot-mono-builds /root/godot-mono-builds && \ - cd /root/godot-mono-builds && \ - git checkout 710b275fbf29ddb03fd5285c51782951a110cdab && \ + cd /root/${mono_version}/godot-mono-builds && \ python3 patch_emscripten.py && \ python3 wasm.py configure --target=runtime && \ python3 wasm.py make --target=runtime && \ cd /root/${mono_version} && git clean -fdx && NOCONFIGURE=1 ./autogen.sh && \ - cd /root/godot-mono-builds && \ + cd /root/${mono_version}/godot-mono-builds && \ python3 bcl.py make --product wasm && \ cd /root && \ - rm -rf /root/${mono_version} /root/godot-mono-builds + rm -rf /root/${mono_version} CMD /bin/bash diff --git a/build.sh b/build.sh index 00d1afb..a2431ba 100755 --- a/build.sh +++ b/build.sh @@ -21,13 +21,13 @@ if [ -z "$1" -o -z "$2" ]; then echo "mono version:" echo " These are combined to form the docker image tag, e.g. 'master-mono-6.6.0.160'." echo " Git will then clone the branch/tag that matches the mono version." - echo + echo echo "mono branch:" echo " If specified, git will clone this mono branch/tag instead. Requires specifying a commit." echo echo "mono commit:" echo " If specified, git will check out this commit after cloning." - echo + echo exit 1 fi @@ -76,11 +76,11 @@ mkdir -p logs # Check out and patch Mono version if [ ! -e ${mono_root} ]; then - if [ ! -z "${mono_commit}" ]; then + if [ ! -z "${mono_commit}" ]; then # If a commit is specified, get the full history git clone -b ${mono_version} --single-branch --progress https://github.com/mono/mono ${mono_root} pushd ${mono_root} - git checkout ${mono_commit} + git checkout ${mono_commit} else # Otherwise, get a shallow repo git clone -b ${mono_version} --single-branch --progress --depth 1 https://github.com/mono/mono ${mono_root} @@ -88,7 +88,14 @@ if [ ! -e ${mono_root} ]; then fi # Download all submodules, up to 6 at a time git submodule update --init --recursive --recommend-shallow -j 6 --progress - patch -p1 < ${files_root}/patches/mono-unity-Clear-TLS-instead-of-aborting.patch + patch -p1 < ${files_root}/patches/mono-unity-Clear-TLS-instead-of-aborting.patch + # Set up godot-mono-builds in tree + git clone --progress https://github.com/godotengine/godot-mono-builds + pushd godot-mono-builds + git checkout 710b275fbf29ddb03fd5285c51782951a110cdab + export MONO_SOURCE_ROOT=${mono_root} + python3 patch_mono.py + popd popd fi