redhat: Make docs and rpki optional for RPM package build

Adding options to disable docs and rpki during the build. By
default they are always built. RPKI sub-package will not be built
(and not available) if built without the RPKI support.

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
Martin Winter 2025-03-19 07:21:37 +01:00
parent 1f815d555c
commit 972ec6fd8c
No known key found for this signature in database
GPG key ID: 05A4ECF8C0102306

View file

@ -31,6 +31,8 @@
%{!?with_watchfrr: %global with_watchfrr 1 } %{!?with_watchfrr: %global with_watchfrr 1 }
%{!?with_pathd: %global with_pathd 1 } %{!?with_pathd: %global with_pathd 1 }
%{!?with_grpc: %global with_grpc 0 } %{!?with_grpc: %global with_grpc 0 }
%{!?with_rpki: %global with_rpki 1 }
%{!?with_docs: %global with_docs 1 }
# user and group # user and group
%{!?frr_user: %global frr_user frr } %{!?frr_user: %global frr_user frr }
@ -196,16 +198,22 @@ BuildRequires: pcre2-devel
%if 0%{?rhel} && 0%{?rhel} < 7 %if 0%{?rhel} && 0%{?rhel} < 7
#python27-devel is available from ius community repo for RedHat/CentOS 6 #python27-devel is available from ius community repo for RedHat/CentOS 6
BuildRequires: python27-devel BuildRequires: python27-devel
%if %{with_docs}
BuildRequires: python27-sphinx BuildRequires: python27-sphinx
%endif
%else %else
%if %{use_python2} %if %{use_python2}
BuildRequires: python-devel >= 2.7 BuildRequires: python-devel >= 2.7
%if %{with_docs}
BuildRequires: python-sphinx BuildRequires: python-sphinx
%endif
%else %else
BuildRequires: python3-devel BuildRequires: python3-devel
%if %{with_docs}
BuildRequires: python3-sphinx BuildRequires: python3-sphinx
%endif %endif
%endif %endif
%endif
%if %{with_grpc} %if %{with_grpc}
BuildRequires: grpc-devel >= 1.16.1 BuildRequires: grpc-devel >= 1.16.1
BuildRequires: protobuf-devel >= 3.6.1 BuildRequires: protobuf-devel >= 3.6.1
@ -286,6 +294,7 @@ The frr-devel package contains the header and object files necessary for
developing OSPF-API and frr applications. developing OSPF-API and frr applications.
%if %{with_rpki}
%package rpki-rtrlib %package rpki-rtrlib
Summary: BGP RPKI support (rtrlib) Summary: BGP RPKI support (rtrlib)
Group: System Environment/Daemons Group: System Environment/Daemons
@ -298,7 +307,7 @@ against cryptographic information stored in WHOIS databases. This is
used to prevent hijacking of networks on the wider internet. It is only used to prevent hijacking of networks on the wider internet. It is only
relevant to internet service providers using their own autonomous system relevant to internet service providers using their own autonomous system
number. number.
%endif
%package snmp %package snmp
Summary: SNMP support Summary: SNMP support
@ -403,9 +412,9 @@ Adds GRPC support to the individual FRR daemons.
--disable-babeld \ --disable-babeld \
%endif %endif
%if %{with_vrrpd} %if %{with_vrrpd}
--enable-vrrpd \ --enable-vrrpd \
%else %else
--disable-vrrpd \ --disable-vrrpd \
%endif %endif
%if %{with_pam} %if %{with_pam}
--with-libpam \ --with-libpam \
@ -436,7 +445,16 @@ Adds GRPC support to the individual FRR daemons.
--disable-bgp-vnc \ --disable-bgp-vnc \
%endif %endif
--enable-isisd \ --enable-isisd \
%if %{with_docs}
--enable-doc \
%else
--disable-doc \
%endif
%if %{with_rpki}
--enable-rpki \ --enable-rpki \
%else
--disable-rpki \
%endif
%if %{with_bfdd} %if %{with_bfdd}
--enable-bfdd \ --enable-bfdd \
%else %else
@ -468,9 +486,11 @@ sed -e '1c #!/usr/bin/python3' -i %{zeb_src}/tools/frr-reload.py
sed -e '1c #!/usr/bin/python3' -i %{zeb_src}/tools/generate_support_bundle.py sed -e '1c #!/usr/bin/python3' -i %{zeb_src}/tools/generate_support_bundle.py
%endif %endif
%if %{with_docs}
pushd doc pushd doc
make info make info
popd popd
%endif
%install %install
@ -608,7 +628,9 @@ zebra_spec_add_service fabricd 2618/tcp "Fabricd vty"
%__sed -i 's|watchfrr_enable=no|watchfrr_enable=yes|g' %{configdir}/daemons 2> /dev/null || true %__sed -i 's|watchfrr_enable=no|watchfrr_enable=yes|g' %{configdir}/daemons 2> /dev/null || true
%endif %endif
%if %{with_docs}
/sbin/install-info %{_infodir}/frr.info.gz %{_infodir}/dir /sbin/install-info %{_infodir}/frr.info.gz %{_infodir}/dir
%endif
# Create dummy config file if they don't exist so basic functions can be used. # Create dummy config file if they don't exist so basic functions can be used.
if [ ! -e %{configdir}/frr.conf ] && [ ! -e %{configdir}/zebra.conf ]; then if [ ! -e %{configdir}/frr.conf ] && [ ! -e %{configdir}/zebra.conf ]; then
@ -676,7 +698,9 @@ fi
/sbin/chkconfig --del frr /sbin/chkconfig --del frr
fi fi
%endif %endif
%if %{with_docs}
/sbin/install-info --delete %{_infodir}/frr.info.gz %{_infodir}/dir /sbin/install-info --delete %{_infodir}/frr.info.gz %{_infodir}/dir
%endif
%files %files
@ -693,8 +717,10 @@ fi
%dir %attr(755,root,root) %{_localstatedir}/log/frr %dir %attr(755,root,root) %{_localstatedir}/log/frr
%dir %attr(750,root,root) %{_runstatedir}/frr %dir %attr(750,root,root) %{_runstatedir}/frr
%endif %endif
%{_infodir}/frr.info.gz %if %{with_docs}
%{_mandir}/man*/* %{_infodir}/frr.info.gz
%{_mandir}/man*/*
%endif
%{_sbindir}/zebra %{_sbindir}/zebra
%{_sbindir}/staticd %{_sbindir}/staticd
%{_sbindir}/ospfd %{_sbindir}/ospfd
@ -794,16 +820,22 @@ fi
%endif %endif
%if %{with_rpki}
%post rpki-rtrlib %post rpki-rtrlib
# add rpki module to daemons # add rpki module to daemons
sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{_sysconfdir}/frr/daemons sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{_sysconfdir}/frr/daemons
%endif
%if %{with_rpki}
%postun rpki-rtrlib %postun rpki-rtrlib
# remove rpki module from daemons # remove rpki module from daemons
sed -i 's/ -M rpki//' %{_sysconfdir}/frr/daemons sed -i 's/ -M rpki//' %{_sysconfdir}/frr/daemons
%endif
%if %{with_rpki}
%files rpki-rtrlib %files rpki-rtrlib
%{_libdir}/frr/modules/bgpd_rpki.so %{_libdir}/frr/modules/bgpd_rpki.so
%endif
%files snmp %files snmp
@ -817,6 +849,7 @@ sed -i 's/ -M rpki//' %{_sysconfdir}/frr/daemons
%{_libdir}/frr/modules/grpc.so %{_libdir}/frr/modules/grpc.so
%endif %endif
%files devel %files devel
%{_libdir}/lib*.so %{_libdir}/lib*.so
%dir %{_includedir}/%{name} %dir %{_includedir}/%{name}
@ -839,7 +872,10 @@ sed -i 's/ -M rpki//' %{_sysconfdir}/frr/daemons
%changelog %changelog
* Thu Oct 10 2024 Jafar Al-Gharaibeh <jafar@atcorp.com> - %{version} * Wed Mar 19 2025 Jafar Al-Gharaibeh <jafar@atcorp.com> - %{version}
* Tue Mar 18 2025 Martin Winter <mwinter@opensourcerouting.org> 10.4-dev
- Change docs and rpki to conditional package builds
* Thu Oct 10 2024 Jafar Al-Gharaibeh <jafar@atcorp.com> - 10.3-dev * Thu Oct 10 2024 Jafar Al-Gharaibeh <jafar@atcorp.com> - 10.3-dev
- FRR 10.3 Development - FRR 10.3 Development