|
1 | 1 | # |
2 | 2 | # 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 | | -# - BZip2 - build BZip2 for all platforms |
8 | | -# - BZip2-iOS - build BZip2 for iOS |
9 | | -# - BZip2-tvOS - build BZip2 for tvOS |
10 | | -# - BZip2-watchOS - build BZip2 for watchOS |
11 | | -# - XZ - build XZ for all platforms |
12 | | -# - XZ-iOS - build XZ for iOS |
13 | | -# - XZ-tvOS - build XZ for tvOS |
14 | | -# - XZ-watchOS - build XZ for watchOS |
15 | | -# - OpenSSL - build OpenSSL for all platforms |
16 | | -# - OpenSSL-iOS - build OpenSSL for iOS |
17 | | -# - OpenSSL-tvOS - build OpenSSL for tvOS |
18 | | -# - OpenSSL-watchOS - build OpenSSL for watchOS |
19 | | -# - mpdecimal - build mpdecimal for all platforms |
20 | | -# - mpdecimal-iOS - build mpdecimal for iOS |
21 | | -# - mpdecimal-tvOS - build mpdecimal for tvOS |
22 | | -# - mpdecimal-watchOS - build mpdecimal for watchOS |
23 | | -# - libFFI-iOS - build libFFI for iOS |
24 | | -# - libFFI-tvOS - build libFFI for tvOS |
25 | | -# - libFFI-watchOS - build libFFI for watchOS |
| 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 |
26 | 32 |
|
27 | 33 | # Current directory |
28 | 34 | PROJECT_DIR=$(shell pwd) |
29 | 35 |
|
30 | 36 | # Supported OS and products |
31 | 37 | PRODUCTS=BZip2 XZ OpenSSL libFFI |
32 | | -OS_LIST=iOS tvOS watchOS |
| 38 | +OS_LIST=iOS tvOS watchOS visionOS |
33 | 39 |
|
34 | 40 | # The versions to compile by default. |
35 | 41 | # In practice, these should be |
@@ -58,21 +64,34 @@ CURL_FLAGS=--disable --fail --location --create-dirs --progress-bar |
58 | 64 |
|
59 | 65 | # iOS targets |
60 | 66 | TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64 |
| 67 | +TRIPLE_OS-iOS=ios |
61 | 68 | VERSION_MIN-iOS=13.0 |
62 | 69 | CFLAGS-iOS=-mios-version-min=$(VERSION_MIN-iOS) |
63 | 70 |
|
64 | 71 | # tvOS targets |
65 | 72 | TARGETS-tvOS=appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64 |
| 73 | +TRIPLE_OS-tvOS=tvos |
66 | 74 | VERSION_MIN-tvOS=9.0 |
67 | 75 | CFLAGS-tvOS=-mtvos-version-min=$(VERSION_MIN-tvOS) |
68 | 76 | PYTHON_CONFIGURE-tvOS=ac_cv_func_sigaltstack=no |
69 | 77 |
|
70 | 78 | # watchOS targets |
71 | 79 | TARGETS-watchOS=watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32 |
| 80 | +TRIPLE_OS-watchOS=watchos |
72 | 81 | VERSION_MIN-watchOS=4.0 |
73 | 82 | CFLAGS-watchOS=-mwatchos-version-min=$(VERSION_MIN-watchOS) |
74 | 83 | PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no |
75 | 84 |
|
| 85 | +# visionOS targets |
| 86 | +TARGETS-visionOS=xrsimulator.arm64 xros.arm64 |
| 87 | +TRIPLE_OS-visionOS=xros |
| 88 | +VERSION_MIN-visionOS=2.0 |
| 89 | +# visionOS doesn't expose -mxros-version-min or similar; it uses the version |
| 90 | +# number in the -target triple, or a definition like: |
| 91 | +# CFLAGS-visionOS=-arch arm64 -mtargetos=xros$(VERSION_MIN-visionOS) |
| 92 | +# For consistency with existing tooling, we use the -target form. |
| 93 | +PYTHON_CONFIGURE-visionOS=ac_cv_func_sigaltstack=no |
| 94 | + |
76 | 95 | # The architecture of the machine doing the build |
77 | 96 | HOST_ARCH=$(shell uname -m) |
78 | 97 |
|
@@ -165,16 +184,14 @@ define build-target |
165 | 184 | target=$1 |
166 | 185 | os=$2 |
167 | 186 |
|
168 | | -OS_LOWER-$(target)=$(shell echo $(os) | tr '[:upper:]' '[:lower:]') |
169 | | - |
170 | 187 | # $(target) can be broken up into is composed of $(SDK).$(ARCH) |
171 | 188 | SDK-$(target)=$$(basename $(target)) |
172 | 189 | ARCH-$(target)=$$(subst .,,$$(suffix $(target))) |
173 | 190 |
|
174 | 191 | ifeq ($$(findstring simulator,$$(SDK-$(target))),) |
175 | | -TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os)) |
| 192 | +TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(TRIPLE_OS-$(os))$$(VERSION_MIN-$(os)) |
176 | 193 | else |
177 | | -TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))-simulator |
| 194 | +TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(TRIPLE_OS-$(os))$$(VERSION_MIN-$(os))-simulator |
178 | 195 | endif |
179 | 196 |
|
180 | 197 | SDK_ROOT-$(target)=$$(shell xcrun --sdk $$(SDK-$(target)) --show-sdk-path) |
@@ -428,7 +445,7 @@ $$(LIBFFI_LIB-$(target)): $$(LIBFFI_BUILD_LIB-$(target)) |
428 | 445 | # Copy the set of platform headers |
429 | 446 | cp -f -r $$(LIBFFI_SRCDIR-$(os))/darwin_common/include \ |
430 | 447 | $$(LIBFFI_INSTALL-$(target)) |
431 | | - cp -f -r $$(LIBFFI_SRCDIR-$(os))/darwin_$$(OS_LOWER-$(sdk))/include/* \ |
| 448 | + cp -f -r $$(LIBFFI_SRCDIR-$(os))/darwin_$$(TRIPLE_OS-$(os))/include/* \ |
432 | 449 | $$(LIBFFI_INSTALL-$(target))/include |
433 | 450 |
|
434 | 451 | $$(LIBFFI_DIST-$(target)): $$(LIBFFI_LIB-$(target)) |
@@ -492,10 +509,6 @@ define build-sdk |
492 | 509 | sdk=$1 |
493 | 510 | os=$2 |
494 | 511 |
|
495 | | -OS_LOWER-$(sdk)=$(shell echo $(os) | tr '[:upper:]' '[:lower:]') |
496 | | - |
497 | | -WHEEL_TAG-$(sdk)=py3-none-$$(shell echo $$(OS_LOWER-$(sdk))_$$(VERSION_MIN-$(os))_$(sdk) | sed "s/\./_/g") |
498 | | - |
499 | 512 | SDK_TARGETS-$(sdk)=$$(filter $(sdk).%,$$(TARGETS-$(os))) |
500 | 513 | SDK_ARCHES-$(sdk)=$$(sort $$(subst .,,$$(suffix $$(SDK_TARGETS-$(sdk))))) |
501 | 514 |
|
@@ -550,6 +563,7 @@ $$(LIBFFI_SRCDIR-$(os))/darwin_common/include/ffi.h: downloads/libffi-$(LIBFFI_V |
550 | 563 | @echo ">>> Unpack and configure libFFI sources on $(os)" |
551 | 564 | mkdir -p $$(LIBFFI_SRCDIR-$(os)) |
552 | 565 | tar zxf $$< --strip-components 1 -C $$(LIBFFI_SRCDIR-$(os)) |
| 566 | + cd $$(LIBFFI_SRCDIR-$(os)) && patch -p1 < $(PROJECT_DIR)/patch/libffi.patch |
553 | 567 | # Configure the build |
554 | 568 | cd $$(LIBFFI_SRCDIR-$(os)) && \ |
555 | 569 | python3 generate-darwin-source-and-headers.py --only-$(shell echo $(os) | tr '[:upper:]' '[:lower:]') \ |
|
0 commit comments