git: 0a8ad0114db6 - main - www/dmarcts-report-viewer: Add new port

From: Norikatsu Shigemura <nork_at_FreeBSD.org>
Date: Tue, 06 Feb 2024 15:00:56 UTC
The branch main has been updated by nork:

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

commit 0a8ad0114db64fb9211238cfe6dff06e8e4bc40c
Author:     Norikatsu Shigemura <nork@FreeBSD.org>
AuthorDate: 2024-02-06 14:58:55 +0000
Commit:     Norikatsu Shigemura <nork@FreeBSD.org>
CommitDate: 2024-02-06 14:58:55 +0000

    www/dmarcts-report-viewer: Add new port
    
    A PHP viewer for DMARC records that have been parsed by John
    Levine's rddmarc script or the dmarcts-report-parser.pl into
    a MySQL or PostgreSQL database.
    
    Reviewed by:    hrs (mentor)
    Approved by:    hrs (mentor)
---
 www/Makefile                                       |  1 +
 www/dmarcts-report-viewer/Makefile                 | 51 ++++++++++++++++++++++
 www/dmarcts-report-viewer/distinfo                 |  3 ++
 .../files/patch-dmarcts-report-viewer-common.php   | 11 +++++
 .../files/patch-dmarcts-report-viewer-options.php  | 11 +++++
 .../patch-dmarcts-report-viewer-report-data.php    | 11 +++++
 .../patch-dmarcts-report-viewer-report-list.php    | 11 +++++
 .../files/patch-dmarcts-report-viewer.php          | 11 +++++
 www/dmarcts-report-viewer/pkg-descr                |  2 +
 www/dmarcts-report-viewer/pkg-plist                | 17 ++++++++
 10 files changed, 129 insertions(+)

diff --git a/www/Makefile b/www/Makefile
index e93e6ba2d583..d14fd96c1eca 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -138,6 +138,7 @@
     SUBDIR += devd
     SUBDIR += dezoomify-rs
     SUBDIR += dillo2
+    SUBDIR += dmarcts-report-viewer
     SUBDIR += dojo
     SUBDIR += dokuwiki
     SUBDIR += dolibarr
