Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.0: meson fails on Linux with Dependency "gtk-mac-integration" not found #3649

Closed
kloczek opened this issue Oct 23, 2023 · 5 comments
Closed
Milestone

Comments

@kloczek
Copy link

kloczek commented Oct 23, 2023

I think that by default MAC dependencies should not be checked on non-MAC systems.

+ /usr/bin/meson setup --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --m
The Meson build system
Version: 1.2.3
Source dir: /home/tkloczko/rpmbuild/BUILD/geany-2.0.0
Build dir: /home/tkloczko/rpmbuild/BUILD/geany-2.0.0/x86_64-redhat-linux-gnu
Build type: native build
Project name: geany
Project version: 2.0.0
C compiler for the host machine: /usr/bin/gcc (gcc 13.2.1 "gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)")
C linker for the host machine: /usr/bin/gcc ld.bfd 2.41-7
C++ compiler for the host machine: /usr/bin/g++ (gcc 13.2.1 "g++ (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)")
C++ linker for the host machine: /usr/bin/g++ ld.bfd 2.41-7
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (2.0.3)
Run-time dependency glib-2.0 found: YES 2.78.0
Run-time dependency gmodule-2.0 found: YES 2.78.0
Run-time dependency gtk+-3.0 found: YES 3.24.38
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency gtk-mac-integration found: NO (tried pkgconfig)

meson.build:26:22: ERROR: Dependency "gtk-mac-integration" not found, tried pkgconfig

A full log can be found at /home/tkloczko/rpmbuild/BUILD/geany-2.0.0/x86_64-redhat-linux-gnu/meson-logs/meson-log.txt
@techee
Copy link
Member

techee commented Oct 23, 2023

This appears as if you explicitly enabled it somehow using -Dmac-integration=enabled or auto_features=enabled.

What is the last --m option? I have only meson 1.0.1 and this one is unrecognised.

@kloczek
Copy link
Author

kloczek commented Oct 23, 2023

It was --mandir=/usr/share/man

+ /usr/bin/meson setup --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled
. x86_64-redhat-linux-gnu -D api-docs=enabled -D gtkdoc=true -D html-docs=enabled -D pdf-docs=disabled -D plugins=true -D socket=true -D vte=true
The Meson build system
Version: 1.2.3
Source dir: /home/tkloczko/rpmbuild/BUILD/geany-2.0.0
Build dir: /home/tkloczko/rpmbuild/BUILD/geany-2.0.0/x86_64-redhat-linux-gnu
Build type: native build
Project name: geany
Project version: 2.0.0
C compiler for the host machine: /usr/bin/gcc (gcc 13.2.1 "gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)")
C linker for the host machine: /usr/bin/gcc ld.bfd 2.41-7
C++ compiler for the host machine: /usr/bin/g++ (gcc 13.2.1 "g++ (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)")
C++ linker for the host machine: /usr/bin/g++ ld.bfd 2.41-7
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (2.0.3)
Run-time dependency glib-2.0 found: YES 2.78.0
Run-time dependency gmodule-2.0 found: YES 2.78.0
Run-time dependency gtk+-3.0 found: YES 3.24.38
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency gtk-mac-integration found: NO (tried pkgconfig)

Even with --auto-features=enabled MAC related things should be only checked on MAC.

@b4n
Copy link
Member

b4n commented Oct 30, 2023

Even with --auto-features=enabled MAC related things should be only checked on MAC.

Sounds reasonable to me; and --auto-features=enabled seems useful to make sure a (potentially new) dependency is not missed.

Would something like this work?

diff --git a/meson.build b/meson.build
index 5c7bc0a04..e5b55aebe 100644
--- a/meson.build
+++ b/meson.build
@@ -23,9 +23,6 @@ foreach dep : deps_in
 	deps_for_pc += ' ' + dep[0] + ' >= ' + dep[1]
 endforeach
 
-dep_mac_integration = dependency('gtk-mac-integration', version: '>= 3.0.1',
-	required: get_option('mac-integration'))
-
 glib = deps[0]
 
 # detect libc
@@ -741,6 +738,17 @@ if (host_machine.system() == 'windows')
 	endforeach
 endif
 
+osx_src = []
+osx_deps = []
+if host_machine.system() == 'darwin'
+	dep_mac_integration = dependency('gtk-mac-integration', version: '>= 3.0.1',
+		required: get_option('mac-integration'))
+	if dep_mac_integration.found()
+		osx_src += ['src/osx.c', 'src/osx.h']
+		osx_deps += [dep_mac_integration]
+	endif
+endif
+
 install_headers(
 	'plugins/geanyfunctions.h',
 	'plugins/geanyplugin.h',
@@ -857,12 +865,12 @@ libgeany = shared_library('geany',
 	'src/utils.h',
 	gen_src,
 	win_src,
-	dep_mac_integration.found() ? ['src/osx.c', 'src/osx.h'] : [],
+	osx_src,
 	host_machine.system() == 'windows' ? ['src/win32.c',  'src/win32.h'] : [ 'src/vte.c', 'src/vte.h' ],
 	soversion: '0',
 	c_args: geany_cflags + [ '-DG_LOG_DOMAIN="Geany"' ],
 	include_directories: [iscintilla],
-	dependencies: [dep_tagmanager, dep_ctags, dep_scintilla, dep_mac_integration] + deps + win_deps,
+	dependencies: [dep_tagmanager, dep_ctags, dep_scintilla] + deps + win_deps + osx_deps,
 	install: true
 )
 dep_libgeany = declare_dependency(

@techee
Copy link
Member

techee commented Nov 1, 2023

@b4n Thanks! Just tested and it fixes the problem on linux and does the right thing on macOS too. So I think you can just commit the patch to master.

@b4n b4n closed this as completed in fb202dc Nov 2, 2023
@b4n b4n added this to the 2.1 (or something?) milestone Nov 2, 2023
@b4n
Copy link
Member

b4n commented Nov 2, 2023

@techee thanks for the test! Committed, as well as 2 additional small improvements, that nobody else tested, so I have a chance to have introduced a big stupid error 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants