x11-themes/QGnomePlatform: Drop old
[gentoo.git] / net-misc / stunnel / stunnel-5.50-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit ssl-cert multilib systemd user
7
8 DESCRIPTION="TLS/SSL - Port Wrapper"
9 HOMEPAGE="http://www.stunnel.org/index.html"
10 SRC_URI="ftp://ftp.stunnel.org/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
11         http://www.usenix.org.uk/mirrors/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
12         http://ftp.nluug.nl/pub/networking/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
13         http://www.namesdir.com/mirrors/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
14         http://stunnel.cybermirror.org/archive/${PV%%.*}.x/${P}.tar.gz
15         http://mirrors.zerg.biz/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
16         ftp://mirrors.go-parts.com/stunnel/archive/${PV%%.*}.x/${P}.tar.gz"
17
18 LICENSE="GPL-2"
19 SLOT="0"
20 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
21 IUSE="ipv6 libressl selinux stunnel3 tcpd"
22
23 DEPEND="tcpd? ( sys-apps/tcp-wrappers )
24         !libressl? ( dev-libs/openssl:0= )
25         libressl? ( dev-libs/libressl:0= )"
26 RDEPEND="${DEPEND}
27         stunnel3? ( dev-lang/perl )
28         selinux? ( sec-policy/selinux-stunnel )"
29
30 RESTRICT="test"
31
32 pkg_setup() {
33         enewgroup stunnel
34         enewuser stunnel -1 -1 -1 stunnel
35 }
36
37 src_prepare() {
38         # Hack away generation of certificate
39         sed -i -e "s/^install-data-local:/do-not-run-this:/" \
40                 tools/Makefile.in || die "sed failed"
41
42         # bug 656420
43         eapply "${FILESDIR}"/${P}-libressl.patch
44
45         echo "CONFIG_PROTECT=\"/etc/stunnel/stunnel.conf\"" > "${T}"/20stunnel
46
47         eapply_user
48 }
49
50 src_configure() {
51         econf \
52                 --libdir="${EPREFIX}/usr/$(get_libdir)" \
53                 $(use_enable ipv6) \
54                 $(use_enable tcpd libwrap) \
55                 --with-ssl="${EPREFIX}"/usr \
56                 --disable-fips
57 }
58
59 src_install() {
60         emake DESTDIR="${D}" install
61         rm -rf "${ED}"/usr/share/doc/${PN}
62         rm -f "${ED}"/etc/stunnel/stunnel.conf-sample \
63                 "${ED}"/usr/share/man/man8/stunnel.{fr,pl}.8
64         use stunnel3 || rm -f "${ED}"/usr/bin/stunnel3
65
66         # The binary was moved to /usr/bin with 4.21,
67         # symlink for backwards compatibility
68         dosym ../bin/stunnel /usr/sbin/stunnel
69
70         dodoc AUTHORS BUGS CREDITS PORTS README TODO ChangeLog
71         docinto html
72         dodoc doc/stunnel.html doc/en/VNC_StunnelHOWTO.html tools/ca.html \
73                 tools/importCA.html
74
75         insinto /etc/stunnel
76         doins "${FILESDIR}"/stunnel.conf
77         newinitd "${FILESDIR}"/stunnel-r1 stunnel
78
79         doenvd "${T}"/20stunnel
80
81         systemd_dounit "${S}/tools/stunnel.service"
82         systemd_newtmpfilesd "${FILESDIR}"/stunnel.tmpfiles.conf stunnel.conf
83 }
84
85 pkg_postinst() {
86         if [ ! -f "${EROOT}"/etc/stunnel/stunnel.key ]; then
87                 install_cert /etc/stunnel/stunnel
88                 chown stunnel:stunnel "${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
89                 chmod 0640 "${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
90         fi
91
92         einfo "If you want to run multiple instances of stunnel, create a new config"
93         einfo "file ending with .conf in /etc/stunnel/. **Make sure** you change "
94         einfo "\'pid= \' with a unique filename."
95 }