# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI="2" inherit eutils linux-info toolchain-funcs DESCRIPTION="Open Source implementation of IPsec for the Linux operating system (was SuperFreeS/WAN)." HOMEPAGE="http://www.openswan.org/" SRC_URI="http://www.openswan.org/download/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="caps curl extra-algorithms ms-bad-proposal nss openssl" COMMON_DEPEND="!net-misc/strongswan dev-libs/gmp dev-lang/perl caps? ( sys-libs/libcap-ng ) curl? ( net-misc/curl ) ldap? ( net-nds/openldap ) nss? ( dev-libs/nss ) openssl? ( dev-libs/openssl )" DEPEND="${COMMON_DEPEND} virtual/linux-sources app-text/xmlto app-text/docbook-xml-dtd:4.1.2" # see bug 237132 RDEPEND="${COMMON_DEPEND} virtual/logger sys-apps/iproute2" # Note: xauth is enabled unconditionally, since openswan won't build without it pkg_setup() { linux-info_pkg_setup kernel_is 2 6 || die "Only 2.6 kernels are supported by this ebuild." einfo "This ebuild will set ${P} to use 2.6 native IPsec (KAME)." einfo "KLIPS will not be compiled/installed." } src_prepare() { epatch "${FILESDIR}/${P}"-gentoo.patch epatch "${FILESDIR}/${P}"-sandbox.patch use ms-bad-proposal && epatch "${FILESDIR}"/${PN}-${PV%.*}-allow-ms-bad-proposal.patch # https://bugs.xelerance.com/issues/1112 epatch "${FILESDIR}/${P}"-KLIPS-PFKEY-prototypes.patch find . -type f -regex '.*[.]\([1-8]\|html\|xml\)' -exec sed -i \ -e s:/usr/local:/usr:g '{}' \; || die "failed to replace text in docs" # Note: prehaps there is a better way to handle these if use nss; then find . -type f -name 'Makefile*' -exec sed -i \ -e s:/usr/include/nss3:/usr/include/nss:g '{}' \; &&\ find . -type f -name 'Makefile*' -exec sed -i \ -e 's:-lnss3:-L/usr/lib/nss -lnss3:' '{}' \; &&\ find . -type f -name 'Makefile*' -exec sed -i \ -e s:/usr/include/nspr4:/usr/include/nspr:g '{}' \; ||\ die "failed to adjust nss/nspr paths" fi # Note: this sed is to fix error bail-out on xmlto failures to generate manpages # a better way would be to fix either xmlto or xml files themselves and remove this line sed -i -e 's:mv $$m $@:mv $$m $@ || true:' programs/Makefile.manpages || die } get_make_options() { echo KERNELSRC=\"${KERNEL_DIR}\"\ FINALEXAMPLECONFDIR=/usr/share/doc/${PF}\ INC_RCDEFAULT=/etc/init.d\ INC_USRLOCAL=/usr\ INC_MANDIR=share/man\ FINALDOCDIR=/usr/share/doc/${PF}/html\ DESTDIR=\"${D}\"\ USERCOMPILE=\"${CFLAGS}\"\ CC=\"$(tc-getCC)\"\ USE_KEYRR=false\ USE_KLIPS=false\ USE_MAST=false\ USE_SAREF_KERNEL=false\ USE_NETKEY=true\ USE_BSDKAME=false\ USE_NM=false\ USE_LWRES=false\ USE_FIPSCHECK=false\ USE_XAUTH=true\ USE_XAUTHPAM=true use caps\ && echo USE_LIBCAP_NG=true\ || echo USE_LIBCAP_NG=false use curl\ && echo USE_LIBCURL=true HAVE_THREADS=true\ || echo USE_LIBCURL=false use extra-algorithms\ && echo USE_EXTRACRYPTO=true\ || echo USE_EXTRACRYPTO=false use ldap\ && echo USE_LDAP=true\ || echo USE_LDAP=false use nss\ && echo USE_LIBNSS=true\ || echo USE_LIBNSS=false use openssl\ && echo HAVE_OPENSSL=true\ || echo HAVE_OPENSSL=false } src_compile() { eval set -- $(get_make_options) emake "$@" programs || die "emake failed" } src_install() { eval set -- $(get_make_options) emake "$@" install || die "emake install failed" dodoc docs/{KNOWN_BUGS*,RELEASE-NOTES*,PATENTS*,debugging*} dohtml doc/*.html docinto quickstarts dodoc doc/quickstarts/* newinitd "${FILESDIR}"/ipsec.init ipsec || die "failed to install init script" keepdir /var/run/pluto keepdir /etc/ipsec.d/{{ca,aa,ocsp,}certs,crls,private} } pkg_preinst() { if has_version "