Commit 778f92a7 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

glib.recipe: iOS build fixes

Sync the host_system == ios change with upstream, and don't look for
`_NSGetEnviron()` on iOS. This regressed when moving to Meson since it
was set via `ac_cv_func__NSGetEnviron` in `ios.config` and was missed.

Part-of: <gstreamer/cerbero!489>
parent a9d6e04e
......@@ -38,12 +38,14 @@ class Recipe(recipe.Recipe):
'glib/0006-giomodule-do-not-try-to-load-modules-from-gio-module.patch',
'glib/0008-Unhide-_g_io_modules_ensure_extension_points_registe.patch',
'glib/0009-Implementation-of-Cocoa-event-loop-integration-in-GM.patch',
# https://github.com/mesonbuild/meson/issues/6257
'glib/0001-meson-host_system-is-ios-inside-cerbero.patch',
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1415,
'glib/0001-meson-Don-t-use-assert-in-test-code.patch',
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1433
'glib/0001-meson-fix-buildtype-args-and-vscrt-usage.patch',
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1512
'glib/0001-meson-host_system-can-be-ios-when-cross-compiling.patch',
'glib/0002-meson-Autodetect-when-building-for-iOS.patch',
'glib/0003-meson-Only-look-for-_NSGetEnviron-when-building-for-.patch',
]
files_libs = [
......
From ec12c163aab22fa08d6797d182b7e296cead0c10 Mon Sep 17 00:00:00 2001
From c6af3c774973594a34b97e7ac6ed2feb064b8d3e Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Fri, 21 Feb 2020 19:12:32 +0530
Subject: [PATCH] meson: host_system is ios inside cerbero
Date: Fri, 29 May 2020 00:31:35 +0530
Subject: [PATCH 1/3] meson: host_system can be ios when cross-compiling
This is actually the only way right now to differentiate between iOS
and macOS inside Meson, but sadly it's not entirely standardized
upstream: https://mesonbuild.com/Reference-tables.html#operating-system-names
Cross-compile system names aren't standardized in Meson yet[1], but we
already use this name in `tests/meson.build`, so use it here too for
consistency.
We can upstream this to glib when things get standardized in Meson:
https://github.com/mesonbuild/meson/issues/6257
1. https://mesonbuild.com/Reference-tables.html#operating-system-names
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 484f4c750..00b3bda32 100644
index 00f767ef9..f9fb01e20 100644
--- a/meson.build
+++ b/meson.build
@@ -2026,7 +2026,7 @@ if host_system == 'windows'
@@ -2142,7 +2142,7 @@ if host_system == 'windows'
export_dynamic_ldflags = []
elif host_system == 'cygwin'
export_dynamic_ldflags = ['-Wl,--export-all-symbols']
......@@ -27,5 +26,5 @@ index 484f4c750..00b3bda32 100644
elif host_system == 'sunos'
export_dynamic_ldflags = []
--
2.24.1
2.26.2
From 3c78d0cec68740231d6d2baac64f9a3584f67ee1 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Fri, 29 May 2020 00:31:35 +0530
Subject: [PATCH 2/3] meson: Autodetect when building for iOS
Instead of relying on `system` to be set correctly in the
cross-compile file, detect when we're building for iOS/watchOS/tvOS.
---
meson.build | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/meson.build b/meson.build
index f9fb01e20..51554ef62 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('.')
--
2.26.2
From a28b52d7db5f60e96c7c7f5ff0c42e9661e5e32a Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Fri, 29 May 2020 00:31:35 +0530
Subject: [PATCH 3/3] meson: Only look for _NSGetEnviron when building for
macOS
On iOS it can cause build failures with some SDK versions, and its
usage will also cause the app to be rejected on submission.
---
meson.build | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 51554ef62..f51daf6b3 100644
--- a/meson.build
+++ b/meson.build
@@ -512,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
--
2.26.2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment