Name glib2-devel
Description Low level core library - development tools
Version 2.86.4-1
Package Base glib2
Homepage https://gitlab.gnome.org/GNOME/glib
Maintainers ['Fabian Bornschein <fabiscafe@archlinux.org>', 'Jan Alexander Steffens (heftig) <heftig@archlinux.org>']
Contributors ['Jan de Groot <jgc@archlinux.org>']
Distro-repo https://gitlab.archlinux.org/archlinux/packaging/packages/glib2
Sources ['0001-glib-compile-schemas-Remove-noisy-deprecation-warnin.patch', '0002-gdesktopappinfo-Add-more-known-terminals.patch', 'gio-querymodules.hook', 'git+https://gitlab.gnome.org/GNOME/glib.git?signed#tag=2.86.4', 'git+https://gitlab.gnome.org/GNOME/gvdb.git', 'glib-compile-schemas.hook']
Dependencies ['glib2', 'glibc', 'libelf', 'python', 'python-packaging']
Optional-Dependencies []
Build-Dependencies ['dbus', 'dconf', 'gettext', 'gi-docgen', 'git', 'gobject-introspection', 'libelf', 'meson', 'python', 'python-docutils', 'python-packaging', 'shared-mime-info', 'util-linux']
Provides []
Builddate 14-02-2026 07:15:47
Architecture x86_64
Distro-Version
Licenses ['LGPL-2.1-or-later']
Hash ea360fb990ba330c6d861fcc0db9a2471c74c0f919f3c524eb800c89711fd60e
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Maintainer: Fabian Bornschein <fabiscafe@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgbase=glib2
pkgname=(
  glib2
  glib2-devel
  glib2-docs
)
pkgver=2.86.4
pkgrel=1
pkgdesc="Low level core library"
url="https://gitlab.gnome.org/GNOME/glib"
license=(LGPL-2.1-or-later)
arch=(x86_64)
depends=(
  bash
  glibc
  libffi
  libsysprof-capture
  pcre2
  util-linux-libs
  zlib
)
makedepends=(
  dbus
  dconf
  gettext
  gi-docgen
  git
  gobject-introspection
  libelf
  meson
  python
  python-docutils
  python-packaging
  shared-mime-info
  util-linux
)
checkdepends=(
  desktop-file-utils
  glib2
)
source=(
  "git+https://gitlab.gnome.org/GNOME/glib.git?signed#tag=$pkgver"
  "git+https://gitlab.gnome.org/GNOME/gvdb.git"
  0001-glib-compile-schemas-Remove-noisy-deprecation-warnin.patch
  0002-gdesktopappinfo-Add-more-known-terminals.patch
  gio-querymodules.hook
  glib-compile-schemas.hook
)
b2sums=('f15ebe56697381a2a28c99c5eab0f016a32a860e388662be658f2b47056de6d0c6ec58664cf987432474b2dde297657ddf73a78234041316e636717bc52c8f6f'
        'SKIP'
        '4ddbd31f5f466fce99d82890292ff922555a9ab379d22202aeea5127f58798668f871dea0485cc0f458069276ad512412285ede6c8f3e36bea899358f49e931a'
        'cc39621757253c9f9e11da4ae40dc16d24f2898a7ee34fbfe5b7709c4f0139c04fab6c1138402c16859b2421c45d55bdde522aa1a1b2c6c3544d87b7c2d10dff'
        '14c9211c0557f6d8d9a914f1b18b7e0e23f79f4abde117cb03ab119b95bf9fa9d7a712aa0a29beb266468aeb352caa3a9e4540503cfc9fe0bbaf764371832a96'
        'acc2f474139e535f4bdd70ac22a9150f786b3395e679b14d0d3fbb9361d511bb1b5069d95b2a7ac9c0f3d901b03a0c037eb273446ba00764191b30a777bd2bc9')
