logo

overlay

My (experimental) gentoo overlay

opensmtpd-6.4.2_p1.ebuild (2621B)


      1 # Copyright 1999-2018 Gentoo Foundation
      2 # Copyright 2018-2019 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
      3 # Distributed under the terms of the GNU General Public License v2
      4 
      5 EAPI=7
      6 
      7 inherit multilib user flag-o-matic pam toolchain-funcs autotools systemd
      8 
      9 DESCRIPTION="Lightweight but featured SMTP daemon from OpenBSD"
     10 HOMEPAGE="https://www.opensmtpd.org"
     11 SRC_URI="https://www.opensmtpd.org/archives/${P/_}.tar.gz"
     12 
     13 LICENSE="ISC BSD BSD-1 BSD-2 BSD-4"
     14 SLOT="0"
     15 KEYWORDS="~amd64"
     16 IUSE="libressl pam mdoc +mta"
     17 
     18 DEPEND="
     19 	!libressl? ( dev-libs/openssl:0 )
     20 	libressl? ( dev-libs/libressl )
     21 	sys-libs/zlib
     22 	pam? ( virtual/pam )
     23 	elibc_musl? (
     24 		sys-libs/fts-standalone
     25 		sys-libs/queue-standalone
     26 	)
     27 	sys-libs/db:=
     28 	dev-libs/libevent
     29 	app-misc/ca-certificates
     30 	net-mail/mailbase
     31 	net-libs/libasr
     32 	!mail-mta/courier
     33 	!mail-mta/esmtp
     34 	!mail-mta/exim
     35 	!mail-mta/mini-qmail
     36 	!mail-mta/msmtp[mta]
     37 	!mail-mta/netqmail
     38 	!mail-mta/nullmailer
     39 	!mail-mta/postfix
     40 	!mail-mta/qmail-ldap
     41 	!mail-mta/sendmail
     42 	!mail-mta/ssmtp[mta]
     43 "
     44 RDEPEND="${DEPEND}"
     45 
     46 S=${WORKDIR}/${P/_}
     47 
     48 # PATCHES=( "${FILESDIR}/opensmtpd-6.4.0_p1_missing_object_file_smtpctl.patch" )
     49 
     50 src_prepare() {
     51 	default
     52 
     53 	# Use /run instead of /var/run
     54 	sed -i -e '/pidfile_path/s:_PATH_VARRUN:"/run/":' openbsd-compat/pidfile.c || die
     55 	sed -i -e 's;/usr/libexec/;/usr/libexec/opensmtpd/;g' smtpd/parse.y || die
     56 
     57 	append-cflags "-ffunction-sections"
     58 	append-ldflags "-Wl,--gc-sections"
     59 
     60 	eautoreconf
     61 }
     62 
     63 src_configure() {
     64 	tc-export AR
     65 	AR="$(which "$AR")" econf \
     66 		--with-table-db \
     67 		--with-user-smtpd=smtpd \
     68 		--with-user-queue=smtpq \
     69 		--with-group-queue=smtpq \
     70 		--with-path-socket=/run \
     71 		--with-path-CAfile=/etc/ssl/certs/ca-certificates.crt \
     72 		--sysconfdir=/etc/opensmtpd \
     73 		--with-mantype=$(usex mdoc doc man) \
     74 		$(use_with pam auth-pam)
     75 }
     76 
     77 src_install() {
     78 	default
     79 
     80 	newinitd "${FILESDIR}"/smtpd.initd smtpd
     81 	systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
     82 
     83 	use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
     84 
     85 	dosym /usr/sbin/smtpctl /usr/sbin/makemap
     86 	dosym /usr/sbin/smtpctl /usr/sbin/newaliases
     87 
     88 	if use mta ; then
     89 		dodir /usr/sbin
     90 		dosym /usr/sbin/smtpctl /usr/sbin/sendmail
     91 		dosym /usr/sbin/smtpctl /usr/bin/sendmail
     92 		dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
     93 	fi
     94 }
     95 
     96 pkg_preinst() {
     97 	enewgroup smtpd 25
     98 	enewuser smtpd 25 -1 /var/empty smtpd
     99 	enewgroup smtpq 252
    100 	enewuser smtpq 252 -1 /var/empty smtpq
    101 }
    102 
    103 pkg_postinst() {
    104 	einfo
    105 	einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
    106 	einfo "Redis, and many other useful addons and filters are"
    107 	einfo "available in the mail-filter/opensmtpd-extras package."
    108 	einfo
    109 }