-
-
Notifications
You must be signed in to change notification settings - Fork 8
Add support for maccatalyst #43
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
Changes from all commits
1ad87d0
b914c33
6d57ba7
bf3fe44
653c6df
29648d4
821324e
7f4b45b
2019023
5a757de
ff2c07c
a05125c
84b0045
d5a17e5
ba3c97b
ad0f881
1a7a51c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ jobs: | |
BUILD_NUMBER: ${{ steps.build-vars.outputs.BUILD_NUMBER }} | ||
strategy: | ||
matrix: | ||
target: [ "iOS", "tvOS", "watchOS" ] | ||
target: [ "iOS", "tvOS", "watchOS", "MacCatalyst" ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
diff -Naur libffi-3.4.7-orig/config.sub libffi-3.4.7/config.sub | ||
--- libffi-3.4.7-orig/config.sub 2024-12-13 10:38:19 | ||
+++ libffi-3.4.7/config.sub 2025-03-11 19:17:04 | ||
@@ -1768,7 +1768,7 @@ | ||
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | ||
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | ||
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ | ||
- | fiwix* | mlibc* | cos* | mbr* | ironclad* ) | ||
+ | fiwix* | mlibc* | cos* | mbr* | ironclad* | macabi) | ||
;; | ||
# This one is extra strict with allowed versions | ||
sco3.2v2 | sco3.2v[4-9]* | sco5v6*) | ||
@@ -1864,8 +1864,8 @@ | ||
;; | ||
os2-emx-) | ||
;; | ||
- ios*-simulator* | tvos*-simulator* | watchos*-simulator*) | ||
- ;; | ||
+ ios*-simulator* | tvos*-simulator* | watchos*-simulator* | ios*macabi*) | ||
+ ;; | ||
*-eabi*- | *-gnueabi*-) | ||
;; | ||
none--*) | ||
diff -Naur libffi-3.4.7-orig/generate-darwin-source-and-headers.py libffi-3.4.7/generate-darwin-source-and-headers.py | ||
--- libffi-3.4.7-orig/generate-darwin-source-and-headers.py 2024-06-01 18:42:02 | ||
+++ libffi-3.4.7/generate-darwin-source-and-headers.py 2025-03-09 14:29:38 | ||
@@ -8,7 +8,7 @@ | ||
|
||
|
||
class Platform(object): | ||
- pass | ||
+ abi = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the usage in this PR - what's the difference between the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I posted a comment above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... where is this comment? I'm not sure I follow what you're referring to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The macosx is the sdk and the macabi instructs the compiler to use the Mac Catalyst ABI. It allows the iOS(iPad) version of the app to run on Mac. The Mac Catalyst version only supports the iOS APIs (no access to the MacOSX APIs) and is therefore closely aligned with iOS and for all intents and purposes behaves as such. The purpose of Mac Catalyst is to allow taking an iPad app and using all the iPad apis in a Mac app. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand what Mac Catalyst is conceptually - I'm asking why it's necessary to separate |
||
|
||
|
||
class i386_platform(Platform): | ||
@@ -153,7 +153,22 @@ | ||
arch = 'arm64_32' | ||
version_min = '-mwatchos-version-min=4.0' | ||
|
||
+class macosx_x86_64_platform(x86_64_platform): | ||
+ target = 'x86_64-apple-ios-macabi' | ||
+ directory = 'darwin_maccatalyst' | ||
+ sdk = 'macosx' | ||
+ version_min = '-mios-version-min=14.2' | ||
+ abi = 'macabi' | ||
|
||
+ | ||
+class macosx_arm64_platform(arm64_platform): | ||
+ target = 'arm64-apple-ios-macabi' | ||
+ directory = 'darwin_maccatalyst' | ||
+ sdk = 'macosx' | ||
+ version_min = '-mios-version-min=14.2' | ||
+ abi = 'macabi' | ||
+ | ||
+ | ||
def mkdir_p(path): | ||
try: | ||
os.makedirs(path) | ||
@@ -219,7 +234,7 @@ | ||
"../configure", | ||
f"--host={platform.target}", | ||
] + ( | ||
- [] if platform.sdk == "macosx" else [f"--build={os.uname().machine}-apple-darwin"] | ||
+ [] if platform.sdk == "macosx" and platform.abi != "macabi" else [f"--build={os.uname().machine}-apple-darwin"] | ||
), | ||
env=env | ||
) | ||
@@ -243,16 +258,24 @@ | ||
generate_ios=True, | ||
generate_tvos=True, | ||
generate_watchos=True, | ||
+ generate_maccatalyst=True, | ||
+ enable_i386=True, | ||
+ enable_armv7=True, | ||
): | ||
copy_files('src', 'darwin_common/src', pattern='*.c') | ||
copy_files('include', 'darwin_common/include', pattern='*.h') | ||
|
||
if generate_ios: | ||
- copy_src_platform_files(ios_simulator_i386_platform) | ||
+ if enable_i386: | ||
+ copy_src_platform_files(ios_simulator_i386_platform) | ||
copy_src_platform_files(ios_simulator_x86_64_platform) | ||
copy_src_platform_files(ios_simulator_arm64_platform) | ||
- copy_src_platform_files(ios_device_armv7_platform) | ||
+ if enable_armv7: | ||
+ copy_src_platform_files(ios_device_armv7_platform) | ||
copy_src_platform_files(ios_device_arm64_platform) | ||
+ if generate_maccatalyst: | ||
+ copy_src_platform_files(macosx_x86_64_platform) | ||
+ copy_src_platform_files(macosx_arm64_platform) | ||
if generate_osx: | ||
copy_src_platform_files(desktop_x86_64_platform) | ||
copy_src_platform_files(desktop_arm64_platform) | ||
@@ -261,20 +284,27 @@ | ||
copy_src_platform_files(tvos_simulator_arm64_platform) | ||
copy_src_platform_files(tvos_device_arm64_platform) | ||
if generate_watchos: | ||
- copy_src_platform_files(watchos_simulator_i386_platform) | ||
+ if enable_i386: | ||
+ copy_src_platform_files(watchos_simulator_i386_platform) | ||
copy_src_platform_files(watchos_simulator_x86_64_platform) | ||
copy_src_platform_files(watchos_simulator_arm64_platform) | ||
- copy_src_platform_files(watchos_device_armv7k_platform) | ||
+ if enable_armv7: | ||
+ copy_src_platform_files(watchos_device_armv7k_platform) | ||
copy_src_platform_files(watchos_device_arm64_32_platform) | ||
|
||
platform_headers = collections.defaultdict(set) | ||
|
||
if generate_ios: | ||
- build_target(ios_simulator_i386_platform, platform_headers) | ||
+ if enable_i386: | ||
+ build_target(ios_simulator_i386_platform, platform_headers) | ||
build_target(ios_simulator_x86_64_platform, platform_headers) | ||
build_target(ios_simulator_arm64_platform, platform_headers) | ||
- build_target(ios_device_armv7_platform, platform_headers) | ||
+ if enable_armv7: | ||
+ build_target(ios_device_armv7_platform, platform_headers) | ||
build_target(ios_device_arm64_platform, platform_headers) | ||
+ if generate_maccatalyst: | ||
+ build_target(macosx_x86_64_platform, platform_headers) | ||
+ build_target(macosx_arm64_platform, platform_headers) | ||
if generate_osx: | ||
build_target(desktop_x86_64_platform, platform_headers) | ||
build_target(desktop_arm64_platform, platform_headers) | ||
@@ -283,10 +313,12 @@ | ||
build_target(tvos_simulator_arm64_platform, platform_headers) | ||
build_target(tvos_device_arm64_platform, platform_headers) | ||
if generate_watchos: | ||
- build_target(watchos_simulator_i386_platform, platform_headers) | ||
+ if enable_i386: | ||
+ build_target(watchos_simulator_i386_platform, platform_headers) | ||
build_target(watchos_simulator_x86_64_platform, platform_headers) | ||
build_target(watchos_simulator_arm64_platform, platform_headers) | ||
- build_target(watchos_device_armv7k_platform, platform_headers) | ||
+ if enable_armv7: | ||
+ build_target(watchos_device_armv7k_platform, platform_headers) | ||
build_target(watchos_device_arm64_32_platform, platform_headers) | ||
|
||
mkdir_p('darwin_common/include') | ||
@@ -298,15 +330,24 @@ | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
- parser.add_argument('--only-ios', action='store_true', default=False) | ||
- parser.add_argument('--only-osx', action='store_true', default=False) | ||
- parser.add_argument('--only-tvos', action='store_true', default=False) | ||
- parser.add_argument('--only-watchos', action='store_true', default=False) | ||
+ only_group = parser.add_mutually_exclusive_group() | ||
+ # Enforce only one of these options to be specified, default is all | ||
+ only_group.add_argument('--only-ios', action='store_true', default=False) | ||
+ only_group.add_argument('--only-osx', action='store_true', default=False) | ||
+ only_group.add_argument('--only-tvos', action='store_true', default=False) | ||
+ only_group.add_argument('--only-watchos', action='store_true', default=False) | ||
+ only_group.add_argument('--only-maccatalyst', action='store_true', default=False) | ||
+ parser.add_argument('--disable-i386', action='store_true', default=False) | ||
+ parser.add_argument('--disable-armv7', action='store_true', default=False) | ||
args = parser.parse_args() | ||
|
||
+ enable_all = not any((args.only_ios, args.only_osx, args.only_tvos, args.only_watchos, args.only_maccatalyst)) | ||
generate_source_and_headers( | ||
- generate_osx=not args.only_ios and not args.only_tvos and not args.only_watchos, | ||
- generate_ios=not args.only_osx and not args.only_tvos and not args.only_watchos, | ||
- generate_tvos=not args.only_ios and not args.only_osx and not args.only_watchos, | ||
- generate_watchos=not args.only_ios and not args.only_osx and not args.only_tvos, | ||
+ generate_osx=enable_all or args.only_osx, | ||
+ generate_ios=enable_all or args.only_ios, | ||
+ generate_tvos=enable_all or args.only_tvos, | ||
+ generate_watchos=enable_all or args.only_watchos, | ||
+ generate_maccatalyst=enable_all or args.only_maccatalyst, | ||
+ enable_i386=not args.disable_i386, | ||
+ enable_armv7=not args.disable_armv7, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the release workflow - it doesn't address the CI workflow that I added a couple of days ago to make it possible to test this PR. You may need to merge with main to get that update.