void-packages/srcpkgs/rhino/template

56 lines
1.5 KiB
Bash

# Template file for 'rhino'
pkgname=rhino
version=1.7.15
revision=1
hostmakedepends="openjdk17 gradle"
depends="virtual?java-runtime"
short_desc="Mozilla's JavaScript written entirely in Java"
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
license="MPL-2.0"
homepage="https://rhino.github.io/"
distfiles="https://github.com/mozilla/rhino/releases/download/Rhino${version//./_}_Release/rhino-${version}.zip"
checksum=42fce6baf1bf789b62bf938b8e8ec18a1ac92c989dd6e7221e9531454cbd97fa
do_build() {
local _tool
. /etc/profile.d/jdk.sh
gradle --no-daemon jar
cat <<-'EOF' >rhino
#!/bin/sh
_jar=/usr/share/java/rhino.jar
if [ -f /usr/share/java/jline.jar ]; then
_jar="$_jar:/usr/share/java/jline.jar"
elif ${RHINO_NO_LINE_EDITING:+false} : ; then
echo "jline.jar not found, line editing is not supported" >&2
fi
exec java -classpath "$_jar" \
org.mozilla.javascript.tools.shell.Main \
"$@"
EOF
for _tool in debugger jsc; do
cat >"rhino-${_tool}" <<-EOF
#!/bin/sh
exec java -classpath /usr/share/java/rhino.jar \\
org.mozilla.javascript.tools.${_tool}.Main \\
"\$@"
EOF
done
}
do_check() {
. /etc/profile.d/jdk.sh
gradle --no-daemon test
}
do_install() {
vinstall buildGradle/libs/rhino-${version}-${version}.jar \
644 usr/share/java rhino-${version}.jar
ln -sf rhino-${version}.jar ${DESTDIR}/usr/share/java/rhino.jar
ln -sf rhino-${version}.jar ${DESTDIR}/usr/share/java/js.jar
vbin rhino
vbin rhino-debugger
vbin rhino-jsc
vman man/rhino.1
}