openconnect-7.07-r2.ebuild 3.8 KB

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