1 |
# Copyright 1999-2015 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/openconnect/openconnect-7.04.ebuild,v 1.2 2015/04/08 18:04:50 mgorny Exp $ |
4 |
|
5 |
EAPI="5" |
6 |
|
7 |
PYTHON_COMPAT=( python2_7 ) |
8 |
PYTHON_REQ_USE="xml" |
9 |
|
10 |
inherit eutils java-pkg-opt-2 linux-info python-any-r1 |
11 |
|
12 |
DESCRIPTION="Free client for Cisco AnyConnect SSL VPN software" |
13 |
HOMEPAGE="http://www.infradead.org/openconnect.html" |
14 |
VPNC_VER=20140806 |
15 |
SRC_URI="ftp://ftp.infradead.org/pub/${PN}/${P}.tar.gz |
16 |
ftp://ftp.infradead.org/pub/vpnc-scripts/vpnc-scripts-${VPNC_VER}.tar.gz" |
17 |
|
18 |
LICENSE="LGPL-2.1 GPL-2" |
19 |
SLOT="0/5" |
20 |
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" |
21 |
IUSE="doc +gnutls gssapi java libproxy nls static-libs" |
22 |
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" |
23 |
for lang in $ILINGUAS; do |
24 |
IUSE="${IUSE} linguas_${lang}" |
25 |
done |
26 |
|
27 |
DEPEND="dev-libs/libxml2 |
28 |
sys-libs/zlib |
29 |
!gnutls? ( |
30 |
>=dev-libs/openssl-1.0.1h:0[static-libs?] |
31 |
) |
32 |
gnutls? ( |
33 |
>=net-libs/gnutls-3[static-libs?] dev-libs/nettle |
34 |
app-misc/ca-certificates |
35 |
) |
36 |
gssapi? ( app-crypt/mit-krb5 ) |
37 |
libproxy? ( net-libs/libproxy ) |
38 |
nls? ( virtual/libintl )" |
39 |
RDEPEND="${DEPEND} |
40 |
sys-apps/iproute2" |
41 |
DEPEND="${DEPEND} |
42 |
virtual/pkgconfig |
43 |
doc? ( ${PYTHON_DEPS} sys-apps/groff ) |
44 |
java? ( >=virtual/jdk-1.6 ) |
45 |
nls? ( sys-devel/gettext )" |
46 |
|
47 |
tun_tap_check() { |
48 |
ebegin "Checking for TUN/TAP support" |
49 |
if { ! linux_chkconfig_present TUN; }; then |
50 |
eerror "Please enable TUN/TAP support in your kernel config, found at:" |
51 |
eerror |
52 |
eerror " Device Drivers --->" |
53 |
eerror " [*] Network device support --->" |
54 |
eerror " <*> Universal TUN/TAP device driver support" |
55 |
eerror |
56 |
eerror "and recompile your kernel ..." |
57 |
die "no CONFIG_TUN support detected!" |
58 |
fi |
59 |
eend $? |
60 |
} |
61 |
|
62 |
pkg_setup() { |
63 |
java-pkg-opt-2_pkg_setup |
64 |
|
65 |
if use doc; then |
66 |
python-any-r1_pkg_setup |
67 |
fi |
68 |
|
69 |
if use kernel_linux; then |
70 |
get_version |
71 |
if linux_config_exists; then |
72 |
tun_tap_check |
73 |
else |
74 |
ewarn "Was unable to determine your kernel .config" |
75 |
ewarn "Please note that OpenConnect requires CONFIG_TUN to be set in your" |
76 |
ewarn "kernel .config, Without it, it will not work correctly." |
77 |
# We don't die here, so it's possible to compile this package without |
78 |
# kernel sources available. Required for cross-compilation. |
79 |
fi |
80 |
fi |
81 |
} |
82 |
|
83 |
src_configure() { |
84 |
strip-linguas $ILINGUAS |
85 |
echo ${LINGUAS} > po/LINGUAS |
86 |
if ! use doc; then |
87 |
# If the python cannot be found, the docs will not build |
88 |
sed -e 's#"${ac_cv_path_PYTHON}"#""#' -i configure || die |
89 |
fi |
90 |
|
91 |
# stoken and liboath not in portage |
92 |
econf \ |
93 |
--with-vpnc-script="${EPREFIX}/etc/openconnect/openconnect.sh" \ |
94 |
$(use_enable static-libs static) \ |
95 |
$(use_enable nls ) \ |
96 |
$(use_with !gnutls openssl) \ |
97 |
$(use_with gnutls ) \ |
98 |
$(use_with libproxy) \ |
99 |
--without-stoken \ |
100 |
--without-liboath \ |
101 |
$(use_with gssapi) \ |
102 |
$(use_with java) |
103 |
} |
104 |
|
105 |
src_install() { |
106 |
emake DESTDIR="${D}" install |
107 |
|
108 |
dodoc AUTHORS TODO |
109 |
newinitd "${FILESDIR}"/openconnect.init.in-r3 openconnect |
110 |
dodir /etc/openconnect |
111 |
insinto /etc/openconnect |
112 |
newconfd "${FILESDIR}"/openconnect.conf.in openconnect |
113 |
exeinto /etc/openconnect |
114 |
newexe "${WORKDIR}"/vpnc-scripts-${VPNC_VER}/vpnc-script openconnect.sh |
115 |
insinto /etc/logrotate.d |
116 |
newins "${FILESDIR}"/openconnect.logrotate openconnect |
117 |
keepdir /var/log/openconnect |
118 |
|
119 |
# Remove useless .la files |
120 |
prune_libtool_files --all |
121 |
} |
122 |
|
123 |
pkg_postinst() { |
124 |
if [[ -z ${REPLACING_VERSIONS} ]]; then |
125 |
elog "The init script for openconnect has changed and now supports multiple vpn tunnels." |
126 |
elog |
127 |
elog "You need to create a symbolic link to /etc/init.d/openconnect in /etc/init.d" |
128 |
elog "instead of calling it directly:" |
129 |
elog |
130 |
elog "ln -s /etc/init.d/openconnect /etc/init.d/openconnect.vpn0" |
131 |
elog |
132 |
elog "You can then start the vpn tunnel like this:" |
133 |
elog |
134 |
elog "/etc/init.d/openconnect.vpn0 start" |
135 |
elog |
136 |
elog "If you would like to run preup, postup, predown, and/or postdown scripts," |
137 |
elog "You need to create a directory in /etc/openconnect with the name of the vpn:" |
138 |
elog |
139 |
elog "mkdir /etc/openconnect/vpn0" |
140 |
elog |
141 |
elog "Then add executable shell files:" |
142 |
elog |
143 |
elog "mkdir /etc/openconnect/vpn0" |
144 |
elog "cd /etc/openconnect/vpn0" |
145 |
elog "echo '#!/bin/sh' > preup.sh" |
146 |
elog "cp preup.sh predown.sh" |
147 |
elog "cp preup.sh postup.sh" |
148 |
elog "cp preup.sh postdown.sh" |
149 |
elog "chmod 755 /etc/openconnect/vpn0/*" |
150 |
fi |
151 |
} |