Skip to content

Commit a9d13de

Browse files
authored
Merge pull request #6812 from BOINC/vko_add_custom_gtk3_port
[linux] Add custom gtk3 vcpkg port
2 parents cc88777 + f383141 commit a9d13de

File tree

5 files changed

+315
-0
lines changed

5 files changed

+315
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/meson.build b/meson.build
2+
index 397ea07..dd6b888 100644
3+
--- a/meson.build
4+
+++ b/meson.build
5+
@@ -997,7 +997,7 @@ subdir('docs/reference')
6+
7+
install_data('m4macros/gtk-3.0.m4', install_dir: join_paths(get_option('datadir'), 'aclocal'))
8+
9+
-if not meson.is_cross_build()
10+
+if false
11+
gnome.post_install(
12+
glib_compile_schemas: true,
13+
gio_querymodules: gio_module_dirs,
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
diff --git a/gtk/meson.build b/gtk/meson.build
2+
index ea866d8..0d312f3 100644
3+
--- a/gtk/meson.build
4+
+++ b/gtk/meson.build
5+
@@ -1102,6 +1102,7 @@ gtk_query_settings = executable(
6+
'gtk-query-settings.c',
7+
c_args: gtk_cargs,
8+
dependencies: libgtk_dep,
9+
+ link_language: 'cpp',
10+
install: true
11+
)
12+
gtk_tools += gtk_query_settings
13+
@@ -1111,6 +1112,7 @@ gtk_builder_tool = executable(
14+
'gtk-builder-tool.c',
15+
c_args: gtk_cargs,
16+
dependencies: libgtk_dep,
17+
+ link_language: 'cpp',
18+
install: true
19+
)
20+
gtk_tools += gtk_builder_tool
21+
@@ -1143,6 +1145,7 @@ gtk_update_icon_cache = executable(
22+
extra_update_icon_cache_objs,
23+
c_args: gtk_cargs,
24+
dependencies: libgtk_dep,
25+
+ link_language: 'cpp',
26+
install: true
27+
)
28+
gtk_tools += gtk_update_icon_cache
29+
@@ -1153,6 +1156,7 @@ gtk_query_immodules = executable(
30+
'gtkutils.c',
31+
c_args: gtk_cargs,
32+
dependencies: libgtk_dep,
33+
+ link_language: 'cpp',
34+
install: true
35+
)
36+
gtk_tools += gtk_query_immodules
37+
@@ -1162,6 +1166,7 @@ gtk_encode_symbolic_svg = executable(
38+
'encodesymbolic.c',
39+
c_args: gtk_cargs,
40+
dependencies: libgtk_dep,
41+
+ link_language: 'cpp',
42+
install: true
43+
)
44+
gtk_tools += gtk_encode_symbolic_svg
45+
@@ -1171,6 +1176,7 @@ gtk_launch = executable(
46+
'gtk-launch.c',
47+
c_args: gtk_cargs,
48+
dependencies: libgtk_dep,
49+
+ link_language: 'cpp',
50+
install: true
51+
)
52+
gtk_tools += gtk_launch
53+
diff --git a/meson.build b/meson.build
54+
index dd6b888..e60ad30 100644
55+
--- a/meson.build
56+
+++ b/meson.build
57+
@@ -1,4 +1,4 @@
58+
-project('gtk', 'c',
59+
+project('gtk', 'c', 'cpp',
60+
version: '3.24.51',
61+
default_options: [
62+
'buildtype=debugoptimized',
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c
2+
index b1cbfa2c047dac8a73002120ffe4130f557cf82f..0021f8cdb5000d2ae0b70a22f6539c47e79a5e9d 100644
3+
--- a/gdk/win32/gdkglcontext-win32.c
4+
+++ b/gdk/win32/gdkglcontext-win32.c
5+
@@ -833,7 +833,7 @@ gdk_win32_gl_context_realize_wgl (GdkGLContext *context,
6+
return TRUE;
7+
}
8+
9+
-static gboolean
10+
+gboolean
11+
gdk_win32_display_is_wgl_context_current (GdkDisplay *display,
12+
GdkGLContext *context)
13+
{
14+
@@ -1313,7 +1313,8 @@ gdk_win32_window_invalidate_egl_framebuffer (GdkWindow *window)
15+
}
16+
}
17+
18+
-static gboolean
19+
+#ifdef GDK_WIN32_ENABLE_EGL
20+
+gboolean
21+
gdk_win32_display_is_egl_context_current (GdkDisplay *display,
22+
GdkGLContext *context)
23+
{
24+
@@ -1321,6 +1322,9 @@ gdk_win32_display_is_egl_context_current (GdkDisplay *display,
25+
26+
return context_egl->egl_context == eglGetCurrentContext ();
27+
}
28+
+#else
29+
+#define gdk_win32_display_is_egl_context_current(disp,ctx) FALSE
30+
+#endif
31+
32+
static gboolean
33+
gdk_win32_display_make_egl_context_current (GdkDisplay *display,
34+
diff --git a/gdk/win32/gdkglcontext-win32.h b/gdk/win32/gdkglcontext-win32.h
35+
index 793a3ef4ffaa1fa2ba3d46b5a0ecfdf2ccb576fa..69d5d63166287360115aeec5cafbce264653f04c 100644
36+
--- a/gdk/win32/gdkglcontext-win32.h
37+
+++ b/gdk/win32/gdkglcontext-win32.h
38+
@@ -61,6 +61,18 @@ gboolean
39+
gdk_win32_display_is_gl_context_current (GdkDisplay *display,
40+
GdkGLContext *context);
41+
42+
+gboolean
43+
+gdk_win32_display_is_wgl_context_current (GdkDisplay *display,
44+
+ GdkGLContext *context);
45+
+
46+
+#ifdef GDK_WIN32_ENABLE_EGL
47+
+gboolean
48+
+gdk_win32_display_is_egl_context_current (GdkDisplay *display,
49+
+ GdkGLContext *context);
50+
+#else
51+
+#define gdk_win32_display_is_egl_context_current(disp,ctx) FALSE
52+
+#endif
53+
+
54+
gboolean
55+
gdk_win32_display_make_gl_context_current (GdkDisplay *display,
56+
GdkGLContext *context);
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
set(warning_length 24)
2+
string(LENGTH "${CURRENT_BUILDTREES_DIR}" buildtrees_path_length)
3+
if(buildtrees_path_length GREATER warning_length AND CMAKE_HOST_WIN32)
4+
message(WARNING "${PORT}'s buildsystem uses very long paths and may fail on your system.\n"
5+
"We recommend moving vcpkg to a short path such as 'C:\\vcpkg' or using the subst command."
6+
)
7+
endif()
8+
9+
string(REGEX MATCH [[^[0-9][0-9]*\.[1-9][0-9]*]] VERSION_MAJOR_MINOR ${VERSION})
10+
vcpkg_download_distfile(ARCHIVE
11+
URLS
12+
"https://download.gnome.org/sources/gtk/${VERSION_MAJOR_MINOR}/gtk-${VERSION}.tar.xz"
13+
"https://www.mirrorservice.org/sites/ftp.gnome.org/pub/GNOME/sources/gtk/${VERSION_MAJOR_MINOR}/gtk-${VERSION}.tar.xz"
14+
FILENAME "GNOME-gtk-${VERSION}.tar.xz"
15+
SHA512 f96ee1c586284af315709ec38e841bd1b2558d09e2162834a132ffc4bbcddca272a92a828550a3accaa3e4da1964ad32b3b48291e929a108a913bd18c61cd73b
16+
)
17+
18+
vcpkg_extract_source_archive(SOURCE_PATH
19+
ARCHIVE "${ARCHIVE}"
20+
PATCHES
21+
0001-build.patch
22+
cairo-cpp-linkage.patch
23+
egl-conditional.diff # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9067
24+
)
25+
26+
vcpkg_find_acquire_program(PKGCONFIG)
27+
get_filename_component(PKGCONFIG_DIR "${PKGCONFIG}" DIRECTORY )
28+
vcpkg_add_to_path("${PKGCONFIG_DIR}") # Post install script runs pkg-config so it needs to be on PATH
29+
vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/glib/")
30+
vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/gdk-pixbuf")
31+
vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/gettext/bin")
32+
33+
34+
if("introspection" IN_LIST FEATURES)
35+
list(APPEND OPTIONS_RELEASE -Dintrospection=true)
36+
vcpkg_get_gobject_introspection_programs(PYTHON3 GIR_COMPILER GIR_SCANNER)
37+
else()
38+
list(APPEND OPTIONS_RELEASE -Dintrospection=false)
39+
endif()
40+
41+
list(APPEND OPTIONS -Dwayland_backend=false)
42+
43+
vcpkg_configure_meson(
44+
SOURCE_PATH "${SOURCE_PATH}"
45+
OPTIONS
46+
${OPTIONS}
47+
-Ddemos=false
48+
-Dexamples=false
49+
-Dtests=false
50+
-Dgtk_doc=false
51+
-Dman=false
52+
-Dxinerama=no # Enable support for the X11 Xinerama extension
53+
-Dcloudproviders=false # Enable the cloudproviders support
54+
-Dprofiler=false # include tracing support for sysprof
55+
-Dtracker3=false # Enable Tracker3 filechooser search
56+
-Dcolord=no # Build colord support for the CUPS printing backend
57+
OPTIONS_RELEASE
58+
${OPTIONS_RELEASE}
59+
OPTIONS_DEBUG
60+
-Dintrospection=false
61+
ADDITIONAL_BINARIES
62+
"glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'"
63+
"glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'"
64+
"glib-compile-resources='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-resources${VCPKG_HOST_EXECUTABLE_SUFFIX}'"
65+
"gdbus-codegen='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/gdbus-codegen'"
66+
"glib-compile-schemas='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-schemas${VCPKG_HOST_EXECUTABLE_SUFFIX}'"
67+
"g-ir-compiler='${GIR_COMPILER}'"
68+
"g-ir-scanner='${GIR_SCANNER}'"
69+
)
70+
71+
# Reduce command line lengths, in particular for static windows builds.
72+
foreach(dir IN ITEMS "${TARGET_TRIPLET}-dbg" "${TARGET_TRIPLET}-rel")
73+
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${dir}/build.ninja")
74+
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${dir}/build.ninja" "/${dir}/../src/" "/src/")
75+
endif()
76+
endforeach()
77+
vcpkg_install_meson(ADD_BIN_TO_PATH)
78+
79+
vcpkg_copy_pdbs()
80+
81+
vcpkg_fixup_pkgconfig()
82+
83+
set(GTK_TOOLS
84+
gtk-builder-tool
85+
gtk-encode-symbolic-svg
86+
gtk-launch
87+
gtk-query-immodules-3.0
88+
gtk-query-settings
89+
gtk-update-icon-cache
90+
)
91+
vcpkg_copy_tools(TOOL_NAMES ${GTK_TOOLS} AUTO_CLEAN)
92+
93+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/etc")
94+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
95+
96+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"name": "gtk3",
3+
"version": "3.24.51",
4+
"port-version": 1,
5+
"description": "Portable library for creating graphical user interfaces.",
6+
"homepage": "https://www.gtk.org/",
7+
"license": null,
8+
"supports": "!android",
9+
"dependencies": [
10+
{
11+
"name": "at-spi2-atk",
12+
"platform": "linux"
13+
},
14+
"atk",
15+
{
16+
"name": "cairo",
17+
"default-features": false,
18+
"features": [
19+
"gobject"
20+
]
21+
},
22+
{
23+
"name": "cairo",
24+
"default-features": false,
25+
"features": [
26+
"x11"
27+
],
28+
"platform": "linux | freebsd | openbsd"
29+
},
30+
{
31+
"name": "gdk-pixbuf",
32+
"host": true
33+
},
34+
"gdk-pixbuf",
35+
{
36+
"name": "gettext",
37+
"host": true,
38+
"default-features": false,
39+
"features": [
40+
"tools"
41+
]
42+
},
43+
"gettext-libintl",
44+
"glib",
45+
{
46+
"name": "glib",
47+
"host": true
48+
},
49+
"libepoxy",
50+
"libxi",
51+
"libxrandr",
52+
"pango",
53+
{
54+
"name": "vcpkg-tool-meson",
55+
"host": true
56+
}
57+
],
58+
"features": {
59+
"introspection": {
60+
"description": "Build with introspection",
61+
"supports": "!static",
62+
"dependencies": [
63+
{
64+
"name": "atk",
65+
"default-features": false,
66+
"features": [
67+
"introspection"
68+
]
69+
},
70+
{
71+
"name": "gdk-pixbuf",
72+
"default-features": false,
73+
"features": [
74+
"introspection"
75+
]
76+
},
77+
"gobject-introspection",
78+
{
79+
"name": "pango",
80+
"default-features": false,
81+
"features": [
82+
"introspection"
83+
]
84+
}
85+
]
86+
}
87+
}
88+
}

0 commit comments

Comments
 (0)