stunnel-5.40.ebuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit ssl-cert 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. eapply "${FILESDIR}"/${PN}-5.39-compat-libressl.patch
  35. echo "CONFIG_PROTECT=\"/etc/stunnel/stunnel.conf\"" > "${T}"/20stunnel
  36. eapply_user
  37. }
  38. src_configure() {
  39. econf \
  40. --libdir="${EPREFIX}/usr/$(get_libdir)" \
  41. $(use_enable ipv6) \
  42. $(use_enable tcpd libwrap) \
  43. --with-ssl="${EPREFIX}"/usr \
  44. --disable-fips
  45. }
  46. src_install() {
  47. emake DESTDIR="${D}" install
  48. rm -rf "${ED}"/usr/share/doc/${PN}
  49. rm -f "${ED}"/etc/stunnel/stunnel.conf-sample \
  50. "${ED}"/usr/share/man/man8/stunnel.{fr,pl}.8
  51. use stunnel3 || rm -f "${ED}"/usr/bin/stunnel3
  52. # The binary was moved to /usr/bin with 4.21,
  53. # symlink for backwards compatibility
  54. dosym ../bin/stunnel /usr/sbin/stunnel
  55. dodoc AUTHORS BUGS CREDITS PORTS README TODO ChangeLog
  56. docinto html
  57. dodoc doc/stunnel.html doc/en/VNC_StunnelHOWTO.html tools/ca.html \
  58. tools/importCA.html
  59. insinto /etc/stunnel
  60. doins "${FILESDIR}"/stunnel.conf
  61. newinitd "${FILESDIR}"/stunnel-r1 stunnel
  62. doenvd "${T}"/20stunnel
  63. systemd_dounit "${S}/tools/stunnel.service"
  64. systemd_newtmpfilesd "${FILESDIR}"/stunnel.tmpfiles.conf stunnel.conf
  65. }
  66. pkg_postinst() {
  67. if [ ! -f "${EROOT}"/etc/stunnel/stunnel.key ]; then
  68. install_cert /etc/stunnel/stunnel
  69. chown stunnel:stunnel "${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
  70. chmod 0640 "${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
  71. fi
  72. einfo "If you want to run multiple instances of stunnel, create a new config"
  73. einfo "file ending with .conf in /etc/stunnel/. **Make sure** you change "
  74. einfo "\'pid= \' with a unique filename."
  75. }