app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / net-misc / quagga / quagga-1.1.1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 CLASSLESS_BGP_PATCH=ht-20040304-classless-bgp.patch
7
8 inherit autotools eutils flag-o-matic multilib pam readme.gentoo-r1 systemd user
9
10 DESCRIPTION="A free routing daemon replacing Zebra supporting RIP, OSPF and BGP"
11 HOMEPAGE="http://quagga.net/"
12 SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz
13         bgpclassless? ( http://hasso.linux.ee/stuff/patches/quagga/${CLASSLESS_BGP_PATCH} )"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="alpha amd64 arm hppa ppc ~s390 sparc x86"
18
19 IUSE="bgpclassless caps doc elibc_glibc ipv6 multipath ospfapi pam protobuf +readline snmp tcp-zebra"
20
21 COMMON_DEPEND="
22         caps? ( sys-libs/libcap )
23         protobuf? ( dev-libs/protobuf-c:0= )
24         readline? (
25                 sys-libs/readline:0=
26                 pam? ( sys-libs/pam )
27         )
28         snmp? ( net-analyzer/net-snmp )
29         !elibc_glibc? ( dev-libs/libpcre )"
30 DEPEND="${COMMON_DEPEND}
31         sys-apps/gawk
32         sys-devel/libtool:2"
33 RDEPEND="${COMMON_DEPEND}
34         sys-apps/iproute2"
35
36 PATCHES=(
37         "${FILESDIR}/${PN}-0.99.22.4-ipctl-forwarding.patch"
38 )
39
40 DISABLE_AUTOFORMATTING=1
41 DOC_CONTENTS="Sample configuration files can be found in /usr/share/doc/${PF}/samples
42 You have to create config files in /etc/quagga before
43 starting one of the daemons.
44
45 You can pass additional options to the daemon by setting the EXTRA_OPTS
46 variable in their respective file in /etc/conf.d"
47
48 pkg_setup() {
49         enewgroup quagga
50         enewuser quagga -1 -1 /var/empty quagga
51 }
52
53 src_prepare() {
54         # Classless prefixes for BGP
55         # http://hasso.linux.ee/doku.php/english:network:quagga
56         use bgpclassless && eapply -p0 "${DISTDIR}/${CLASSLESS_BGP_PATCH}"
57
58         eapply "${PATCHES[@]}"
59         eapply_user
60         eautoreconf
61 }
62
63 src_configure() {
64         append-flags -fno-strict-aliasing
65
66         # do not build PDF docs
67         export ac_cv_prog_PDFLATEX=no
68         export ac_cv_prog_LATEXMK=no
69
70         econf \
71                 --enable-exampledir=/usr/share/doc/${PF}/samples \
72                 --enable-irdp \
73                 --enable-isisd \
74                 --enable-isis-topology \
75                 --enable-pimd \
76                 --enable-user=quagga \
77                 --enable-group=quagga \
78                 --enable-vty-group=quagga \
79                 --with-cflags="${CFLAGS}" \
80                 --with-pkg-extra-version="-gentoo" \
81                 --sysconfdir=/etc/quagga \
82                 --localstatedir=/run/quagga \
83                 --disable-static \
84                 $(use_enable caps capabilities) \
85                 $(usex snmp '--enable-snmp' '' '' '') \
86                 $(use_enable !elibc_glibc pcreposix) \
87                 $(use_enable tcp-zebra) \
88                 $(use_enable doc) \
89                 $(usex multipath $(use_enable multipath) '' '=0' '') \
90                 $(usex ospfapi '--enable-opaque-lsa --enable-ospf-te --enable-ospfclient' '' '' '') \
91                 $(use_enable readline vtysh) \
92                 $(use_with pam libpam) \
93                 $(use_enable protobuf) \
94                 $(use_enable ipv6 ripngd) \
95                 $(use_enable ipv6 ospf6d) \
96                 $(use_enable ipv6 rtadv)
97 }
98
99 src_install() {
100         default
101         prune_libtool_files
102         readme.gentoo_create_doc
103
104         keepdir /etc/quagga
105         fowners root:quagga /etc/quagga
106         fperms 0770 /etc/quagga
107
108         # Path for PIDs before first reboot should be created here, bug #558194
109         dodir /run/quagga
110         fowners quagga:quagga /run/quagga
111         fperms 0770 /run/quagga
112
113         # Install systemd-related stuff, bug #553136
114         systemd_dotmpfilesd "${FILESDIR}/systemd/quagga.conf"
115         systemd_dounit "${FILESDIR}/systemd/zebra.service"
116
117         # install zebra as a file, symlink the rest
118         newinitd "${FILESDIR}"/quagga-services.init.3 zebra
119
120         for service in bgpd isisd ospfd pimd ripd $(use ipv6 && echo ospf6d ripngd); do
121                 dosym zebra /etc/init.d/${service}
122                 systemd_dounit "${FILESDIR}/systemd/${service}.service"
123         done
124
125         use readline && use pam && newpamd "${FILESDIR}/quagga.pam" quagga
126
127         insinto /etc/logrotate.d
128         newins redhat/quagga.logrotate quagga
129 }
130
131 pkg_postinst() {
132         readme.gentoo_print_elog
133 }