logo

overlay

My (experimental) gentoo overlay

glib-2.62.2.ebuild (7797B)


      1 # Copyright 1999-2019 Gentoo Authors
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI=7
      5 PYTHON_COMPAT=( python{3_5,3_6,3_7} )
      6 
      7 inherit flag-o-matic gnome.org gnome2-utils linux-info meson multilib multilib-minimal python-any-r1 toolchain-funcs xdg
      8 
      9 DESCRIPTION="The GLib library of C routines"
     10 HOMEPAGE="https://www.gtk.org/"
     11 LICENSE="LGPL-2.1+"
     12 SLOT="2"
     13 IUSE="dbus debug fam gtk-doc kernel_linux +mime selinux static-libs systemtap test utils xattr"
     14 
     15 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
     16 
     17 RDEPEND="
     18 	${PYTHON_DEPS}
     19 	>=dev-libs/libpcre-8.31:3[${MULTILIB_USEDEP},static-libs?]
     20 	!<dev-util/gdbus-codegen-${PV}
     21 	>=dev-util/gdbus-codegen-${PV}
     22 	>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
     23 	virtual/libelf:0=
     24 	>=virtual/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}]
     25 	>=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
     26 	>=virtual/libintl-0-r2[${MULTILIB_USEDEP}]
     27 	kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] )
     28 	selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
     29 	xattr? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] )
     30 	fam? ( >=virtual/fam-0-r1[${MULTILIB_USEDEP}] )
     31 "
     32 DEPEND="${RDEPEND}
     33 	app-text/docbook-xml-dtd:4.1.2
     34 	app-text/docbook-xsl-stylesheets
     35 	>=dev-libs/libxslt-1.0
     36 	>=sys-devel/gettext-0.11
     37 	gtk-doc? ( >=dev-util/gtk-doc-1.20 )
     38 	systemtap? ( >=dev-util/systemtap-1.3 )
     39 	${PYTHON_DEPS}
     40 	test? ( >=sys-apps/dbus-1.2.14 )
     41 	virtual/pkgconfig[${MULTILIB_USEDEP}]
     42 "
     43 PDEPEND="
     44 	dbus? ( gnome-base/dconf )
     45 	mime? ( x11-misc/shared-mime-info )
     46 "
     47 # shared-mime-info needed for gio/xdgmime, bug #409481
     48 # dconf is needed to be able to save settings, bug #498436
     49 
     50 MULTILIB_CHOST_TOOLS=(
     51 	/usr/bin/gio-querymodules$(get_exeext)
     52 )
     53 
     54 pkg_setup() {
     55 	if use kernel_linux ; then
     56 		CONFIG_CHECK="~INOTIFY_USER"
     57 		if use test ; then
     58 			CONFIG_CHECK="~IPV6"
     59 			WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
     60 		fi
     61 		linux-info_pkg_setup
     62 	fi
     63 	python-any-r1_pkg_setup
     64 }
     65 
     66 src_prepare() {
     67 	if ! use test; then
     68 		# Don't build tests, also prevents extra deps, bug #512022
     69 		sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die
     70 	fi
     71 
     72 	# Don't build fuzzing binaries - not used
     73 	sed -i -e '/subdir.*fuzzing/d' meson.build || die
     74 
     75 	# gdbus-codegen is a separate package
     76 	sed -i -e 's/install.*true/install : false/g' gio/gdbus-2.0/codegen/meson.build || die
     77 	# Older than meson-0.50 doesn't know about install kwarg for configure_file; for that we need to remove the install_dir kwarg.
     78 	# Upstream will remove the install kwarg in a future version to require only meson-0.49.2 or newer, at which point the
     79 	# install_dir removal only should be kept.
     80 	sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die
     81 
     82 	# Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon
     83 	sed -i -e '/install_dir/d' gio/tests/meson.build || die
     84 
     85 	cat > "${T}/glib-test-ld-wrapper" <<-EOF
     86 		#!/usr/bin/env sh
     87 		exec \${LD:-ld} "\$@"
     88 	EOF
     89 	chmod a+x "${T}/glib-test-ld-wrapper" || die
     90 	sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die
     91 
     92 	xdg_src_prepare
     93 	gnome2_environment_reset
     94 	# TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only
     95 }
     96 
     97 multilib_src_configure() {
     98 	# These configure tests don't work when cross-compiling.
     99 	if tc-is-cross-compiler ; then
    100 		# https://bugzilla.gnome.org/show_bug.cgi?id=756473
    101 		case ${CHOST} in
    102 		hppa*|metag*) export glib_cv_stack_grows=yes ;;
    103 		*)            export glib_cv_stack_grows=no ;;
    104 		esac
    105 		# https://bugzilla.gnome.org/show_bug.cgi?id=756474
    106 		export glib_cv_uscore=no
    107 		# https://bugzilla.gnome.org/show_bug.cgi?id=756475
    108 		export ac_cv_func_posix_get{pwuid,grgid}_r=yes
    109 	fi
    110 
    111 	local emesonargs=(
    112 		$(usex debug "-Dbuildtype='debug'" "")
    113 		-Ddefault_library=$(usex static-libs both shared)
    114 		$(meson_feature selinux)
    115 		$(meson_use xattr)
    116 		-Dlibmount=true # only used if host_system == 'linux'
    117 		-Dinternal_pcre=false
    118 		-Dman=true
    119 		$(meson_use systemtap dtrace)
    120 		$(meson_use systemtap)
    121 		-Dgtk_doc=$(multilib_native_usex gtk-doc true false)
    122 		$(meson_use fam)
    123 		-Dinstalled_tests=false
    124 		-Dnls=enabled
    125 	)
    126 
    127 
    128 	meson_src_configure
    129 
    130 }
    131 
    132 multilib_src_compile() {
    133 	meson_src_compile
    134 }
    135 
    136 multilib_src_test() {
    137 	export XDG_CONFIG_DIRS=/etc/xdg
    138 	export XDG_DATA_DIRS=/usr/local/share:/usr/share
    139 	export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
    140 	export LC_TIME=C # bug #411967
    141 	unset GSETTINGS_BACKEND # bug #596380
    142 	python_setup
    143 
    144 	# Related test is a bit nitpicking
    145 	mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
    146 	chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
    147 
    148 	meson_src_test --timeout-multiplier 2 --no-suite flaky
    149 }
    150 
    151 multilib_src_install() {
    152 	chmod +x glib-gettextize || die
    153 	meson_src_install
    154 	keepdir /usr/$(get_libdir)/gio/modules
    155 }
    156 
    157 multilib_src_install_all() {
    158 	einstalldocs
    159 
    160 	if use utils; then
    161 		python_replicate_script "${ED}"/usr/bin/gtester-report
    162 	else
    163 		rm "${ED}usr/bin/gtester-report"
    164 		rm "${ED}usr/share/man/man1/gtester-report.1"
    165 	fi
    166 
    167 	# Do not install charset.alias even if generated, leave it to libiconv
    168 	rm -f "${ED}/usr/lib/charset.alias"
    169 
    170 	# Don't install gdb python macros, bug 291328
    171 	rm -rf "${ED}/usr/share/gdb/" "${ED}/usr/share/glib-2.0/gdb/"
    172 
    173 	# These are installed by dev-util/glib-utils
    174 	# TODO: With patching we might be able to get rid of the python-any deps and removals, and test depend on glib-utils instead; revisit now with meson
    175 	rm "${ED}/usr/bin/glib-genmarshal" || die
    176 	rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die
    177 	rm "${ED}/usr/bin/glib-mkenums" || die
    178 	rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die
    179 	rm "${ED}/usr/bin/gtester-report" || die
    180 	rm "${ED}/usr/share/man/man1/gtester-report.1" || die
    181 	# gdbus-codegen manpage installed by dev-util/gdbus-codegen
    182 	rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die
    183 }
    184 
    185 pkg_preinst() {
    186 	xdg_pkg_preinst
    187 
    188 	# Make gschemas.compiled belong to glib alone
    189 	local cache="/usr/share/glib-2.0/schemas/gschemas.compiled"
    190 
    191 	if [[ -e "${EROOT}${cache}" ]]; then
    192 		cp "${EROOT}${cache}" "${ED}${cache}" || die
    193 	else
    194 		touch "${ED}${cache}" || die
    195 	fi
    196 
    197 	multilib_pkg_preinst() {
    198 		# Make giomodule.cache belong to glib alone
    199 		local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache"
    200 
    201 		if [[ -e "${EROOT}${cache}" ]]; then
    202 			cp "${EROOT}${cache}" "${ED}${cache}" || die
    203 		else
    204 			touch "${ED}${cache}" || die
    205 		fi
    206 	}
    207 
    208 	# Don't run the cache ownership when cross-compiling, as it would end up with an empty cache
    209 	# file due to inability to create it and GIO might not look at any of the modules there
    210 	if ! tc-is-cross-compiler ; then
    211 		multilib_foreach_abi multilib_pkg_preinst
    212 	fi
    213 }
    214 
    215 pkg_postinst() {
    216 	xdg_pkg_postinst
    217 	# glib installs no schemas itself, but we force update for fresh install in case
    218 	# something has dropped in a schemas file without direct glib dep; and for upgrades
    219 	# in case the compiled schema format could have changed
    220 	gnome2_schemas_update
    221 
    222 	multilib_pkg_postinst() {
    223 		gnome2_giomodule_cache_update \
    224 			|| die "Update GIO modules cache failed (for ${ABI})"
    225 	}
    226 	if ! tc-is-cross-compiler ; then
    227 		multilib_foreach_abi multilib_pkg_postinst
    228 	else
    229 		ewarn "Updating of GIO modules cache skipped due to cross-compilation."
    230 		ewarn "You might want to run gio-querymodules manually on the target for"
    231 		ewarn "your final image for performance reasons and re-run it when packages"
    232 		ewarn "installing GIO modules get upgraded or added to the image."
    233 	fi
    234 }
    235 
    236 pkg_postrm() {
    237 	xdg_pkg_postrm
    238 	gnome2_schemas_update
    239 
    240 	if [[ -z ${REPLACED_BY_VERSION} ]]; then
    241 		multilib_pkg_postrm() {
    242 			rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache
    243 		}
    244 		multilib_foreach_abi multilib_pkg_postrm
    245 		rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled
    246 	fi
    247 }