/[gentoo-x86]/net-misc/openswan/openswan-2.6.37-r1.ebuild
Gentoo

Contents of /net-misc/openswan/openswan-2.6.37-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu Dec 27 15:24:03 2012 UTC (6 years, 9 months ago) by floppym
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
pluto creates /var/run/pluto on startup, so don't call keepdir. Bug 448834 by flameeyes. Remove old.

(Portage version: 2.2.0_alpha149/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)

1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/openswan/openswan-2.6.37-r1.ebuild,v 1.1 2011/11/21 20:51:51 vapier Exp $
4
5 EAPI="2"
6
7 inherit eutils linux-info toolchain-funcs flag-o-matic
8
9 DESCRIPTION="Open Source implementation of IPsec for the Linux operating system (was SuperFreeS/WAN)."
10 HOMEPAGE="http://www.openswan.org/"
11 SRC_URI="http://www.openswan.org/download/${P}.tar.gz"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~amd64 ~ppc ~sparc ~x86"
16 IUSE="caps curl ldap pam ssl extra-algorithms weak-algorithms nocrypto-algorithms ms-bad-proposal nss"
17
18 RESTRICT="test" # requires user mode linux setup
19
20 COMMON_DEPEND="!net-misc/strongswan
21 dev-libs/gmp
22 dev-lang/perl
23 caps? ( sys-libs/libcap-ng )
24 curl? ( net-misc/curl )
25 ldap? ( net-nds/openldap )
26 nss? ( dev-libs/nss )
27 ssl? ( dev-libs/openssl )"
28 DEPEND="${COMMON_DEPEND}
29 virtual/linux-sources
30 app-text/xmlto
31 app-text/docbook-xml-dtd:4.1.2" # see bug 237132
32 RDEPEND="${COMMON_DEPEND}
33 || ( sys-apps/net-tools[old-output] <sys-apps/net-tools-1.60_p201111202031570500 )
34 virtual/logger
35 sys-apps/iproute2"
36
37 pkg_setup() {
38 if use nocrypto-algorithms && ! use weak-algorithms; then
39 ewarn "Enabling nocrypto-algorithms USE flag has no effect when"
40 ewarn "weak-algorithms USE flag is disabled"
41 fi
42
43 linux-info_pkg_setup
44
45 if kernel_is -ge 2 6; then
46 einfo "This ebuild will set ${P} to use kernel native IPsec (KAME)."
47 MYMAKE="programs"
48
49 elif kernel_is 2 4; then
50 if ! [[ -d "${KERNEL_DIR}/net/ipsec" ]]; then
51 eerror "You need to have an IPsec enabled 2.4.x kernel."
52 eerror "Ensure you have one running and make a symlink to it in /usr/src/linux"
53 die
54 fi
55
56 einfo "Using patched-in IPsec code for kernel 2.4"
57 einfo "Your kernel only supports KLIPS for kernel level IPsec."
58 MYMAKE="confcheck programs"
59
60 else
61 die "Unsupported kernel version"
62 fi
63
64 # most code is OK, but programs/pluto code breaks strict aliasing
65 append-cflags -fno-strict-aliasing
66 }
67
68 src_prepare() {
69 epatch "${FILESDIR}"/${P}-gentoo.patch
70 use ms-bad-proposal && epatch "${FILESDIR}"/${PN}-${PV%.*}-allow-ms-bad-proposal.patch
71
72 find . -type f -regex '.*[.]\([1-8]\|html\|xml\)' -exec sed -i \
73 -e s:/usr/local:/usr:g '{}' \; ||
74 die "failed to replace text in docs"
75 }
76
77 usetf() { usex $1 true false ; }
78 get_make_options() {
79 make_options=(
80 KERNELSRC="${KERNEL_DIR}"
81 FINALEXAMPLECONFDIR=/usr/share/doc/${PF}
82 INC_RCDEFAULT=/etc/init.d
83 INC_USRLOCAL=/usr
84 INC_MANDIR=share/man
85 FINALDOCDIR=/usr/share/doc/${PF}/html
86 FINALLIBDIR=/usr/$(get_libdir)/ipsec
87 DESTDIR="${D}"
88 USERCOMPILE="${CFLAGS}"
89 USERLINK="-Wl,-z,relro ${LDFLAGS}"
90 CC="$(tc-getCC)"
91 USE_LIBCAP_NG=$(usetf caps)
92 USE_LIBCURL=$(usetf curl)
93 USE_LDAP=$(usetf ldap)
94 USE_XAUTH=true
95 USE_XAUTHPAM=$(usetf pam)
96 USE_LIBNSS=$(usetf nss)
97 HAVE_OPENSSL=$(usetf ssl)
98 USE_EXTRACRYPTO=$(usetf extra-algorithms)
99 USE_WEAKSTUFF=$(usetf weak-algorithms)
100 )
101
102 if use weak-algorithms && use nocrypto-algorithms ; then
103 make_options+=( USE_NOCRYPTO=true )
104 fi
105
106 make_options+=( USE_LWRES=false ) # needs bind9 with lwres support
107 if use curl || use ldap || use pam; then
108 make_options+=( HAVE_THREADS=true )
109 else
110 make_options+=( HAVE_THREADS=false )
111 fi
112 }
113
114 src_compile() {
115 local make_options; get_make_options
116 emake "${make_options[@]}" ${MYMAKE} || die
117 }
118
119 src_install() {
120 local make_options; get_make_options
121 emake "${make_options[@]}" install || die
122
123 dodoc docs/{KNOWN_BUGS*,RELEASE-NOTES*,PATENTS*,debugging*}
124 docinto quickstarts
125 dodoc docs/quickstarts/*
126
127 insinto /usr/share/doc/${PF}
128 doins -r contrib
129
130 newinitd "${FILESDIR}"/ipsec-initd ipsec || die "failed to install init script"
131
132 keepdir /var/run/pluto
133 }
134
135 pkg_preinst() {
136 if has_version "<net-misc/openswan-2.6.14" && pushd "${ROOT}etc/ipsec"; then
137 ewarn "Following files and directories were moved from '${ROOT}etc/ipsec' to '${ROOT}etc':"
138 local i err=0
139 if [ -h "../ipsec.d" ]; then
140 rm "../ipsec.d" || die "failed to remove ../ipsec.d symlink"
141 fi
142 for i in *; do
143 if [ -e "../$i" ]; then
144 eerror " $i NOT MOVED, ../$i already exists!"
145 err=1
146 elif [ -d "$i" ]; then
147 mv "$i" .. || die "failed to move $i directory"
148 ewarn " directory $i"
149 elif [ -f "$i" ]; then
150 sed -i -e 's:/etc/ipsec/:/etc/:g' "$i" && \
151 mv "$i" .. && ewarn " file $i" || \
152 die "failed to move $i file"
153 else
154 eerror " $i NOT MOVED, it is not a file nor a directory!"
155 err=1
156 fi
157 done
158 popd
159 if [ $err -eq 0 ]; then
160 rmdir "${ROOT}etc/ipsec" || eerror "Failed to remove ${ROOT}etc/ipsec"
161 else
162 ewarn "${ROOT}etc/ipsec is not empty, you will have to remove it yourself"
163 fi
164 fi
165 }
166
167 pkg_postinst() {
168 if kernel_is -ge 2 6; then
169 CONFIG_CHECK="~NET_KEY ~INET_XFRM_MODE_TRANSPORT ~INET_XFRM_MODE_TUNNEL ~INET_AH ~INET_ESP ~INET_IPCOMP"
170 WARNING_INET_AH="CONFIG_INET_AH:\tmissing IPsec AH support (needed if you want only authentication)"
171 WARNING_INET_ESP="CONFIG_INET_ESP:\tmissing IPsec ESP support (needed if you want authentication and encryption)"
172 WARNING_INET_IPCOMP="CONFIG_INET_IPCOMP:\tmissing IPsec Payload Compression (required for compress=yes)"
173 check_extra_config
174 fi
175 }

  ViewVC Help
Powered by ViewVC 1.1.20