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 00f767ef9..f51daf6b3 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 + #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 = []