pkgname=glib
pkgver=2.84.4
_basever=2.84
_lfsver=12.4
pkgdesc="Low level core library"
homepage="https://gitlab.gnome.org/GNOME/glib"
license=(LGPL-2.1-or-later)
arch=(x86_64)
sources=("${pkgname}-${pkgver}.tar.xz"
  "glib-skip_warnings-1.patch"
)
_gnomeurl="https://download.gnome.org/sources"
urls=("${_gnomeurl}/${pkgname}/${_basever}/${sources[0]}"
  "https://www.linuxfromscratch.org/patches/blfs/${_lfsver}/${sources[2]}"
)
md5sums=("5655d0ff809b98dd77c02490609fadde"
  "729287ad0c60b5b2d6ca9ec4a19d8cec"
)

export GLIB_LOG_LEVEL=4

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  patch -p1 -i ${distdir}/${sources[1]}
}

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

  meson setup build               \
        --prefix=/usr             \
        --buildtype=release       \
        -D introspection=disabled \
        -D glib_debug=disabled    \
        -D man-pages=enabled      \
        -D sysprof=disabled       &&
  meson compile -C build
}

src_check() {
  leaf_noop
}

src_install() {
  meson install -C build --destdir "$pkgdir"
}
