# Template file for 'cjs'
pkgname=cjs
version=128.0
revision=2
build_style=meson
build_helper="gir"
configure_args="-Dprofiler=disabled -Dinstalled_tests=false"
hostmakedepends="pkg-config glib-devel dbus xvfb-run gtk4"
makedepends="readline-devel mozjs${version%%.*}-devel gtk4-devel"
# depends="gtk+3"
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=d3432dd2722eef65b4a36db430824882b3bd90b4db469f576ff087d045e022ca
make_check_pre="xvfb-run"

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
	}
}
