gtk+-2.24.33-r4.ebuild (9747B)
1 # Copyright 1999-2024 Gentoo Authors 2 # Distributed under the terms of the GNU General Public License v2 3 4 EAPI=8 5 GNOME2_EAUTORECONF="yes" 6 7 inherit flag-o-matic gnome2 multilib multilib-minimal readme.gentoo-r1 virtualx 8 9 DESCRIPTION="Gimp ToolKit +" 10 HOMEPAGE="https://www.gtk.org/" 11 12 LICENSE="LGPL-2+" 13 SLOT="2" 14 IUSE="aqua cups examples +introspection test vim-syntax xinerama" 15 REQUIRED_USE=" 16 xinerama? ( !aqua ) 17 " 18 19 KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris" 20 21 # Upstream wants us to do their job: 22 # https://bugzilla.gnome.org/show_bug.cgi?id=768663#c1 23 RESTRICT="test" 24 25 # >=app-accessibility/at-spi2-core-2.46.0[introspection?,${MULTILIB_USEDEP}] 26 COMMON_DEPEND=" 27 >=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}] 28 >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] 29 virtual/libintl[${MULTILIB_USEDEP}] 30 >=x11-libs/cairo-1.12.14-r4:=[aqua?,svg(+),${MULTILIB_USEDEP}] 31 >=x11-libs/gdk-pixbuf-2.30.7:2[introspection?,${MULTILIB_USEDEP}] 32 >=x11-libs/pango-1.36.3[introspection?,${MULTILIB_USEDEP}] 33 x11-misc/shared-mime-info 34 35 cups? ( >=net-print/cups-1.7.1-r2:=[${MULTILIB_USEDEP}] ) 36 introspection? ( >=dev-libs/gobject-introspection-0.9.3:= ) 37 !aqua? ( 38 >=x11-libs/cairo-1.12.14-r4:=[aqua?,svg(+),X,${MULTILIB_USEDEP}] 39 >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}] 40 >=x11-libs/libXcomposite-0.4.4-r1[${MULTILIB_USEDEP}] 41 >=x11-libs/libXcursor-1.1.14[${MULTILIB_USEDEP}] 42 >=x11-libs/libXdamage-1.1.4-r1[${MULTILIB_USEDEP}] 43 >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}] 44 >=x11-libs/libXfixes-5.0.1[${MULTILIB_USEDEP}] 45 >=x11-libs/libXi-1.7.2[${MULTILIB_USEDEP}] 46 >=x11-libs/libXrandr-1.5[${MULTILIB_USEDEP}] 47 >=x11-libs/libXrender-0.9.8[${MULTILIB_USEDEP}] 48 xinerama? ( >=x11-libs/libXinerama-1.1.3[${MULTILIB_USEDEP}] ) 49 ) 50 " 51 DEPEND="${COMMON_DEPEND} 52 !aqua? ( x11-base/xorg-proto ) 53 test? ( 54 media-fonts/font-cursor-misc 55 media-fonts/font-misc-misc 56 x11-themes/hicolor-icon-theme 57 ) 58 " 59 60 # >=dev-util/gtk-update-icon-cache-2 61 # >=x11-themes/adwaita-icon-theme-3.14 62 # x11-themes/gnome-themes-standard 63 RDEPEND="${COMMON_DEPEND}" 64 # librsvg for svg icons (PDEPEND to avoid circular dep), bug #547710 65 # x11-themes/gtk-engines-adwaita 66 PDEPEND=" 67 gnome-base/librsvg[${MULTILIB_USEDEP}] 68 vim-syntax? ( app-vim/gtk-syntax ) 69 " 70 # docbook-4.1.2 and xsl required for man pages 71 # docbook-4.3 required for gtk-doc 72 # app-text/docbook-xml-dtd:4.1.2 73 # app-text/docbook-xml-dtd:4.3 74 # app-text/docbook-xsl-stylesheets 75 # dev-libs/gobject-introspection-common 76 # dev-libs/libxslt 77 # >=dev-build/gtk-doc-am-1.20 78 BDEPEND=" 79 dev-util/glib-utils 80 >=sys-devel/gettext-0.18.3 81 virtual/pkgconfig 82 examples? ( x11-libs/gdk-pixbuf ) 83 " 84 85 DISABLE_AUTOFORMATTING="yes" 86 DOC_CONTENTS="To make the gtk2 file chooser use 'current directory' mode by default, 87 edit ~/.config/gtk-2.0/gtkfilechooser.ini to contain the following: 88 [Filechooser Settings] 89 StartupMode=cwd" 90 91 MULTILIB_CHOST_TOOLS=( 92 /usr/bin/gtk-query-immodules-2.0$(get_exeext) 93 ) 94 95 PATCHES=( 96 # Fix tests running when building out of sources, bug #510596, upstream bug #730319 97 "${FILESDIR}"/${PN}-2.24.24-out-of-source.patch 98 # Rely on split gtk-update-icon-cache package, bug #528810 99 "${FILESDIR}"/${PN}-2.24.31-update-icon-cache.patch # requires eautoreconf 100 # Respect ${NM}, bug #725852 101 "${FILESDIR}"/${PN}-2.24.33-respect-NM.patch # requires eautoreconf 102 # Fix casts, bug #880617 103 "${FILESDIR}"/${PN}-2.24.33-Fix-casts.patch 104 ) 105 106 strip_builddir() { 107 local rule=$1 108 shift 109 local directory=$1 110 shift 111 sed -e "s/^\(${rule} =.*\)${directory}\(.*\)$/\1\2/" -i $@ \ 112 || die "Could not strip director ${directory} from build." 113 } 114 115 set_gtk2_confdir() { 116 # An arch specific config directory is used on multilib systems 117 GTK2_CONFDIR="/etc/gtk-2.0/${CHOST}" 118 } 119 120 src_prepare() { 121 # Various glib marshaller churn could break build against a different glib version, force regeneration 122 rm -v gdk/gdkmarshalers.{c,h} gtk/gtkmarshal.{c,h} gtk/gtkmarshalers.{c,h} \ 123 perf/marshalers.{c,h} gtk/gtkaliasdef.c gtk/gtkalias.h || die 124 125 # Stop trying to build unmaintained docs, bug #349754, upstream bug #623150 126 strip_builddir SUBDIRS tutorial docs/Makefile.{am,in} 127 strip_builddir SUBDIRS faq docs/Makefile.{am,in} 128 129 # -O3 and company cause random crashes in applications, bug #133469 130 replace-flags -O3 -O2 131 strip-flags 132 # Not compatible with C23 decls 133 append-flags -std=gnu17 134 135 if ! use test ; then 136 # don't waste time building tests 137 strip_builddir SRC_SUBDIRS tests Makefile.{am,in} 138 strip_builddir SUBDIRS tests gdk/Makefile.{am,in} gtk/Makefile.{am,in} 139 else 140 # Non-working test in gentoo's env 141 sed 's:\(g_test_add_func ("/ui-tests/keys-events.*\):/*\1*/:g' \ 142 -i gtk/tests/testing.c || die "sed 1 failed" 143 144 # Cannot work because glib is too clever to find real user's home 145 # gentoo bug #285687, upstream bug #639832 146 # XXX: /!\ Pay extra attention to second sed when bumping /!\ 147 sed '/TEST_PROGS.*recentmanager/d' -i gtk/tests/Makefile.am \ 148 || die "failed to disable recentmanager test (1)" 149 sed '/^TEST_PROGS =/,+3 s/recentmanager//' -i gtk/tests/Makefile.in \ 150 || die "failed to disable recentmanager test (2)" 151 sed 's:\({ "GtkFileChooserButton".*},\):/*\1*/:g' -i gtk/tests/object.c \ 152 || die "failed to disable recentmanager test (3)" 153 154 # https://bugzilla.gnome.org/show_bug.cgi?id=617473 155 sed -i -e 's:pltcheck.sh:$(NULL):g' \ 156 gtk/Makefile.am || die 157 158 # UI tests require immodules already installed; bug #413185 159 if ! has_version 'x11-libs/gtk+:2'; then 160 ewarn "Disabling UI tests because this is the first install of" 161 ewarn "gtk+:2 on this machine. Please re-run the tests after ${P}" 162 ewarn "has been installed." 163 sed '/g_test_add_func.*ui-tests/ d' \ 164 -i gtk/tests/testing.c || die "sed 2 failed" 165 fi 166 fi 167 168 if ! use examples; then 169 # don't waste time building demos 170 strip_builddir SRC_SUBDIRS demos Makefile.{am,in} 171 fi 172 173 gnome2_src_prepare 174 } 175 176 multilib_src_configure() { 177 [[ ${ABI} == ppc64 ]] && append-flags -mminimal-toc 178 179 ECONF_SOURCE=${S} \ 180 gnome2_src_configure \ 181 $(usex aqua --with-gdktarget=quartz --with-gdktarget=x11) \ 182 $(usex aqua "" --with-xinput) \ 183 $(use_enable cups cups auto) \ 184 $(multilib_native_use_enable introspection) \ 185 $(use_enable xinerama) \ 186 --disable-papi \ 187 --enable-man \ 188 --with-xml-catalog="${EPREFIX}"/etc/xml/catalog \ 189 CUPS_CONFIG="${EPREFIX}/usr/bin/${CHOST}-cups-config" 190 191 # work-around gtk-doc out-of-source brokedness 192 if multilib_is_native_abi; then 193 local d 194 for d in gdk gtk libgail-util; do 195 ln -s "${S}"/docs/reference/${d}/html docs/reference/${d}/html || die 196 done 197 fi 198 } 199 200 multilib_src_test() { 201 virtx emake check 202 } 203 204 multilib_src_install() { 205 gnome2_src_install 206 } 207 208 multilib_src_install_all() { 209 # see bug #133241 210 # Also set more default variables in sync with gtk3 and other distributions 211 insinto /usr/share/gtk-2.0 212 newins - gtkrc <<- 'EOF' 213 gtk-fallback-icon-theme = "gnome" 214 gtk-theme-name = "Adwaita" 215 gtk-icon-theme-name = "Adwaita" 216 gtk-cursor-theme-name = "Adwaita" 217 EOF 218 219 einstalldocs 220 rm "${ED}"/usr/share/doc/${P}/ChangeLog # empty file 221 222 # dev-util/gtk-builder-convert split off into a separate package, #402905 223 rm "${ED}"/usr/bin/gtk-builder-convert || die 224 rm "${ED}"/usr/share/man/man1/gtk-builder-convert.* || die 225 226 readme.gentoo_create_doc 227 } 228 229 pkg_preinst() { 230 gnome2_pkg_preinst 231 232 multilib_pkg_preinst() { 233 # Make immodules.cache belongs to gtk+ alone 234 local cache="/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" 235 236 if [[ -e "${EROOT}${cache}" ]]; then 237 cp "${EROOT}${cache}" "${ED}${cache}" || die 238 else 239 touch "${ED}${cache}" || die 240 fi 241 } 242 multilib_parallel_foreach_abi multilib_pkg_preinst 243 } 244 245 pkg_postinst() { 246 gnome2_pkg_postinst 247 248 multilib_pkg_postinst() { 249 gnome2_query_immodules_gtk2 \ 250 || die "Update immodules cache failed (for ${ABI})" 251 } 252 multilib_parallel_foreach_abi multilib_pkg_postinst 253 254 set_gtk2_confdir 255 256 if [[ -e "${EROOT}/etc/gtk-2.0/gtk.immodules" ]]; then 257 elog "File /etc/gtk-2.0/gtk.immodules has been moved to \$CHOST" 258 elog "aware location. Removing deprecated file." 259 rm -f "${EROOT}/etc/gtk-2.0/gtk.immodules" 260 fi 261 262 if [[ -e "${EROOT}${GTK2_CONFDIR}/gtk.immodules" ]]; then 263 elog "File /etc/gtk-2.0/gtk.immodules has been moved to" 264 elog "${EROOT}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" 265 elog "Removing deprecated file." 266 rm -f "${EROOT}${GTK2_CONFDIR}/gtk.immodules" 267 fi 268 269 # pixbufs are now handled by x11-libs/gdk-pixbuf 270 if [[ -e "${EROOT}${GTK2_CONFDIR}/gdk-pixbuf.loaders" ]]; then 271 elog "File ${EROOT}${GTK2_CONFDIR}/gdk-pixbuf.loaders is now handled by x11-libs/gdk-pixbuf" 272 elog "Removing deprecated file." 273 rm -f "${EROOT}${GTK2_CONFDIR}/gdk-pixbuf.loaders" 274 fi 275 276 # two checks needed since we dropped multilib conditional 277 if [[ -e "${EROOT}/etc/gtk-2.0/gdk-pixbuf.loaders" ]]; then 278 elog "File ${EROOT}/etc/gtk-2.0/gdk-pixbuf.loaders is now handled by x11-libs/gdk-pixbuf" 279 elog "Removing deprecated file." 280 rm -f "${EROOT}/etc/gtk-2.0/gdk-pixbuf.loaders" 281 fi 282 283 if [[ -e "${EROOT}"/usr/lib/gtk-2.0/2.[^1]* ]]; then 284 elog "You need to rebuild ebuilds that installed into" "${EROOT}"/usr/lib/gtk-2.0/2.[^1]* 285 elog "to do that you can use qfile from portage-utils:" 286 elog "emerge -va1 \$(qfile -qC ${EPREFIX}/usr/lib/gtk-2.0/2.[^1]*)" 287 fi 288 289 if ! has_version "app-text/evince"; then 290 elog "Please install app-text/evince for print preview functionality." 291 elog "Alternatively, check \"gtk-print-preview-command\" documentation and" 292 elog "add it to your gtkrc." 293 fi 294 295 readme.gentoo_print_elog 296 } 297 298 pkg_postrm() { 299 gnome2_pkg_postrm 300 301 if [[ -z ${REPLACED_BY_VERSION} ]]; then 302 multilib_pkg_postrm() { 303 rm -f "${EROOT}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" 304 } 305 multilib_foreach_abi multilib_pkg_postrm 306 fi 307 }