git: 23ce783a74d8 - main - deskutils/stirling-pdf: made Stirling-PDF available

From: Matthias Fechner <mfechner_at_FreeBSD.org>
Date: Mon, 07 Apr 2025 13:32:14 UTC
The branch main has been updated by mfechner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=23ce783a74d8317a18d95f0a28ca266bc2bd7e3b

commit 23ce783a74d8317a18d95f0a28ca266bc2bd7e3b
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2025-04-07 13:26:31 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2025-04-07 13:32:10 +0000

    deskutils/stirling-pdf: made Stirling-PDF available
    
    This will make via webinterface editing on PDF available.
    For more details check the webpage:
    https://www.stirlingpdf.com/
    Github:
    https://github.com/Stirling-Tools/Stirling-PDF
    Documentation:
    https://docs.stirlingpdf.com/
---
 GIDs                                             |  2 +-
 UIDs                                             |  2 +-
 deskutils/Makefile                               |  1 +
 deskutils/stirling-pdf/Makefile                  | 56 +++++++++++++++++++++++
 deskutils/stirling-pdf/distinfo                  |  3 ++
 deskutils/stirling-pdf/files/custom_settings.yml |  6 +++
 deskutils/stirling-pdf/files/stirlingpdf.in      | 57 ++++++++++++++++++++++++
 deskutils/stirling-pdf/pkg-descr                 | 10 +++++
 deskutils/stirling-pdf/pkg-message               | 30 +++++++++++++
 9 files changed, 165 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index 50727c43468f..461c6349c29e 100644
--- a/GIDs
+++ b/GIDs
@@ -726,7 +726,7 @@ monero:*:781:
 zeek:*:782:
 # free: 783
 # free: 784
-# free: 785
+stirlingpdf:*:785:
 # free: 786
 # free: 787
 # free: 788
diff --git a/UIDs b/UIDs
index 22e316471440..0de2ef28aee6 100644
--- a/UIDs
+++ b/UIDs
@@ -732,7 +732,7 @@ monero:*:781:781::0:0:Monero Daemon:/var/db/monero:/usr/sbin/nologin
 zeek:*:782:782::0:0:Zeek Network Security Monitor:/nonexistent:/usr/sbin/nologin
 # free: 783
 # free: 784
-# free: 785
+stirlingpdf:*:785:785::0:0:Stirling PDF Daemon:/usr/local/stirlingpdf:/usr/sbin/nologin
 # free: 786
 # free: 787
 # free: 788
diff --git a/deskutils/Makefile b/deskutils/Makefile
index 50b984ae7fd1..087001c80c72 100644
--- a/deskutils/Makefile
+++ b/deskutils/Makefile
@@ -264,6 +264,7 @@
     SUBDIR += sowon
     SUBDIR += spacefm
     SUBDIR += spice-gtk
+    SUBDIR += stirling-pdf
     SUBDIR += subsurface
     SUBDIR += synapse
     SUBDIR += syncthingtray
