pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

opensmtpd: finish package.



Module Name:	pkgsrc-wip
Committed By:	Paolo Vincenzo Olivo <vms%retrobsd.ddns.net@localhost>
Pushed By:	vms
Date:		Tue Aug 22 22:55:26 2023 +0200
Changeset:	a7549e5314c84cbfb1c5543314bca6f0c6c68cf1

Modified Files:
	opensmtpd/Makefile
	opensmtpd/PLIST.common
	opensmtpd/TODO
	opensmtpd/options.mk
Added Files:
	opensmtpd/MESSAGE
	opensmtpd/files/README.pkgsrc

Log Message:
opensmtpd: finish package.

Package has been tested on Linux and SunOS.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=a7549e5314c84cbfb1c5543314bca6f0c6c68cf1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 opensmtpd/MESSAGE             |  8 ++++++++
 opensmtpd/Makefile            | 41 ++++++++++++++++++++++++-----------------
 opensmtpd/PLIST.common        |  1 +
 opensmtpd/TODO                |  2 +-
 opensmtpd/files/README.pkgsrc | 14 ++++++++++++++
 opensmtpd/options.mk          |  6 +++---
 6 files changed, 51 insertions(+), 21 deletions(-)

diffs:
diff --git a/opensmtpd/MESSAGE b/opensmtpd/MESSAGE
new file mode 100644
index 0000000000..4f7d090e38
--- /dev/null
+++ b/opensmtpd/MESSAGE
@@ -0,0 +1,8 @@
+===========================================================================
+$NetBSD$
+
+Sample configuration files have been installed at ${PKG_SYSCONFDIR}/smtpd.
+
+Check the README available at ${DOCDIR}.
+
+===========================================================================
diff --git a/opensmtpd/Makefile b/opensmtpd/Makefile
index b5d38b987f..94f16a1318 100644
--- a/opensmtpd/Makefile
+++ b/opensmtpd/Makefile
@@ -18,11 +18,10 @@ USE_TOOLS+=	automake aclocal autoheader autoconf
 
 DEPENDS+=	mozilla-rootcerts-[0-9]*:../../security/mozilla-rootcerts
 
-SMTPD_HOME=	${VARBASE}/chroot/smtpd
-OWN_DIRS=	${SMTPD_HOME}
-
 PLIST_SRC=	PLIST.common
 
+CFLAGS.SunOS+=	-D__EXTENSIONS__
+
 PKG_GROUPS=		_smtpd _smtpq
 PKG_USERS=		_smtpd:_smtpd _smtpq:_smtpq
 PKG_GECOS._smtpd=	OpenSMTPD pseudo-user
@@ -51,29 +50,32 @@ CONFIGURE_ARGS+=	--with-pie
 
 .include "options.mk"
 
-CFLAGS.SunOS+=		-D__EXTENSIONS__
-
 EGDIR=		${PREFIX}/share/examples/opensmtpd
+DOCDIR=		${PREFIX}/share/doc/opensmtpd
 CONF_FILES+=	${EGDIR}/smtpd.conf ${PKG_SYSCONFDIR}/smtpd/smtpd.conf
 CONF_FILES+=	${EGDIR}/aliases ${PKG_SYSCONFDIR}/smtpd/aliases
 
+OWN_DIRS+=	${VARBASE}/chroot/smtpd
+OWN_DIRS+=	${PKG_SYSCONFDIR}/smtpd
+MAKE_DIRS+=	${VARBASE}/empty ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
+
+INSTALLATION_DIRS+=	share/examples/${PKGBASE}
+INSTALLATION_DIRS+=	share/doc/${PKGBASE}
+
 RCD_SCRIPTS=	opensmtpd
 
 SETUID_ROOT_PERMS?=	${REAL_ROOT_USER} _smtpq 2555
 SPECIAL_PERMS+=		sbin/smtpctl ${SETUID_ROOT_PERMS}
 
-MAKE_DIRS+=	${PKG_SYSCONFDIR}/smtpd
-MAKE_DIRS+=	${VARBASE}/empty ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
-
-SUBST_CLASSES+=		prefix
-SUBST_STAGE.prefix=	pre-configure
-SUBST_FILES.prefix=	${WRKDIR}/mailer.conf
-SUBST_VARS.prefix=	PREFIX
-SUBST_MESSAGE.prefix=	Replacing PREFIX placeholders.
+SUBST_CLASSES+=		pkgsrc
+SUBST_STAGE.pkgsrc=	pre-configure
+SUBST_FILES.pkgsrc=	mailer.conf README.pkgsrc
+SUBST_VARS.pkgsrc=	PKG_SYSCONFDIR PREFIX RCD_SCRIPTS_DIR
+SUBST_MESSAGE.pkgsrc=	Replacing pkgsrc placeholders.
 
 SUBST_CLASSES+=		paths
 SUBST_STAGE.paths=	pre-configure
-SUBST_MESSAGE.paths=	Replacing hard-coded paths.
+SUBST_MESSAGE.paths=	Fixing hard-coded paths.
 SUBST_FILES.paths+=	mk/smtpd/Makefile.am usr.sbin/smtpd/smtpd.conf	\
 			usr.sbin/smtpd/smtpd.8 usr.sbin/smtpd/smtpd.conf.5 \
 			usr.sbin/smtpd/aliases.5 usr.sbin/smtpd/makemap.8 \
