git: 73fd41d01859 - main - textproc/saxon-he: Resurrect bin/saxon scripts

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Mon, 14 Jul 2025 11:38:25 UTC
The branch main has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=73fd41d0185923daf5b56be7ae13ceb11fe19eab

commit 73fd41d0185923daf5b56be7ae13ceb11fe19eab
Author:     Palle Girgensohn <girgen@FreeBSD.org>
AuthorDate: 2025-07-14 11:19:15 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2025-07-14 11:38:18 +0000

    textproc/saxon-he: Resurrect bin/saxon scripts
    
    Resurrected from the now removed saxon-devel, the script allows a simple
    way to run saxon transforms and xqueries from the command line.
    
    (Without PORTREVISION; I have two tiny fixes for the script coming up.
      -- mandree@)
    
    PR:             286764
    Approved by:    thierry@ with request to rebase it
---
 textproc/saxon-he/Makefile          |  9 ++++++++-
 textproc/saxon-he/files/saxon.sh.in | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/textproc/saxon-he/Makefile b/textproc/saxon-he/Makefile
index 0cf15bac7260..decab80302cb 100644
--- a/textproc/saxon-he/Makefile
+++ b/textproc/saxon-he/Makefile
@@ -29,12 +29,19 @@ JARFILES1=	saxon-he-${PORTVERSION}.jar \
 JARFILES2=	jline-2.14.6.jar \
 		xmlresolver-${_XMLRESOLVER_VER}.jar \
 		xmlresolver-${_XMLRESOLVER_VER}-data.jar
-PLIST_FILES=	${JARFILES:S,^,%%JAVAJARDIR%%/,}
+PLIST_FILES=	${JARFILES:S,^,%%JAVAJARDIR%%/,} ${SCRIPTFILES}
+
+SUB_FILES=	saxon.sh
+SUB_LIST=	SAXON_JARS="${JARFILES:S,^,${JAVAJARDIR}/,}"
+SCRIPTFILES=	bin/saxon bin/saxon-xquery
 
 do-install:
 	@${MKDIR} ${STAGEDIR}${JAVAJARDIR}
 	${INSTALL_DATA} ${JARFILES1:S,^,${WRKSRC}/,} ${STAGEDIR}${JAVAJARDIR}
 	${INSTALL_DATA} ${JARFILES2:S,^,${WRKSRC}/lib/,} ${STAGEDIR}${JAVAJARDIR}
+.for scriptfile in ${SCRIPTFILES}
+	${INSTALL_SCRIPT} ${WRKDIR}/saxon.sh ${STAGEDIR}${PREFIX}/${scriptfile}
+.endfor
 
 post-stage:
 # smoke test so we're sure we can load all required classes
diff --git a/textproc/saxon-he/files/saxon.sh.in b/textproc/saxon-he/files/saxon.sh.in
new file mode 100644
index 000000000000..3cb3014693c0
--- /dev/null
+++ b/textproc/saxon-he/files/saxon.sh.in
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+IAM="`basename "$0"`"
+
+if [ "${IAM}" = "saxon-xquery" ]
+then
+	LAUNCHER_CLASS="net.sf.saxon.Query"
+else
+	LAUNCHER_CLASS="net.sf.saxon.Transform"
+fi
+
+SAXON_CLASSPATH=""
+for jarfile in %%SAXON_JARS%%
+do
+	SAXON_CLASSPATH="${SAXON_CLASSPATH}:${jarfile}"
+done
+
+exec "%%LOCALBASE%%/bin/java" -classpath "${SAXON_CLASSPATH}" "${LAUNCHER_CLASS}" "$@"