From 904e88d104399b51fbc6cbf3f904f831786dedb6 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 30 Apr 2018 14:41:18 +0000
Subject: postfix: update to 3.3.0

---
 abs/extra/postfix/PKGBUILD    | 93 +++++++++++++++++++++++++++++--------------
 abs/extra/postfix/__changelog |  2 +-
 abs/extra/postfix/sysusers.d  |  2 +
 3 files changed, 67 insertions(+), 30 deletions(-)
 create mode 100644 abs/extra/postfix/sysusers.d

diff --git a/abs/extra/postfix/PKGBUILD b/abs/extra/postfix/PKGBUILD
index 86b79f6..4683391 100644
--- a/abs/extra/postfix/PKGBUILD
+++ b/abs/extra/postfix/PKGBUILD
@@ -4,55 +4,90 @@
 # Maintainer: Gaetan Bisson <bisson@archlinux.org>
 
 pkgname=postfix
-pkgver=2.10.2
-pkgrel=1
-pkgdesc='Fast, easy to administer, secure mail server'
+pkgver=3.3.0
+pkgrel=3
 url='http://www.postfix.org/'
+pkgdesc='Fast, easy to administer, secure mail server'
 license=('custom')
-arch=('i686' 'x86_64')
-depends=('pcre' 'libsasl' 'db')
-backup=('etc/postfix/'{access,aliases,canonical,generic,header_checks,main.cf,master.cf,relocated,transport,virtual})
-source=("ftp://ftp.porcupine.org/mirrors/postfix-release/official/${pkgname}-${pkgver}.tar.gz"{,.sig}
+arch=('x86_64')
+depends=('openssl' 'pcre' 'icu' 'libsasl' 'db')
+source=("ftp://ftp.porcupine.org/mirrors/postfix-release/official/${pkgname}-${pkgver}.tar.gz"
         'aliases.patch'
+	'sysusers.d'
         'service')
-sha1sums=('4721024784d071c3e663d610db17f8bd99821f3d' 'SKIP'
-          '5fc3de6c7df1e5851a0a379e825148868808318b'
-          'dd12885d367bebaf0fc9d2e9823a7f82086b6ee9')
+sha256sums=('7942e89721e30118d7050675b0d976955e3160e21f7898b85a79cac4f4baef39'
+            'f4c766efc20b4638f9fd72707ca6d4c2628279ebd79f5227276fa4ca6867c336'
+	    '63f39147887336bdd173fb9425998f0a0c6f00a31241f922a255c157bfd8d02e'
+            '52781649c49a50cecd7d20f693f602d7dc78b985ac5f0e72c4abfa0d800e58f0')
 
-provides=('smtp-server' 'smtp-forwarder')
-conflicts=('smtp-server' 'smtp-forwarder')
+backup=('etc/postfix/'{access,aliases,canonical,generic,header_checks,main.cf,master.cf,relocated,transport,virtual})
 
-install=install
+conflicts=('smtp-server' 'smtp-forwarder' 'postfix-tools')
+provides=('smtp-server' 'smtp-forwarder' 'postfix-tools')
+replaces=('postfix-tools')
 
 build() {
 	cd "${srcdir}/${pkgname}-${pkgver}"
 
-	make makefiles DEBUG='' CCARGS=' \
-		-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl \
-		-DUSE_TLS \
-		-DDEF_COMMAND_DIR=\"/usr/bin\" \
-		-DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
-		-DDEF_SENDMAIL_PATH=\"/usr/bin/sendmail\" \
-#		-DDEF_README_DIR=\"/usr/share/doc/postfix\" \
-		-DDEF_SAMPLE_DIR=\"/etc/postfix/sample\" \
-		-DDEF_MANPAGE_DIR=\"/usr/share/man\" \
-	' AUXLIBS=' \
-		-lsasl2 \
-		-lssl -lcrypto \
-	' OPT="${CFLAGS} ${LDFLAGS}"
+	CCARGS='
+                -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl
+                -DUSE_TLS
+                -DDEF_COMMAND_DIR=\"/usr/bin\"
+                -DDEF_DAEMON_DIR=\"/usr/lib/postfix/bin\"
+                -DDEF_SENDMAIL_PATH=\"/usr/bin/sendmail\"
+                -DDEF_README_DIR=\"/usr/share/doc/postfix\"
+                -DDEF_MANPAGE_DIR=\"/usr/share/man\"
+        '
+	AUXLIBS='
+                -lsasl2
+                -llber
+                -lssl -lcrypto
+                -lpthread
+        '
+	make makefiles \
+		DEBUG='' \
+		pie=yes \
+		shared=yes \
+		CCARGS="${CCARGS//$'\n'/}" \
+		AUXLIBS="${AUXLIBS//$'\n'/}" \
+		OPT="${CFLAGS} ${LDFLAGS}" \
 
 	make
 }
 
 package() {
-	cd "${srcdir}/${pkgname}-${pkgver}"
+	cd "${srcdir}/postfix-${pkgver}"
 
+	sed 's:bin/postconf -dhx:bin/postconf -c conf -dhx:g' -i postfix-install
+	LD_LIBRARY_PATH=lib:$LD_LIBRARY_PATH \
 	sh postfix-install -non-interactive install_root="${pkgdir}"
 
 	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
 	install -Dm644 ../service "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
+	install -Dm644 ../sysusers.d "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
+
+	for name in posttls-finger {smtp,qmqp}-{sink,source}; do
+		install -Dm644 "man/man1/${name}.1" "${pkgdir}/usr/share/man/man1/${name}.1"
+		install -Dm755 "bin/${name}" "${pkgdir}/usr/bin/${name}"
+	done
 
+	# now set permissions right to appease the pacman gods
+	sed -r \
+		-e '/override=1/d' \
+		-e '/absolute path name/d' \
+		-e 's/\$POSTCONF -/$POSTCONF -c .\/etc\/postfix -/g' \
+		-e '/(if \[|chmod|chown|find|mkdir|test)/s/\$path/.\/$path/g' \
+		libexec/post-install > ../arch-post-install
 	cd "${pkgdir}"
-	patch -p0 -i "${srcdir}"/aliases.patch
-	sed 's/^\(\$manpage[^:]*\):/\1.gz:/' -i "usr/lib/${pkgname}/postfix-files"
+	LD_LIBRARY_PATH=usr/lib/postfix:$LD_LIBRARY_PATH \
+	sh "${srcdir}/arch-post-install" \
+                command_directory=usr/bin \
+                config_directory=etc/postfix \
+                meta_directory=etc/postfix \
+                setgid_group=75 \
+                mail_owner=73 \
+                set-permissions
+
+	patch --no-backup-if-mismatch -p0 -i "${srcdir}"/aliases.patch
+	sed 's/^\(\$manpage[^:]*\):/\1.gz:/' -i "etc/postfix/postfix-files"
 }
diff --git a/abs/extra/postfix/__changelog b/abs/extra/postfix/__changelog
index 25ca6b4..2826faf 100644
--- a/abs/extra/postfix/__changelog
+++ b/abs/extra/postfix/__changelog
@@ -1 +1 @@
-remove ldap/mysql/pg support
+remove ldap/mysql/pg/cdb support
diff --git a/abs/extra/postfix/sysusers.d b/abs/extra/postfix/sysusers.d
new file mode 100644
index 0000000..677b1b1
--- /dev/null
+++ b/abs/extra/postfix/sysusers.d
@@ -0,0 +1,2 @@
+g postdrop 75 -
+u postfix 73 - /var/spool/postfix
-- 
cgit v0.12