diff --git a/deskutils/stirling-pdf/Makefile b/deskutils/stirling-pdf/Makefile
new file mode 100644
index 000000000000..d24d9e2e3dde
--- /dev/null
+++ b/deskutils/stirling-pdf/Makefile
@@ -0,0 +1,56 @@
+PORTNAME=	stirling-pdf
+PORTVERSION=	0.45.0
+CATEGORIES=	deskutils java
+MASTER_SITES=	https://files.stirlingpdf.com/v${PORTVERSION}/
+DISTNAME=	Stirling-PDF-with-login
+EXTRACT_SUFX=	.jar
+DIST_SUBDIR=	${PORTNAME}/${PORTVERSION}
+EXTRACT_ONLY=	
+
+MAINTAINER=	mfechner@FreeBSD.org
+COMMENT=	PDF modification toolbox with web UI
+WWW=		https://github.com/Stirling-Tools/Stirling-PDF \
+		https://www.stirlingpdf.com/
+
+LICENSE=	MIT
+
+USES=		java
+JAVA_VERSION=	21+
+USE_RC_SUBR=	stirlingpdf
+
+NO_ARCH=	yes
+NO_BUILD=	yes
+
+STIRLINGPDF_HOME?=	${PREFIX}/stirlingpdf
+STIRLINGPDF_USER?=	stirlingpdf
+STIRLINGPDF_GROUP?=	stirlingpdf
+
+SUB_LIST+=	STIRLINGPDF_HOME=${STIRLINGPDF_HOME} \
+		STIRLINGPDF_USER=${STIRLINGPDF_USER} \
+		STIRLINGPDF_GROUP=${STIRLINGPDF_GROUP} \
+		PREFIX=${PREFIX} \
+		JAVA=${JAVA} \
+		DISTNAME=${DISTNAME} \
+		EXTRACT_SUFX=${EXTRACT_SUFX}
+
+USERS=		${STIRLINGPDF_USER}
+GROUPS=		${STIRLINGPDF_GROUP}
+
+do-install:
+	${MKDIR} ${STAGEDIR}${STIRLINGPDF_HOME}
+	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}${EXTRACT_SUFX} \
+		${STAGEDIR}${STIRLINGPDF_HOME}/${DISTNAME}${EXTRACT_SUFX}
+	# Install configuration directory and sample config
+	${MKDIR} ${STAGEDIR}${STIRLINGPDF_HOME}/configs
+	${INSTALL_DATA} ${FILESDIR}/custom_settings.yml \
+		${STAGEDIR}${STIRLINGPDF_HOME}/configs/custom_settings.yml.sample
+
+post-install:
+	${ECHO_CMD} "stirlingpdf/Stirling-PDF-with-login.jar" >> ${TMPPLIST}
+	${ECHO_CMD} "@owner ${STIRLINGPDF_USER}" >> ${TMPPLIST}
+	${ECHO_CMD} "@group ${STIRLINGPDF_GROUP}" >> ${TMPPLIST}
+	${ECHO_CMD} "@dir(,,740) stirlingpdf" >> ${TMPPLIST}
+	${ECHO_CMD} "@dir(,,740) stirlingpdf/configs" >> ${TMPPLIST}
+	${ECHO_CMD} "@sample stirlingpdf/configs/custom_settings.yml.sample" >> ${TMPPLIST}
+
+.include <bsd.port.mk>
diff --git a/deskutils/stirling-pdf/distinfo b/deskutils/stirling-pdf/distinfo
new file mode 100644
index 000000000000..ce55e8b67a5f
--- /dev/null
+++ b/deskutils/stirling-pdf/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1744015419
+SHA256 (stirling-pdf/0.45.0/Stirling-PDF-with-login.jar) = 12e2b0ed7f7c560a44177e9a577b0676c8fcdfcaf3373e8ff6fb429925ba548a
+SIZE (stirling-pdf/0.45.0/Stirling-PDF-with-login.jar) = 149498193
diff --git a/deskutils/stirling-pdf/files/custom_settings.yml b/deskutils/stirling-pdf/files/custom_settings.yml
new file mode 100644
index 000000000000..14b21f0e9903
--- /dev/null
+++ b/deskutils/stirling-pdf/files/custom_settings.yml
@@ -0,0 +1,6 @@
+server:
+  host: 127.0.0.1
+  port: 9105
+security:
+  enableLogin: true # set to 'true' to enable login
+
diff --git a/deskutils/stirling-pdf/files/stirlingpdf.in b/deskutils/stirling-pdf/files/stirlingpdf.in
new file mode 100644
index 000000000000..f6ddbcb7dd83
--- /dev/null
+++ b/deskutils/stirling-pdf/files/stirlingpdf.in
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# PROVIDE: stirlingpdf
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+#
+# Configuration settings for Stirling-PDF in /etc/rc.conf:
+#
+# stirlingpdf_enable (bool):
+#   Set tto "NO" by default.
+#   Set it to "YES" to enable Stirling-PDF
+#
+# stirlingpdf_home (str):
+#   Set to "%%STIRLINGPDF_HOME%%" by default.
+#
+# stirlingpdf_user (str):
+#   Set to "%%STIRLINGPDF_USER%%" by default.
+#   User to run Stirling-PDF as.
+#
+# stirlingpdf_group (str):
+#   Set to "%%STIRLINGPDF_GROUP%%" by default.
+#   Group for data file ownership
+
+. /etc/rc.subr
+
+name="stirlingpdf"
+rcvar="${name}_enable"
+load_rc_config "${name}"
+
+: ${stirlingpdf_enable:="NO"}
+: ${stirlingpdf_home="%%STIRLINGPDF_HOME%%"}
+: ${stirlingpdf_user="%%STIRLINGPDF_USER%%"}
+: ${stirlingpdf_group="%%STIRLINGPDF_GROUP%%"}
+
+stirlingpdf_prestart()
+{
+	if [ ! -d "/var/run/${name}" ]; then
+		install -d -o "${stirlingpdf_user}" -g "${stirlingpdf_group}" -m 750 "/var/run/${name}"
+	fi
+}
+
+stirlingpdf_start()
+{
+	su -m ${stirlingpdf_user} -c "cd ${stirlingpdf_home} && exec ${command} ${command_args}"
+}
+
+pidfile=/var/run/${name}/${name}.pid
+command=/usr/sbin/daemon
+procname="%%JAVA%%"
+command_args="-f -p ${pidfile} %%JAVA%% -jar %%DISTNAME%%%%EXTRACT_SUFX%%"
+required_files="%%JAVA%% ${stirlingpdf_home}/%%DISTNAME%%%%EXTRACT_SUFX%%"
+
+start_precmd=stirlingpdf_prestart
+start_cmd=stirlingpdf_start
+
+run_rc_command "$1"
diff --git a/deskutils/stirling-pdf/pkg-descr b/deskutils/stirling-pdf/pkg-descr
new file mode 100644
index 000000000000..a7cd53b37951
--- /dev/null
+++ b/deskutils/stirling-pdf/pkg-descr
@@ -0,0 +1,10 @@
+Stirling-PDF is a robust, locally hosted web-based PDF manipulation tool.
+It enables you to carry out various operations on PDF files, including
+splitting, merging, converting, reorganizing, adding images, rotating,
+compressing, and more. This locally hosted web application has evolved to
+encompass a comprehensive set of features, addressing all your PDF requirements.
+
+All files and PDFs exist either exclusively on the client side, reside in
+server memory only during task execution, or temporarily reside in a file
+solely for the execution of the task. Any file downloaded by the user will have
+been deleted from the server by that point.
diff --git a/deskutils/stirling-pdf/pkg-message b/deskutils/stirling-pdf/pkg-message
new file mode 100644
index 000000000000..2110cc6c4325
--- /dev/null
+++ b/deskutils/stirling-pdf/pkg-message
@@ -0,0 +1,30 @@
+[
+{
+  message: <<EOM
+Stirling PDF was installed successfully.
+
+It listens by default on localhost:9105.
+
+Enable it with:
+service stirlingpdf enable
+
+Start it with:
+service stirlingpdf start
+
+It is recommended to use a reverse proxy like nginx to connect to it
+or change the configuration in:
+/usr/local/stirlingpdf/configs/custom_settings.yml
+
+For more details check the manual:
+https://docs.stirlingpdf.com/
+
+Authentication is enabled by default.
+Initial username: admin
+Initial password: stirling
+
+You must change the password after first login.
+
+EOM
+  type: install
+}
+]