dev-python/numpydoc: arm64 keyworded (bug #721130)
[gentoo.git] / net-libs / courier-authlib / courier-authlib-0.69.0-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 inherit flag-o-matic
6
7 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86"
8
9 DESCRIPTION="Courier authentication library"
10 SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
11 HOMEPAGE="https://www.courier-mta.org/authlib/"
12 LICENSE="GPL-3"
13 SLOT="0"
14 IUSE="berkdb crypt debug gdbm ldap libressl mysql pam postgres sqlite static-libs"
15
16 RESTRICT="!berkdb? ( test )"
17
18 DEPEND="net-mail/mailbase
19                 >=net-libs/courier-unicode-2.1
20                 gdbm? ( sys-libs/gdbm )
21                 !gdbm? ( sys-libs/db:= )
22                 !libressl? ( dev-libs/openssl:0= )
23                 libressl? ( dev-libs/libressl:= )
24                 ldap? ( >=net-nds/openldap-1.2.11 )
25                 mysql? ( dev-db/mysql-connector-c )
26                 pam? ( sys-libs/pam )
27                 postgres? ( dev-db/postgresql:= )
28                 sqlite? ( dev-db/sqlite:3 )"
29
30 RDEPEND="${DEPEND}"
31
32 pkg_setup() {
33         if ! has_version 'dev-tcltk/expect' ; then
34                 ewarn 'The dev-tcltk/expect package is not installed.'
35                 ewarn 'Without it, you will not be able to change system login passwords.'
36                 ewarn 'However non-system authentication modules (LDAP, MySQL, PostgreSQL,'
37                 ewarn 'and others) will work just fine.'
38         fi
39 }
40
41 src_configure() {
42         filter-flags -fomit-frame-pointer
43         local myconf
44         if use berkdb ; then
45                 if use gdbm ; then
46                         ewarn "Both gdbm and berkdb selected. Using gdbm."
47                 else
48                         myconf="--with-db=db"
49                 fi
50         fi
51         use gdbm && myconf="--with-db=gdbm"
52         use debug && myconf+=" debug=true"
53         use sqlite && myconf+=" --with-sqlite-libs"
54
55         econf \
56                 --sysconfdir=/etc/courier \
57                 --datadir=/usr/share/courier \
58                 --localstatedir=/var/lib/courier \
59                 --sharedstatedir=/var/lib/courier/com \
60                 --with-authdaemonvar=/var/lib/courier/authdaemon \
61                 --with-authshadow \
62                 --without-redhat \
63                 --with-mailuser=mail \
64                 --with-mailgroup=mail \
65                 --cache-file="${S}/configuring.cache" \
66                 $(use_with pam authpam) \
67                 $(use_with ldap authldap) \
68                 $(use_with mysql authmysql) \
69                 $(use_with postgres authpgsql) \
70                 $(use_with sqlite authsqlite) \
71                 ${myconf}
72 }
73
74 orderfirst() {
75         file="${D}/etc/courier/authlib/${1}" ; option="${2}" ; param="${3}"
76         if [[ -e "${file}" ]] ; then
77                 orig="$(grep ^${option}= ${file} | cut -d\" -f 2)"
78                 new="${option}=\"${param} `echo ${orig} | sed -e\"s/${param}//g\" -e\"s/  / /g\"`\""
79                 sed -i -e "s/^${option}=.*$/${new}/" "${file}" || die
80         fi
81 }
82
83 finduserdb() {
84         for dir in \
85                 /etc/courier/authlib /etc/courier /etc/courier-imap \
86                 /usr/lib/courier/etc /usr/lib/courier-imap/etc \
87                 /usr/local/etc /usr/local/etc/courier /usr/local/courier/etc \
88                 /usr/local/lib/courier/etc /usr/local/lib/courier-imap/etc \
89                 /usr/local/share/sqwebmail /usr/local/etc/courier-imap ; do
90                 if [[ -e "${dir}/userdb" ]] ; then
91                         einfo "Found userdb at: ${dir}/userdb"
92                         cp -fR "${dir}/userdb" "${D}/etc/courier/authlib/" || die
93                         chmod go-rwx "${D}/etc/courier/authlib/userdb" || die
94                         continue
95                 fi
96         done
97 }
98
99 src_install() {
100         diropts -o mail -g mail
101         dodir /etc/courier
102         keepdir /var/lib/courier/authdaemon
103         keepdir /etc/courier/authlib
104         emake DESTDIR="${D}" install
105         [[ ! -e "${D}/etc/courier/authlib/userdb" ]] && finduserdb
106         emake DESTDIR="${D}" install-configure
107         rm -f "${D}"/etc/courier/authlib/*.bak
108         chown mail:mail "${D}"/etc/courier/authlib/* || die
109         for y in "${D}"/etc/courier/authlib/*.dist ; do
110                 [[ ! -e "${y%%.dist}" ]] && cp -f "${y}" "${y%%.dist}"
111         done
112         use pam && orderfirst authdaemonrc authmodulelist authpam
113         use ldap && orderfirst authdaemonrc authmodulelist authldap
114         use sqlite && orderfirst authdaemonrc authmodulelist authsqlite
115         use postgres && orderfirst authdaemonrc authmodulelist authpgsql
116         use mysql && orderfirst authdaemonrc authmodulelist authmysql
117
118         DOCS=( AUTHORS ChangeLog* INSTALL NEWS README )
119         HTML_DOCS=(     README.html README_authlib.html NEWS.html INSTALL.html README.authdebug.html )
120         if use mysql ; then
121                 DOCS+=( README.authmysql.myownquery )
122                 HTML_DOCS+=( README.authmysql.html )
123         fi
124         if use postgres ; then
125                 HTML_DOCS+=( README.authpostgres.html README.authmysql.html )
126         fi
127         if use ldap ; then
128                 DOCS+=( README.ldap )
129                 dodir /etc/openldap/schema
130                 cp -f authldap.schema "${D}/etc/openldap/schema/" || die
131         fi
132         if use sqlite ; then
133                 HTML_DOCS+=( README.authsqlite.html README.authmysql.html )
134         fi
135         einstalldocs
136
137         newinitd "${FILESDIR}/${PN}-r2" "${PN}"
138
139         use static-libs || find "${D}" -name "*.a" -delete
140 }
141
142 pkg_postinst() {
143         if [[ -e /etc/courier/authlib/userdb ]] ; then
144                 einfo "Running makeuserdb ..."
145                 chmod go-rwx /etc/courier/authlib/userdb || die
146                 makeuserdb
147         fi
148 }