Skip to content

Commit

Permalink
APPLE: Rework Apple toolchains and add tvOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
lephilousophe committed Dec 31, 2022
1 parent d41919d commit 79b231f
Show file tree
Hide file tree
Showing 48 changed files with 741 additions and 343 deletions.
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ALL_TOOLCHAINS_M4 := $(patsubst %/,%,$(dir $(wildcard toolchains/*/Dockerfile.m
ALL_TOOLCHAINS_DOC := $(patsubst %/,%,$(dir $(wildcard toolchains/*/Dockerfile)))
ALL_TOOLCHAINS := $(ALL_TOOLCHAINS_M4) $(ALL_TOOLCHAINS_DOC)

TOOLCHAINS_RESTRICTED := toolchains/apple-sdks toolchains/macosx-arm64 toolchains/macosx-x86_64 toolchains/macosx-i386 toolchains/iphone
TOOLCHAINS_RESTRICTED := toolchains/apple-sdks toolchains/appletv toolchains/macosx-arm64 toolchains/macosx-x86_64 toolchains/macosx-i386 toolchains/iphone

# Override because we use the provided value and calculate the real one
override TOOLCHAINS_ENABLED := $(call filter_list,$(TOOLCHAINS_ENABLED),$(ALL_TOOLCHAINS),toolchains/)
Expand Down Expand Up @@ -256,6 +256,7 @@ $(eval $(call DEPEND_IMAGE,\
toolchains/android-old,\
toolchains/android-common,\
$(TOOLCHAINS_BUILT)))