@@ -83,8 +85,12 @@ SUBST_SED.paths+=	-e "s:/usr/local/etc:${PKG_SYSCONFDIR}/smtpd:g"
 SUBST_SED.paths+=	-e "s:@EXAMPLE_DIR@:${EGDIR}:g"
 SUBST_SED.paths+=	-e "s:/etc/ssl:${SSLDIR}:g"
 
+MESSAGE_SUBST+=		DOCDIR=${DOCDIR:Q}
+
 post-extract:
-	cp ${FILESDIR}/mailer.conf ${WRKDIR}/mailer.conf
+.for f in mailer.conf README.pkgsrc
+	cp ${FILESDIR}/${f} ${WRKSRC}
+.endfor
 
 pre-configure:
 	cd ${WRKSRC} && ${PREFIX}/bin/libtoolize --copy --force
@@ -93,9 +99,10 @@ pre-configure:
 	cd ${WRKSRC} && ${TOOLS_CMD.autoheader}
 	cd ${WRKSRC} && ${TOOLS_CMD.automake} --foreign --add-missing --copy
 
-.PHONY: install-aliases
-install-aliases:
+.PHONY: doc-install
+doc-install:
 	${INSTALL_DATA} ${WRKSRC}/etc/aliases ${DESTDIR}${EGDIR}
+	${INSTALL_DATA} ${WRKSRC}/README.pkgsrc ${DESTDIR}${DOCDIR}
 
 .if ${OPSYS} == "Linux"
 .  include "../../devel/libbsd/buildlink3.mk"
diff --git a/opensmtpd/PLIST.common b/opensmtpd/PLIST.common
index 3654426eba..815a79f7a2 100644
--- a/opensmtpd/PLIST.common
+++ b/opensmtpd/PLIST.common
@@ -27,6 +27,7 @@ man/man8/smtpctl.8
 man/man8/smtpd.8
 sbin/smtpctl
 sbin/smtpd
+share/doc/opensmtpd/README.pkgsrc
 share/examples/opensmtpd/aliases
 ${PLIST.mailwrapper}share/examples/opensmtpd/mailer.conf
 ${PLIST.pam}share/examples/opensmtpd/pam.d/smtp
diff --git a/opensmtpd/TODO b/opensmtpd/TODO
index 8beb511d8a..2d16ea66b8 100644
--- a/opensmtpd/TODO
+++ b/opensmtpd/TODO
@@ -11,7 +11,7 @@
 [X] Remove BROKEN_FOR_PLATFORM
     - OpenBSD-*-* (not tested yet)
 [X] CVE-2023-29323 is fixed upstream as of OpenSMTPD version 7.0.0-portable
-[ ] Write a README.pkgsrc
+[X] Write a README.pkgsrc
 [ ] Switch to bundled-libtls if OpenSSL3 is imported and LibreTLS
     doesn't get a fix in the meantime. See:
     https://github.com/OpenSMTPD/OpenSMTPD/pull/1208
diff --git a/opensmtpd/files/README.pkgsrc b/opensmtpd/files/README.pkgsrc
new file mode 100644
index 0000000000..a02a538133
--- /dev/null
+++ b/opensmtpd/files/README.pkgsrc
@@ -0,0 +1,14 @@
+Getting started
+===============
+
+Assuming NetBSD-style mailwrapper(8) and rc(8), few steps are required
+to set up OpenSMTPD for local and outbound delivery on your system: 
+
+* Run `$ @RCD_SCRIPTS_DIR@/postfix stop' and set postfix=NO in /etc/rc.conf.
+* Replace /etc/mailer.conf with @PREFIX@/share/examples/opensmtpd/mailer.conf.
+* Prepend @PREFIX@/man to the MANPATH environment to avoid conflicting
+  names for man pages with sendmail-compatible mail servers.
+* Check the smptd.conf and aliases files in @PKG_SYSCONFDIR@/smtpd. See 
+  relevant man pages.
+* Set opensmtpd=YES in /etc/rc.conf.  
+* Run `@RCD_SCRIPTS_DIR@/opensmtpd start' to start OpenSMTPD.
diff --git a/opensmtpd/options.mk b/opensmtpd/options.mk
index 43a40be5c9..2e88bf0a4f 100644
--- a/opensmtpd/options.mk
+++ b/opensmtpd/options.mk
@@ -49,8 +49,8 @@ pam-install:
 # the historical name.
 #
 .if !empty(PKG_OPTIONS:Mmailwrapper)
-post-install: install-aliases pam-install
-	${INSTALL_DATA} ${WRKDIR}/mailer.conf \
+post-install: doc-install pam-install
+	${INSTALL_DATA} ${WRKSRC}/mailer.conf \
 		${DESTDIR}${EGDIR}/mailer.conf
 	${RUN}${LN} -sf ${PREFIX}/sbin/smtpctl \
 		${DESTDIR}${PREFIX}/libexec/opensmtpd/makemap
@@ -62,7 +62,7 @@ PLIST.mailwrapper=	yes
 CONFLICTS+=	courier-mta-[0-9]* fastforward>=0.51nb2 sendmail-[0-9]*
 CONFLICTS+=	esmtp>=1.2 nullmailer-[0-9]* postfix-[0-9]* qmail-[0-9]*
 
-post-install: install-aliases pam-install
+post-install: doc-install pam-install
 .  for i in mailq makemap newaliases sendmail
 	${RUN}${LN} -sf ${PREFIX}/sbin/smtpctl	\
 		${DESTDIR}${PREFIX}/sbin/${i}


Home | Main Index | Thread Index | Old Index