git: f9ecfbda7dce - main - www/py-searxng-devel: Add new port

From: Gabriel M. Dutra <dutra_at_FreeBSD.org>
Date: Fri, 23 Aug 2024 03:51:10 UTC
The branch main has been updated by dutra:

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

commit f9ecfbda7dceb7ffa5b3aae43035118401ff6826
Author:     Jesús Daniel Colmenares Oviedo <DtxdF@disroot.org>
AuthorDate: 2024-08-23 03:47:32 +0000
Commit:     Gabriel M. Dutra <dutra@FreeBSD.org>
CommitDate: 2024-08-23 03:49:57 +0000

    www/py-searxng-devel: Add new port
    
    SearXNG is a free internet metasearch engine
    
    PR:             278972
---
 www/Makefile                          |  1 +
 www/py-searxng-devel/Makefile         | 57 +++++++++++++++++++++++++++++++++++
 www/py-searxng-devel/distinfo         |  3 ++
 www/py-searxng-devel/files/searxng.in | 46 ++++++++++++++++++++++++++++
 www/py-searxng-devel/pkg-descr        |  4 +++
 www/py-searxng-devel/pkg-message      |  8 +++++
 www/py-searxng-devel/pkg-plist        |  1 +
 7 files changed, 120 insertions(+)

diff --git a/www/Makefile b/www/Makefile
index 06b9c69c555d..94798e02dd65 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -1813,6 +1813,7 @@
     SUBDIR += py-scrapy
     SUBDIR += py-seafdav
     SUBDIR += py-seafobj
+    SUBDIR += py-searxng-devel
     SUBDIR += py-secure-cookie
     SUBDIR += py-selector
     SUBDIR += py-selenium
