macosx.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. commit 4e5cf4e3689c49d641c08245100c095c416c4f86
  2. Author: Kelvin Zhang <[email protected]>
  3. Date: Fri Dec 31 09:31:00 2021 -0800
  4. Use meson dependency to link against apple framework
  5. Using ld_flags would work, but that does not propagate ldflags to users
  6. of glib. Meson's dependency() call will propagate apple framework
  7. dependencies to downstream users.
  8. diff --git a/gio/meson.build b/gio/meson.build
  9. index 5e879fd3d..a22c822b0 100644
  10. --- a/gio/meson.build
  11. +++ b/gio/meson.build
  12. @@ -390,6 +390,8 @@ if host_system != 'windows'
  13. settings_sources += files('gnextstepsettingsbackend.m')
  14. contenttype_sources += files('gosxcontenttype.m')
  15. appinfo_sources += files('gosxappinfo.m')
  16. + framework_dep = dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation', 'AppKit'])
  17. + platform_deps += [framework_dep]
  18. if glib_have_os_x_9_or_later
  19. unix_sources += files('gcocoanotificationbackend.m')
  20. endif
  21. diff --git a/glib/meson.build b/glib/meson.build
  22. index f78f32969..13750dd83 100644
  23. --- a/glib/meson.build
  24. +++ b/glib/meson.build
  25. @@ -310,6 +310,8 @@ glib_sources = files(
  26. 'gprintf.c',
  27. )
  28. +platform_deps = []
  29. +
  30. if host_system == 'windows'
  31. glib_win_rc = configure_file(
  32. input: 'glib.rc.in',
  33. @@ -330,6 +332,13 @@ endif
  34. if glib_have_cocoa
  35. glib_sources += files('gosxutils.m')
  36. + framework_dep = dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation', 'AppKit'])
  37. + platform_deps += [framework_dep]
  38. +endif
  39. +
  40. +if glib_have_carbon
  41. + framework_dep = dependency('appleframeworks', modules : 'Carbon')
  42. + platform_deps += [framework_dep]
  43. endif
  44. glib_sources += files('gthread-@[email protected]'.format(threads_implementation))
  45. diff --git a/meson.build b/meson.build
  46. index 9d1b76c56..f780fa82e 100644
  47. --- a/meson.build
  48. +++ b/meson.build
  49. @@ -769,8 +769,6 @@ if host_system == 'darwin'
  50. add_project_arguments(objcc.get_supported_arguments(warning_objc_args), language: 'objc')
  51. - osx_ldflags += ['-Wl,-framework,CoreFoundation']
  52. -
  53. # Mac OS X Carbon support
  54. glib_have_carbon = objcc.compiles('''#include <Carbon/Carbon.h>
  55. #include <CoreServices/CoreServices.h>''',
  56. @@ -778,7 +776,6 @@ if host_system == 'darwin'
  57. if glib_have_carbon
  58. glib_conf.set('HAVE_CARBON', true)
  59. - osx_ldflags += '-Wl,-framework,Carbon'
  60. glib_have_os_x_9_or_later = objcc.compiles('''#include <AvailabilityMacros.h>
  61. #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
  62. #error Compiling for minimum OS X version before 10.9
  63. @@ -795,7 +792,6 @@ if host_system == 'darwin'
  64. if glib_have_cocoa
  65. glib_conf.set('HAVE_COCOA', true)
  66. - osx_ldflags += ['-Wl,-framework,Foundation', '-Wl,-framework,AppKit']
  67. endif
  68. # FIXME: libgio mix C and objC source files and there is no way to reliably