Skip to content

Commit fb19036

Browse files
committed
Add support for visionOS
1 parent 097fdaa commit fb19036

File tree

4 files changed

+119
-3
lines changed

4 files changed

+119
-3
lines changed

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,38 @@
44
# - iOS - build everything for iOS
55
# - tvOS - build everything for tvOS
66
# - watchOS - build everything for watchOS
7+
# - xrOS - build everything for xrOS
78
# - BZip2 - build BZip2 for all platforms
89
# - BZip2-iOS - build BZip2 for iOS
910
# - BZip2-tvOS - build BZip2 for tvOS
1011
# - BZip2-watchOS - build BZip2 for watchOS
12+
# - BZip2-xrOS - build BZip2 for xrOS
1113
# - XZ - build XZ for all platforms
1214
# - XZ-iOS - build XZ for iOS
1315
# - XZ-tvOS - build XZ for tvOS
1416
# - XZ-watchOS - build XZ for watchOS
17+
# - XZ-xrOS - build XZ for xrOS
1518
# - OpenSSL - build OpenSSL for all platforms
1619
# - OpenSSL-iOS - build OpenSSL for iOS
1720
# - OpenSSL-tvOS - build OpenSSL for tvOS
1821
# - OpenSSL-watchOS - build OpenSSL for watchOS
22+
# - OpenSSL-xrOS - build OpenSSL for xrOS
1923
# - mpdecimal - build mpdecimal for all platforms
2024
# - mpdecimal-iOS - build mpdecimal for iOS
2125
# - mpdecimal-tvOS - build mpdecimal for tvOS
2226
# - mpdecimal-watchOS - build mpdecimal for watchOS
27+
# - mpdecimal-xrOS - build mpdecimal for xrOS
2328
# - libFFI-iOS - build libFFI for iOS
2429
# - libFFI-tvOS - build libFFI for tvOS
2530
# - libFFI-watchOS - build libFFI for watchOS
31+
# - libFFI-xrOS - build libFFI for xrOS
2632

2733
# Current directory
2834
PROJECT_DIR=$(shell pwd)
2935

3036
# Supported OS and products
3137
PRODUCTS=BZip2 XZ OpenSSL libFFI
32-
OS_LIST=iOS tvOS watchOS
38+
OS_LIST=iOS tvOS watchOS xrOS
3339

3440
# The versions to compile by default.
3541
# In practice, these should be
@@ -73,6 +79,12 @@ VERSION_MIN-watchOS=4.0
7379
CFLAGS-watchOS=-mwatchos-version-min=$(VERSION_MIN-watchOS)
7480
PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
7581

82+
# xrOS targets
83+
TARGETS-xrOS=xrsimulator.arm64 xros.arm64
84+
VERSION_MIN-xrOS=4.0
85+
# I don't know the version-min flag for xros, seems to work fine without it
86+
PYTHON_CONFIGURE-xrOS=ac_cv_func_sigaltstack=no
87+
7688
# The architecture of the machine doing the build
7789
HOST_ARCH=$(shell uname -m)
7890

