Skip to content

build: support specifying subset of platforms #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 41 additions & 28 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ basedir=$(cd $(dirname "$0"); pwd)

source $basedir/setup.sh

platforms="linux,windows,web,android,osx,ios,msvc"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The msvc platform doesn't work currently, so it shouldn't be built by default. That's why it's disabled in main.


if [ -z "$1" -o -z "$2" ]; then
echo "Usage: $0 <godot branch> <base distro>"
echo "Usage: $0 <godot branch> <base distro> [<platforms>]"
echo
echo "Example: $0 3.x f35"
echo
Expand All @@ -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 <godot branch>-<base distro>."
exit 1
fi
Expand All @@ -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
Expand Down Expand Up @@ -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."
Expand Down