$(eval $(call DEPEND_IMAGE,\
toolchains/devkit3ds,\
toolchains/devkitarm,\
Expand All @@ -264,30 +265,47 @@ $(eval $(call DEPEND_IMAGE,\
toolchains/devkitnds,\
toolchains/devkitarm,\
$(TOOLCHAINS_BUILT)))

$(eval $(call DEPEND_IMAGE,\
toolchains/macosx-arm64,\
toolchains/macosx-common,\
toolchains/apple-common,\
$(TOOLCHAINS_BUILT)))
$(eval $(call DEPEND_IMAGE,\
toolchains/macosx-arm64,\
toolchains/apple-sdks,\
$(TOOLCHAINS_BUILT)))

$(eval $(call DEPEND_IMAGE,\
toolchains/macosx-x86_64,\
toolchains/macosx-common,\
toolchains/apple-common,\
$(TOOLCHAINS_BUILT)))
$(eval $(call DEPEND_IMAGE,\
toolchains/macosx-x86_64,\
toolchains/apple-sdks,\
$(TOOLCHAINS_BUILT)))

$(eval $(call DEPEND_IMAGE,\
toolchains/macosx-i386,\
toolchains/macosx-common,\
toolchains/apple-common,\
$(TOOLCHAINS_BUILT)))
$(eval $(call DEPEND_IMAGE,\
toolchains/macosx-i386,\
toolchains/apple-sdks,\
$(TOOLCHAINS_BUILT)))

$(eval $(call DEPEND_IMAGE,\
toolchains/appletv,\
toolchains/apple-common,\
$(TOOLCHAINS_BUILT)))
$(eval $(call DEPEND_IMAGE,\
toolchains/appletv,\
toolchains/apple-sdks,\
$(TOOLCHAINS_BUILT)))

$(eval $(call DEPEND_IMAGE,\
toolchains/iphone,\
toolchains/apple-common,\
$(TOOLCHAINS_BUILT)))
$(eval $(call DEPEND_IMAGE,\
toolchains/iphone,\
toolchains/apple-sdks,\
Expand Down
4 changes: 3 additions & 1 deletion buildbot-config/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ def addConfigureSteps(self, *args, **kwargs):
additional_args_before.extend(other_args)
if self.ENABLE_ENGINES_BUILD_FLAG:
additional_args_before.append(self.ENABLE_ENGINES_BUILD_FLAG)
additional_args_before.extend(["--disable-all-engines", "--enable-engines=testbed,playground3d"])

# Disabling engines must come last in the command line to override platforms choices
additional_args_after = []
Expand Down Expand Up @@ -603,7 +604,8 @@ def addTestsSteps(self, f, platform, *, env, **kwargs):

builds = []

builds.append(ScummVMBuild("master", "https://github.com/scummvm/scummvm", "master", verbose_build=True, daily=(4, 1), description="ScummVM latest\nBranch master"))
#builds.append(ScummVMBuild("master", "https://github.com/scummvm/scummvm", "master", verbose_build=True, daily=(4, 1), description="ScummVM latest\nBranch master"))
builds.append(ScummVMBuild("master", "https://github.com/lephilousophe/scummvm", "appletv", verbose_build=True, daily=(4, 1), description="ScummVM latest\nBranch master"))
builds.append(ScummVMStableBuild("stable", "https://github.com/scummvm/scummvm", "branch-2-6", verbose_build=True, daily=(4, 1), description="ScummVM stable\nFuture 2.6.x"))
#builds.append(ScummVMBuild("gsoc2012", "https://github.com/digitall/scummvm", "gsoc2012-scalers-cont", verbose_build=True))
builds.append(ScummVMToolsBuild("tools-master", "https://github.com/scummvm/scummvm-tools", "master", verbose_build=True, daily=(4, 1), description="ScummVM tools"))
56 changes: 29 additions & 27 deletions check-versions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,31 @@
# Android NDK must match ScummVM build system
('./toolchains/android/Dockerfile.m4', 'ANDROID_NDK'): 'ignore',

('./toolchains/apple-common/packages/cctools-port/build.sh', 'CCTOOLS_PORT'): cctools_port_check,
('./toolchains/apple-common/packages/cctools-port/build.sh', 'LDID'): {
'check': 'git commit',
'repository': 'https://github.com/tpoechtrager/ldid.git',
'branch': 'master',
},
('./toolchains/apple-common/packages/osxcross-clang/build.sh', 'OSXCROSS'): osxcross_check,
('./toolchains/apple-common/packages/osxcross/build.sh', 'OSXCROSS'): osxcross_check,
('./toolchains/apple-common/packages/osxcross/build.sh', 'XAR'): xar_check,
('./toolchains/apple-common/packages/ldid/build.sh', 'LDID'): {
# For MacOSX we need upstream ldid with latest MacOS support
'check': 'git tag',
'repository': 'https://git.saurik.com/ldid.git',
'context': TLSv1_CONTEXT,
'prefix': 'v',
},
('./toolchains/apple-common/packages/sparkle/build.sh', 'SPARKLE'): {
'check': 'git tag',
'repository': 'https://github.com/sparkle-project/Sparkle.git',
# Only keep vanilla releases
'pattern': r'^1\.[0-9.]+$',
},
('./toolchains/apple-common/packages/xar/build.sh', 'XAR'): xar_check,


# Recent Xcode don't support i386 anymore
('./toolchains/apple-sdks/Dockerfile.m4', 'I386_XCODE'): 'ignore',
('./toolchains/apple-sdks/Dockerfile.m4', 'XCODE'): {
Expand All @@ -176,14 +201,16 @@

# Apple SDK and target versions depend on which Xcode is used
# We already check for it
('./toolchains/iphone/Dockerfile.m4', 'IPHONE_SDK'): 'ignore',
('./toolchains/appletv/Dockerfile.m4', 'XOS_SDK'): 'ignore',
('./toolchains/iphone/Dockerfile.m4', 'XOS_SDK'): 'ignore',
('./toolchains/macosx-i386/Dockerfile.m4', 'MACOSX_SDK'): 'ignore',
('./toolchains/macosx-i386/Dockerfile.m4', 'MACOSX_TARGET'): 'ignore',
('./toolchains/macosx-arm64/Dockerfile.m4', 'MACOSX_SDK'): 'ignore',
('./toolchains/macosx-arm64/Dockerfile.m4', 'MACOSX_TARGET'): 'ignore',
('./toolchains/macosx-x86_64/Dockerfile.m4', 'MACOSX_SDK'): 'ignore',
('./toolchains/macosx-x86_64/Dockerfile.m4', 'MACOSX_TARGET'): 'ignore',
('./workers/iphone/Dockerfile.m4', 'IPHONE_SDK'): 'ignore',
('./workers/appletv/Dockerfile.m4', 'XOS_SDK'): 'ignore',
('./workers/iphone/Dockerfile.m4', 'XOS_SDK'): 'ignore',
('./workers/macosx-i386/Dockerfile.m4', 'MACOSX_SDK'): 'ignore',
('./workers/macosx-i386/Dockerfile.m4', 'MACOSX_TARGET'): 'ignore',
('./workers/macosx-arm64/Dockerfile.m4', 'MACOSX_SDK'): 'ignore',
Expand Down Expand Up @@ -304,31 +331,6 @@
# Latest crosstool-ng doesn't support uClibc anymore
('./toolchains/gcw0/packages/toolchain/build.sh', 'CT_NG'): 'ignore',

('./toolchains/iphone/packages/toolchain/build.sh', 'CCTOOLS_PORT'): cctools_port_check,
('./toolchains/iphone/packages/toolchain/build.sh', 'LDID'): {
'check': 'git commit',
'repository': 'https://github.com/tpoechtrager/ldid.git',
'branch': 'master',
},
('./toolchains/iphone/packages/xar/build.sh', 'XAR'): xar_check,

('./toolchains/macosx-common/packages/osxcross-clang/build.sh', 'OSXCROSS'): osxcross_check,
('./toolchains/macosx-common/packages/osxcross/build.sh', 'OSXCROSS'): osxcross_check,
('./toolchains/macosx-common/packages/osxcross/build.sh', 'XAR'): xar_check,
('./toolchains/macosx-common/packages/ldid/build.sh', 'LDID'): {
# For MacOSX we need upstream ldid with latest MacOS support
'check': 'git tag',
'repository': 'https://git.saurik.com/ldid.git',
'context': TLSv1_CONTEXT,
'prefix': 'v',
},
('./toolchains/macosx-common/packages/sparkle/build.sh', 'SPARKLE'): {
'check': 'git tag',
'repository': 'https://github.com/sparkle-project/Sparkle.git',
# Only keep vanilla releases
'pattern': r'^1\.[0-9.]+$',
},

('./toolchains/mxe/Dockerfile.m4', 'MXE'): {
'check': 'git tag',
'repository': 'https://github.com/mxe/mxe.git',
Expand Down
File renamed without changes.
45 changes: 45 additions & 0 deletions toolchains/apple-common/packages/cctools-port/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#! /bin/sh

CCTOOLS_PORT_VERSION=11c93763d7e7ce7305163341d08052374e4712de
export LDID_VERSION=4bf8f4d60384a0693dbbe2084ce62a35bfeb87ab

PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
HELPERS_DIR=$PACKAGE_DIR/../..
. $HELPERS_DIR/functions.sh

do_make_bdir

do_git_fetch cctools-port "https://github.com/tpoechtrager/cctools-port.git" "${CCTOOLS_PORT_VERSION}"

if [ "$1" = "iphone" ]; then
TARGETDIR="${TARGET_DIR}" \
TRIPLE=aarch64-apple-darwin11 \
./usage_examples/ios_toolchain/build.sh "${SDK_DIR}/"* arm64
elif [ "$1" = "tv" ]; then
# Create an appletv wrapper out of blue
mv usage_examples/ios_toolchain usage_examples/tvos_toolchain
for f in usage_examples/tvos_toolchain/*; do
sed -i -e 's/iPhoneOS/AppleTVOS/g' "$f"
sed -i -e 's/IPHONEOS_/TVOS_/g' "$f"
sed -i -e 's/IOS_/TVOS_/g' "$f"
sed -i -e 's/iphoneos-/tvos-/g' "$f"
done

TARGETDIR="${TARGET_DIR}" \
TRIPLE=aarch64-apple-darwin11 \
./usage_examples/tvos_toolchain/build.sh "${SDK_DIR}/"* arm64
else
echo "ERROR: Invalid platform specified"
exit 1
fi


# Create symlinks to arm64 as official Apple tools are named like this
for f in "${TARGET_DIR}"/bin/aarch64-apple-darwin11-*; do
ln -s "$(basename "$f")" "$(echo "$f" | sed -e 's|/aarch64-|/arm64-|')"
done

# Install codesign shim
cp "${PACKAGE_DIR}"/codesign "${TARGET_DIR}"/bin

do_clean_bdir
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ do_make_bdir

SDK_DIR=$(readlink -e $PREFIX/..)
SDK_VERSION=$(basename "${SDK_DIR}" | sed -e 's/^[A-Za-z]\+\([0-9.]\+\)\.sdk$/\1/')
SDK_PLATFORM=$(basename "${SDK_DIR}" | sed -e 's/^\([A-Za-z]\+\)[0-9.]\+\.sdk$/\1/' | tr 'A-Z' 'a-z')

CLANG_VERSION=$(echo "__clang_major__ __clang_minor__ __clang_patchlevel__" | \
$CC -E - | tail -n1 | tr ' ' '.')
Expand Down Expand Up @@ -103,8 +104,9 @@ do_cmake \
-DCMAKE_LIPO=$LIPO \
-DCMAKE_OSX_SYSROOT="$SDK_DIR" \
-DDARWIN_macosx_OVERRIDE_SDK_VERSION=99.99 \
-DDARWIN_iphoneos_CACHED_SYSROOT="$SDK_DIR" \
-DDARWIN_iphoneos_OVERRIDE_SDK_VERSION="$SDK_VERSION" \
-DDARWIN_${SDK_PLATFORM}_CACHED_SYSROOT="$SDK_DIR" \
-DDARWIN_${SDK_PLATFORM}_OVERRIDE_SDK_VERSION="$SDK_VERSION" \
-DCOMPILER_RT_ENABLE_TVOS=ON \
-DCOMPILER_RT_BUILD_BUILTINS=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_XRAY=OFF \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ab3d89a74bcd29ef9d3a13bdb32dc5e1738434b3 Mon Sep 17 00:00:00 2001
From 7a6b9ffab15872522b02a292a097859d305fd721 Mon Sep 17 00:00:00 2001
From: Jonas Hahnfeld <hahnjo@hahnjo.de>
Date: Sun, 16 May 2021 11:58:26 +0200
Subject: [PATCH 1/2] meson: Fix detection of static libintl on macOS
Subject: [PATCH 1/4] meson: Fix detection of static libintl on macOS

If libintl is built statically on macOS, linking it requires passing
"-framework CoreFoundation" to satisfy symbol dependencies. Use the
Expand Down Expand Up @@ -53,5 +53,5 @@ index 740e46b86..7022e85ca 100644
endif
endif
--
2.30.2
2.38.2

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ac479562962a3d155b2d080db53efe533274cb08 Mon Sep 17 00:00:00 2001
From d4f6c101aa1f3cddb823b6bb697595626f84bd86 Mon Sep 17 00:00:00 2001
From: Le Philousophe <lephilousophe@users.noreply.github.com>
Date: Sat, 16 Oct 2021 12:39:23 +0200
Subject: [PATCH 2/2] Remove need of ObjectiveC and deprecated Carbon
Subject: [PATCH 2/4] Remove need of ObjectiveC and deprecated Carbon

---
meson.build | 11 +++--------
Expand Down Expand Up @@ -47,5 +47,5 @@ index 7022e85ca..8d3bf08cc 100644

# Check for futex(2)
--
2.30.2
2.38.2

Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
From 37d80b2670669424ba281f558f9ae2ad6a877ed5 Mon Sep 17 00:00:00 2001
From 9930def5534c13c812fbd13b53e5cfaa644feb86 Mon Sep 17 00:00:00 2001
From: Le Philousophe <lephilousophe@users.noreply.github.com>
Date: Sun, 17 Oct 2021 16:04:14 +0200
Subject: [PATCH 2/2] Fix intl build with iOS
Subject: [PATCH 3/4] Fix intl build with iOS

---
meson.build | 3 +++
1 file changed, 3 insertions(+)

diff --git a/meson.build b/meson.build
index 7022e85ca..429352318 100644
index 8d3bf08cc..85b14caf9 100644
--- a/meson.build
+++ b/meson.build
@@ -766,6 +766,9 @@ if host_system == 'darwin'
@@ -761,6 +761,9 @@ if host_system == 'darwin'
# know which language flags it's going to use to link. Add to both languages
# for now. See https://github.com/mesonbuild/meson/issues/3585.
add_project_link_arguments(osx_ldflags, language : ['objc', 'c'])
add_project_link_arguments(osx_ldflags, language : ['c'])
+elif host_system == 'ios'
+ osx_ldflags += ['-Wl,-framework,CoreFoundation']
+ add_project_link_arguments(osx_ldflags, language : ['c'])
endif

# Check for futex(2)
--
2.30.2
2.38.2

Loading

0 comments on commit 79b231f

Please sign in to comment.