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

Contents of /net-misc/openswan/openswan-2.6.38.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Sat Apr 4 06:54:40 2015 UTC (4 years, 6 months ago) by mr_bones_
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
FILE REMOVED
old

(Portage version: 2.2.14/cvs/Linux x86_64, unsigned Manifest commit)

1 # Copyright 1999-2014 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.38.ebuild,v 1.9 2014/08/10 20:46:00 slyfox Exp $
4
5 EAPI="4"
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://download.openswan.org/openswan/${P}.tar.gz"
12
13 LICENSE="GPL-2 BSD-4 DES RSA"
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 virtual/logger
34 sys-apps/iproute2
35 !net-misc/libreswan"
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}
117 }
118
119 src_install() {
120 local make_options; get_make_options
121 emake "${make_options[@]}" install
122
123 dodoc CHANGES README
124 dodoc docs/{KNOWN_BUGS*,RELEASE-NOTES*,PATENTS*,debugging*}
125 docinto quickstarts
126 dodoc docs/quickstarts/*
127
128 insinto /usr/share/doc/${PF}
129 doins -r contrib
130 docompress -x /usr/share/doc/${PF}/contrib
131
132 newinitd "${FILESDIR}"/ipsec-initd ipsec
133
134 # We don't need to install /var/run/pluto.
135 rm -rf "${D}var" || die
136 }
137
138 pkg_preinst() {
139 if has_version "<net-misc/openswan-2.6.14" && pushd "${ROOT}etc/ipsec"; then
140 ewarn "Following files and directories were moved from '${ROOT}etc/ipsec' to '${ROOT}etc':"
141 local i err=0
142 if [ -h "../ipsec.d" ]; then
143 rm "../ipsec.d" || die "failed to remove ../ipsec.d symlink"
144 fi
145 for i in *; do
146 if [ -e "../$i" ]; then
147 eerror " $i NOT MOVED, ../$i already exists!"
148 err=1
149 elif [ -d "$i" ]; then
150 mv "$i" .. || die "failed to move $i directory"
151 ewarn " directory $i"
152 elif [ -f "$i" ]; then
153 sed -i -e 's:/etc/ipsec/:/etc/:g' "$i" && \
154 mv "$i" .. && ewarn " file $i" || \
155 die "failed to move $i file"
156 else
157 eerror " $i NOT MOVED, it is not a file nor a directory!"
158 err=1
159 fi
160 done
161 popd
162 if [ $err -eq 0 ]; then
163 rmdir "${ROOT}etc/ipsec" || eerror "Failed to remove ${ROOT}etc/ipsec"
164 else
165 ewarn "${ROOT}etc/ipsec is not empty, you will have to remove it yourself"
166 fi
167 fi
168 }
169
170 pkg_postinst() {
171 if kernel_is -ge 2 6; then
172 CONFIG_CHECK="~NET_KEY ~INET_XFRM_MODE_TRANSPORT ~INET_XFRM_MODE_TUNNEL ~INET_AH ~INET_ESP ~INET_IPCOMP"
173 WARNING_INET_AH="CONFIG_INET_AH:\tmissing IPsec AH support (needed if you want only authentication)"
174 WARNING_INET_ESP="CONFIG_INET_ESP:\tmissing IPsec ESP support (needed if you want authentication and encryption)"
175 WARNING_INET_IPCOMP="CONFIG_INET_IPCOMP:\tmissing IPsec Payload Compression (required for compress=yes)"
176 check_extra_config
177 fi
178 }

  ViewVC Help
Powered by ViewVC 1.1.20