[glib/cherry-pick-2ed356cb] Merge branch 'disable-ios-nsgetenviron' into 'master'
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/cherry-pick-2ed356cb] Merge branch 'disable-ios-nsgetenviron' into 'master'
- Date: Tue, 2 Jun 2020 10:58:10 +0000 (UTC)
commit cf90263d90f798b2e81d533704bfa5b339c25efd
Author: Sebastian Dröge <slomo coaxion net>
Date: Tue Jun 2 10:56:44 2020 +0000
Merge branch 'disable-ios-nsgetenviron' into 'master'
Various fixes when building for iOS
See merge request GNOME/glib!1512
(cherry picked from commit 2ed356cb67dff722e0a58906861ad70965c5b2a3)
c6af3c77 meson: host_system can be ios when cross-compiling
3c78d0ce meson: Autodetect when building for iOS
a28b52d7 meson: Only look for _NSGetEnviron when building for macOS
e3ef2cdf .gitlab-ci: Add an example iOS cross file
ab6b764e ci: growing_stack should be true for android and ios
.gitlab-ci/android-setup-env.sh | 1 +
.gitlab-ci/cross_file_ios_example.txt | 25 +++++++++++++++++++++++++
meson.build | 19 +++++++++++++++++--
3 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci/android-setup-env.sh b/.gitlab-ci/android-setup-env.sh
index bdbb958e3..42620cca4 100755
--- a/.gitlab-ci/android-setup-env.sh
+++ b/.gitlab-ci/android-setup-env.sh
@@ -90,6 +90,7 @@ endian = 'little'
c_args = ['-I${prefix_path}/include']
c_link_args = ['-L${prefix_path}/lib64',
'-fuse-ld=gold']
+growing_stack = true
[binaries]
c = '${toolchain_path}/bin/${CC}'
diff --git a/.gitlab-ci/cross_file_ios_example.txt b/.gitlab-ci/cross_file_ios_example.txt
new file mode 100644
index 000000000..0afeef0bb
--- /dev/null
+++ b/.gitlab-ci/cross_file_ios_example.txt
@@ -0,0 +1,25 @@
+[host_machine]
+system = 'darwin'
+cpu_family = 'aarch64'
+cpu = 'arm64'
+endian = 'little'
+
+[properties]
+c_args = ['-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-miphoneos-version-min=11.0']
+cpp_args = ['-stdlib=libc++', '-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-miphoneos-version-min=11.0']
+objc_args = ['-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-miphoneos-version-min=11.0']
+objcpp_args = ['-stdlib=libc++', '-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-miphoneos-version-min=11.0']
+c_link_args = ['-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-Wl,-iphoneos_version_min,11.0']
+cpp_link_args = ['-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-Wl,-iphoneos_version_min,11.0']
+objc_link_args = ['-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-Wl,-iphoneos_version_min,11.0']
+objcpp_link_args = ['-arch', 'arm64', '-isysroot',
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk',
'-Wl,-iphoneos_version_min,11.0']
+growing_stack = true
+
+
+[binaries]
+c = ['clang']
+cpp = ['clang++']
+objc = ['clang']
+objcpp = ['clang++']
+ar = ['ar']
+strip = ['strip']
diff --git a/meson.build b/meson.build
index db57297b9..fe4dc6f52 100644
--- a/meson.build
+++ b/meson.build
@@ -33,6 +33,16 @@ endif
host_system = host_machine.system()
+if host_system == 'darwin'
+ ios_test_code = '''#include <TargetConditionals.h>
+ #if ! TARGET_OS_IPHONE
+ #error "Not iOS/tvOS/watchOS/iPhoneSimulator"
+ #endif'''
+ if cc.compiles(ios_test_code, name : 'building for iOS')
+ host_system = 'ios'
+ endif
+endif
+
glib_version = meson.project_version()
glib_api_version = '2.0'
version_arr = glib_version.split('.')
@@ -480,9 +490,14 @@ functions = [
'wcslen',
'wcsnlen',
'sysctlbyname',
- '_NSGetEnviron',
]
+# _NSGetEnviron is available on iOS too, but its usage gets apps rejected from
+# the app store since it's considered 'private API'
+if host_system == 'darwin'
+ functions += ['_NSGetEnviron']
+endif
+
if glib_conf.has('HAVE_SYS_STATVFS_H')
functions += ['statvfs']
else
@@ -2103,7 +2118,7 @@ if host_system == 'windows'
export_dynamic_ldflags = []
elif host_system == 'cygwin'
export_dynamic_ldflags = ['-Wl,--export-all-symbols']
-elif host_system == 'darwin'
+elif host_system in ['darwin', 'ios']
export_dynamic_ldflags = []
elif host_system == 'sunos'
export_dynamic_ldflags = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]