diff --git a/build.sh b/build.sh index c825246..f16b580 100755 --- a/build.sh +++ b/build.sh @@ -4,8 +4,10 @@ basedir=$(cd $(dirname "$0"); pwd) source $basedir/setup.sh +platforms="linux,windows,web,android,osx,ios,msvc" + if [ -z "$1" -o -z "$2" ]; then - echo "Usage: $0 " + echo "Usage: $0 []" echo echo "Example: $0 3.x f35" echo @@ -15,6 +17,10 @@ if [ -z "$1" -o -z "$2" ]; then echo "base distro:" echo " Informational, tracks the base Linux distro these containers are based on." echo + echo "(Optional) platforms:" + echo " Comma-separated list of platforms." + echo " Defaults to: $platforms" + echo echo "The resulting image version will be -." exit 1 fi @@ -23,7 +29,14 @@ godot_branch=$1 base_distro=$2 img_version=$godot_branch-$base_distro files_root="$basedir/files" -build_msvc=0 + +if [ ! -z "$3" ]; then + case "$3" in + free) platforms="linux,windows,web,android";; + nonfree) platforms="osx,ios,msvc";; + *) platforms="$3";; + esac +fi if [ ! -z "$PS1" ]; then # Confirm settings @@ -55,36 +68,36 @@ podman_build() { podman_build export -podman_build linux -podman_build windows - -podman_build web -podman_build android - -XCODE_SDK=14.1 -OSX_SDK=13.0 -IOS_SDK=16.1 -if [ ! -e "${files_root}"/MacOSX${OSX_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneOS${IOS_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneSimulator${IOS_SDK}.sdk.tar.xz ]; then - if [ ! -e "${files_root}"/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 +for platform in linux windows web android; do + if grep -q "$platform" <<< "$platforms"; then podman_build "$platform"; fi +done + +if grep -q osx <<< "$platforms" || grep -q ios <<< "$platforms"; then + XCODE_SDK=14.1 + OSX_SDK=13.0 + IOS_SDK=16.1 + if [ ! -e "${files_root}"/MacOSX${OSX_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneOS${IOS_SDK}.sdk.tar.xz ] || [ ! -e "${files_root}"/iPhoneSimulator${IOS_SDK}.sdk.tar.xz ]; then + if [ ! -e "${files_root}"/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" + podman_build xcode + $podman run -it --rm \ + -v "${files_root}":/root/files:z \ + -e XCODE_SDKV="${XCODE_SDK}" \ + -e OSX_SDKV="${OSX_SDK}" \ + -e IOS_SDKV="${IOS_SDK}" \ + godot-xcode:${img_version} \ + 2>&1 | tee logs/xcode_packer.log fi - echo "Building OSX and iOS SDK packages. This will take a while" - podman_build xcode - "$podman" run -it --rm \ - -v "${files_root}":/root/files:z \ - -e XCODE_SDKV="${XCODE_SDK}" \ - -e OSX_SDKV="${OSX_SDK}" \ - -e IOS_SDKV="${IOS_SDK}" \ - godot-xcode:${img_version} \ - 2>&1 | tee logs/xcode_packer.log + podman_build osx + podman_build ios fi -podman_build osx -podman_build ios - -if [ "${build_msvc}" != "0" ]; then +if grep -q msvc <<< "$platforms"; then if [ ! -e "${files_root}"/msvc2017.tar ]; then echo echo "files/msvc2017.tar is missing. This file can be created on a Windows 7 or 10 machine by downloading the 'Visual Studio Tools' installer."