makedepends=(llvm git gobject-introspection libheif rustc vala bubblewrap
  cairo xorg-fontconfig glib gtk4 lcms2 librsvg libseccomp libjxl python-setuptools)

description="Sandboxed and extendable image decoding"
url="https://gitlab.gnome.org/sophie-h/glycin"

packager="Great-OS Team"
maintainer="Great-OS Team"

name=glycin
version=2.1.1
release=2

source=(https://gitlab.gnome.org/GNOME/glycin/-/archive/$version/glycin-$version.tar.gz)

# Use LTO
export CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1

# Use debug
export CARGO_PROFILE_RELEASE_DEBUG=2

prepare() {

  cd $name-$version
  CARGO_HOME="$SRC/build/cargo-home" cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {

  meson setup --prefix=/usr \
              --libdir=/usr/lib \
              $name-$version \
              build \
              -Dtest_skip_install=true \
              -Dloaders=glycin-heif,glycin-svg,glycin-image-rs

  ninja -C build
  DESTDIR=$PKG ninja install -C build
}