diff --git a/www/dmarcts-report-viewer/Makefile b/www/dmarcts-report-viewer/Makefile
new file mode 100644
index 000000000000..5f974a8bd5e8
--- /dev/null
+++ b/www/dmarcts-report-viewer/Makefile
@@ -0,0 +1,51 @@
+PORTNAME=	dmarcts-report-viewer
+PORTVERSION=	2.0.0.20230615.${GH_TAGNAME}
+CATEGORIES=	www mail
+PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
+DIST_SUBDIR=	${PORTNAME}
+
+MAINTAINER=	nork@FreeBSD.org
+COMMENT=	PHP viewer for DMARC records
+WWW=		https://www.techsneeze.com/dmarc-report/
+
+LICENSE=	BSD3CLAUSE GPLv3
+LICENSE_COMB=	multi
+LICENSE_FILE_GPLv3=	${WRKSRC}/LICENSE
+LICENSE_FILE_BSD3CLAUSE=	${WRKSRC}/highlight.js/LICENSE
+
+USES=		php
+USE_PHP=	dom pdo xml
+USE_GITHUB=	yes
+GH_ACCOUNT=	techsneeze
+GH_TAGNAME=	4730985
+
+NO_ARCH=	yes
+NO_BUILD=	yes
+PLIST_SUB=	PORTNAME=${PORTNAME}
+ETCDIR=		${PREFIX}/etc
+
+OPTIONS_DEFINE=		MYSQL PGSQL
+OPTIONS_DEFAULT=	MYSQL PGSQL
+MYSQL_USE=		PHP=pdo_mysql
+PGSQL_USE=		PHP=pdo_pgsql
+
+post-patch:
+	cd ${PATCH_WRKSRC} && ${REINPLACE_CMD} \
+	    -e 's|%%ETCDIR%%|${ETCDIR}|' \
+	    -e 's|%%PORTNAME%%|${PORTNAME}|' \
+	    dmarcts-report-viewer-common.php \
+	    dmarcts-report-viewer-options.php \
+	    dmarcts-report-viewer-report-data.php \
+	    dmarcts-report-viewer-report-list.php \
+	    dmarcts-report-viewer.php
+
+pre-install:
+	@${MKDIR} ${STAGEDIR}${WWWDIR}/highlight.js/styles
+
+do-install:
+	${INSTALL_DATA} /dev/null ${STAGEDIR}${WWWDIR}/index.html
+	cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR} \
+	    "-name *\.js -o -name *\.css -o -name *\.png -o -name *\.php"
+	${INSTALL_DATA} ${WRKSRC}/${PORTNAME}-config.php.sample ${STAGEDIR}${ETCDIR}
+
+.include <bsd.port.mk>
diff --git a/www/dmarcts-report-viewer/distinfo b/www/dmarcts-report-viewer/distinfo
new file mode 100644
index 000000000000..8ed1180081c6
--- /dev/null
+++ b/www/dmarcts-report-viewer/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1704737908
+SHA256 (dmarcts-report-viewer/techsneeze-dmarcts-report-viewer-2.0.0.20230615.4730985-4730985_GH0.tar.gz) = 55a6563f5fe06616a16a2415d432c7ca9546e96017ae63d0df0963697be14033
+SIZE (dmarcts-report-viewer/techsneeze-dmarcts-report-viewer-2.0.0.20230615.4730985-4730985_GH0.tar.gz) = 82271
diff --git a/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-common.php b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-common.php
new file mode 100644
index 000000000000..059f1539c677
--- /dev/null
+++ b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-common.php
@@ -0,0 +1,11 @@
+--- dmarcts-report-viewer-common.php.orig	2023-07-15 05:56:09 UTC
++++ dmarcts-report-viewer-common.php
+@@ -251,7 +251,7 @@ function main() {
+ 
+ function main() {
+ 
+-	include "dmarcts-report-viewer-config.php";
++	include "%%ETCDIR%%/%%PORTNAME%%-config.php";
+ }
+ 
+ // This function sets variables for the DMARC Result portion (left half-circle) in the Report List
diff --git a/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-options.php b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-options.php
new file mode 100644
index 000000000000..44c32346224b
--- /dev/null
+++ b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-options.php
@@ -0,0 +1,11 @@
+--- dmarcts-report-viewer-options.php.orig	2023-07-15 05:56:09 UTC
++++ dmarcts-report-viewer-options.php
+@@ -255,7 +255,7 @@ function create_select($option_name, $option = array()
+ //####################################################################
+ 
+ // These files must exist, in the same folder as this script.
+-include "dmarcts-report-viewer-config.php";
++include "%%ETCDIR%%/%%PORTNAME%%-config.php";
+ include "dmarcts-report-viewer-common.php";
+ 
+ // Get all configuration options
diff --git a/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-report-data.php b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-report-data.php
new file mode 100644
index 000000000000..0c4b9a4e6481
--- /dev/null
+++ b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-report-data.php
@@ -0,0 +1,11 @@
+--- dmarcts-report-viewer-report-data.php.orig	2023-07-15 05:56:09 UTC
++++ dmarcts-report-viewer-report-data.php
+@@ -257,7 +257,7 @@ function formatXML($raw_xml, $reportnumber) {
+ //####################################################################
+ 
+ // These files are expected to be in the same folder as this script, and must exist.
+-include "dmarcts-report-viewer-config.php";
++include "%%ETCDIR%%/%%PORTNAME%%-config.php";
+ include "dmarcts-report-viewer-common.php";
+ 
+ // Get all configuration options
diff --git a/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-report-list.php b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-report-list.php
new file mode 100644
index 000000000000..2afdc6278210
--- /dev/null
+++ b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer-report-list.php
@@ -0,0 +1,11 @@
+--- dmarcts-report-viewer-report-list.php.orig	2023-07-15 05:56:09 UTC
++++ dmarcts-report-viewer-report-list.php
+@@ -105,7 +105,7 @@ function tmpl_reportList($reports, $sort) {
+ //####################################################################
+ 
+ // These files are expected to be in the same folder as this script, and must exist.
+-include "dmarcts-report-viewer-config.php";
++include "%%ETCDIR%%/%%PORTNAME%%-config.php";
+ include "dmarcts-report-viewer-common.php";
+ 
+ // Get all configuration options
diff --git a/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer.php b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer.php
new file mode 100644
index 000000000000..63bbe3e7ef3a
--- /dev/null
+++ b/www/dmarcts-report-viewer/files/patch-dmarcts-report-viewer.php
@@ -0,0 +1,11 @@
+--- dmarcts-report-viewer.php.orig	2023-07-15 05:56:09 UTC
++++ dmarcts-report-viewer.php
+@@ -224,7 +224,7 @@ function html ($domains = array(), $orgs = array(), $p
+ //####################################################################
+ 
+ // These files must exist, in the same folder as this script.
+-include "dmarcts-report-viewer-config.php";
++include "%%ETCDIR%%/%%PORTNAME%%-config.php";
+ include "dmarcts-report-viewer-common.php";
+ 
+ // Get all configuration options
diff --git a/www/dmarcts-report-viewer/pkg-descr b/www/dmarcts-report-viewer/pkg-descr
new file mode 100644
index 000000000000..9384cb9fd2a2
--- /dev/null
+++ b/www/dmarcts-report-viewer/pkg-descr
@@ -0,0 +1,2 @@
+A PHP viewer for DMARC records that have been parsed by John Levine's rddmarc
+script or the dmarcts-report-parser.pl into a MySQL or PostgreSQL database.
diff --git a/www/dmarcts-report-viewer/pkg-plist b/www/dmarcts-report-viewer/pkg-plist
new file mode 100644
index 000000000000..9fcf38806cd1
--- /dev/null
+++ b/www/dmarcts-report-viewer/pkg-plist
@@ -0,0 +1,17 @@
+%%WWWDIR%%/default.css
+%%WWWDIR%%/dusk2dawn.css
+%%WWWDIR%%/%%PORTNAME%%.js
+%%WWWDIR%%/%%PORTNAME%%-common.php
+%%WWWDIR%%/%%PORTNAME%%-options.php
+%%WWWDIR%%/%%PORTNAME%%-report-data.php
+%%WWWDIR%%/%%PORTNAME%%-report-list.php
+%%WWWDIR%%/%%PORTNAME%%.php
+%%WWWDIR%%/html.png
+%%WWWDIR%%/highlight.js/highlight.pack.js
+%%WWWDIR%%/highlight.js/styles/default.css
+%%WWWDIR%%/highlight.js/styles/dusk2dawn.css
+%%WWWDIR%%/index.html
+%%WWWDIR%%/menu_icon_default.css.png
+%%WWWDIR%%/menu_icon_dusk2dawn.css.png
+%%WWWDIR%%/xml.png
+@sample %%ETCDIR%%/%%PORTNAME%%-config.php.sample