app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / net-misc / quagga / quagga-1.2.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 tmpfiles 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 fpm doc elibc_glibc ipv6 multipath nhrpd ospfapi pam protobuf +readline snmp tcp-zebra"
20
21 COMMON_DEPEND="
22         caps? ( sys-libs/libcap )
23         nhrpd? ( net-dns/c-ares:0= )
24         protobuf? ( dev-libs/protobuf-c:0= )
25         readline? (
26                 sys-libs/readline:0=
27                 pam? ( sys-libs/pam )
28         )
29         snmp? ( net-analyzer/net-snmp )
30         !elibc_glibc? ( dev-libs/libpcre )"
31 DEPEND="${COMMON_DEPEND}
32         sys-apps/gawk
33         sys-devel/libtool:2"
34 RDEPEND="${COMMON_DEPEND}
35         sys-apps/iproute2"
36
37 PATCHES=(
38         "${FILESDIR}/${PN}-0.99.22.4-ipctl-forwarding.patch"
39 )
40
41 DISABLE_AUTOFORMATTING=1
42 DOC_CONTENTS="Sample configuration files can be found in /usr/share/doc/${PF}/samples
43 You have to create config files in /etc/quagga before
44 starting one of the daemons.
45
46 You can pass additional options to the daemon by setting the EXTRA_OPTS
47 variable in their respective file in /etc/conf.d"
48
49 pkg_setup() {
50         enewgroup quagga
51         enewuser quagga -1 -1 /var/empty quagga
52 }
53
54 src_prepare() {
55         # Classless prefixes for BGP
56         # http://hasso.linux.ee/doku.php/english:network:quagga
57         use bgpclassless && eapply -p0 "${DISTDIR}/${CLASSLESS_BGP_PATCH}"
58
59         eapply "${PATCHES[@]}"
60         eapply_user
61         eautoreconf
62 }
63
64 src_configure() {
65         append-flags -fno-strict-aliasing
66
67         # do not build PDF docs
68         export ac_cv_prog_PDFLATEX=no
69         export ac_cv_prog_LATEXMK=no
70
71         econf \
72                 --enable-exampledir=/usr/share/doc/${PF}/samples \
73                 --enable-irdp \
74                 --enable-isisd \
75                 --enable-isis-topology \
76                 --enable-pimd \
77                 --enable-user=quagga \
78                 --enable-group=quagga \
79                 --enable-vty-group=quagga \
80                 --with-cflags="${CFLAGS}" \
81                 --with-pkg-extra-version="-gentoo" \
82                 --sysconfdir=/etc/quagga \
83                 --localstatedir=/run/quagga \
84                 --disable-static \
85                 $(use_enable caps capabilities) \
86                 $(usex snmp '--enable-snmp' '' '' '') \
87                 $(use_enable !elibc_glibc pcreposix) \
88                 $(use_enable fpm) \
89                 $(use_enable tcp-zebra) \
90                 $(use_enable doc) \
91                 $(usex multipath $(use_enable multipath) '' '=0' '') \
92                 $(usex ospfapi '--enable-opaque-lsa --enable-ospf-te --enable-ospfclient' '' '' '') \
93                 $(use_enable readline vtysh) \
94                 $(use_with pam libpam) \
95                 $(use_enable nhrpd) \
96                 $(use_enable protobuf) \
97                 $(use_enable ipv6 ripngd) \
98                 $(use_enable ipv6 ospf6d) \
99                 $(use_enable ipv6 rtadv)
100 }
101
102 src_install() {
103         default
104         prune_libtool_files
105         readme.gentoo_create_doc
106
107         keepdir /etc/quagga
108         fowners root:quagga /etc/quagga
109         fperms 0770 /etc/quagga
110
111         # Install systemd-related stuff, bug #553136
112         dotmpfiles "${FILESDIR}/systemd/quagga.conf"
113         systemd_dounit "${FILESDIR}/systemd/zebra.service"
114
115         # install zebra as a file, symlink the rest
116         newinitd "${FILESDIR}"/quagga-services.init.3 zebra
117
118         for service in bgpd isisd ospfd pimd ripd $(use ipv6 && echo ospf6d ripngd) $(use nhrpd && echo nhrpd); do
119                 dosym zebra /etc/init.d/${service}
120                 systemd_dounit "${FILESDIR}/systemd/${service}.service"
121         done
122
123         use readline && use pam && newpamd "${FILESDIR}/quagga.pam" quagga
124
125         insinto /etc/logrotate.d
126         newins redhat/quagga.logrotate quagga
127 }
128
129 pkg_postinst() {
130         # Path for PIDs before first reboot should be created here, bug #558194
131         tmpfiles_process quagga.conf
132
133         readme.gentoo_print_elog
134 }