SHA256
1
0
forked from pool/frr
frr/frr.spec

653 lines
15 KiB
RPMSpec
Raw Normal View History

#
# spec file for package frr
#
# Copyright (c) 2019 SUSE LLC
# Copyright (c) 2019, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define skip_python2 1
%if 0%{?suse_version} >= 1210
%bcond_without systemd
%else
%bcond_with systemd
%endif
%define frr_user frr
%define frr_group frr
%define frrvty_group frrvty
%define frr_home %{_localstatedir}/lib/%{name}
%define frr_statedir %{_rundir}/%{name}
%define frr_daemondir %{_prefix}/lib/frr
%bcond_without babeld
%bcond_without bfdd
%bcond_without bgpd
%bcond_without bgp_vnc
%bcond_with cumulus
%bcond_with datacenter
%bcond_without doc
%bcond_without eigrpd
%bcond_without fpm
%bcond_without irdp
%bcond_without isisd
%bcond_without ldpd
%bcond_without multipath
%bcond_without nhrpd
%bcond_without ospf6d
%bcond_without ospfapi
%bcond_without ospfclient
%bcond_without ospfd
%bcond_without pam
%bcond_without pbrd
%bcond_with pcre
%bcond_without pimd
%bcond_with protobuf
%bcond_without ripd
%bcond_without ripngd
%bcond_with rpki
%bcond_without rtadv
%bcond_without snmp
%bcond_without sharpd
%bcond_without staticd
%bcond_without vtysh
%bcond_without watchfrr
%bcond_without zebra
%bcond_with zeromq
Name: frr
Version: 7.2
Release: 0
Summary: FRRouting Routing daemon
License: LGPL-2.1-or-later
Group: Productivity/Networking/System
URL: https://www.frrouting.org
#Git-Clone: https://github.com/FRRouting/frr.git
Source: %{name}-%{name}%{version}.tar.xz
Source1: %{name}-tmpfiles.d
Patch0: fix_tests.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison >= 2.7
BuildRequires: flex
BuildRequires: libtool
BuildRequires: mininet
BuildRequires: pkgconfig
BuildRequires: readline-devel
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(libcap)
BuildRequires: pkgconfig(libcares)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libyang) >= 1.0.101
BuildRequires: libyang-extentions
BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pytest}
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: %{install_info_prereq}
Requires(post): %{install_info_prereq}
Requires(pre): shadow
Requires(preun): %{install_info_prereq}
Recommends: logrotate
Conflicts: quagga
Provides: zebra = %{version}
Obsoletes: zebra < %{version}
%if %{with systemd}
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%endif
%if %{with doc}
BuildRequires: makeinfo
BuildRequires: %{python_module Sphinx}
%endif
%if %{with pam}
BuildRequires: pam-devel
%endif
%if %{with pcre}
BuildRequires: pkgconfig(libpcre)
%endif
%if %{with protobuf}
BuildRequires: protobuf-c
BuildRequires: pkgconfig(libprotobuf-c)
%endif
%if %{with rpki}
BuildRequires: pkgconfig(rtrlib) >= 0.5.0
%endif
%if %{with snmp}
BuildRequires: net-snmp-devel
%endif
%if %{with zeromq}
BuildRequires: pkgconfig(libzmq) >= 4.0.0
%endif
%description
FRR is free software which manages TCP/IP based routing protocols.
It supports BGP4, BGP4+, OSPFv2, OSPFv3, IS-IS, RIPv1, RIPv2, RIPng,
PIM and LDP as well as the IPv6 versions of these.
FRR is a fork of Quagga..
%package -n libfrrfpm_pb0
Summary: FRRouting fpm protobuf library
Group: System/Libraries
%description -n libfrrfpm_pb0
This library contains forwarding plane manager protobuf definitions
for FRRouting.
%package -n libfrr_pb0
Summary: FRRouting protobuf library
Group: System/Libraries
%description -n libfrr_pb0
This library contains protobuf memory management for FRRouting..
%package -n libfrrospfapiclient0
Summary: API for FRRouting's OSPFv2 implementation
Group: System/Libraries
%description -n libfrrospfapiclient0
This library contains part of the OSPFv2 implementation of FRRouting.
%if %{with snmp}
%package -n libfrrsnmp0
Summary: FRRouting snmp library
Group: System/Libraries
%description -n libfrrsnmp0
This library contains part of the net-snmp agentx implementation of FRRouting.
%endif
%if %{with zeromq}
%package -n libfrrzmq0
Summary: FRRouting zeromq library
Group: System/Libraries
%description -n libfrrzmq0
This library contains part of the zermomq implementation of FRRouting.
%endif
%package -n libfrr0
Summary: FRRouting utility library
Group: System/Libraries
%description -n libfrr0
This library contains various utility functions to FRRouting, such as
data types, buffers and socket handling.
%package -n libfrrcares0
Summary: FRRouting utility library
Group: System/Libraries
%description -n libfrrcares0
This library contains various utility functions to FRRouting, such as
data types, buffers and socket handling.
%package devel
Summary: Header and object files for frr development
Group: Development/Libraries/C and C++
Requires: libfrr0 = %{version}
%if %{with protobuf}
Requires: libfrr_pb0 = %{version}
Requires: libfrrfpm_pb0 = %{version}
%endif
%if %{with ospfapi}
Requires: libfrrospfapiclient0 = %{version}
%endif
%if %{with snmp}
Requires: libfrrsnmp0 = %{version}
%endif
%if %{with zeromq}
Requires: libfrrzmq0 = %{version}
%endif
%description devel
The frr-devel package contains the header and object files necessary for
developing OSPF-API and frr applications.
%prep
%setup -q -n %{name}-%{name}%{version}
%patch0 -p0
%build
# GCC LTO objects must be "fat" to avoid assembly errors
export CFLAGS="-ffat-lto-objects"
autoreconf -fiv
%configure \
--enable-exampledir=%{_docdir}/%{name}/examples \
--sysconfdir=%{_sysconfdir}/%{name} \
--localstatedir=%{frr_statedir} \
--sbindir=%{frr_daemondir} \
--with-moduledir=%{_libdir}/frr/modules \
--disable-static \
--with-vtysh-pager=%{_bindir}/less \
--enable-user=%{frr_user} \
--enable-group=%{frr_group} \
--enable-vty-group=%{frrvty_group} \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
%if %{with doc}
--enable-doc \
--enable-doc-html \
%endif
%if %{with babeld}
--enable-babeld \
%else
--disable-babeld \
%endif
%if %{with bfdd}
--enable-bfdd \
%else
--disable-bfdd \
%endif
%if %{with bgpd}
--enable-bgpd \
%else
--disable-bgpd \
%endif
%if %{with bgp_vnc}
--enable-bgp-vnc \
%else
--disable-bgp-vnc \
%endif
%if %{with cumulus}
--enable-cumulus \
%endif
%if %{with datacenter}
--enable-datacenter \
%endif
%if %{with eigrpd}
--enable-eigrpd \
%else
--disable-eigrpd \
%endif
%if %{with fpm}
--enable-fpm \
%else
--disable-fpm \
%endif
%if %{with irdp}
--enable-irdp \
%else
--disable-irdp \
%endif
%if %{with isisd}
--enable-isisd \
%else
--disable-isisd \
%endif
%if %{with ldpd}
--enable-ldpd \
%else
--disable-ldpd \
%endif
%if %{with multipath}
--enable-multipath=256 \
%endif
%if %{with nhrpd}
--enable-nhrpd \
%else
--disable-nhrpd \
%endif
%if %{with snmp}
--enable-snmp \
%endif
%if %{with zeromq}
--enable-zeromq \
%endif
%if %{with ospfd}
--enable-ospfd \
%else
--disable-ospfd \
%endif
%if %{with ospf6d}
--enable-ospf6d \
%else
--disable-ospf6d \
%endif
%if %{with ospfapi}
--enable-ospfapi \
%else
--disable-ospfapi \
%endif
%if %{with ospfclient}
--enable-ospfclient \
%else
--disable-ospfclient \
%endif
%if %{with pam}
--with-libpam \
%endif
%if %{with pcre}
--enable-pcreposix \
%endif
%if %{with pbrd}
--enable-pbrd \
%else
--disable-pbrd \
%endif
%if %{with pimd}
--enable-pimd \
%else
--disable-pimd \
%endif
%if %{with protobuf}
--enable-protobuf \
%endif
%if %{with ripd}
--enable-ripd \
%else
--disable-ripd \
%endif
%if %{with ripngd}
--enable-ripngd \
%else
--disable-ripngd \
%endif
%if %{with rpki}
--enable-rpki \
%else
--disable-rpki \
%endif
%if %{with rtadv}
--enable-rtadv \
%else
--disable-rtadv \
%endif
%if %{with sharpd}
--enable-sharpd \
%else
--disable-sharpd \
%endif
%if %{with staticd}
--enable-staticd \
%else
--disable-staticd \
%endif
%if %{with vtysh}
--enable-vtysh \
%else
--disable-vtysh \
%endif
%if %{with watchfrr}
--enable-watchfrr \
%else
--disable-watchfrr \
%endif
%if %{with zebra}
--enable-zebra \
%else
--disable-zebra \
%endif
--enable-systemd
make %{?_smp_mflags} MAKEINFO="makeinfo --no-split"
%install
make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" install
find %{buildroot} -type f -name "*.la" -delete -print
install -d %{buildroot}%{_sysconfdir}/frr
%if %{with doc}
install -d %{buildroot}/%{_docdir}/%{name}
mv %{buildroot}/%{_datadir}/doc/frr/html %{buildroot}/%{_docdir}/%{name}
%endif
# remove stray buildinfo files
find %{buildroot}/%{_docdir}/%{name} -type f -name .buildinfo -delete
# systemd init scripts
install -D -m 0644 tools/frr.service %{buildroot}%{_unitdir}/frr.service
install -D -m 0644 tools%{_sysconfdir}/frr/daemons %{buildroot}%{_sysconfdir}/frr/daemons
# add rpki module to daemon
%if %{with rpki}
sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{buildroot}%{_sysconfdir}/frr/daemons
%endif
install -D -m 0644 redhat/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr
install -D -m 0644 redhat/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr
install -d -m 0750 %{buildroot}%{rundir}
install -d -m 0750 %{buildroot}%{_localstatedir}/log/frr
install -D -m 0644 %{SOURCE1} %{buildroot}/%{_tmpfilesdir}/%{name}.conf
sed -e "s|@frr_statedir@|%{frr_statedir}|g" -i %{buildroot}/%{_tmpfilesdir}/%{name}.conf
install -d %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcfrr
rm -f %{buildroot}%{frr_daemondir}/ssd
cat > %{buildroot}%{_sysconfdir}/frr/frr.conf << __EOF__
!hostname frr
!password frr
!enable password frr
log file %{_localstatedir}/log/frr/frr.log
__EOF__
cat > %{buildroot}%{_sysconfdir}/frr/vtysh.conf << __EOF__
! vtysh is using PAM authentication allowing root to use it.
__EOF__
%check
make -C tests
%pre
# Create frr user/groups
getent group %{frr_group} >/dev/null || groupadd -r %{frr_group}
getent group %{frrvty_group} >/dev/null || groupadd -r %{frrvty_group}
getent passwd %{frr_user} >/dev/null || useradd -r -g %{frr_group} -G %{frrvty_group} -d %{frr_home} -s /sbin/nologin -c "FRRouting suite" %{frr_user}
exit 0
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%if %{with doc}
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}
%endif
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf || true
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%if %{with doc}
%install_info_delete --info-dir=%{_infodir} %{_infodir}/frr.info%{ext_info}
%endif
# delete the user and groups created if it's an uninstall
if [ "$1" = "0" ]; then
userdel -r frr
groupdel frr
groupdel frrvty
fi
%if %{with protobuf}
%post -n libfrr_pb0 -p /sbin/ldconfig
%postun -n libfrr_pb0 -p /sbin/ldconfig
%post -n libfrrfpm_pb0 -p /sbin/ldconfig
%postun -n libfrrfpm_pb0 -p /sbin/ldconfig
%endif
%if %{with ospfapi}
%post -n libfrrospfapiclient0 -p /sbin/ldconfig
%postun -n libfrrospfapiclient0 -p /sbin/ldconfig
%endif
%if %{with snmp}
%post -n libfrrsnmp0 -p /sbin/ldconfig
%postun -n libfrrsnmp0 -p /sbin/ldconfig
%endif
%if %{with zeromq}
%post -n libfrrzmq0 -p /sbin/ldconfig
%postun -n libfrrzmq0 -p /sbin/ldconfig
%endif
%post -n libfrr0 -p /sbin/ldconfig
%postun -n libfrr0 -p /sbin/ldconfig
%post -n libfrrcares0 -p /sbin/ldconfig
%postun -n libfrrcares0 -p /sbin/ldconfig
%files
%license COPYING COPYING-LGPLv2.1
%doc README.md
%doc doc/mpls
%doc %{_docdir}/%{name}/examples
%dir %attr(750,%{frr_user},%{frr_user}) %{_sysconfdir}/%{name}
%config(noreplace) %attr(640,%{frr_user},%{frr_group}) %{_sysconfdir}/%{name}/[!v]*.conf*
%config(noreplace) %attr(640,%{frr_user},%{frrvty_group}) %{_sysconfdir}/%{name}/vtysh.conf
%config(noreplace) %%attr(640,%{frr_user},%{frr_group}) %{_sysconfdir}/%{name}/daemons
%config(noreplace) %{_sysconfdir}/pam.d/frr
%config(noreplace) %{_sysconfdir}/logrotate.d/frr
%if %{with doc}
%{_infodir}/frr.info%{?ext_info}
%{_mandir}/man?/*
%{_docdir}/%{name}/html
%endif
%{_unitdir}/%%{name}.service
%dir %{_tmpfilesdir}
%{_tmpfilesdir}/%{name}.conf
%dir %attr(-,%{frr_user},%{frr_group}) %{_localstatedir}/log/frr
%dir %attr(-,%{frr_user},%{frr_group}) %ghost %{frr_statedir}
%{_sbindir}/rc%{name}
%dir %{_prefix}/lib/frr
%{_prefix}/lib/frr/fabricd
%{_prefix}/lib/frr/vrrpd
%{_datadir}/yang
%if %{with pimd}
%{_bindir}/mtracebis
%endif
%if %{with vtysh}
%{_bindir}/vtysh
%endif
%if %{with babeld}
%{frr_daemondir}/babeld
%endif
%if %{with bfdd}
%{frr_daemondir}/bfdd
%endif
%if %{with bgpd}
%{frr_daemondir}/bgpd
%endif
%if %{with eigrpd}
%{frr_daemondir}/eigrpd
%endif
%{frr_daemondir}/frr
%{frr_daemondir}/frr-reload
%{frr_daemondir}/frr-reload.py
%{frr_daemondir}/frrcommon.sh
%{frr_daemondir}/frrinit.sh
%if %{with isisd}
%{frr_daemondir}/isisd
%endif
%if %{with ldpd}
%{frr_daemondir}/ldpd
%endif
%if %{with nhrpd}
%{frr_daemondir}/nhrpd
%endif
%if %{with ospf6d}
%{frr_daemondir}/ospf6d
%endif
%if %{with ospfd}
%{frr_daemondir}/ospfd
%endif
%if %{with pbrd}
%{frr_daemondir}/pbrd
%endif
%if %{with pimd}
%{frr_daemondir}/pimd
%endif
%if %{with ripd}
%{frr_daemondir}/ripd
%endif
%if %{with ripngd}
%{frr_daemondir}/ripngd
%endif
%if %{with sharpd}
%{frr_daemondir}/sharpd
%endif
%if %{with staticd}
%{frr_daemondir}/staticd
%endif
%if %{with watchfrr}
%{frr_daemondir}/watchfrr
%{frr_daemondir}/watchfrr.sh
%endif
%if %{with zebra}
%{frr_daemondir}/zebra
%endif
%dir %{_libdir}/frr
%dir %{_libdir}/frr/modules
%if %{with zebra} && %{with fpm}
%{_libdir}/frr/modules/zebra_fpm.so
%endif
%if %{with zebra} && %{with irdp}
%{_libdir}/frr/modules/zebra_irdp.so
%endif
%if %{with bgpd} && %{with rpki}
%{_libdir}/frr/modules/bgpd_rpki.so
%endif
%{_prefix}/lib/frr/vrrpd
%{_libdir}/frr/modules/bgpd_bmp.so
%if %{with protobuf}
%files -n libfrr_pb0
%{_libdir}/libfrr_pb.so.0*
%files -n libfrrfpm_pb0
%{_libdir}/libfrrfpm_pb.so.0*
%endif
%if %{with ospfapi}
%files -n libfrrospfapiclient0
%{_libdir}/libfrrospfapiclient.so.0*
%endif
%if %{with snmp}
%files -n libfrrsnmp0
%{_libdir}/libfrrsnmp.so.0*
%{_libdir}/frr/modules/*_snmp.so
%endif
%if %{with zeromq}
%files -n libfrrzmq0
%{_libdir}/libfrrzmq.so.0*
%endif
%files -n libfrr0
%{_libdir}/libfrr.so.0*
%files -n libfrrcares0
%{_libdir}/libfrrcares.so.0
%{_libdir}/libfrrcares.so.0.0.0
%files devel
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*.h
%if %{with ospfd}
%dir %{_includedir}/%{name}/ospfd
%{_includedir}/%{name}/ospfd/*.h
%endif
%if %{with ospfapi}
%dir %{_includedir}/%{name}/ospfapi
%{_includedir}/%{name}/ospfapi/*.h
%endif
%if %{with eigrpd}
%dir %{_includedir}/%{name}/eigrpd
%{_includedir}/%{name}/eigrpd/*.h
%endif
%{_libdir}/lib*.so
%changelog