# Template file for 'cjs'
pkgname=cjs
version=5.2.0
revision=1
build_style=meson
build_helper=gir
# XXX: disable tests because they need dbus, X and GTK, same as gjs
configure_args="-Dskip_dbus_tests=true -Dskip_gtk_tests=true
 -Dprofiler=disabled -Dinstalled_tests=false"
hostmakedepends="pkg-config gobject-introspection glib-devel dbus mozjs78-devel"
makedepends="dbus-glib-devel readline-devel gobject-introspection
 gtk+3-devel mozjs78 mozjs78-devel"
short_desc="Javascript for Cinnamon"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.0-or-later"
homepage="https://github.com/linuxmint/cjs"
distfiles="https://github.com/linuxmint/cjs/archive/refs/tags/${version}.tar.gz"
checksum=4141185cc554156ebbad80faf66c52f4287db911528e7f3ef8035f6b9c5f8f8c
# ΧΧ A single test fails on x86_64,  meson reports in the configure stage:
# meson.build:663: WARNING: Your libc does not have the C.UTF-8 locale and no
# other suitable UTF-8 fallback locale could be found. You can still build GJS,
# but some tests will fail.
make_check=extended

pre_configure() {
	# The deleted lines in meson.build try to build and run a simple program,
	# and that does not work when cross-compiling.
	vsed -e '/Check if a minimal SpiderMonkey program compiles/,/^endif/d' -i meson.build
}

cjs-devel_package() {
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove "usr/lib/*.so"
		vmove usr/include
		vmove usr/lib/pkgconfig
	}
}
