openconnect-7.07-r1.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # Copyright 1999-2016 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 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. 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. }
  51. src_unpack() {
  52. if [[ ${PV} == 9999 ]]; then
  53. git-r3_src_unpack
  54. fi
  55. default
  56. }
  57. src_prepare() {
  58. default
  59. if [[ ${PV} == 9999 ]]; then
  60. eautoreconf
  61. fi
  62. }
  63. src_configure() {
  64. if [[ ${LINGUAS+set} == set ]]; then
  65. strip-linguas -u po
  66. echo "${LINGUAS}" > po/LINGUAS || die
  67. fi
  68. if use doc; then
  69. python_setup
  70. else
  71. # If the python cannot be found, the docs will not build
  72. sed -e 's#"${ac_cv_path_PYTHON}"#""#' -i configure || die
  73. fi
  74. # liboath not in portage
  75. econf \
  76. --with-vpnc-script="${EPREFIX}/etc/openconnect/openconnect.sh" \
  77. $(use_enable static-libs static) \
  78. $(use_enable nls ) \
  79. $(use_with !gnutls openssl) \
  80. $(use_with gnutls ) \
  81. $(use_with libproxy) \
  82. $(use_with gssapi) \
  83. $(use_with smartcard libpcsclite) \
  84. $(use_with stoken) \
  85. $(use_with java)
  86. }
  87. DOC_CONTENTS="The init script for openconnect supports multiple vpn tunnels.
  88. You need to create a symbolic link to /etc/init.d/openconnect in /etc/init.d
  89. instead of calling it directly:
  90. ln -s /etc/init.d/openconnect /etc/init.d/openconnect.vpn0
  91. You can then start the vpn tunnel like this:
  92. /etc/init.d/openconnect.vpn0 start
  93. If you would like to run preup, postup, predown, and/or postdown scripts,
  94. You need to create a directory in /etc/openconnect with the name of the vpn:
  95. mkdir /etc/openconnect/vpn0
  96. Then add executable shell files:
  97. mkdir /etc/openconnect/vpn0
  98. cd /etc/openconnect/vpn0
  99. echo '#!/bin/sh' > preup.sh
  100. cp preup.sh predown.sh
  101. cp preup.sh postup.sh
  102. cp preup.sh postdown.sh
  103. chmod 755 /etc/openconnect/vpn0/*
  104. "
  105. src_install() {
  106. emake DESTDIR="${D}" install
  107. dodoc AUTHORS TODO
  108. newinitd "${FILESDIR}"/openconnect.init.in-r4 openconnect
  109. dodir /etc/openconnect
  110. insinto /etc/openconnect
  111. newconfd "${FILESDIR}"/openconnect.conf.in openconnect
  112. exeinto /etc/openconnect
  113. newexe "${WORKDIR}"/vpnc-scripts-${VPNC_VER}/vpnc-script openconnect.sh
  114. insinto /etc/logrotate.d
  115. newins "${FILESDIR}"/openconnect.logrotate openconnect
  116. keepdir /var/log/openconnect
  117. # Remove useless .la files
  118. prune_libtool_files --all
  119. readme.gentoo_create_doc
  120. }
  121. pkg_postinst() {
  122. readme.gentoo_print_elog
  123. if [[ -z ${REPLACING_VERSIONS} ]]; then
  124. elog
  125. elog "You may want to consider installing the following optional packages."
  126. optfeature "resolvconf support" net-dns/openresolv
  127. fi
  128. }