Merge branch 'disable-ios-nsgetenviron' into 'master'

Various fixes when building for iOS

See merge request GNOME/glib!1512
This commit is contained in:
Sebastian Dröge 2020-06-02 10:56:44 +00:00
commit 2ed356cb67
3 changed files with 43 additions and 2 deletions

View File

@ -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}'

View File

@ -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']

View File

@ -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('.')
@ -502,9 +512,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
@ -2142,7 +2157,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 = []