[gedit] Fix build on macOS



commit e5d9704805a06ef8a18c9ff1b2cb4469e2c372c9
Author: Tom Schoonjans <Tom Schoonjans diamond ac uk>
Date:   Tue Mar 12 12:50:17 2019 +0000

    Fix build on macOS

 gedit/{gedit-app-osx.c => gedit-app-osx.m}          |  0
 ...dialog-osx.c => gedit-file-chooser-dialog-osx.m} |  0
 gedit/meson.build                                   | 21 +++++++++++++++++++--
 meson.build                                         |  8 ++++++++
 plugins/checkupdate/meson.build                     |  3 ++-
 plugins/docinfo/meson.build                         |  3 ++-
 plugins/filebrowser/meson.build                     |  3 ++-
 plugins/modelines/meson.build                       |  3 ++-
 plugins/quickhighlight/meson.build                  |  3 ++-
 plugins/sort/meson.build                            |  3 ++-
 plugins/spell/meson.build                           |  3 ++-
 plugins/time/meson.build                            |  3 ++-
 12 files changed, 43 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.m
similarity index 100%
rename from gedit/gedit-app-osx.c
rename to gedit/gedit-app-osx.m
diff --git a/gedit/gedit-file-chooser-dialog-osx.c b/gedit/gedit-file-chooser-dialog-osx.m
similarity index 100%
rename from gedit/gedit-file-chooser-dialog-osx.c
rename to gedit/gedit-file-chooser-dialog-osx.m
diff --git a/gedit/meson.build b/gedit/meson.build
index b92045394..b6bf8a455 100644
--- a/gedit/meson.build
+++ b/gedit/meson.build
@@ -137,9 +137,20 @@ libgedit_deps = [
 
 if windowing_target == 'quartz'
   libgedit_sources += files(
-    'gedit-app-osx.c',
-    'gedit-file-chooser-dialog-osx.c',
+    'gedit-app-osx.m',
+    'gedit-file-chooser-dialog-osx.m',
   )
+  libgedit_c_args += [
+    '-DOS_OSX=1',
+  ]
+  libgedit_link_args += [
+    '-Wl,-framework', '-Wl,Foundation',
+    '-Wl,-framework', '-Wl,AppKit',
+  ]
+  gtk_mac_integration_dep = dependency('gtk-mac-integration-gtk3')
+  libgedit_deps += [
+    gtk_mac_integration_dep,
+  ]
 elif windowing_target == 'win32'
   libgedit_sources += files(
     'gedit-app-win32.c',
@@ -293,6 +304,12 @@ gedit_c_args = [
   '-DHAVE_CONFIG_H',
 ]
 
+if windowing_target == 'quartz'
+  gedit_c_args += [
+    '-DOS_OSX=1',
+  ]
+endif
+
 gedit_deps = [
   libgedit_dep,
 ]
diff --git a/meson.build b/meson.build
index cb9170581..fd21791b2 100644
--- a/meson.build
+++ b/meson.build
@@ -139,6 +139,14 @@ configure_file(
   configuration: config_h
 )
 
+module_suffix = []
+# Keep the autotools convention for shared module suffix because GModule
+# depends on it: https://gitlab.gnome.org/GNOME/glib/issues/520
+if ['darwin', 'ios'].contains(host_machine.system())
+  module_suffix = 'so'
+  add_languages('objc')
+endif
+
 # Options
 build_plugins = get_option('plugins')
 
diff --git a/plugins/checkupdate/meson.build b/plugins/checkupdate/meson.build
index 1755357f0..dc55d5336 100644
--- a/plugins/checkupdate/meson.build
+++ b/plugins/checkupdate/meson.build
@@ -21,7 +21,8 @@ libcheckupdate_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 custom_target(
diff --git a/plugins/docinfo/meson.build b/plugins/docinfo/meson.build
index 14a9cff38..d59951de8 100644
--- a/plugins/docinfo/meson.build
+++ b/plugins/docinfo/meson.build
@@ -22,7 +22,8 @@ libdocinfo_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 custom_target(
diff --git a/plugins/filebrowser/meson.build b/plugins/filebrowser/meson.build
index 374d7eda2..708f7f1d4 100644
--- a/plugins/filebrowser/meson.build
+++ b/plugins/filebrowser/meson.build
@@ -73,7 +73,8 @@ libfilebrowser_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 # FIXME: https://github.com/mesonbuild/meson/issues/1687
diff --git a/plugins/modelines/meson.build b/plugins/modelines/meson.build
index 380115062..598dfe194 100644
--- a/plugins/modelines/meson.build
+++ b/plugins/modelines/meson.build
@@ -21,7 +21,8 @@ libmodelines_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 custom_target(
diff --git a/plugins/quickhighlight/meson.build b/plugins/quickhighlight/meson.build
index 2be303cd3..0580a63fb 100644
--- a/plugins/quickhighlight/meson.build
+++ b/plugins/quickhighlight/meson.build
@@ -20,7 +20,8 @@ libquickhighlight_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 custom_target(
diff --git a/plugins/sort/meson.build b/plugins/sort/meson.build
index 64063ac8e..187dfc01f 100644
--- a/plugins/sort/meson.build
+++ b/plugins/sort/meson.build
@@ -22,7 +22,8 @@ libsort_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 custom_target(
diff --git a/plugins/spell/meson.build b/plugins/spell/meson.build
index b7d1bef42..f89cef785 100644
--- a/plugins/spell/meson.build
+++ b/plugins/spell/meson.build
@@ -24,7 +24,8 @@ libspell_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 configure_file(
diff --git a/plugins/time/meson.build b/plugins/time/meson.build
index 36fdeb667..4294abc61 100644
--- a/plugins/time/meson.build
+++ b/plugins/time/meson.build
@@ -38,7 +38,8 @@ libtime_sha = shared_module(
   install_dir: join_paths(
     pkglibdir,
     'plugins',
-  )
+  ),
+  name_suffix: module_suffix,
 )
 
 configure_file(


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]