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
This commit is contained in:
John Ralls 2024-11-19 16:16:37 -08:00
parent dfe252429c
commit 9bbb1acd7d
6 changed files with 13 additions and 49 deletions

View File

@ -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 with versions typically being updated as they lapse from receiving support from
their vendor. their vendor.
* macOS: minimum version OS X 10.7 (we * macOS: minimum version macOS 11.
[dont support universal binaries](https://bugzilla.gnome.org/show_bug.cgi?id=780238); * [No support for universal binaries ](https://bugzilla.gnome.org/show_bug.cgi?id=780238);
some features (like notification support) * macOS 10.13 support is maintained on a best-effort basis.
[require OS X 10.9](https://bugzilla.gnome.org/show_bug.cgi?id=747146)
* Note that older versions of macOS than whats currently officially
supported by Apple are supported by GLib on a best-effort basis due to
still having significant user bases
* Windows: * Windows:
[minimum version is Windows 8](https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1970), [minimum version is Windows 8](https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1970),
minimum build chain is Visual Studio 2012 minimum build chain is Visual Studio 2012

View File

@ -1093,11 +1093,8 @@ extern GType g_proxy_resolver_portal_get_type (void);
extern GType g_network_monitor_portal_get_type (void); extern GType g_network_monitor_portal_get_type (void);
#endif #endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
extern GType g_cocoa_notification_backend_get_type (void);
#endif
#ifdef HAVE_COCOA #ifdef HAVE_COCOA
extern GType g_cocoa_notification_backend_get_type (void);
extern GType g_osx_network_monitor_get_type (void); extern GType g_osx_network_monitor_get_type (void);
#endif #endif
@ -1352,6 +1349,7 @@ _g_io_modules_ensure_loaded (void)
g_type_ensure (g_registry_settings_backend_get_type ()); g_type_ensure (g_registry_settings_backend_get_type ());
#endif #endif
#ifdef HAVE_COCOA #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_nextstep_settings_backend_get_type ());
g_type_ensure (g_osx_app_info_get_type ()); g_type_ensure (g_osx_app_info_get_type ());
g_type_ensure (g_osx_network_monitor_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_power_profile_monitor_portal_get_type ());
g_type_ensure (g_proxy_resolver_portal_get_type ()); g_type_ensure (g_proxy_resolver_portal_get_type ());
#endif #endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
g_type_ensure (g_cocoa_notification_backend_get_type ());
#endif
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
g_type_ensure (g_win32_notification_backend_get_type ()); g_type_ensure (g_win32_notification_backend_get_type ());
g_type_ensure (_g_winhttp_vfs_get_type ()); g_type_ensure (_g_winhttp_vfs_get_type ());

View File

@ -345,12 +345,7 @@ g_nextstep_settings_backend_get_g_variant (id object,
g_variant_builder_init_static (&builder, type); g_variant_builder_init_static (&builder, type);
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
for(key in object) for(key in object)
#else
NSEnumerator *enumerator = [object objectEnumerator];
while((key = [enumerator nextObject]))
#endif
{ {
GVariant *name; GVariant *name;
id value; id value;
@ -386,12 +381,7 @@ g_nextstep_settings_backend_get_g_variant (id object,
value_type = g_variant_type_element (type); value_type = g_variant_type_element (type);
g_variant_builder_init_static (&builder, type); g_variant_builder_init_static (&builder, type);
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
for(value in object) 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); GVariant *variant = g_nextstep_settings_backend_get_g_variant (value, value_type);

View File

@ -314,7 +314,6 @@ get_bundle_for_id (CFStringRef bundle_id)
CFURLRef app_url; CFURLRef app_url;
NSBundle *bundle; NSBundle *bundle;
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
CFArrayRef urls = LSCopyApplicationURLsForBundleIdentifier (bundle_id, NULL); CFArrayRef urls = LSCopyApplicationURLsForBundleIdentifier (bundle_id, NULL);
if (urls) if (urls)
{ {
@ -326,9 +325,6 @@ get_bundle_for_id (CFStringRef bundle_id)
CFRelease (urls); CFRelease (urls);
} }
else 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 */ #ifdef G_ENABLE_DEBUG /* This can fail often, no reason to alloc strings */
gchar *id_str = create_cstr_from_cfstring (bundle_id); 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; gchar *mime_type;
CFStringRef type; CFStringRef type;
NSBundle *bundle; NSBundle *bundle;
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
CFURLRef bundle_id; CFURLRef bundle_id;
#else
CFStringRef bundle_id;
#endif
mime_type = g_content_type_get_mime_type (content_type); mime_type = g_content_type_get_mime_type (content_type);
if (g_str_has_prefix (mime_type, "x-scheme-handler/")) 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); type = create_cfstring_from_cstr (content_type);
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
bundle_id = LSCopyDefaultApplicationURLForContentType (type, kLSRolesAll, NULL); bundle_id = LSCopyDefaultApplicationURLForContentType (type, kLSRolesAll, NULL);
#else
bundle_id = LSCopyDefaultRoleHandlerForContentType (type, kLSRolesAll);
#endif
CFRelease (type); CFRelease (type);
if (!bundle_id) if (!bundle_id)
@ -776,11 +764,7 @@ g_app_info_get_default_for_type_impl (const char *content_type,
return NULL; return NULL;
} }
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
bundle = get_bundle_for_url (bundle_id); bundle = get_bundle_for_url (bundle_id);
#else
bundle = get_bundle_for_id (bundle_id);
#endif
CFRelease (bundle_id); CFRelease (bundle_id);
if (!bundle) if (!bundle)

View File

@ -396,9 +396,7 @@ if host_system != 'windows'
unix_sources += files('gosxappinfo.m') unix_sources += files('gosxappinfo.m')
framework_dep = dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation', 'AppKit']) framework_dep = dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation', 'AppKit'])
platform_deps += [framework_dep] platform_deps += [framework_dep]
if glib_have_os_x_9_or_later unix_sources += files('gcocoanotificationbackend.m')
unix_sources += files('gcocoanotificationbackend.m')
endif
unix_sources += files('gosxnetworkmonitor.c') unix_sources += files('gosxnetworkmonitor.c')
application_headers += files('gosxappinfo.h') application_headers += files('gosxappinfo.h')
else else

View File

@ -965,12 +965,18 @@ if host_system == 'linux'
endif endif
osx_ldflags = [] osx_ldflags = []
glib_have_os_x_9_or_later = false
glib_have_carbon = false glib_have_carbon = false
glib_have_cocoa = false glib_have_cocoa = false
if host_system == 'darwin' if host_system == 'darwin'
add_languages('objc', native: false, required: true) add_languages('objc', native: false, required: true)
objcc = meson.get_compiler('objc') objcc = meson.get_compiler('objc')
if not objcc.compiles('''#include <AvailabilityMacros.h>
#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') add_project_arguments(objcc.get_supported_arguments(warning_objc_args), language: 'objc')
@ -981,11 +987,6 @@ if host_system == 'darwin'
if glib_have_carbon if glib_have_carbon
glib_conf.set('HAVE_CARBON', true) glib_conf.set('HAVE_CARBON', true)
glib_have_os_x_9_or_later = objcc.compiles('''#include <AvailabilityMacros.h>
#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 endif
# Mac OS X Cocoa support # Mac OS X Cocoa support