diff --git a/www/py-searxng-devel/Makefile b/www/py-searxng-devel/Makefile
new file mode 100644
index 000000000000..e7108a1eac90
--- /dev/null
+++ b/www/py-searxng-devel/Makefile
@@ -0,0 +1,57 @@
+PORTNAME=	searxng
+DISTVERSION=	20240819
+CATEGORIES=	www python
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+PKGNAMESUFFIX=	-devel
+
+MAINTAINER=	DtxdF@disroot.org
+COMMENT=	Free internet metasearch engine
+WWW=		https://docs.searxng.org/
+
+LICENSE=	AGPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pyyaml>=0:devel/py-pyyaml@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}Babel>=0:devel/py-babel@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}brotli>=0:archivers/py-brotli@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}certifi>=0:security/py-certifi@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}fasttext-predict>=0:textproc/py-fasttext-predict@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}flask-babel>=0:devel/py-flask-babel@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}flask>=0:www/py-flask@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}httpx-socks>=0:www/py-httpx-socks@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}httpx>=0:www/py-httpx@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}Jinja2>=0:devel/py-Jinja2@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}langdetect>=0:textproc/py-langdetect@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}lxml>=0:devel/py-lxml@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}markdown-it-py>=0:textproc/py-markdown-it-py@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pygments>=0:textproc/py-pygments@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}python-dateutil>=0:devel/py-python-dateutil@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytomlpp>=0:textproc/py-pytomlpp@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}redis>=0:databases/py-redis@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}requests>=0:www/py-requests@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}setproctitle>=0:devel/py-setproctitle@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}uvloop>=0:devel/py-uvloop@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pyyaml>=0:devel/py-pyyaml@${PY_FLAVOR}
+
+USES=		python
+USE_GITHUB=	yes
+GH_TAGNAME=	c0369ee48812451d40f331de80d388841a8bcf77
+USE_PYTHON=	autoplist distutils
+USE_RC_SUBR=	searxng
+
+CONFLICTS=	searx
+
+NO_ARCH=	yes
+
+SUB_FILES=	searxng
+SUB_LIST=	PYTHON_CMD=${PYTHON_CMD}
+
+post-patch: # expect dependencies to be backwards-compatible, otherwise it is difficult to have a port
+	@${REINPLACE_CMD} -e 's|==|>=|' ${WRKSRC}/requirements.txt
+
+post-install:
+# move settings to etc/ /usr/local/lib/python3.x/site-packages/searx/settings.yml
+	@${MV} ${STAGEDIR}${PYTHON_SITELIBDIR}/searx/settings.yml ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.yml.sample
+	@${LN} -s ${PREFIX}/etc/${PORTNAME}.yml ${STAGEDIR}${PYTHON_SITELIBDIR}/searx/settings.yml
+
+.include <bsd.port.mk>
diff --git a/www/py-searxng-devel/distinfo b/www/py-searxng-devel/distinfo
new file mode 100644
index 000000000000..ddf74effe77f
--- /dev/null
+++ b/www/py-searxng-devel/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1724070743
+SHA256 (searxng-searxng-20240819-c0369ee48812451d40f331de80d388841a8bcf77_GH0.tar.gz) = bad2074397364c9dfe4a8e1e6e4670bd01c2d3208005ba0b4a0348531dbdbc01
+SIZE (searxng-searxng-20240819-c0369ee48812451d40f331de80d388841a8bcf77_GH0.tar.gz) = 4701096
diff --git a/www/py-searxng-devel/files/searxng.in b/www/py-searxng-devel/files/searxng.in
new file mode 100644
index 000000000000..43e7fa3bc86d
--- /dev/null
+++ b/www/py-searxng-devel/files/searxng.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# PROVIDE: searxng
+# REQUIRE: DAEMON NETWORKING
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+#
+# Configuration settings for searxng in /etc/rc.conf
+#
+# searxng_enable (bool):        Enable searxng. (Default=NO)
+# searxng_user (str):           User to run searxng as. (Default=www)
+# searxng_group (str):          Group to run searxng as. (Default=www)
+# searxng_env (str):            Environment variables.
+#                               (Default=SEARXNG_SETTINGS_PATH="%%PREFIX%%/etc/searxng.yml")
+# searxng_log (str):            Log file used to store the searxng's output.
+#                               (Default=/var/log/searxng.log)
+
+. /etc/rc.subr
+
+name="searxng"
+rcvar=searxng_enable
+
+: ${searxng_enable:="NO"}
+: ${searxng_user:="www"}
+: ${searxng_group:="www"}
+: ${searxng_env:="SEARXNG_SETTINGS_PATH=\"%%PREFIX%%/etc/searxng.yml\""}
+: ${searxng_log:="/var/log/searxng.log"}
+
+# daemon
+pidfile="/var/run/${name}.pid"
+command=/usr/sbin/daemon
+procname="daemon"
+command_args=" -c -o ${searxng_log} -P ${pidfile} %%PYTHON_CMD%% %%PREFIX%%/bin/searxng-run"
+start_precmd="searxng_precmd"
+
+searxng_precmd()
+{
+	install -o ${searxng_user} /dev/null ${pidfile}
+
+	if [ ! -f "${searxng_log}" ]; then
+		install -o ${searxng_user} -m 640 /dev/null "${searxng_log}"
+	fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/www/py-searxng-devel/pkg-descr b/www/py-searxng-devel/pkg-descr
new file mode 100644
index 000000000000..c3d0e1530969
--- /dev/null
+++ b/www/py-searxng-devel/pkg-descr
@@ -0,0 +1,4 @@
+SearXNG is a free internet metasearch engine which aggregates results
+from more than 70 search services. Users are neither tracked nor
+profiled. Additionally, SearXNG can be used over Tor for online
+anonymity.
diff --git a/www/py-searxng-devel/pkg-message b/www/py-searxng-devel/pkg-message
new file mode 100644
index 000000000000..6d8a3815fec0
--- /dev/null
+++ b/www/py-searxng-devel/pkg-message
@@ -0,0 +1,8 @@
+[
+{ type: install
+  message: <<EOM
+If you want to use SearxNG in a production environment, use www/nginx, www/apache24,
+or www/uwsgi. The rc script for this port does not use any of them.
+EOM
+}
+]
diff --git a/www/py-searxng-devel/pkg-plist b/www/py-searxng-devel/pkg-plist
new file mode 100644
index 000000000000..88375f420963
--- /dev/null
+++ b/www/py-searxng-devel/pkg-plist
@@ -0,0 +1 @@
+@sample etc/searxng.yml.sample