1 |
# Copyright 1999-2005 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/strongswan/strongswan-2.3.0.ebuild,v 1.4 2005/07/15 10:41:17 george Exp $ |
4 |
|
5 |
inherit eutils |
6 |
|
7 |
DESCRIPTION="Open Source implementation of IPsec for the Linux operating system." |
8 |
HOMEPAGE="http://www.strongswan.org/" |
9 |
SRC_URI="http://download.strongswan.org/${P}.tar.gz |
10 |
mirror://gentoo/${P}.tar.gz" |
11 |
|
12 |
LICENSE="GPL-2" |
13 |
SLOT="0" |
14 |
KEYWORDS="-* x86 ppc ~amd64" |
15 |
IUSE="curl ldap smartcard" |
16 |
|
17 |
DEPEND="!net-misc/openswan |
18 |
virtual/libc |
19 |
virtual/linux-sources |
20 |
curl? ( net-misc/curl ) |
21 |
ldap? ( =net-nds/openldap-2* ) |
22 |
smartcard? ( dev-libs/opensc ) |
23 |
>=dev-libs/gmp-3.1.1 |
24 |
net-dns/host |
25 |
sys-apps/iproute2" |
26 |
RDEPEND="" |
27 |
|
28 |
check_version_h() { |
29 |
if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ] |
30 |
then |
31 |
eerror "Please verify that your /usr/src/linux symlink is pointing" |
32 |
eerror "to your current kernel sources, and that you have a running kernel" |
33 |
die "/usr/src/linux symlink not setup!" |
34 |
fi |
35 |
} |
36 |
|
37 |
get_KV_info() { |
38 |
check_version_h |
39 |
|
40 |
# Get the kernel version of sources in /usr/src/linux ... |
41 |
export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \ |
42 |
"${ROOT}/usr/src/linux/include/linux/version.h")" |
43 |
export KV_major="$(echo "${KV_full}" | cut -d. -f1)" |
44 |
export KV_minor="$(echo "${KV_full}" | cut -d. -f2)" |
45 |
export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')" |
46 |
} |
47 |
|
48 |
is_kernel() { |
49 |
[ -z "$1" -o -z "$2" ] && return 1 |
50 |
|
51 |
get_KV_info |
52 |
|
53 |
if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ] |
54 |
then |
55 |
return 0 |
56 |
else |
57 |
return 1 |
58 |
fi |
59 |
} |
60 |
|
61 |
pkg_setup() { |
62 |
get_KV_info |
63 |
|
64 |
einfo "Linux kernel is version ${KV_major}.${KV_minor}.${KV_micro}" |
65 |
|
66 |
if is_kernel 2 5 |
67 |
then |
68 |
eerror "Kernel version ${KV_major}.${KV_minor}.${KV_micro} will not work with this ebuild." |
69 |
die "Please install a 2.6.x version of the Linux kernel." |
70 |
fi |
71 |
|
72 |
if is_kernel 2 6 |
73 |
then |
74 |
einfo "This ebuild will set ${P} to use 2.6 native IPsec (KAME)." |
75 |
einfo "KLIPS will not be compiled/installed." |
76 |
export MYMAKE="programs" |
77 |
|
78 |
elif is_kernel 2 4 |
79 |
then |
80 |
[ -d /usr/src/linux/net/ipsec ] || { |
81 |
eerror "You need to have an IPsec enabled 2.4.x kernel." |
82 |
eerror "Ensure you have one running and make a symlink to it in /usr/src/linux" |
83 |
} |
84 |
einfo "Using patched-in IPsec code for kernel 2.4" |
85 |
einfo "Your kernel only supports KLIPS for kernel level IPsec." |
86 |
export MYMAKE="confcheck programs" |
87 |
|
88 |
else |
89 |
eerror "Sorry, no support for your kernel version ${KV_major}.${KV_minor}.${KV_micro}." |
90 |
die "Install an IPsec enabled 2.4 or 2.6 kernel." |
91 |
fi |
92 |
} |
93 |
|
94 |
src_unpack() { |
95 |
unpack ${A} |
96 |
|
97 |
cd ${S} |
98 |
epatch ${FILESDIR}/${P}-gentoo.patch |
99 |
|
100 |
cd programs/pluto |
101 |
|
102 |
if use curl ; then |
103 |
ebegin "Curl support requested. Enabling curl support" |
104 |
sed -i -e 's:#LIBCURL=1:LIBCURL=1:g' Makefile || die |
105 |
eend $? |
106 |
fi |
107 |
|
108 |
if use ldap ; then |
109 |
ebegin "LDAP support requested. Enabling LDAPv3 support" |
110 |
sed -i -e 's:#LDAP_VERSION=3:LDAP_VERSION=3:g' Makefile || die |
111 |
eend $? |
112 |
fi |
113 |
|
114 |
if use smartcard ; then |
115 |
ebegin "Smartcard support requested. Enabling opensc support" |
116 |
sed -i -e 's:#SMARTCARD=1:SMARTCARD=1:g' Makefile || die |
117 |
eend $? |
118 |
fi |
119 |
} |
120 |
|
121 |
src_compile() { |
122 |
make \ |
123 |
DESTDIR=${D} \ |
124 |
USERCOMPILE="${CFLAGS}" \ |
125 |
FINALCONFDIR=/etc/ipsec \ |
126 |
INC_RCDEFAULT=/etc/init.d \ |
127 |
INC_USRLOCAL=/usr \ |
128 |
INC_MANDIR=share/man \ |
129 |
${MYMAKE} || die |
130 |
} |
131 |
|
132 |
src_install() { |
133 |
make \ |
134 |
DESTDIR=${D} \ |
135 |
USERCOMPILE="${CFLAGS}" \ |
136 |
FINALCONFDIR=/etc/ipsec \ |
137 |
INC_RCDEFAULT=/etc/init.d \ |
138 |
INC_USRLOCAL=/usr \ |
139 |
INC_MANDIR=share/man \ |
140 |
install || die |
141 |
|
142 |
dodoc CHANGES* CREDITS INSTALL LICENSE README* doc/* |
143 |
dosym /etc/ipsec/ipsec.d /etc/ipsec.d |
144 |
|
145 |
exeinto /etc/init.d/ |
146 |
doexe ${FILESDIR}/ipsec |
147 |
} |