void-packages/srcpkgs/frr/template
2021-02-14 20:07:53 -03:00

138 lines
3.8 KiB
Bash

# Template file for 'frr'
pkgname=frr
version=7.5
revision=1
wrksrc="${pkgname}-${pkgname}-${version}"
build_style=gnu-configure
# chroot-texinfo is not able to build frr's docs
configure_args="--disable-doc
--localstatedir=/run/frr --sysconfdir=/etc/frr
--enable-exampledir=/usr/share/examples/frr
--enable-user=_frr --enable-group=_frr --enable-vty-group=_frrvty"
make_build_args="SPHINXBUILD=sphinx-build"
conf_files="/etc/frr/*.conf"
make_dirs="/var/log/frr 0700 _frr _frr"
hostmakedepends="pkg-config flex bison autoconf automake libtool
python3 python3-Sphinx python3-devel libyang-tools"
makedepends="pcre-devel libcap-devel json-c-devel pam-devel c-ares-devel
readline-devel python3-devel libyang-devel"
checkdepends="python3-pytest"
short_desc="IP routing protocol suite"
maintainer="Cameron Nemo <cnemo@tutanota.com>"
license="GPL-2.0-or-later, LGPL-2.1-or-later"
homepage="https://frrouting.org"
distfiles="https://github.com/FRRouting/frr/archive/${pkgname}-${version}.tar.gz"
checksum=54066e82a82751ec5876d9b67aa0cb24fe94e19e7371af290ac25099eda9f136
python_version=3
system_groups="_frrvty"
system_accounts="_frr"
_frr_groups="_frrvty"
_daemons="zebra staticd bgpd ospfd ospf6d ripd ripngd isisd pimd ldpd nhrpd
eigrpd babeld sharpd pbrd bfdd fabricd"
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
makedepends+=" musl-legacy-compat"
fi
subpackages="libfrrospfapiclient libfrrospfapiclient-devel libfrr libfrr-devel frr-flush frr-reload"
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" frr-devel"
configure_args+=" --with-clippy=/usr/libexec/frr-devel/clippy"
else
subpackages+=" frr-devel"
fi
post_patch() {
# Typo in configure macro
vsed -i m4/ax_python.m4 -e 's/"{py_ver}"/"${py_ver}"/g'
}
pre_configure() {
autoreconf -fi
}
post_install() {
if [ -z "$CROSS_BUILD" ]; then
# install build tool to be used by cross builds
vinstall lib/clippy 0755 usr/libexec/frr-devel
fi
# LSB init script and friends are not needed
for cmd in frr watchfrr watchfrr.sh frrcommon.sh frrinit.sh generate_support_bundle.py; do
rm -f -- "${DESTDIR}/usr/bin/${cmd}"
done
# frr-reload wrapper script hardcodes sbindir as usr/lib/frr, avoid it
rm -f -- "${DESTDIR}/usr/bin/frr-reload"
mv "${DESTDIR}/usr/bin/frr-reload.py" "${DESTDIR}/usr/bin/frr-reload"
vbin "${FILESDIR}/frr-flush"
vsv frr-generic
vmkdir etc/frr 0755
vinstall /dev/null 0640 etc/frr vtysh.conf
for daemon in ${_daemons}; do
vinstall /dev/null 0640 etc/frr "${daemon}.conf"
vsv "${daemon}"
done
}
frr-devel_package() {
short_desc+=" (development binaries)"
pkg_install() {
vmove usr/libexec/frr-devel
}
}
frr-flush_package() {
short_desc+=" - route flushing tool"
depends="iproute2 ${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/bin/frr-flush
}
}
frr-reload_package() {
short_desc+=" - reload tool"
depends="python3 ${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/bin/frr-reload
}
}
libfrr_package() {
short_desc+=" - client library"
pkg_install() {
vmove "usr/lib/libfrr.so.*"
vmove "usr/lib/libfrrcares.so.*"
}
}
libfrr-devel_package() {
short_desc+=" - client library (development files)"
depends="${pkgname%-devel}-${version}_${revision}"
pkg_install() {
vmove "usr/include/frr/*.h"
vmove usr/include/frr/ospfd
vmove usr/include/frr/eigrpd
vmove usr/lib/libfrr.so
vmove usr/lib/libfrr.a
vmove usr/lib/libfrrcares.so
vmove usr/lib/libfrrcares.a
}
}
libfrrospfapiclient_package() {
short_desc+=" - OSPF client library"
pkg_install() {
vmove "usr/lib/libfrrospfapiclient.so.*"
}
}
libfrrospfapiclient-devel_package() {
short_desc+=" - OSPF client library (development files)"
depends="${pkgname%-devel}-${version}_${revision}"
pkg_install() {
vmove usr/include/frr/ospfapi
vmove usr/lib/libfrrospfapiclient.so
vmove usr/lib/libfrrospfapiclient.a
}
}