logo

overlay

My own overlay for experimentations, use with caution, no support is provided

opensmtpd-6.6.4_p1.ebuild (2556B)


      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-1.1.0:0 )
     20 	libressl? ( >=dev-libs/libressl-3.0.2 )
     21 	sys-libs/zlib
     22 	pam? ( sys-libs/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 src_prepare() {
     49 	default
     50 
     51 	# Use /run instead of /var/run
     52 	sed -i -e '/pidfile_path/s:_PATH_VARRUN:"/run/":' openbsd-compat/pidfile.c || die
     53 	sed -i -e 's;/usr/libexec/;/usr/libexec/opensmtpd/;g' smtpd/parse.y || die
     54 
     55 	append-cflags "-ffunction-sections"
     56 	append-ldflags "-Wl,--gc-sections"
     57 
     58 	eautoreconf
     59 }
     60 
     61 src_configure() {
     62 	tc-export AR
     63 	AR="$(which "$AR")" econf \
     64 		--with-table-db \
     65 		--with-user-smtpd=smtpd \
     66 		--with-user-queue=smtpq \
     67 		--with-group-queue=smtpq \
     68 		--with-path-socket=/run \
     69 		--with-path-CAfile=/etc/ssl/certs/ca-certificates.crt \
     70 		--sysconfdir=/etc/opensmtpd \
     71 		--with-mantype=$(usex mdoc doc man) \
     72 		$(use_with pam auth-pam)
     73 }
     74 
     75 src_install() {
     76 	default
     77 
     78 	newinitd "${FILESDIR}"/smtpd.initd smtpd
     79 	systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
     80 
     81 	use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
     82 
     83 	dosym /usr/sbin/smtpctl /usr/sbin/makemap
     84 	dosym /usr/sbin/smtpctl /usr/sbin/newaliases
     85 
     86 	if use mta ; then
     87 		dodir /usr/sbin
     88 		dosym /usr/sbin/smtpctl /usr/sbin/sendmail
     89 		dosym /usr/sbin/smtpctl /usr/bin/sendmail
     90 		dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
     91 	fi
     92 }
     93 
     94 pkg_preinst() {
     95 	enewgroup smtpd 25
     96 	enewuser smtpd 25 -1 /var/empty smtpd
     97 	enewgroup smtpq 252
     98 	enewuser smtpq 252 -1 /var/empty smtpq
     99 }
    100 
    101 pkg_postinst() {
    102 	einfo
    103 	einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
    104 	einfo "Redis, and many other useful addons and filters are"
    105 	einfo "available in the mail-filter/opensmtpd-extras package."
    106 	einfo
    107 }