| 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-misc/quagga/quagga-0.99.20-r1.ebuild,v 1.7 2012/06/14 05:41:16 xmw Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
|
| 7 |
CLASSLESS_BGP_PATCH=ht-20040304-classless-bgp.patch |
| 8 |
|
| 9 |
BACKPORTS=2 |
| 10 |
|
| 11 |
inherit eutils multilib autotools pam flag-o-matic user |
| 12 |
|
| 13 |
DESCRIPTION="A free routing daemon replacing Zebra supporting RIP, OSPF and BGP." |
| 14 |
HOMEPAGE="http://quagga.net/" |
| 15 |
SRC_URI="http://www.quagga.net/download/${P}.tar.gz |
| 16 |
${BACKPORTS:+ |
| 17 |
http://dev.gentoo.org/~flameeyes/${PN}/${P}-backports-${BACKPORTS}.tar.xz} |
| 18 |
bgpclassless? ( http://hasso.linux.ee/stuff/patches/quagga/${CLASSLESS_BGP_PATCH} )" |
| 19 |
|
| 20 |
LICENSE="GPL-2" |
| 21 |
SLOT="0" |
| 22 |
KEYWORDS="alpha amd64 arm hppa ppc s390 sparc x86" |
| 23 |
IUSE="caps doc ipv6 snmp pam bgpclassless ospfapi multipath tcp-zebra elibc_glibc +readline" |
| 24 |
|
| 25 |
COMMON_DEPEND=" |
| 26 |
caps? ( sys-libs/libcap ) |
| 27 |
snmp? ( net-analyzer/net-snmp ) |
| 28 |
readline? ( |
| 29 |
sys-libs/readline |
| 30 |
pam? ( sys-libs/pam ) |
| 31 |
) |
| 32 |
!elibc_glibc? ( dev-libs/libpcre )" |
| 33 |
DEPEND="${COMMON_DEPEND} |
| 34 |
app-arch/xz-utils |
| 35 |
>=sys-devel/libtool-2.2.4" |
| 36 |
RDEPEND="${COMMON_DEPEND} |
| 37 |
sys-apps/openrc |
| 38 |
sys-apps/iproute2" |
| 39 |
|
| 40 |
pkg_setup() { |
| 41 |
enewgroup quagga |
| 42 |
enewuser quagga -1 -1 /var/empty quagga |
| 43 |
} |
| 44 |
|
| 45 |
src_prepare() { |
| 46 |
[[ -n ${BACKPORTS} ]] && \ |
| 47 |
EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \ |
| 48 |
epatch |
| 49 |
|
| 50 |
# Classless prefixes for BGP |
| 51 |
# http://hasso.linux.ee/doku.php/english:network:quagga |
| 52 |
use bgpclassless && epatch "${DISTDIR}/${CLASSLESS_BGP_PATCH}" |
| 53 |
|
| 54 |
eautoreconf |
| 55 |
} |
| 56 |
|
| 57 |
src_configure() { |
| 58 |
local myconf= |
| 59 |
|
| 60 |
use ospfapi \ |
| 61 |
&& myconf="${myconf} --enable-opaque-lsa --enable-ospf-te --enable-ospfclient" |
| 62 |
|
| 63 |
use multipath && myconf="${myconf} --enable-multipath=0" |
| 64 |
|
| 65 |
append-flags -fno-strict-aliasing |
| 66 |
|
| 67 |
econf \ |
| 68 |
--enable-user=quagga \ |
| 69 |
--enable-group=quagga \ |
| 70 |
--enable-vty-group=quagga \ |
| 71 |
--with-cflags="${CFLAGS}" \ |
| 72 |
--sysconfdir=/etc/quagga \ |
| 73 |
--enable-exampledir=/usr/share/doc/${PF}/samples \ |
| 74 |
--localstatedir=/var/run/quagga \ |
| 75 |
--disable-static \ |
| 76 |
--disable-pie \ |
| 77 |
\ |
| 78 |
$(use_enable caps capabilities) \ |
| 79 |
$(use_enable snmp) \ |
| 80 |
$(use_enable !elibc_glibc pcreposix) \ |
| 81 |
$(use_enable tcp-zebra) \ |
| 82 |
$(use_enable doc) \ |
| 83 |
\ |
| 84 |
$(use_enable readline vtysh) \ |
| 85 |
$(use_with pam libpam) \ |
| 86 |
\ |
| 87 |
$(use_enable ipv6) \ |
| 88 |
$(use_enable ipv6 ripngd) \ |
| 89 |
$(use_enable ipv6 ospf6d) \ |
| 90 |
$(use_enable ipv6 rtadv) \ |
| 91 |
\ |
| 92 |
${myconf} |
| 93 |
} |
| 94 |
|
| 95 |
src_install() { |
| 96 |
emake DESTDIR="${D}" install |
| 97 |
find "${D}" -name '*.la' -delete || die |
| 98 |
|
| 99 |
keepdir /etc/quagga |
| 100 |
fowners root:quagga /etc/quagga |
| 101 |
fperms 0770 /etc/quagga |
| 102 |
|
| 103 |
# install zebra as a file, symlink the rest |
| 104 |
newinitd "${FILESDIR}"/quagga-services.init.3 zebra |
| 105 |
|
| 106 |
for service in ripd ospfd bgpd $(use ipv6 && echo ripngd ospf6d); do |
| 107 |
dosym zebra /etc/init.d/${service} |
| 108 |
done |
| 109 |
|
| 110 |
use readline && newpamd "${FILESDIR}/quagga.pam" quagga |
| 111 |
} |
| 112 |
|
| 113 |
pkg_postinst() { |
| 114 |
elog "Sample configuration files can be found in /usr/share/doc/${PF}/samples" |
| 115 |
elog "You have to create config files in /etc/quagga before" |
| 116 |
elog "starting one of the daemons." |
| 117 |
elog "" |
| 118 |
elog "You can pass additional options to the daemon by setting the EXTRA_OPTS" |
| 119 |
elog "variable in their respective file in /etc/conf.d" |
| 120 |
elog "" |
| 121 |
elog "Starting from version 0.99.18, quagga no longer supports the realms patch." |
| 122 |
elog "The patch was abandoned upstream and once again didn't apply; it needs a" |
| 123 |
elog "dedicated maintainer, if it is still necessary." |
| 124 |
} |