blob: 47cdb83dce66f78569d5f3b17f1b800f60565181 [file] [log] [blame]
Andrew Geissler475cb722020-07-10 16:00:51 -05001
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002SUMMARY = "Multi-platform toolkit for creating GUIs"
3DESCRIPTION = "GTK+ is a multi-platform toolkit for creating graphical user interfaces. Offering a complete \
4set of widgets, GTK+ is suitable for projects ranging from small one-off projects to complete application suites."
5HOMEPAGE = "http://www.gtk.org"
6BUGTRACKER = "https://bugzilla.gnome.org/"
7SECTION = "libs"
8
9DEPENDS = "glib-2.0 cairo pango atk jpeg libpng gdk-pixbuf \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010 gdk-pixbuf-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
12LICENSE = "LGPLv2 & LGPLv2+ & LGPLv2.1+"
13
Brad Bishop6dbb3162019-11-25 09:41:34 -050014inherit autotools gettext pkgconfig gtk-doc update-alternatives gtk-immodules-cache gsettings features_check gobject-introspection
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015
Brad Bishop19323692019-04-05 15:28:33 -040016BBCLASSEXTEND = "native nativesdk"
17
Patrick Williams213cb262021-08-07 19:21:33 -050018GSETTINGS_PACKAGE:class-native = ""
Brad Bishop19323692019-04-05 15:28:33 -040019
Brad Bishopd7bf8c12018-02-25 22:55:05 -050020# versions >= 3.90 are development versions, otherwise like upstream-version-is-even
21UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>3\.([1-8]?[02468])+(\.\d+)+)\.tar"
22
Patrick Williamsf1e5d692016-03-30 15:21:19 -050023ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024
25# This should be in autotools.bbclass, but until something elses uses it putting
26# it here avoids rebuilding everything.
27export PKG_CONFIG_FOR_BUILD = "${STAGING_BINDIR_NATIVE}/pkg-config-native"
28
Patrick Williams213cb262021-08-07 19:21:33 -050029do_configure:prepend() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030 # Do this because the configure script is running ./libtool directly
31 rm -f libtool
32 ln -s ${TARGET_PREFIX}libtool libtool
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033 #delete a file that will get confused with generated one in ${B}
34 rm -f ${S}/gtk/gtktypefuncs.c
Andrew Geissler475cb722020-07-10 16:00:51 -050035
36 # These files are generated by wayland-scanner but will race over modification
37 # time between the copies in the sysroot from wayland-protocols and the copy
38 # in the source tree. Solve the race by deleting so they need to be regenerated.
39 # 3.24.22 will not be shipping these files so this can be deleted then:
40 # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2183
41 rm -f ${S}/modules/input/text-input-unstable-v3*.[ch]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042}
43
44EXTRA_OECONF += " \
45 --disable-glibtest \
46 --disable-xinerama \
47 --enable-modules \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048 ${@bb.utils.contains("DISTRO_FEATURES", "x11", "", "--disable-gtk-doc", d)} \
49 "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050
Patrick Williams213cb262021-08-07 19:21:33 -050051do_compile:prepend() {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050052 export GIR_EXTRA_LIBS_PATH="${B}/gdk/.libs"
53}
54
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl wayland x11', d)} \
56 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'glx', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -050057PACKAGECONFIG:class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
58PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059
60PACKAGECONFIG[x11] = "--enable-x11-backend,--disable-x11-backend,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060061# this is provided by oe-core patch that removes epoxy/gl dependency from a X11 build
62PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,libepoxy"
Patrick Williamsf1e5d692016-03-30 15:21:19 -050063PACKAGECONFIG[glx] = "--enable-glx,--disable-glx,,libgl"
Brad Bishopa34c0302019-09-23 22:34:48 -040064PACKAGECONFIG[wayland] = "--enable-wayland-backend,--disable-wayland-backend,wayland wayland-protocols libxkbcommon virtual/egl virtual/libgles2 wayland-native"
Brad Bishop19323692019-04-05 15:28:33 -040065PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups"
Andrew Geissler82c905d2020-04-13 13:39:40 -050066PACKAGECONFIG[colord] = "--enable-colord,--disable-colord,colord"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067
Brad Bishop19323692019-04-05 15:28:33 -040068prepare_gtk_scripts() {
69 mv ${D}${bindir}/gtk-update-icon-cache ${D}${bindir}/gtk-update-icon-cache-3.0
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080070
71 # duplicate gtk-query-immodules for post install script update_gtk_immodules_cache
72 mkdir -p ${D}${libexecdir}
73 ln ${D}${bindir}/gtk-query-immodules-3.0 ${D}${libexecdir}/${MLPREFIX}gtk-query-immodules-3.0
Patrick Williamsc124f4f2015-09-15 14:41:29 -050074}
75
Patrick Williams213cb262021-08-07 19:21:33 -050076do_install:append:class-target() {
Brad Bishop19323692019-04-05 15:28:33 -040077 prepare_gtk_scripts
78}
79
Patrick Williams213cb262021-08-07 19:21:33 -050080do_install:append:class-nativesdk() {
Brad Bishop19323692019-04-05 15:28:33 -040081 prepare_gtk_scripts
82}
83
Patrick Williams213cb262021-08-07 19:21:33 -050084do_install:append:class-native() {
Brad Bishop19323692019-04-05 15:28:33 -040085 create_wrapper ${D}/${bindir}/gtk-update-icon-cache \
86 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/2.10.0/loaders.cache
87 create_wrapper ${D}/${bindir}/gtk-encode-symbolic-svg \
88 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/2.10.0/loaders.cache
89}
90
91PROVIDES += "gtk-icon-utils"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092PACKAGES =+ "${PN}-demo"
93LIBV = "3.0.0"
94
Patrick Williams213cb262021-08-07 19:21:33 -050095FILES:${PN}-demo = "${bindir}/gtk3-demo \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096 ${bindir}/gtk3-demo-application \
97 ${bindir}/gtk3-icon-browser \
98 ${bindir}/gtk3-widget-factory \
99 ${datadir}/gtk-3.0/demo \
100 ${datadir}/applications/gtk3-demo.desktop \
101 ${datadir}/applications/gtk3-icon-browser.desktop \
102 ${datadir}/applications/gtk3-widget-factory.desktop \
103 ${datadir}/icons/hicolor/*/apps/gtk3-demo*.png \
104 ${datadir}/icons/hicolor/*/apps/gtk3-widget-factory*.png"
105
Patrick Williams213cb262021-08-07 19:21:33 -0500106FILES:${PN}:append = " ${bindir}/gtk-update-icon-cache-3.0 \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500107 ${bindir}/gtk-query-immodules-3.0 \
108 ${bindir}/gtk-launch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109 ${datadir}/themes ${sysconfdir} ${datadir}/glib-2.0/schemas/ \
110 ${libdir}/gtk-3.0/${LIBV}/engines/libpixmap.so \
111 ${libdir}/gtk-3.0/modules/*.so"
112
Patrick Williams213cb262021-08-07 19:21:33 -0500113FILES:${PN}-dev += " \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500114 ${datadir}/gtk-3.0/gtkbuilder.rng \
115 ${datadir}/gtk-3.0/include \
Andrew Geissler4ed12e12020-06-05 18:00:41 -0500116 ${datadir}/gtk-3.0/valgrind \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600117 ${datadir}/gettext/its \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500118 ${libdir}/gtk-3.0/include \
119 ${libdir}/gtk-3.0/${LIBV}/loaders/*.la \
120 ${libdir}/gtk-3.0/${LIBV}/immodules/*.la \
121 ${libdir}/gtk-3.0/3.0.0/printbackends/*.la \
122 ${libdir}/gtk-3.0/${LIBV}/engines/*.la \
123 ${libdir}/gtk-3.0/modules/*.la \
124 ${bindir}/gtk-builder-convert \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500125 ${bindir}/gtk-encode-symbolic-svg \
126 ${bindir}/gtk-builder-tool \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600127 ${bindir}/gtk-query-settings \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500128 "
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600130GTKBASE_RRECOMMENDS ?= "liberation-fonts \
131 gdk-pixbuf-loader-png \
132 gdk-pixbuf-loader-jpeg \
133 gdk-pixbuf-loader-gif \
134 gdk-pixbuf-loader-xpm \
135 shared-mime-info \
136 adwaita-icon-theme-symbolic \
137 "
Brad Bishop19323692019-04-05 15:28:33 -0400138
Patrick Williams213cb262021-08-07 19:21:33 -0500139GTKBASE_RRECOMMENDS:class-native ?= "\
Brad Bishop19323692019-04-05 15:28:33 -0400140 "
141
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600142GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1"
143
Patrick Williams213cb262021-08-07 19:21:33 -0500144RRECOMMENDS:${PN} = "${GTKBASE_RRECOMMENDS}"
145RRECOMMENDS:${PN}:libc-glibc = "${GTKGLIBC_RRECOMMENDS}"
146RDEPENDS:${PN}-dev += "${@bb.utils.contains("PACKAGECONFIG", "wayland", "wayland-protocols", "", d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500147
148PACKAGES_DYNAMIC += "^gtk3-immodule-.* ^gtk3-printbackend-.*"
149
Patrick Williams213cb262021-08-07 19:21:33 -0500150ALTERNATIVE:${PN} = "gtk-update-icon-cache"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500151ALTERNATIVE_TARGET[gtk-update-icon-cache] = "${bindir}/gtk-update-icon-cache-3.0"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500152ALTERNATIVE_PRIORITY = "30"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500153
Patrick Williams213cb262021-08-07 19:21:33 -0500154python populate_packages:prepend () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500155 import os.path
156
157 gtk_libdir = d.expand('${libdir}/gtk-3.0/${LIBV}')
158 immodules_root = os.path.join(gtk_libdir, 'immodules')
159 printmodules_root = os.path.join(gtk_libdir, 'printbackends');
160
Brad Bishop19323692019-04-05 15:28:33 -0400161 immodules = do_split_packages(d, immodules_root, r'^im-(.*)\.so$', 'gtk3-immodule-%s', 'GTK input module for %s')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162 if immodules:
163 d.setVar("GTKIMMODULES_PACKAGES", " ".join(immodules))
164
Brad Bishop19323692019-04-05 15:28:33 -0400165 do_split_packages(d, printmodules_root, r'^libprintbackend-(.*)\.so$', 'gtk3-printbackend-%s', 'GTK printbackend module for %s')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500166
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500167 if (d.getVar('DEBIAN_NAMES')):
Patrick Williams213cb262021-08-07 19:21:33 -0500168 d.setVar(d.expand('PKG:${PN}'), '${MLPREFIX}libgtk-3.0')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500169}