openconnect-7.06-r1.ebuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Copyright 1999-2015 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 nls smartcard static-libs"
  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. >=dev-libs/openssl-1.0.1h:0[static-libs?]
  24. )
  25. gnutls? (
  26. >=net-libs/gnutls-3[static-libs?] dev-libs/nettle
  27. app-misc/ca-certificates
  28. )
  29. gssapi? ( virtual/krb5 )
  30. libproxy? ( net-libs/libproxy )
  31. nls? ( virtual/libintl )
  32. smartcard? ( sys-apps/pcsc-lite:0= )"
  33. RDEPEND="${DEPEND}
  34. sys-apps/iproute2
  35. !<sys-apps/openrc-0.13"
  36. DEPEND="${DEPEND}
  37. virtual/pkgconfig
  38. doc? ( ${PYTHON_DEPS} sys-apps/groff )
  39. java? ( >=virtual/jdk-1.6 )
  40. nls? ( sys-devel/gettext )"
  41. CONFIG_CHECK="~TUN"
  42. pkg_pretend() {
  43. check_extra_config
  44. }
  45. pkg_setup() {
  46. java-pkg-opt-2_pkg_setup
  47. if use doc; then
  48. python-any-r1_pkg_setup
  49. fi
  50. }
  51. src_configure() {
  52. strip-linguas $ILINGUAS
  53. echo ${LINGUAS} > po/LINGUAS
  54. if ! use doc; then
  55. # If the python cannot be found, the docs will not build
  56. sed -e 's#"${ac_cv_path_PYTHON}"#""#' -i configure || die
  57. fi
  58. # stoken and liboath not in portage
  59. econf \
  60. --with-vpnc-script="${EPREFIX}/etc/openconnect/openconnect.sh" \
  61. $(use_enable static-libs static) \
  62. $(use_enable nls ) \
  63. $(use_with !gnutls openssl) \
  64. $(use_with gnutls ) \
  65. $(use_with libproxy) \
  66. --without-stoken \
  67. $(use_with gssapi) \
  68. $(use_with smartcard libpcsclite) \
  69. $(use_with java)
  70. }
  71. DOC_CONTENTS="The init script for openconnect supports multiple vpn tunnels.
  72. You need to create a symbolic link to /etc/init.d/openconnect in /etc/init.d
  73. instead of calling it directly:
  74. ln -s /etc/init.d/openconnect /etc/init.d/openconnect.vpn0
  75. You can then start the vpn tunnel like this:
  76. /etc/init.d/openconnect.vpn0 start
  77. If you would like to run preup, postup, predown, and/or postdown scripts,
  78. You need to create a directory in /etc/openconnect with the name of the vpn:
  79. mkdir /etc/openconnect/vpn0
  80. Then add executable shell files:
  81. mkdir /etc/openconnect/vpn0
  82. cd /etc/openconnect/vpn0
  83. echo '#!/bin/sh' > preup.sh
  84. cp preup.sh predown.sh
  85. cp preup.sh postup.sh
  86. cp preup.sh postdown.sh
  87. chmod 755 /etc/openconnect/vpn0/*
  88. "
  89. src_install() {
  90. emake DESTDIR="${D}" install
  91. dodoc AUTHORS TODO
  92. newinitd "${FILESDIR}"/openconnect.init.in-r4 openconnect
  93. dodir /etc/openconnect
  94. insinto /etc/openconnect
  95. newconfd "${FILESDIR}"/openconnect.conf.in openconnect
  96. exeinto /etc/openconnect
  97. newexe "${WORKDIR}"/vpnc-scripts-${VPNC_VER}/vpnc-script openconnect.sh
  98. insinto /etc/logrotate.d
  99. newins "${FILESDIR}"/openconnect.logrotate openconnect
  100. keepdir /var/log/openconnect
  101. # Remove useless .la files
  102. prune_libtool_files --all
  103. readme.gentoo_create_doc
  104. }
  105. pkg_postinst() {
  106. readme.gentoo_print_elog
  107. if [[ -z ${REPLACING_VERSIONS} ]]; then
  108. elog
  109. elog "You may want to consider installing the following optional packages."
  110. optfeature "resolvconf support" net-dns/openresolv
  111. fi
  112. }