Last active
February 15, 2020 22:53
-
-
Save xsellier/600e2047c5081011617920c7f153c5dc to your computer and use it in GitHub Desktop.
Compile Godot Engine 2.1-branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is intended to run on Linux. | |
set -eo pipefail | |
export BUILD_REVISION=official | |
# if this flag is set, build is tagged as release in the version | |
# Build templates | |
# Remove this stuff, will be created anew | |
rm -rf templates | |
mkdir -p templates | |
export CXX=g++ | |
export CC=gcc | |
export SCRIPT_AES256_ENCRYPTION_KEY=YOUR_KEY_HERE | |
if [ "${FORCE_CLEAN}" == "1" ] | |
then | |
find . -name "*.lib" -not -path "*/sdk/*" -print -delete | |
find . -name "*.o" -not -path "*/sdk/*" -print -delete | |
find . -name "*.obj" -not -path "*/sdk/*" -print -delete | |
find . -name "*.ox" -not -path "*/sdk/*" -print -delete | |
find . -name "*.a" -not -path "*/sdk/*" -print -delete | |
find . -name "*.ax" -not -path "*/sdk/*" -print -delete | |
find . -name "*.d" -not -path "*/sdk/*" -print -delete | |
find . -name "*.so" -not -path "*/sdk/*" -print -delete | |
find . -name "*.os" -not -path "*/sdk/*" -print -delete | |
find . -name "*.Plo" -not -path "*/sdk/*" -print -delete | |
find . -name "*.lo" -not -path "*/sdk/*" -print -delete | |
find . -name "*.gen.*" -not -path "*/sdk/*" -print -delete | |
fi | |
if [ "${BUILD_BINARY}" != "1" ] | |
then | |
# Windows 32 Release and Debug | |
echo "" | |
echo "BUILDING TEMPLATE FOR Windows 32/64 Release and Debug" | |
echo "" | |
# scons platform=windows bits=64 tools=no target=debug use_lto=yes | |
# scons platform=windows bits=32 tools=no target=debug use_lto=yes -j6 | |
# scons platform=windows bits=64 tools=no target=release use_lto=yes | |
# scons platform=windows bits=32 tools=no target=release use_lto=yes -j6 | |
# set BUILD_REVISION=official | |
# set SCRIPT_AES256_ENCRYPTION_KEY=YOUR_KEY_HERE | |
# scons platform=windows tools=no target=debug warnings=no -j6 %% scons platform=windows tools=no target=release warnings=no -j6 | |
# scons platform=windows tools=no target=debug warnings=no -j6 | |
# scons platform=windows tools=no target=release warnings=no -j6 | |
strip "bin/godot.windows.debug.64.exe" \ | |
"bin/godot.windows.debug.32.exe" \ | |
"bin/godot.windows.opt.64.exe" \ | |
"bin/godot.windows.opt.32.exe" | |
cp "bin/godot.windows.debug.64.exe" "templates/windows_64_debug.exe" | |
cp "bin/godot.windows.debug.32.exe" "templates/windows_32_debug.exe" | |
cp "bin/godot.windows.opt.64.exe" "templates/windows_64_release.exe" | |
cp "bin/godot.windows.opt.32.exe" "templates/windows_32_release.exe" | |
echo "" | |
echo "BUILD DONE FOR Windows 64 Release and Debug (UPX does not support it yet)" | |
echo "" | |
# Linux 32 Release and Debug | |
echo "" | |
echo "BUILDING TEMPLATE FOR Linux 32 Release and Debug" | |
echo "" | |
scons -j6 CXX=$CXX CC=$CC platform=x11 target=release tools=no bits=32 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes use_lto=yes | |
cp bin/godot.x11.opt.32 templates/linux_x11_32_release | |
upx templates/linux_x11_32_release | |
scons -j6 CXX=$CXX CC=$CC platform=x11 target=debug tools=no bits=32 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes | |
cp bin/godot.x11.debug.32 templates/linux_x11_32_debug | |
upx templates/linux_x11_32_debug | |
echo "" | |
echo "BUILD DONE FOR Linux 32 Release and Debug" | |
echo "" | |
# echo "" | |
# echo "BUILDING TEMPLATE FOR Android 32 Release and Debug" | |
# echo "" | |
# export ANDROID_HOME=/usr/lib/android-sdk | |
# export ANDROID_NDK_ROOT=/usr/lib/android-sdk/ndk-bundle | |
# scons -j6 CXX=$CXX CC=$CC platform=android tools=no target=debug | |
# scons -j6 CXX=$CXX CC=$CC platform=android tools=no target=debug android_arch=x86 | |
# scons -j6 CXX=$CXX CC=$CC platform=android tools=no target=debug android_arch=arm64v8 | |
# scons -j6 CXX=$CXX CC=$CC platform=android tools=no target=release | |
# scons -j6 CXX=$CXX CC=$CC platform=android tools=no target=release android_arch=x86 | |
# scons -j6 CXX=$CXX CC=$CC platform=android tools=no target=release android_arch=arm64v8 | |
# cd platform/android/java | |
# ./gradlew clean | |
# ./gradlew build | |
# cd - | |
# cp -a bin/android_release.apk templates/android_release.apk | |
# cp -a bin/android_debug.apk templates/android_debug.apk | |
# unset ANDROID_HOME | |
# unset ANDROID_NDK_ROOT | |
# echo "" | |
# echo "BUILD DONE FOR Android 32 Release and Debug" | |
# echo "" | |
# Linux 64 Release and Debug | |
echo "" | |
echo "BUILDING TEMPLATE FOR Linux 64 Release and Debug" | |
echo "" | |
scons -j6 CXX=$CXX CC=$CC platform=x11 target=release tools=no bits=64 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes use_lto=yes | |
cp bin/godot.x11.opt.64 templates/linux_x11_64_release | |
upx templates/linux_x11_64_release | |
scons -j6 CXX=$CXX CC=$CC platform=x11 target=debug tools=no bits=64 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes | |
cp bin/godot.x11.debug.64 templates/linux_x11_64_debug | |
upx templates/linux_x11_64_debug | |
echo "" | |
echo "BUILD DONE FOR Linux 64 Release and Debug" | |
echo "" | |
# Server for 32 and 64 bits (always in debug) | |
echo "" | |
echo "BUILDING TEMPLATE FOR Server for 32 and 64 bits (always in debug)" | |
echo "" | |
scons -j6 CXX=$CXX CC=$CC platform=server target=debug tools=no bits=64 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes | |
cp bin/godot_server.server.debug.64 templates/linux_server_64 | |
upx templates/linux_server_64 | |
scons -j6 CXX=$CXX CC=$CC platform=server target=debug tools=no bits=32 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes | |
cp bin/godot_server.server.debug.32 templates/linux_server_32 | |
upx templates/linux_server_32 | |
echo "" | |
echo "BUILD DONE FOR Server for 32 and 64 bits (always in debug)" | |
echo "" | |
# OSX for 32 and 64 bits | |
echo "" | |
echo "BUILDING TEMPLATE FOR OSX for 32 and 64 bits" | |
echo "" | |
export OSXCROSS_ROOT=/opt/osxcross | |
scons -j6 CXX=$CXX CC=$CC platform=osx osxcross_sdk=darwin15 target=release tools=no bits=64 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes use_lto=yes | |
scons -j6 CXX=$CXX CC=$CC platform=osx osxcross_sdk=darwin15 target=release_debug tools=no bits=64 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_static_cpp=yes | |
unset OSXCROSS_ROOT | |
rm -rf osx_template.app | |
cp -a misc/dist/osx_template.app . | |
mkdir osx_template.app/Contents/MacOS | |
cp bin/godot.osx.opt.64 osx_template.app/Contents/MacOS/godot_osx_release.64 | |
chmod a+x osx_template.app/Contents/MacOS/godot_osx_release.64 | |
zip -r9 osx.zip osx_template.app | |
mv osx.zip templates/ | |
echo "" | |
echo "BUILD DONE FOR OSX for 32 and 64 bits" | |
echo "" | |
mv -f -v templates/* ~/.godot/templates/ | |
fi | |
# Build release executables with editor | |
rm -rf release | |
mkdir -p release | |
echo "" | |
echo "BUILDING BINARY FOR Linux 64" | |
echo "" | |
scons -j6 CXX=$CXX CC=$CC platform=x11 target=debug tools=yes bits=64 builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes use_lto=yes | |
cp bin/godot.x11.tools.64 release/godot_x11.64 | |
upx release/godot_x11.64 | |
mv -f -v release/godot_x11.64 /opt/godot/Godot_v2.1.5-compiled_x11 | |
echo "" | |
echo "BUILD DONE FOR Linux 64" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment