From b7f9b60bb08d9b6bc1e80021eb939f6c0decc28f Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Wed, 8 Aug 2018 14:03:07 +0200
Subject: [PATCH 1/2] Add www/obhttpd from ports unchanged.

---
 www/obhttpd/Makefile                          | 65 +++++++++++++++++++
 www/obhttpd/distinfo                          |  3 +
 www/obhttpd/files/obhttpd.in                  | 25 +++++++
 .../files/patch-usr.bin_htpasswd_Makefile     |  9 +++
 .../files/patch-usr.sbin_httpd_Makefile       | 10 +++
 www/obhttpd/pkg-descr                         |  3 +
 www/obhttpd/pkg-plist                         |  7 ++
 7 files changed, 122 insertions(+)
 create mode 100644 www/obhttpd/Makefile
 create mode 100644 www/obhttpd/distinfo
 create mode 100644 www/obhttpd/files/obhttpd.in
 create mode 100644 www/obhttpd/files/patch-usr.bin_htpasswd_Makefile
 create mode 100644 www/obhttpd/files/patch-usr.sbin_httpd_Makefile
 create mode 100644 www/obhttpd/pkg-descr
 create mode 100644 www/obhttpd/pkg-plist

diff --git a/www/obhttpd/Makefile b/www/obhttpd/Makefile
new file mode 100644
index 0000000000..6bf08727c5
--- /dev/null
+++ b/www/obhttpd/Makefile
@@ -0,0 +1,65 @@
+# $FreeBSD: head/www/obhttpd/Makefile 476303 2018-08-03 16:14:26Z swills $
+
+PORTNAME=	obhttpd
+PORTVERSION=	6.3.20180803
+CATEGORIES=	www
+
+MAINTAINER=	koue@chaosophia.net
+COMMENT=	OpenBSD http server
+
+LICENSE=	BSD3CLAUSE
+
+WRKSRC_SUBDIR=	src
+
+USES=		ssl uidfix
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	koue
+GH_PROJECT=	httpd
+
+USE_RC_SUBR=	obhttpd
+
+CFLAGS+=	-Wall
+
+MAKE_ARGS+=	MANDIR=${PREFIX}/man/man
+
+USERS=		www
+GROUPS=		www
+
+post-patch:
+	${REINPLACE_CMD} -e 's|httpd$$|obhttpd|g' \
+			 -e 's|httpd.conf.5|obhttpd.conf.5|g' \
+			 -e 's|httpd.8|obhttpd.8|g' ${WRKSRC}/usr.sbin/httpd/Makefile
+	${REINPLACE_CMD} -e 's|htpasswd$$|obhtpasswd|g' \
+			 -e 's|htpasswd.1|obhtpasswd.1|g' ${WRKSRC}/usr.bin/htpasswd/Makefile
+	${MV} ${WRKSRC}/usr.bin/htpasswd/htpasswd.1 ${WRKSRC}/usr.bin/htpasswd/obhtpasswd.1
+	${MV} ${WRKSRC}/usr.sbin/httpd/httpd.conf.5 ${WRKSRC}/usr.sbin/httpd/obhttpd.conf.5
+	${MV} ${WRKSRC}/usr.sbin/httpd/httpd.8 ${WRKSRC}/usr.sbin/httpd/obhttpd.8
+	${REINPLACE_CMD} -e 's|/etc/httpd.conf|${PREFIX}/etc/obhttpd.conf|g' \
+		${WRKSRC}/usr.sbin/httpd/httpd.h
+
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/etc/examples/httpd.conf \
+		${STAGEDIR}${PREFIX}/etc/obhttpd.conf.sample
+
+.include <bsd.port.pre.mk>
+
+.if ! ${SSL_DEFAULT:Mlibressl*}
+. ifnmake describe
+STAGEDIR_libressl!=	${MAKE} -V STAGEDIR -C ${PORTSDIR}/security/libressl
+. endif
+BUILD_DEPENDS+= 	${NONEXISTENT}:security/libressl:stage
+CFLAGS+=		-I${STAGEDIR_libressl}${LOCALBASE}/include
+
+post-configure:
+	${REINPLACE_CMD} 's|-ltls|${STAGEDIR_libressl}${LOCALBASE}/lib/libtls.a|g' \
+		${WRKSRC}/usr.sbin/httpd/Makefile
+	${REINPLACE_CMD} 's|-lssl|${STAGEDIR_libressl}${LOCALBASE}/lib/libssl.a|g' \
+		 ${WRKSRC}/usr.sbin/httpd/Makefile
+	${REINPLACE_CMD} 's|-lcrypto|${STAGEDIR_libressl}${LOCALBASE}/lib/libcrypto.a|g' \
+		${WRKSRC}/usr.sbin/httpd/Makefile
+	${REINPLACE_CMD} 's|-lcrypto|${STAGEDIR_libressl}${LOCALBASE}/lib/libcrypto.a|g' \
+		${WRKSRC}/usr.bin/htpasswd/Makefile
+.endif # SSL_DEFAULT
+
+.include <bsd.port.post.mk>
diff --git a/www/obhttpd/distinfo b/www/obhttpd/distinfo
new file mode 100644
index 0000000000..56016c4818
--- /dev/null
+++ b/www/obhttpd/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1533301574
+SHA256 (koue-httpd-6.3.20180803_GH0.tar.gz) = 0133dc39e099aa04a570326457874329119a249f8b52aa4cb3e29600dae9e1ab
+SIZE (koue-httpd-6.3.20180803_GH0.tar.gz) = 217937
diff --git a/www/obhttpd/files/obhttpd.in b/www/obhttpd/files/obhttpd.in
new file mode 100644
index 0000000000..1f92e1843e
--- /dev/null
+++ b/www/obhttpd/files/obhttpd.in
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# $FreeBSD: head/www/obhttpd/files/obhttpd.in 403107 2015-12-06 12:17:51Z riggs $
+#
+# PROVIDE: obhttpd
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable obhttpd:
+# obhttpd_enable="YES"
+# obhttpd_flags="<set as needed>"
+
+. /etc/rc.subr
+
+name=obhttpd
+rcvar=obhttpd_enable
+
+command="%%PREFIX%%/sbin/obhttpd"
+
+obhttpd_enable=${obhttpd_enable:-"NO"}
+obhttpd_flags=${obhttpd_flags:-"-f %%PREFIX%%/etc/obhttpd.conf"}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/www/obhttpd/files/patch-usr.bin_htpasswd_Makefile b/www/obhttpd/files/patch-usr.bin_htpasswd_Makefile
new file mode 100644
index 0000000000..ad6f3102be
--- /dev/null
+++ b/www/obhttpd/files/patch-usr.bin_htpasswd_Makefile
@@ -0,0 +1,9 @@
+--- usr.bin/htpasswd/Makefile.orig	2018-07-10 10:58:14 UTC
++++ usr.bin/htpasswd/Makefile
+@@ -1,5 +1,6 @@
+ #	$OpenBSD: Makefile,v 1.4 2017/07/09 21:23:19 espie Exp $
+ LOCALBASE?=	/usr/local
++BINDIR?=	${LOCALBASE}/bin
+ 
+ PROG=		htpasswd
+ SRCS=		htpasswd.c
diff --git a/www/obhttpd/files/patch-usr.sbin_httpd_Makefile b/www/obhttpd/files/patch-usr.sbin_httpd_Makefile
new file mode 100644
index 0000000000..aedb439043
--- /dev/null
+++ b/www/obhttpd/files/patch-usr.sbin_httpd_Makefile
@@ -0,0 +1,10 @@
+--- usr.sbin/httpd/Makefile.orig	2018-07-10 10:58:32 UTC
++++ usr.sbin/httpd/Makefile
+@@ -1,6 +1,7 @@
+ #	$OpenBSD: Makefile,v 1.30 2017/07/03 22:21:47 espie Exp $
+ 
+ LOCALBASE?=	/usr/local
++BINDIR?=	${LOCALBASE}/sbin
+ PROG=		httpd
+ SRCS=		parse.y
+ SRCS+=		config.c control.c httpd.c log.c logger.c proc.c getdtablecount.c
diff --git a/www/obhttpd/pkg-descr b/www/obhttpd/pkg-descr
new file mode 100644
index 0000000000..ea3c00d271
--- /dev/null
+++ b/www/obhttpd/pkg-descr
@@ -0,0 +1,3 @@
+This is the FreeBSD port of the OpenBSD http server.
+
+WWW: https://github.com/koue/httpd
diff --git a/www/obhttpd/pkg-plist b/www/obhttpd/pkg-plist
new file mode 100644
index 0000000000..782e2449bb
--- /dev/null
+++ b/www/obhttpd/pkg-plist
@@ -0,0 +1,7 @@
+@sample etc/obhttpd.conf.sample
+bin/obhtpasswd
+man/man1/obhtpasswd.1.gz
+man/man5/obhttpd.conf.5.gz
+man/man7/patterns.7.gz
+man/man8/obhttpd.8.gz
+sbin/obhttpd
-- 
2.18.0

