Skip to content

Commit 1a23507

Browse files
authored
Add Mac Catalyst to the build set. (#54)
Adds Mac Catalyst targets and artefacts to the build.
1 parent 88a564f commit 1a23507

File tree

6 files changed

+234
-90
lines changed

6 files changed

+234
-90
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ jobs:
1919
name: ${{ matrix.target }}
2020
runs-on: macOS-latest
2121
strategy:
22+
fail-fast: false
2223
matrix:
23-
target: [ "iOS", "tvOS", "watchOS", "visionOS" ]
24+
target: [ "iOS", "MacCatalyst", "tvOS", "visionOS", "watchOS" ]
2425
steps:
2526
- name: Checkout
2627
uses: actions/[email protected]

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ jobs:
1515
PACKAGE_VERSION: ${{ steps.build-vars.outputs.PACKAGE_VERSION }}
1616
BUILD_NUMBER: ${{ steps.build-vars.outputs.BUILD_NUMBER }}
1717
strategy:
18+
fail-fast: false
1819
matrix:
19-
target: [ "iOS", "tvOS", "watchOS", "visionOS" ]
20+
target: [ "iOS", "MacCatalyst", "tvOS", "visionOS", "watchOS" ]
2021
steps:
2122
- name: Checkout
2223
uses: actions/[email protected]

Makefile

Lines changed: 65 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
11
#
22
# Useful targets:
3-
# - all - build everything
4-
# - iOS - build everything for iOS
5-
# - tvOS - build everything for tvOS
6-
# - watchOS - build everything for watchOS
7-
# - visionOS - build everything for visionOS
8-
# - BZip2 - build BZip2 for all platforms
9-
# - BZip2-iOS - build BZip2 for iOS
10-
# - BZip2-tvOS - build BZip2 for tvOS
11-
# - BZip2-watchOS - build BZip2 for watchOS
12-
# - BZip2-visionOS - build BZip2 for visionOS
13-
# - XZ - build XZ for all platforms
14-
# - XZ-iOS - build XZ for iOS
15-
# - XZ-tvOS - build XZ for tvOS
16-
# - XZ-watchOS - build XZ for watchOS
17-
# - XZ-visionOS - build XZ for xrOS
18-
# - OpenSSL - build OpenSSL for all platforms
19-
# - OpenSSL-iOS - build OpenSSL for iOS
20-
# - OpenSSL-tvOS - build OpenSSL for tvOS
21-
# - OpenSSL-watchOS - build OpenSSL for watchOS
22-
# - OpenSSL-visionOS - build OpenSSL for visionOS
23-
# - mpdecimal - build mpdecimal for all platforms
24-
# - mpdecimal-iOS - build mpdecimal for iOS
25-
# - mpdecimal-tvOS - build mpdecimal for tvOS
26-
# - mpdecimal-watchOS - build mpdecimal for watchOS
27-
# - mpdecimal-visionOS - build mpdecimal for visionOS
28-
# - libFFI-iOS - build libFFI for iOS
29-
# - libFFI-tvOS - build libFFI for tvOS
30-
# - libFFI-watchOS - build libFFI for watchOS
31-
# - libFFI-visionOS - build libFFI for visionOS
3+
# - all - build everything
4+
# - iOS - build everything for iOS
5+
# - tvOS - build everything for tvOS
6+
# - watchOS - build everything for watchOS
7+
# - visionOS - build everything for visionOS
8+
# - BZip2 - build BZip2 for all platforms
9+
# - BZip2-iOS - build BZip2 for iOS
10+
# - BZip2-MacCatalyst - build BZip2 for MacCatalyst
11+
# - BZip2-tvOS - build BZip2 for tvOS
12+
# - BZip2-watchOS - build BZip2 for watchOS
13+
# - BZip2-visionOS - build BZip2 for visionOS
14+
# - XZ - build XZ for all platforms
15+
# - XZ-iOS - build XZ for iOS
16+
# - XZ-MacCatalyst - build XZ for MacCatalyst
17+
# - XZ-tvOS - build XZ for tvOS
18+
# - XZ-watchOS - build XZ for watchOS
19+
# - XZ-visionOS - build XZ for xrOS
20+
# - OpenSSL - build OpenSSL for all platforms
21+
# - OpenSSL-iOS - build OpenSSL for iOS
22+
# - OpenSSL-MacCatalyst - build OpenSSL for MacCatalyst
23+
# - OpenSSL-tvOS - build OpenSSL for tvOS
24+
# - OpenSSL-watchOS - build OpenSSL for watchOS
25+
# - OpenSSL-visionOS - build OpenSSL for visionOS
26+
# - mpdecimal - build mpdecimal for all platforms
27+
# - mpdecimal-iOS - build mpdecimal for iOS
28+
# - mpdecimal-MacCatalyst - build mpdecimal for MacCatalyst
29+
# - mpdecimal-tvOS - build mpdecimal for tvOS
30+
# - mpdecimal-watchOS - build mpdecimal for watchOS
31+
# - mpdecimal-visionOS - build mpdecimal for visionOS
32+
# - libFFI-iOS - build libFFI for iOS
33+
# - libFFI-MacCatalyst - build libFFI for MacCatalyst
34+
# - libFFI-tvOS - build libFFI for tvOS
35+
# - libFFI-watchOS - build libFFI for watchOS
36+
# - libFFI-visionOS - build libFFI for visionOS
3237

3338
# Current directory
3439
PROJECT_DIR=$(shell pwd)
3540

3641
# Supported OS and products
3742
PRODUCTS=BZip2 XZ OpenSSL libFFI
38-
OS_LIST=iOS tvOS watchOS visionOS
43+
OS_LIST=iOS MacCatalyst tvOS watchOS visionOS
3944

4045
# The versions to compile by default.
4146
# In practice, these should be
@@ -65,32 +70,48 @@ CURL_FLAGS=--disable --fail --location --create-dirs --progress-bar
6570
# iOS targets
6671
TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
6772
TRIPLE_OS-iOS=ios
73+
TRIPLE_SUFFIX-iphonesimulator=-simulator
6874
VERSION_MIN-iOS=13.0
6975
CFLAGS-iOS=-mios-version-min=$(VERSION_MIN-iOS)
76+
LIBFFI_HEADER_DIR-iOS=ios
77+
78+
# MacCatalyst targets
79+
TARGETS-MacCatalyst=macabi.x86_64 macabi.arm64
80+
TRIPLE_OS-MacCatalyst=ios
81+
TRIPLE_SUFFIX-macabi=-macabi
82+
VERSION_MIN-MacCatalyst=14.2
83+
CFLAGS-MacCatalyst=-mios-version-min=$(VERSION_MIN-MacCatalyst)
84+
LIBFFI_HEADER_DIR-MacCatalyst=macabi
7085

7186
# tvOS targets
7287
TARGETS-tvOS=appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64
7388
TRIPLE_OS-tvOS=tvos
89+
TRIPLE_SUFFIX-appletvsimulator=-simulator
7490
VERSION_MIN-tvOS=9.0
7591
CFLAGS-tvOS=-mtvos-version-min=$(VERSION_MIN-tvOS)
7692
PYTHON_CONFIGURE-tvOS=ac_cv_func_sigaltstack=no
77-
78-
# watchOS targets
79-
TARGETS-watchOS=watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32
80-
TRIPLE_OS-watchOS=watchos
81-
VERSION_MIN-watchOS=4.0
82-
CFLAGS-watchOS=-mwatchos-version-min=$(VERSION_MIN-watchOS)
83-
PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
93+
LIBFFI_HEADER_DIR-tvOS=tvos
8494

8595
# visionOS targets
8696
TARGETS-visionOS=xrsimulator.arm64 xros.arm64
8797
TRIPLE_OS-visionOS=xros
98+
TRIPLE_SUFFIX-xrsimulator=-simulator
8899
VERSION_MIN-visionOS=2.0
89100
# visionOS doesn't expose -mxros-version-min or similar; it uses the version
90101
# number in the -target triple, or a definition like:
91102
# CFLAGS-visionOS=-arch arm64 -mtargetos=xros$(VERSION_MIN-visionOS)
92103
# For consistency with existing tooling, we use the -target form.
93104
PYTHON_CONFIGURE-visionOS=ac_cv_func_sigaltstack=no
105+
LIBFFI_HEADER_DIR-visionOS=xros
106+
107+
# watchOS targets
108+
TARGETS-watchOS=watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32
109+
TRIPLE_OS-watchOS=watchos
110+
TRIPLE_SUFFIX-watchsimulator=-simulator
111+
VERSION_MIN-watchOS=4.0
112+
CFLAGS-watchOS=-mwatchos-version-min=$(VERSION_MIN-watchOS)
113+
PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
114+
LIBFFI_HEADER_DIR-watchOS=watchos
94115

95116
# The architecture of the machine doing the build
96117
HOST_ARCH=$(shell uname -m)
@@ -184,15 +205,12 @@ define build-target
184205
target=$1
185206
os=$2
186207

187-
# $(target) can be broken up into is composed of $(SDK).$(ARCH)
188-
SDK-$(target)=$$(basename $(target))
208+
# $(target) can be broken up into is composed of $(ABI).$(ARCH)
209+
ABI-$(target)=$$(basename $(target))
210+
SDK-$(target)=$$(subst macabi,macosx,$$(basename $(target)))
189211
ARCH-$(target)=$$(subst .,,$$(suffix $(target)))
190212

191-
ifeq ($$(findstring simulator,$$(SDK-$(target))),)
192-
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(TRIPLE_OS-$(os))$$(VERSION_MIN-$(os))
193-
else
194-
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(TRIPLE_OS-$(os))$$(VERSION_MIN-$(os))-simulator
195-
endif
213+
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(TRIPLE_OS-$(os))$$(VERSION_MIN-$(os))$$(TRIPLE_SUFFIX-$$(ABI-$(target)))
196214

197215
SDK_ROOT-$(target)=$$(shell xcrun --sdk $$(SDK-$(target)) --show-sdk-path)
198216
CC-$(target)=xcrun --sdk $$(SDK-$(target)) clang -target $$(TARGET_TRIPLE-$(target))
@@ -425,7 +443,7 @@ mpdecimal-$(target): $$(MPDECIMAL_DIST-$(target))
425443
# The configure step is performed as part of the OS-level build.
426444

427445
LIBFFI_SRCDIR-$(os)=build/$(os)/libffi-$(LIBFFI_VERSION)
428-
LIBFFI_SRCDIR-$(target)=$$(LIBFFI_SRCDIR-$(os))/build_$$(SDK-$(target))-$$(ARCH-$(target))
446+
LIBFFI_SRCDIR-$(target)=$$(LIBFFI_SRCDIR-$(os))/build_$$(ABI-$(target))-$$(ARCH-$(target))
429447
LIBFFI_BUILD_LIB-$(target)=$$(LIBFFI_SRCDIR-$(target))/.libs/libffi.a
430448
LIBFFI_INSTALL-$(target)=$(PROJECT_DIR)/install/$(os)/$(target)/libffi-$(LIBFFI_VERSION)
431449
LIBFFI_LIB-$(target)=$$(LIBFFI_INSTALL-$(target))/lib/libffi.a
@@ -445,7 +463,7 @@ $$(LIBFFI_LIB-$(target)): $$(LIBFFI_BUILD_LIB-$(target))
445463
# Copy the set of platform headers
446464
cp -f -r $$(LIBFFI_SRCDIR-$(os))/darwin_common/include \
447465
$$(LIBFFI_INSTALL-$(target))
448-
cp -f -r $$(LIBFFI_SRCDIR-$(os))/darwin_$$(TRIPLE_OS-$(os))/include/* \
466+
cp -f -r $$(LIBFFI_SRCDIR-$(os))/darwin_$$(LIBFFI_HEADER_DIR-$(os))/include/* \
449467
$$(LIBFFI_INSTALL-$(target))/include
450468

451469
$$(LIBFFI_DIST-$(target)): $$(LIBFFI_LIB-$(target))
@@ -464,6 +482,7 @@ libFFI-$(target): $$(LIBFFI_DIST-$(target))
464482
.PHONY: vars-$(target)
465483
vars-$(target):
466484
@echo ">>> Environment variables for $(target)"
485+
@echo "ABI-$(target): $$(ABI-$(target))"
467486
@echo "SDK-$(target): $$(SDK-$(target))"
468487
@echo "ARCH-$(target): $$(ARCH-$(target))"
469488
@echo "TARGET_TRIPLE-$(target): $$(TARGET_TRIPLE-$(target))"

0 commit comments

Comments
 (0)