From 9bbb1acd7d9c0fd9e8367453a7e7ef1ebda400a8 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 19 Nov 2024 16:16:37 -0800 Subject: [PATCH] Raise minimum supported macOS version to 10.13 (High Sierra). Allows removing all macOS version ifdefs. Closes https://gitlab.gnome.org/GNOME/glib/-/issues/3441 --- docs/supported-platforms.md | 10 +++------- gio/giomodule.c | 9 ++------- gio/gnextstepsettingsbackend.m | 10 ---------- gio/gosxappinfo.m | 16 ---------------- gio/meson.build | 4 +--- meson.build | 13 +++++++------ 6 files changed, 13 insertions(+), 49 deletions(-) diff --git a/docs/supported-platforms.md b/docs/supported-platforms.md index 90752ee72..1870d1416 100644 --- a/docs/supported-platforms.md +++ b/docs/supported-platforms.md @@ -13,13 +13,9 @@ support. The list will be periodically updated for the development branch, with versions typically being updated as they lapse from receiving support from their vendor. - * macOS: minimum version OS X 10.7 (we - [don’t support universal binaries](https://bugzilla.gnome.org/show_bug.cgi?id=780238); - some features (like notification support) - [require OS X 10.9](https://bugzilla.gnome.org/show_bug.cgi?id=747146) - * Note that older versions of macOS than what’s currently officially - supported by Apple are supported by GLib on a best-effort basis due to - still having significant user bases + * macOS: minimum version macOS 11. + * [No support for universal binaries ](https://bugzilla.gnome.org/show_bug.cgi?id=780238); + * macOS 10.13 support is maintained on a best-effort basis. * Windows: [minimum version is Windows 8](https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1970), minimum build chain is Visual Studio 2012 diff --git a/gio/giomodule.c b/gio/giomodule.c index e19fc9065..76c202848 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -1093,11 +1093,8 @@ extern GType g_proxy_resolver_portal_get_type (void); extern GType g_network_monitor_portal_get_type (void); #endif -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 -extern GType g_cocoa_notification_backend_get_type (void); -#endif - #ifdef HAVE_COCOA +extern GType g_cocoa_notification_backend_get_type (void); extern GType g_osx_network_monitor_get_type (void); #endif @@ -1352,6 +1349,7 @@ _g_io_modules_ensure_loaded (void) g_type_ensure (g_registry_settings_backend_get_type ()); #endif #ifdef HAVE_COCOA + g_type_ensure (g_cocoa_notification_backend_get_type ()); g_type_ensure (g_nextstep_settings_backend_get_type ()); g_type_ensure (g_osx_app_info_get_type ()); g_type_ensure (g_osx_network_monitor_get_type ()); @@ -1368,9 +1366,6 @@ _g_io_modules_ensure_loaded (void) g_type_ensure (g_power_profile_monitor_portal_get_type ()); g_type_ensure (g_proxy_resolver_portal_get_type ()); #endif -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 - g_type_ensure (g_cocoa_notification_backend_get_type ()); -#endif #ifdef G_OS_WIN32 g_type_ensure (g_win32_notification_backend_get_type ()); g_type_ensure (_g_winhttp_vfs_get_type ()); diff --git a/gio/gnextstepsettingsbackend.m b/gio/gnextstepsettingsbackend.m index 296774a91..7b48164b3 100644 --- a/gio/gnextstepsettingsbackend.m +++ b/gio/gnextstepsettingsbackend.m @@ -345,12 +345,7 @@ g_nextstep_settings_backend_get_g_variant (id object, g_variant_builder_init_static (&builder, type); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 for(key in object) -#else - NSEnumerator *enumerator = [object objectEnumerator]; - while((key = [enumerator nextObject])) -#endif { GVariant *name; id value; @@ -386,12 +381,7 @@ g_nextstep_settings_backend_get_g_variant (id object, value_type = g_variant_type_element (type); g_variant_builder_init_static (&builder, type); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 for(value in object) -#else - NSEnumerator *enumerator = [object objectEnumerator]; - while((value = [enumerator nextObject])) -#endif { GVariant *variant = g_nextstep_settings_backend_get_g_variant (value, value_type); diff --git a/gio/gosxappinfo.m b/gio/gosxappinfo.m index 038429456..28b97e9fa 100644 --- a/gio/gosxappinfo.m +++ b/gio/gosxappinfo.m @@ -314,7 +314,6 @@ get_bundle_for_id (CFStringRef bundle_id) CFURLRef app_url; NSBundle *bundle; -#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER CFArrayRef urls = LSCopyApplicationURLsForBundleIdentifier (bundle_id, NULL); if (urls) { @@ -326,9 +325,6 @@ get_bundle_for_id (CFStringRef bundle_id) CFRelease (urls); } else -#else - if (LSFindApplicationForInfo (kLSUnknownCreator, bundle_id, NULL, NULL, &app_url) == kLSApplicationNotFoundErr) -#endif { #ifdef G_ENABLE_DEBUG /* This can fail often, no reason to alloc strings */ gchar *id_str = create_cstr_from_cfstring (bundle_id); @@ -744,11 +740,7 @@ g_app_info_get_default_for_type_impl (const char *content_type, gchar *mime_type; CFStringRef type; NSBundle *bundle; -#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER CFURLRef bundle_id; -#else - CFStringRef bundle_id; -#endif mime_type = g_content_type_get_mime_type (content_type); if (g_str_has_prefix (mime_type, "x-scheme-handler/")) @@ -763,11 +755,7 @@ g_app_info_get_default_for_type_impl (const char *content_type, type = create_cfstring_from_cstr (content_type); -#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER bundle_id = LSCopyDefaultApplicationURLForContentType (type, kLSRolesAll, NULL); -#else - bundle_id = LSCopyDefaultRoleHandlerForContentType (type, kLSRolesAll); -#endif CFRelease (type); if (!bundle_id) @@ -776,11 +764,7 @@ g_app_info_get_default_for_type_impl (const char *content_type, return NULL; } -#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER bundle = get_bundle_for_url (bundle_id); -#else - bundle = get_bundle_for_id (bundle_id); -#endif CFRelease (bundle_id); if (!bundle) diff --git a/gio/meson.build b/gio/meson.build index 04d8f5918..854b95afa 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -396,9 +396,7 @@ if host_system != 'windows' unix_sources += files('gosxappinfo.m') framework_dep = dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation', 'AppKit']) platform_deps += [framework_dep] - if glib_have_os_x_9_or_later - unix_sources += files('gcocoanotificationbackend.m') - endif + unix_sources += files('gcocoanotificationbackend.m') unix_sources += files('gosxnetworkmonitor.c') application_headers += files('gosxappinfo.h') else diff --git a/meson.build b/meson.build index 7da293881..2e2f2d65b 100644 --- a/meson.build +++ b/meson.build @@ -965,12 +965,18 @@ if host_system == 'linux' endif osx_ldflags = [] -glib_have_os_x_9_or_later = false glib_have_carbon = false glib_have_cocoa = false if host_system == 'darwin' add_languages('objc', native: false, required: true) objcc = meson.get_compiler('objc') + if not objcc.compiles('''#include + #if MAC_OS_X_VERSION_MIN_REQUIRED < 101300 + #error message "GLib requires macOS 10.13 or later." + #endif''', + name : 'macOS 10.13 or later') + error('GLib requires macOS 10.13 or later.') + endif add_project_arguments(objcc.get_supported_arguments(warning_objc_args), language: 'objc') @@ -981,11 +987,6 @@ if host_system == 'darwin' if glib_have_carbon glib_conf.set('HAVE_CARBON', true) - glib_have_os_x_9_or_later = objcc.compiles('''#include - #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 - #error Compiling for minimum OS X version before 10.9 - #endif''', - name : 'OS X 9 or later') endif # Mac OS X Cocoa support