-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[gtk] Conan 2.x migration #29172
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
base: master
Are you sure you want to change the base?
[gtk] Conan 2.x migration #29172
Conversation
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
recipes/gdk-pixbuf/all/conanfile.py
Outdated
| replace_in_file(self, gdk_meson_build, | ||
| "dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ],", | ||
| "dependencies: loaders_deps + gdk_pixbuf_deps + [ gdkpixbuf_dep ],") | ||
| if Version(self.version) < "2.44.4": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fixed already in the new versions: https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/blob/2.44.4/gdk-pixbuf/meson.build?ref_type=tags#L162
| pkgconfig_vars = {"graphene_has_gcc": 1 if self.settings.compiler == "gcc" else 0, | ||
| "graphene_has_sse2": 1 if str(self.settings.arch) in ["x86", "x86_64"] else 0, | ||
| "graphene_has_neon": 1 if str(self.settings.arch).startswith("arm") else 0, | ||
| "graphene_has_scalar": 1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scalar is enabled by default: https://github.com/ebassi/graphene/blob/1.10.8/meson.build#L409
gcc requires gcc: https://github.com/ebassi/graphene/blob/1.10.8/meson.build#L409
neon requires a default enabled option + an arm build to validate: https://github.com/ebassi/graphene/blob/1.10.8/meson.build#L359.
sse2 requires a default enabled option + an build to validate: https://github.com/ebassi/graphene/blob/1.10.8/meson.build#L294
|
|
||
| include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
| conan_basic_setup() | ||
| find_package(gtk REQUIRED CONFIG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMake recommends using pkg_check_modules for GTK:
https://cmake.org/cmake/help/latest/module/FindGTK2.html#examples-finding-gtk-version-3-or-later
The GTK project does not generate .cmake files as well.
| env = VirtualRunEnv(self) | ||
| env.generate(scope="build") | ||
|
|
||
| tc = MesonToolchain(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
|
I'm able to build on Mac + static: gtk-4.18.6-mac-armv8-clang17-rel-static.log For shared I'm still investigating a linkage error. |
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
| replace_in_file(self, meson_build, "subdir('tools')", "") | ||
| replace_in_file(self, meson_build, "subdir('utils')", "") | ||
| replace_in_file(self, meson_build, "subdir('examples')", "") | ||
| if Version(self.version) < "1.54.0": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tc.extra_cflags.append("-Wno-error") is not enough, the project compiler flags override what is defined by Conan meson toolchain file.
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
Signed-off-by: Uilian Ries <[email protected]>
| @@ -1,4 +1,7 @@ | |||
| sources: | |||
| "1.18.4": | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GTK4 requires Cairo >=1.18.2: https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/meson.build?ref_type=tags#L25
Pango requires Cairo >=1.18.0: https://gitlab.gnome.org/GNOME/pango/-/blob/1.57.0/meson.build?ref_type=tags#L218
|
|
||
| # Dependency freetype2 found: NO found 2.11.0 but need: '>= 9.7.3' | ||
| if self.options.with_freetype: | ||
| source_freetype_version = "9.7.3" if Version(self.version) < "1.18.4" else "23.0.17" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hard to track Cairo without a public git browse. Here Cairo's 1.18.4 Meson build file: [meson.build](https://github.com/user-attachments/files/24292774/
meson.build.txt)
It requires Freetype >=23.0.17
Fontconfig >=2.13.0. Still, the version range is to avoid version conflict as spotted locally
Glib >=2.14 but using version ranges to avoid conflict with GTK needing a newer version.
| @@ -1,4 +1,7 @@ | |||
| sources: | |||
| "2.17.1": | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pango 1.57.0 wants fontconfig >=2.17.0: https://gitlab.gnome.org/GNOME/pango/-/blob/1.57.0/meson.build?ref_type=tags#L216
Signed-off-by: Uilian Ries <[email protected]>
| "4.18.6": | ||
| folder: all | ||
| "system": | ||
| folder: "system" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove gtk/system too? The only "advantage" is installing GTK-2 and GTK-3.
| self.cpp_info.system_libs.append(libcxx) | ||
| self.cpp_info.components["core"].system_libs.append(libcxx) | ||
|
|
||
| if self.options.with_icu: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a housekeeping, but exposing those expected .pc files. GTK-4 expects harfbuzz-subset.pc
| @@ -1,4 +1,7 @@ | |||
| sources: | |||
| "2.17.1": | |||
| url: "https://gitlab.freedesktop.org/api/v4/projects/890/packages/generic/fontconfig/2.17.1/fontconfig-2.17.1.tar.xz" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The download link changed: https://www.freedesktop.org/wiki/Software/fontconfig/
The current stable series is 2.17.0. Releases until 2.16.0 are available in the release directory and Releases after that are available in the GitLab.
|
Linux test package failed due to a missing system runtime library. In terms of changes, this PR is ready for review. |
Summary
Changes to recipe: gtk/4.18.6
Motivation
The current Conan recipe for GTK needs to be ported for Conan 2.x
Details
This is a WIP, but I'm able to build it on Linux so far. Unfortunately, I could not cross-build for ARMv8 nor for Android due to compilation errors, but related to its dependencies.
The latest stable GTK-4 version is 4.20.4 (see https://www.gtk.org/), however, since 4.19.2 the dependency rsvg was introduced (https://gitlab.gnome.org/GNOME/gtk/-/commit/afa0d2341a442d356f91ee0a9f7b168cf14d628a) and we still don't have it available in ConanCenterIndex. Then the version 4.18.6 is latest that we can build without that.
When building GTK, it resulted in a massive version conflict, mostly due glib: It requires version 2.80: https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/meson.build?ref_type=tags#L15 And its dependencies are using 2.78 mostly.
For Cairo, the required version is 1.18.2 (https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/meson.build?ref_type=tags#L25), but only 1.18.0 is available in CCI. Which resulted in a bump version.
But when building Cairo 1.18.2, it resulted in it requires fontconfig 2.13 (https://gitlab.com/freedesktop-sdk/mirrors/freedesktop/cairo/cairo/-/blob/1.18.4/meson.build?ref_type=tags#L11), which is available in CCI, but later, Pango 1.57.0 requires fontconfig 2.17.0, which resulted in a bump version as well
In a following step, GTK needs some variables available in Graphene .pc file (https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/meson.build?ref_type=tags#L731), but we don't expose them, resulting in an error during GTK setup. I added those expected variables in the Graphene, but I'm not 100% sure, as those variables are evaluated by the consumer and may differ from the built package.
Both Harfbuzz library and its subset library are required by GTK too (https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/meson.build?ref_type=tags#L435), but subset is not enabled by default. Only enabling it is not enough; it should generate a .pc as well and the upstream generates one: https://github.com/harfbuzz/harfbuzz/blob/11.4.1/CMakeLists.txt#L982
The Pango dependency also requires a newer version than available in CCI 1.56.0 (https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/meson.build?ref_type=tags#L18). I updated it as well in a new bump version.
The wayland package also resulted in a version conflict; GTK requires 1.23.0 (https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/meson.build?ref_type=tags#L28), needed to update xkbcommon recipes to fix the conflict.
The GTK only generates a shared library: https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.6/gtk/meson.build?ref_type=tags#L1128. Other libraries are static and private libraries; they are linked to the shared library in the end.
Linux build logs:
Still need to validate it on Mac and Windows and a clean-up.
Add a 👍 reaction to pull requests you find important to help the team prioritize, thanks!