# Maintainer: Fabian Bornschein <fabiscafe@archlinux.org>
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=gjs
pkgver=1.88.1
pkgrel=1
epoch=2
pkgdesc="Javascript Bindings for GNOME"
url="https://gitlab.gnome.org/GNOME/gjs"
arch=(x86_64 aarch64)
license=(LGPL-2.0-or-later)
depends=(
  cairo
  dconf
  glib2
  glibc
  gobject-introspection-runtime
  js140
  libffi
  libgcc
  libstdc++
  libsysprof-capture
  libx11
  readline
)
makedepends=(
  dbus
  git
  glib2-devel
  gobject-introspection
  meson
)
checkdepends=(
  gtk3
  gtk4
  xorg-server-xvfb
)
provides=(libgjs.so)
source=(
  "git+https://gitlab.gnome.org/GNOME/gjs.git#tag=$pkgver"
  "git+https://gitlab.gnome.org/GNOME/gobject-introspection-tests.git"
)
b2sums=('ae565e0ee6b1ea94800e39aba53dc569deb7d747e263d620030ffd8963ff4511bfc29fcb38e2e6e01f9dda8bfff4e97642e1388e19d77dae7e0ce8c62a11e453'
        'SKIP')
validpgpkeys=(
  53C0524AD3AE115F69C47D2D0E9D857756977391 # Philip Chimento (Signing Key for GNOME Releases) <philip.chimento@gmail.com>
)

prepare() {
  cd gjs

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

build() {
  local meson_options=(
    -D installed_tests=false
  )

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

check() {
  dbus-run-session xvfb-run -s '-nolisten local' \
    meson test -C build --print-errorlogs
}

package() {
  depends+=(libreadline.so)
  meson install -C build --destdir "$pkgdir"
}

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