validpgpkeys=(
  53EF3DC3B63E2899271BD26322E8091EEA11BBB7 # Emmanuele Bassi <ebassi@gnome.org>
  923B7025EE03C1C59F42684CF0942E894B2EAFA0 # Philip Withnall <pwithnall@gnome.org>
)

prepare() {
  cd glib

  # Suppress noise from glib-compile-schemas.hook
  git apply -3 ../0001-glib-compile-schemas-Remove-noisy-deprecation-warnin.patch

  # Add ghostty and ptyxis to known terminals list
  # This is a downstream only patch; GNOME will not add new terminal emulators.
  # https://gitlab.gnome.org/GNOME/glib/-/issues/338#note_1076172
  git apply -3 ../0002-gdesktopappinfo-Add-more-known-terminals.patch

  git submodule init
  git submodule set-url subprojects/gvdb "$srcdir/gvdb"
  git -c protocol.file.allow=always -c protocol.allow=never submodule update
}

build() {
  local meson_options=(
    --default-library both
    -D documentation=true
    -D dtrace=disabled
    -D glib_debug=disabled
    -D introspection=enabled
    -D man-pages=enabled
    -D selinux=disabled
    -D sysprof=enabled
    -D systemtap=disabled
  )

  # Produce more debug info: GLib has a lot of useful macros
  CFLAGS+=" -g3"
  CXXFLAGS+=" -g3"

  # use fat LTO objects for static libraries
  CFLAGS+=" -ffat-lto-objects"
  CXXFLAGS+=" -ffat-lto-objects"

  arch-meson glib build "${meson_options[@]}"
  meson compile -C build
}

check() {
  meson test -C build --no-suite flaky --no-suite slow --print-errorlogs
}

_pick() {
  local p="$1" f d; shift
  for f; do
    d="$srcdir/$p/${f#$pkgdir/}"
    mkdir -p "$(dirname "$d")"
    mv "$f" "$d"
    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  done
}

package_glib2() {
  depends+=(
    libffi.so
    libmount.so
  )
  provides+=(libg{lib,io,irepository,module,object,thread}-2.0.so)
  optdepends=(
    'dconf: GSettings storage backend'
    'glib2-devel: development tools'
    'gvfs: most gio functionality'
  )
  options+=(staticlibs)
  install=glib2.install

  meson install -C build --destdir "$pkgdir"

  install -Dt "$pkgdir/usr/share/libalpm/hooks" -m644 *.hook
  touch "$pkgdir/usr/lib/gio/modules/.keep"

  python -m compileall -d /usr/share/glib-2.0/codegen \
    "$pkgdir/usr/share/glib-2.0/codegen"
  python -O -m compileall -d /usr/share/glib-2.0/codegen \
    "$pkgdir/usr/share/glib-2.0/codegen"

  cd "$pkgdir"

  # Split docs
  _pick docs usr/share/doc

  # Split devel
  _pick devel usr/bin/gdbus-codegen
  _pick devel usr/bin/glib-{mkenums,genmarshal}
  _pick devel usr/bin/gresource
  _pick devel usr/bin/gtester{,-report}

  _pick devel usr/share/gdb/
  _pick devel usr/share/glib-2.0/gdb/
  _pick devel usr/share/glib-2.0/codegen/

  _pick devel usr/share/bash-completion/completions/gresource

  _pick devel usr/share/man/man1/gdbus-codegen.1
  _pick devel usr/share/man/man1/glib-{mkenums,genmarshal}.1
  _pick devel usr/share/man/man1/gresource.1
  _pick devel usr/share/man/man1/gtester{,-report}.1
}

package_glib2-devel() {
  pkgdesc+=" - development tools"
  depends=(
    glib2
    glibc
    libelf
    python
    python-packaging
  )
  mv devel/* "$pkgdir"
}

package_glib2-docs() {
  pkgdesc+=" - documentation"
  depends=()
  license+=(LicenseRef-Public-Domain)

  mv docs/* "$pkgdir"
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 glib/docs/reference/COPYING
}

# vim:set sw=2 sts=-1 et: