Name libglib-2.0.so.0
Description Common C routines used by Gtk+ and other libs
Version 2.84.4-r0
Package Base glib
Homepage https://developer.gnome.org/glib/
Maintainers ['team/gnome <pabloyoyoista@postmarketos.org>']
Contributors ['Rasmus Thomsen <oss@cogitri.dev>', 'Valery Kartel <valery.kartel@gmail.com>']
Distro-repo https://gitlab.alpinelinux.org/alpine/aports/-/tree/3.22-stable/main/glib
Sources []
Dependencies []
Optional-Dependencies []
Build-Dependencies []
Provides ['so:libgio-2.0.so.0=0.8400.4', 'so:libgirepository-2.0.so.0=0.8400.4', 'so:libglib-2.0.so.0=0.8400.4', 'so:libgmodule-2.0.so.0=0.8400.4', 'so:libgobject-2.0.so.0=0.8400.4', 'so:libgthread-2.0.so.0=0.8400.4', 'cmd:gapplication=2.84.4-r0', 'cmd:gdbus=2.84.4-r0', 'cmd:gi-compile-repository=2.84.4-r0', 'cmd:gi-decompile-typelib=2.84.4-r0', 'cmd:gi-inspect-typelib=2.84.4-r0', 'cmd:gio-querymodules=2.84.4-r0', 'cmd:gio=2.84.4-r0', 'cmd:glib-compile-schemas=2.84.4-r0', 'cmd:gsettings=2.84.4-r0']
Builddate 08-08-2025 19:38:20
Architecture x86_64
Distro-Version v3.22
Licenses ['LGPL-2.1-or-later']
Hash Q1/K0Jl7TLEP+X4tiLCzcSD6CAcMc=
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: team/gnome <pabloyoyoista@postmarketos.org>
pkgname=glib
pkgver=2.84.4
_gi_version=1.82.0
pkgrel=0
pkgdesc="Common C routines used by Gtk+ and other libs"
url="https://developer.gnome.org/glib/"
arch="all"
license="LGPL-2.1-or-later"
triggers="$pkgname.trigger=/usr/share/glib-2.0/schemas:/usr/lib/gio/modules:/usr/lib/gtk-4.0"
depends_dev="
	bzip2-dev
	docbook-xml
	docbook-xsl
	gettext-dev
	libxml2-utils
	libxslt
	python3
	py3-packaging
	"
makedepends="$depends_dev
	bash
	bison
	flex
	libffi-dev
	meson
	pcre2-dev
	py3-setuptools
	python3-dev
	util-linux-dev
	zlib-dev
	py3-docutils
	"
subpackages="
	$pkgname-dbg
	$pkgname-doc
	$pkgname-static
	$pkgname-dev
	$pkgname-lang
	$pkgname-bash-completion
	"
source="https://download.gnome.org/sources/glib/${pkgver%.*}/glib-$pkgver.tar.xz
	https://download.gnome.org/sources/gobject-introspection/${_gi_version%.*}/gobject-introspection-$_gi_version.tar.xz
	tests-machine-id.patch
	flaky-tests.patch
	"

# 2.80 moves gir here
replaces="gobject-introspection<1.80.0"

[ "$CARCH" = "ppc64le" ] && options="$options !check" # https://gitlab.gnome.org/GNOME/glib/-/issues/3474

# secfixes:
#   2.80.1-r0:
#     - CVE-2024-34397
#   2.66.6-r0:
#     - CVE-2021-27219 GHSL-2021-045
#   2.62.5-r0:
#     - CVE-2020-6750
#   2.60.4-r0:
#     - CVE-2019-12450

build() {
	export CFLAGS="$CFLAGS -ffat-lto-objects -O2"
	export CXXFLAGS="$CXXFLAGS -O2"
	export CPPFLAGS="$CPPFLAGS -O2"
	local _prefix="$PWD/boostrap-glib"

	msg "build bootstrap glib"
	meson setup \
		--default-library=shared \
		--prefix="$_prefix" \
		-Dman-pages=disabled \
		-Dlibmount=disabled \
		-Dtests=false \
		-Dintrospection=disabled \
		-Dnls=disabled \
		. output
	meson compile -C output
	meson install --no-rebuild -C output

	msg "build bootstrap gobject-introspection"
	meson setup \
		--pkg-config-path="$_prefix"/lib/pkgconfig \
		--prefix="$_prefix" \
		-Dbuild_introspection_data=false \
		-Dcairo=disabled \
		-Ddoctool=disabled \
		"$srcdir"/gobject-introspection-$_gi_version \
		gioutput
	meson compile -C gioutput
	meson install --no-rebuild -C gioutput

	msg "re-build glib with introspection"
	PATH="$_prefix/bin:$PATH" LD_LIBRARY_PATH="$_prefix/lib" \
		meson setup \
		--reconfigure \
		--pkg-config-path="$_prefix"/lib/pkgconfig \
		--default-library=both \
		--prefix=/usr \
		-Dman-pages=enabled \
		-Dlibmount=enabled \
		-Dtests="$(want_check && echo true || echo false)" \
		-Dintrospection=enabled \
		-Dnls=enabled \
		. output
	PATH="$_prefix/bin:$PATH" LD_LIBRARY_PATH="$_prefix/lib" \
		meson compile -C output
}

check() {
	# riscv64 and armhf may time out with the standard timeout
	meson test --timeout-multiplier 10 --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

dev() {
	# 2.80 moves gir here
	replaces="gobject-introspection-dev<1.80.0"
	default_dev
	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/share
	find "$pkgdir"/usr/bin ! -name "glib-compile-schemas" -a \( \
		-name "gdbus-codegen" -o \
		-name "gobject-query" -o \
		-name "gresource" -o \
		-name "gtester*" -o \
		-name "glib-*" \) \
		-exec mv {} "$subpkgdir"/usr/bin \;

	amove usr/share/gdb usr/share/glib-2.0
}

static() {
	default_static
	depends="gettext-static"
}

sha512sums="
2de9b2f7376c0e5f6ee585087090675d597c474199a10d04aad18df688b6ca77d17e93a86ec07482898663f51c82121992272496318138f77ca5ad2c340a4bd3  glib-2.84.4.tar.xz
e139fadb4174c72b648914f3774d89fc0e5eaee45bba0c13edf05de883664dad8276dbc34006217bb09871ed4bad23adab51ff232a17b9eb131329b2926cafb7  gobject-introspection-1.82.0.tar.xz
4f561bfede4a559b314195aa4b7b5923a52c62063e6dd33b4933ad53b29c32ef789d69b9f7b17d8d701323006366e6b7acbb083a68674c1c535c185d35cc5d1f  tests-machine-id.patch
268cf6f089274f29285242f1e29bf5650e85f9fcb5744df884deb139493cc25792ad78487113732665f1c5393c94b2f76f97093a1a003e3caaf65c07960a1bf9  flaky-tests.patch
"