summaryrefslogtreecommitdiff
blob: 10a020e731fa154c3987cfdccbb375408603964d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/freeswan/freeswan-2.04-r1.ebuild,v 1.2 2004/06/24 23:44:40 agriffis Exp $

inherit eutils

X509_PATCH=1.6.1
DESCRIPTION="FreeS/WAN IPSec Userspace Utilities with X.509 Patches"
HOMEPAGE="http://www.freeswan.org"
SRC_URI="ftp://ftp.xs4all.nl/pub/crypto/freeswan/${P}.tar.gz
	 http://www.strongsec.com/freeswan/x509-${X509_PATCH}-${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 -sparc"
IUSE=""

DEPEND="virtual/glibc
	virtual/linux-sources
	>=dev-libs/gmp-3.1.1
	net-misc/host
	sys-apps/iproute2"
RDEPEND=""

pkg_setup() {
	[ -d ${ROOT}/usr/src/linux/net/ipsec ] || {
		echo You need to have the crypto-enabled version of Gentoo Sources
		echo with a symlink to it in /usr/src/linux in order to have IPSec
		echo kernel compatibility.
		die
	}
}

src_unpack() {
	unpack ${A}

	cd ${S}
	epatch ${FILESDIR}/${P}-gentoo.patch
	cp ${WORKDIR}/x509-${X509_PATCH}\-${P}/freeswan.diff \
	   ${WORKDIR}/x509-${X509_PATCH}\-${P}/freeswan.diff.old
	sed 's:/etc/ipsec.d:/etc/ipsec/ipsec.d:g' \
	    ${WORKDIR}/x509-${X509_PATCH}-${P}/freeswan.diff.old > \
	    ${WORKDIR}/x509-${X509_PATCH}-${P}/freeswan.diff
	epatch ${WORKDIR}/x509-${X509_PATCH}-${P}/freeswan.diff
}

src_compile() {
	make \
		DESTDIR=${D} \
		USERCOMPILE="${CFLAGS}" \
		FINALCONFDIR=/etc/ipsec \
		INC_RCDEFAULT=/etc/init.d \
		INC_USRLOCAL=/usr \
		INC_MANDIR=share/man \
		confcheck programs || die
}

src_install() {
	# try make prefix=${D}/usr install
	make \
		DESTDIR=${D} \
		USERCOMPILE="${CFLAGS}" \
		FINALCONFDIR=/etc/ipsec \
		INC_RCDEFAULT=/etc/init.d \
		INC_USRLOCAL=/usr \
		INC_MANDIR=share/man \
		install || die

	newdoc ${WORKDIR}/x509-${X509_PATCH}-${P}/README README.x509
	newdoc ${WORKDIR}/x509-${X509_PATCH}-${P}/CHANGES CHANGES.x509
	newdoc ${WORKDIR}/x509-${X509_PATCH}-${P}/ipsec.secrets.template ipsec.secrets.x509
	dodoc INSTALL CREDITS BUGS CHANGES README doc/*
	dosym /etc/ipsec/ipsec.d /etc/ipsec.d
	dosym /etc/ipsec/ipsec.conf /etc/ipsec.conf

	exeinto /etc/init.d/
	doexe ${FILESDIR}/ipsec
}