| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-firewall/ipsec-tools/ipsec-tools-0.8.0.ebuild,v 1.1 2012/02/09 20:47:18 blueness Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
|
| 7 |
inherit eutils flag-o-matic autotools linux-info |
| 8 |
|
| 9 |
DESCRIPTION="A port of KAME's IPsec utilities to the Linux-2.6 IPsec implementation" |
| 10 |
HOMEPAGE="http://ipsec-tools.sourceforge.net/" |
| 11 |
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" |
| 12 |
|
| 13 |
LICENSE="BSD" |
| 14 |
SLOT="0" |
| 15 |
KEYWORDS="~amd64 ~x86" |
| 16 |
IUSE="rc5 idea kerberos stats ipv6 nat selinux readline pam hybrid ldap" |
| 17 |
|
| 18 |
RDEPEND=" |
| 19 |
kerberos? ( virtual/krb5 ) |
| 20 |
selinux? ( |
| 21 |
sys-libs/libselinux |
| 22 |
sec-policy/selinux-ipsec-tools |
| 23 |
) |
| 24 |
readline? ( sys-libs/readline ) |
| 25 |
pam? ( sys-libs/pam ) |
| 26 |
ldap? ( net-nds/openldap ) |
| 27 |
dev-libs/openssl |
| 28 |
virtual/libiconv" |
| 29 |
# iconv? ( virtual/libiconv ) |
| 30 |
# radius? ( net-dialup/gnuradius ) |
| 31 |
|
| 32 |
DEPEND="${RDEPEND} |
| 33 |
>=sys-kernel/linux-headers-2.6.30" |
| 34 |
|
| 35 |
pkg_setup() { |
| 36 |
get_version |
| 37 |
if kernel_is -ge 2 6 19 ; then |
| 38 |
einfo "Checking for suitable kernel configuration (Networking | Networking support | Networking options)" |
| 39 |
|
| 40 |
if use nat; then |
| 41 |
CONFIG_CHECK="${CONFIG_CHECK} ~NETFILTER_XT_MATCH_POLICY" |
| 42 |
export WARNING_NETFILTER_XT_MATCH_POLICY="NAT support may fail weirdly unless you enable this option in your kernel" |
| 43 |
fi |
| 44 |
|
| 45 |
for i in XFRM_USER NET_KEY; do |
| 46 |
CONFIG_CHECK="${CONFIG_CHECK} ~${i}" |
| 47 |
eval "export WARNING_${i}='No tunnels will be available at all'" |
| 48 |
done |
| 49 |
|
| 50 |
for i in INET_IPCOMP INET_AH INET_ESP \ |
| 51 |
INET_XFRM_MODE_TRANSPORT \ |
| 52 |
INET_XFRM_MODE_TUNNEL \ |
| 53 |
INET_XFRM_MODE_BEET ; do |
| 54 |
CONFIG_CHECK="${CONFIG_CHECK} ~${i}" |
| 55 |
eval "export WARNING_${i}='IPv4 tunnels will not be available'" |
| 56 |
done |
| 57 |
|
| 58 |
for i in INET6_IPCOMP INET6_AH INET6_ESP \ |
| 59 |
INET6_XFRM_MODE_TRANSPORT \ |
| 60 |
INET6_XFRM_MODE_TUNNEL \ |
| 61 |
INET6_XFRM_MODE_BEET ; do |
| 62 |
CONFIG_CHECK="${CONFIG_CHECK} ~${i}" |
| 63 |
eval "export WARNING_${i}='IPv6 tunnels will not be available'" |
| 64 |
done |
| 65 |
|
| 66 |
CONFIG_CHECK="${CONFIG_CHECK} ~CRYPTO_NULL" |
| 67 |
export WARNING_CRYPTO_NULL="Unencrypted tunnels will not be available" |
| 68 |
export CONFIG_CHECK |
| 69 |
|
| 70 |
check_extra_config |
| 71 |
else |
| 72 |
eerror "You must have a kernel >=2.6.19 to run ipsec-tools." |
| 73 |
eerror "Building now, assuming that you will run on a different kernel" |
| 74 |
fi |
| 75 |
} |
| 76 |
|
| 77 |
src_prepare() { |
| 78 |
# fix for bug #76741 |
| 79 |
sed -i 's:#include <sys/sysctl.h>::' src/racoon/pfkey.c src/setkey/setkey.c || die |
| 80 |
# fix for bug #124813 |
| 81 |
sed -i 's:-Werror::g' "${S}"/configure.ac || die |
| 82 |
# fix for building with gcc-4.6 |
| 83 |
sed -i 's: -R: -Wl,-R:' "${S}"/configure.ac || die |
| 84 |
|
| 85 |
AT_M4DIR="${S}" eautoreconf |
| 86 |
epunt_cxx |
| 87 |
} |
| 88 |
|
| 89 |
src_configure() { |
| 90 |
# fix for bug #61025 |
| 91 |
filter-flags -march=c3 |
| 92 |
|
| 93 |
local myconf |
| 94 |
myconf="--with-kernel-headers=/usr/include \ |
| 95 |
--enable-adminport \ |
| 96 |
--enable-frag \ |
| 97 |
--enable-dpd \ |
| 98 |
--enable-dependency-tracking \ |
| 99 |
$(use_enable rc5) \ |
| 100 |
$(use_enable idea) \ |
| 101 |
$(use_enable kerberos gssapi) \ |
| 102 |
$(use_enable stats) \ |
| 103 |
$(use_enable ipv6) \ |
| 104 |
$(use_enable nat natt) \ |
| 105 |
$(use_enable selinux security-context) \ |
| 106 |
$(use_with readline) \ |
| 107 |
$(use_with pam libpam) \ |
| 108 |
$(use_with ldap libldap)" |
| 109 |
|
| 110 |
use nat && myconf="${myconf} --enable-natt-versions=yes" |
| 111 |
|
| 112 |
# enable mode-cfg and xauth support |
| 113 |
if use pam; then |
| 114 |
myconf="${myconf} --enable-hybrid" |
| 115 |
else |
| 116 |
myconf="${myconf} $(use_enable hybrid)" |
| 117 |
fi |
| 118 |
|
| 119 |
# dev-libs/libiconv is hard masked |
| 120 |
#use iconv && myconf="${myconf} $(use_with iconv libiconv)" |
| 121 |
|
| 122 |
# the default (/usr/include/openssl/) is OK for Gentoo, leave it |
| 123 |
# myconf="${myconf} $(use_with ssl openssl )" |
| 124 |
|
| 125 |
# No way to get it compiling with freeradius or gnuradius |
| 126 |
# We would need libradius which only exists on FreeBSD |
| 127 |
|
| 128 |
# See bug #77369 |
| 129 |
#myconf="${myconf} --enable-samode-unspec" |
| 130 |
|
| 131 |
econf ${myconf} |
| 132 |
} |
| 133 |
|
| 134 |
src_install() { |
| 135 |
emake DESTDIR="${D}" install |
| 136 |
keepdir /var/lib/racoon |
| 137 |
newconfd "${FILESDIR}"/racoon.conf.d racoon |
| 138 |
newinitd "${FILESDIR}"/racoon.init.d racoon |
| 139 |
|
| 140 |
dodoc ChangeLog README NEWS |
| 141 |
dodoc -r src/racoon/samples |
| 142 |
dodoc -r src/racoon/doc |
| 143 |
|
| 144 |
docinto setkey |
| 145 |
dodoc src/setkey/sample.cf |
| 146 |
|
| 147 |
dodir /etc/racoon |
| 148 |
|
| 149 |
# RFC are only available from CVS for the moment, see einfo below |
| 150 |
#docinto "rfc" |
| 151 |
#dodoc ${S}/src/racoon/rfc/* |
| 152 |
} |
| 153 |
|
| 154 |
pkg_postinst() { |
| 155 |
if use nat; then |
| 156 |
elog |
| 157 |
elog "You have enabled the nat traversal functionnality." |
| 158 |
elog "Nat versions wich are enabled by default are 00,02,rfc" |
| 159 |
elog "you can find those drafts in the CVS repository:" |
| 160 |
elog "cvs -d anoncvs@anoncvs.netbsd.org:/cvsroot co ipsec-tools" |
| 161 |
elog |
| 162 |
elog "If you feel brave enough and you know what you are" |
| 163 |
elog "doing, you can consider emerging this ebuild with" |
| 164 |
elog "EXTRA_ECONF=\"--enable-natt-versions=08,07,06\"" |
| 165 |
elog |
| 166 |
fi |
| 167 |
|
| 168 |
if use ldap; then |
| 169 |
elog |
| 170 |
elog "You have enabled ldap support with {$PN}." |
| 171 |
elog "The man page does NOT contain any information on it yet." |
| 172 |
elog "Consider using a more recent version or CVS." |
| 173 |
elog |
| 174 |
fi |
| 175 |
|
| 176 |
elog |
| 177 |
elog "Please have a look in /usr/share/doc/${P} and visit" |
| 178 |
elog "http://www.netbsd.org/Documentation/network/ipsec/" |
| 179 |
elog "to find more information on how to configure this tool." |
| 180 |
elog |
| 181 |
} |