stunnel-5.36.ebuild 2.8 KB

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