openconnect-7.06-r4.ebuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. PYTHON_COMPAT=( python2_7 )
  5. PYTHON_REQ_USE="xml"
  6. inherit eutils java-pkg-opt-2 linux-info python-any-r1 readme.gentoo
  7. DESCRIPTION="Free client for Cisco AnyConnect SSL VPN software"
  8. HOMEPAGE="http://www.infradead.org/openconnect.html"
  9. VPNC_VER=20140806
  10. SRC_URI="ftp://ftp.infradead.org/pub/${PN}/${P}.tar.gz
  11. ftp://ftp.infradead.org/pub/vpnc-scripts/vpnc-scripts-${VPNC_VER}.tar.gz"
  12. LICENSE="LGPL-2.1 GPL-2"
  13. SLOT="0/5"
  14. KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
  15. IUSE="doc +gnutls gssapi java libproxy libressl nls smartcard static-libs stoken"
  16. ILINGUAS="ar cs de el en_GB en_US es eu fi fr gl id lt nl pa pl pt pt_BR sk sl tg ug uk zh_CN zh_TW"
  17. for lang in $ILINGUAS; do
  18. IUSE="${IUSE} linguas_${lang}"
  19. done
  20. DEPEND="dev-libs/libxml2
  21. sys-libs/zlib
  22. !gnutls? (
  23. !libressl? ( >=dev-libs/openssl-1.0.1h:0=[static-libs?] )
  24. libressl? ( dev-libs/libressl:0=[static-libs?] )
  25. )
  26. gnutls? (
  27. app-misc/ca-certificates
  28. dev-libs/nettle
  29. >=net-libs/gnutls-3:0=[static-libs?]
  30. )
  31. gssapi? ( virtual/krb5 )
  32. libproxy? ( net-libs/libproxy )
  33. nls? ( virtual/libintl )
  34. smartcard? ( sys-apps/pcsc-lite:0= )
  35. stoken? ( app-crypt/stoken )"
  36. RDEPEND="${DEPEND}
  37. sys-apps/iproute2
  38. !<sys-apps/openrc-0.13"
  39. DEPEND="${DEPEND}
  40. virtual/pkgconfig
  41. doc? ( ${PYTHON_DEPS} sys-apps/groff )
  42. java? ( >=virtual/jdk-1.6 )
  43. nls? ( sys-devel/gettext )"
  44. CONFIG_CHECK="~TUN"
  45. pkg_pretend() {
  46. check_extra_config
  47. }
  48. pkg_setup() {
  49. java-pkg-opt-2_pkg_setup
  50. if use doc; then
  51. python-any-r1_pkg_setup
  52. fi
  53. }
  54. src_configure() {
  55. strip-linguas $ILINGUAS
  56. echo ${LINGUAS} > po/LINGUAS
  57. if ! use doc; then
  58. # If the python cannot be found, the docs will not build
  59. sed -e 's#"${ac_cv_path_PYTHON}"#""#' -i configure || die
  60. fi
  61. # liboath not in portage
  62. econf \
  63. --with-vpnc-script="${EPREFIX}/etc/openconnect/openconnect.sh" \
  64. $(use_enable static-libs static) \
  65. $(use_enable nls ) \
  66. $(use_with !gnutls openssl) \
  67. $(use_with gnutls ) \
  68. $(use_with libproxy) \
  69. $(use_with gssapi) \
  70. $(use_with smartcard libpcsclite) \
  71. $(use_with stoken) \
  72. $(use_with java)
  73. }
  74. DOC_CONTENTS="The init script for openconnect supports multiple vpn tunnels.
  75. You need to create a symbolic link to /etc/init.d/openconnect in /etc/init.d
  76. instead of calling it directly:
  77. ln -s /etc/init.d/openconnect /etc/init.d/openconnect.vpn0
  78. You can then start the vpn tunnel like this:
  79. /etc/init.d/openconnect.vpn0 start
  80. If you would like to run preup, postup, predown, and/or postdown scripts,
  81. You need to create a directory in /etc/openconnect with the name of the vpn:
  82. mkdir /etc/openconnect/vpn0
  83. Then add executable shell files:
  84. mkdir /etc/openconnect/vpn0
  85. cd /etc/openconnect/vpn0
  86. echo '#!/bin/sh' > preup.sh
  87. cp preup.sh predown.sh
  88. cp preup.sh postup.sh
  89. cp preup.sh postdown.sh
  90. chmod 755 /etc/openconnect/vpn0/*
  91. "
  92. src_install() {
  93. emake DESTDIR="${D}" install
  94. dodoc AUTHORS TODO
  95. newinitd "${FILESDIR}"/openconnect.init.in-r4 openconnect
  96. dodir /etc/openconnect
  97. insinto /etc/openconnect
  98. newconfd "${FILESDIR}"/openconnect.conf.in openconnect
  99. exeinto /etc/openconnect
  100. newexe "${WORKDIR}"/vpnc-scripts-${VPNC_VER}/vpnc-script openconnect.sh
  101. insinto /etc/logrotate.d
  102. newins "${FILESDIR}"/openconnect.logrotate openconnect
  103. keepdir /var/log/openconnect
  104. # Remove useless .la files
  105. prune_libtool_files --all
  106. readme.gentoo_create_doc
  107. }
  108. pkg_postinst() {
  109. readme.gentoo_print_elog
  110. if [[ -z ${REPLACING_VERSIONS} ]]; then
  111. elog
  112. elog "You may want to consider installing the following optional packages."
  113. optfeature "resolvconf support" net-dns/openresolv
  114. fi
  115. }