gedit 3.32.0 build with meson fails on macOS
It would appear that the meson build script was not properly updated for macOS.
This is the patch I had to apply to get things working again. For this to work, you also need to rename gedit-app-osx.c
to gedit-app-osx.m
, and gedit-file-chooser-dialog-osx.c
to gedit-file-chooser-dialog-osx.m
.
diff --git a/gedit/meson.build b/gedit/meson.build
index b920453..b6bf8a4 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 237c2ca..fe61b33 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project(
- 'gedit', 'c',
+ 'gedit', ['c', 'objc'],
version: '3.32.0',
meson_version: '>=0.46.0',
license: 'GPL2'
@@ -128,6 +128,13 @@ 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'
+endif
+
# Options
build_plugins = get_option('plugins')
diff --git a/plugins/checkupdate/meson.build b/plugins/checkupdate/meson.build
index 1755357..dc55d53 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 14a9cff..d59951d 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 374d7ed..708f7f1 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 3801150..598dfe1 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 2be303c..0580a63 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 64063ac..187dfc0 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 f9c4f6c..7310348 100644
--- a/plugins/spell/meson.build
+++ b/plugins/spell/meson.build
@@ -22,7 +22,8 @@ libspell_sha = shared_module(
install_dir: join_paths(
pkglibdir,
'plugins',
- )
+ ),
+ name_suffix: module_suffix,
)
custom_target(
diff --git a/plugins/time/meson.build b/plugins/time/meson.build
index 36fdeb6..4294abc 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(