@@ -550,6 +562,7 @@ $$(LIBFFI_SRCDIR-$(os))/darwin_common/include/ffi.h: downloads/libffi-$(LIBFFI_V
550562
@echo ">>> Unpack and configure libFFI sources on $(os)"
551563
mkdir -p $$(LIBFFI_SRCDIR-$(os))
552564
tar zxf $$< --strip-components 1 -C $$(LIBFFI_SRCDIR-$(os))
565+
cd $$(LIBFFI_SRCDIR-$(os)) && patch -p1 < $(PROJECT_DIR)/patch/libffi.patch
553566
# Configure the build
554567
cd $$(LIBFFI_SRCDIR-$(os)) && \
555568
python3 generate-darwin-source-and-headers.py --only-$(shell echo $(os) | tr '[:upper:]' '[:lower:]') \

patch/libffi.patch

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
diff -ur libffi-3.4.7 2/config.sub libffi-3.4.7/config.sub
2+
--- libffi-3.4.7 2/config.sub 2024-12-13 04:38:19
3+
+++ libffi-3.4.7/config.sub 2025-04-12 17:44:40
4+
@@ -1742,7 +1742,7 @@
5+
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
6+
| sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
7+
| hiux* | abug | nacl* | netware* | windows* \
8+
- | os9* | macos* | osx* | ios* | tvos* | watchos* \
9+
+ | os9* | macos* | osx* | ios* | tvos* | watchos* | xros* \
10+
| mpw* | magic* | mmixware* | mon960* | lnews* \
11+
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
12+
| aos* | aros* | cloudabi* | sortix* | twizzler* \
13+
@@ -1864,7 +1864,7 @@
14+
;;
15+
os2-emx-)
16+
;;
17+
- ios*-simulator* | tvos*-simulator* | watchos*-simulator*)
18+
+ ios*-simulator* | tvos*-simulator* | watchos*-simulator* | xros*-simulator*)
19+
;;
20+
*-eabi*- | *-gnueabi*-)
21+
;;
22+
diff -ur libffi-3.4.7 2/generate-darwin-source-and-headers.py libffi-3.4.7/generate-darwin-source-and-headers.py
23+
--- libffi-3.4.7 2/generate-darwin-source-and-headers.py 2024-06-01 12:42:02
24+
+++ libffi-3.4.7/generate-darwin-source-and-headers.py 2025-04-12 18:02:51
25+
@@ -152,8 +152,22 @@
26+
sdk = 'watchos'
27+
arch = 'arm64_32'
28+
version_min = '-mwatchos-version-min=4.0'
29+
+
30+
+class xros_simulator_arm64_platform(arm64_platform):
31+
+ target = 'arm64-apple-xros-simulator'
32+
+ directory = 'darwin_xros'
33+
+ sdk = 'xrsimulator'
34+
+ version_min = ''
35+
36+
37+
+class xros_device_arm64_platform(arm64_platform):
38+
+ target = 'arm64-apple-xros'
39+
+ directory = 'darwin_xros'
40+
+ sdk = 'xros'
41+
+ arch = 'arm64'
42+
+ version_min = ''
43+
+
44+
+
45+
def mkdir_p(path):
46+
try:
47+
os.makedirs(path)
48+
@@ -243,6 +257,7 @@
49+
generate_ios=True,
50+
generate_tvos=True,
51+
generate_watchos=True,
52+
+ generate_xros=True
53+
):
54+
copy_files('src', 'darwin_common/src', pattern='*.c')
55+
copy_files('include', 'darwin_common/include', pattern='*.h')
56+
@@ -266,6 +281,9 @@
57+
copy_src_platform_files(watchos_simulator_arm64_platform)
58+
copy_src_platform_files(watchos_device_armv7k_platform)
59+
copy_src_platform_files(watchos_device_arm64_32_platform)
60+
+ if generate_xros:
61+
+ copy_src_platform_files(xros_simulator_arm64_platform)
62+
+ copy_src_platform_files(xros_device_arm64_platform)
63+
64+
platform_headers = collections.defaultdict(set)
65+
66+
@@ -288,6 +306,9 @@
67+
build_target(watchos_simulator_arm64_platform, platform_headers)
68+
build_target(watchos_device_armv7k_platform, platform_headers)
69+
build_target(watchos_device_arm64_32_platform, platform_headers)
70+
+ if generate_xros:
71+
+ build_target(xros_simulator_arm64_platform, platform_headers)
72+
+ build_target(xros_device_arm64_platform, platform_headers)
73+
74+
mkdir_p('darwin_common/include')
75+
for header_name, tag_tuples in platform_headers.items():
76+
@@ -302,11 +323,13 @@
77+
parser.add_argument('--only-osx', action='store_true', default=False)
78+
parser.add_argument('--only-tvos', action='store_true', default=False)
79+
parser.add_argument('--only-watchos', action='store_true', default=False)
80+
+ parser.add_argument('--only-xros', action='store_true', default=False)
81+
args = parser.parse_args()
82+
83+
generate_source_and_headers(
84+
- generate_osx=not args.only_ios and not args.only_tvos and not args.only_watchos,
85+
- generate_ios=not args.only_osx and not args.only_tvos and not args.only_watchos,
86+
- generate_tvos=not args.only_ios and not args.only_osx and not args.only_watchos,
87+
- generate_watchos=not args.only_ios and not args.only_osx and not args.only_tvos,
88+
+ generate_osx=not args.only_ios and not args.only_tvos and not args.only_watchos and not args.only_xros,
89+
+ generate_ios=not args.only_osx and not args.only_tvos and not args.only_watchos and not args.only_xros,
90+
+ generate_tvos=not args.only_ios and not args.only_osx and not args.only_watchos and not args.only_xros,
91+
+ generate_watchos=not args.only_ios and not args.only_osx and not args.only_tvos and not args.only_xros,
92+
+ generate_xros=not args.only_ios and not args.only_osx and not args.only_tvos and not args.only_watchos,
93+
)
94+

patch/mpdecimal.patch

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ diff -ur mpdecimal-4.0.0-orig/config.sub mpdecimal-4.0.0/config.sub
1010
cpu=aarch64
1111
;;
1212

13+
@@ -1713,3 +1713,3 @@
14+
| hiux* | abug | nacl* | netware* | windows* \
15+
- | os9* | macos* | osx* | ios* | tvos* | watchos* \
16+
+ | os9* | macos* | osx* | ios* | tvos* | watchOS* | xros* \
17+
| mpw* | magic* | mmixware* | mon960* | lnews* \
1318
@@ -1792,6 +1792,8 @@
1419
os2-emx)
1520
;;
1621
*-eabi* | *-gnueabi*)
1722
+ ;;
18-
+ ios*-simulator | tvos*-simulator | watchos*-simulator)
23+
+ ios*-simulator | tvos*-simulator | watchos*-simulator | xros*-simulator)
1924
;;
2025
none-coff* | none-elf*)
2126
# None (no kernel, i.e. freestanding / bare metal),

patch/xz.patch

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ diff -ru xz-5.4.7-orig/build-aux/config.sub xz-5.4.7/build-aux/config.sub
1010
cpu=aarch64
1111
;;
1212

13+
@@ -2150,2 +2150,3 @@
14+
| xray* \
15+
+ | xros* \
16+
| zephyr* \
1317
@@ -1865,6 +1865,8 @@
1418
os2-emx-)
1519
;;
1620
*-eabi*- | *-gnueabi*-)
1721
+ ;;
18-
+ ios*-simulator- | tvos*-simulator- | watchos*-simulator- )
22+
+ ios*-simulator- | tvos*-simulator- | watchos*-simulator- | xros*-simulator-)
1923
;;
2024
none--*)
2125
# None (no kernel, i.e. freestanding / bare metal),

0 commit comments

Comments
 (0)