1SUMMARY = "BGP/OSPF/RIP routing daemon"
2DESCRIPTION = "FRRouting is a free and open source Internet routing protocol suite for Linux \
3and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM, LDP, BFD, Babel, PBR, OpenFabric \
4and VRRP, with alpha support for EIGRP and NHRP."
5HOMEPAGE = "https://frrouting.org/"
6SECTION = "net"
7
8LICENSE = "GPL-2.0-only & LGPL-2.1-only"
9LIC_FILES_CHKSUM = "file://doc/licenses/GPL-2.0;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
10                    file://doc/licenses/LGPL-2.1;md5=4fbd65380cdd255951079008b364516c"
11
12
13SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/10.0 \
14           file://frr.pam \
15           file://0001-zebra-Mimic-GNU-basename-API-for-non-glibc-library-e.patch \
16           "
17
18SRCREV = "03a143cd49ed1b190cb38f48a31ef4d71fa01a02"
19
20UPSTREAM_CHECK_GITTAGREGEX = "frr-(?P<pver>\d+(\.\d+)+)$"
21
22CVE_PRODUCT = "frrouting"
23
24S = "${WORKDIR}/git"
25
26inherit autotools-brokensep python3native pkgconfig useradd systemd
27
28DEPENDS:class-native = "bison-native elfutils-native"
29DEPENDS:class-target = "bison-native json-c readline c-ares libyang frr-native protobuf-c-native protobuf-c"
30
31RDEPENDS:${PN}:class-target = "iproute2 python3-core bash"
32
33PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
34PACKAGECONFIG:class-native = ""
35
36PACKAGECONFIG[fpm] = "--enable-fpm,--disable-fpm"
37PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam"
38PACKAGECONFIG[grpc] = "--enable-grpc,--disable-grpc,grpc-native grpc"
39PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp"
40PACKAGECONFIG[zeromq] = "--enable-zeromq,--disable-zeromq,zeromq"
41PACKAGECONFIG[protobuf] = "--enable-protobuf,--disable-protobuf,protobuf-c-native protobuf-c"
42PACKAGECONFIG[capabilities] = "--enable-capabilities,--disable-capabilities,libcap"
43PACKAGECONFIG[cumulus] = "--enable-cumulus,--disable-cumulus"
44PACKAGECONFIG[datacenter] = "--enable-datacenter,--disable-datacenter"
45PACKAGECONFIG[ospfclient] = "--enable-ospfapi --enable-ospfclient,--disable-ospfapi --disable-ospfclient"
46
47EXTRA_OECONF:class-native = "--enable-clippy-only"
48
49EXTRA_OECONF:class-target = "--sbindir=${libexecdir}/frr \
50                             --sysconfdir=${sysconfdir}/frr \
51                             --localstatedir=${localstatedir}/run/frr \
52                             --enable-vtysh \
53                             --enable-multipath=64 \
54                             --enable-user=frr \
55                             --enable-group=frr \
56                             --enable-vty-group=frrvty \
57                             --enable-configfile-mask=0640 \
58                             --enable-logfile-mask=0640 \
59                             --disable-doc \
60                             --with-clippy=${RECIPE_SYSROOT_NATIVE}/usr/lib/clippy \
61                            "
62
63CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
64
65# https://github.com/FRRouting/frr/issues/14469
66DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map"
67
68LDFLAGS:append:mips = " -latomic"
69LDFLAGS:append:mipsel = " -latomic"
70LDFLAGS:append:powerpc = " -latomic"
71LDFLAGS:append:riscv32 = " -latomic"
72
73SYSTEMD_PACKAGES = "${PN}"
74SYSTEMD_SERVICE:${PN} = "frr.service"
75SYSTEMD_AUTO_ENABLE = "disable"
76
77inherit update-alternatives multilib_script multilib_header
78
79ALTERNATIVE_PRIORITY = "100"
80ALTERNATIVE:${PN} = " ietf-interfaces ietf-netconf-acm ietf-netconf-with-defaults ietf-netconf"
81ALTERNATIVE_LINK_NAME[ietf-interfaces] = "${datadir}/yang/ietf-interfaces.yang"
82ALTERNATIVE_LINK_NAME[ietf-netconf-acm] = "${datadir}/yang/ietf-netconf-acm.yang"
83ALTERNATIVE_LINK_NAME[ietf-netconf-with-defaults] = "${datadir}/yang/ietf-netconf-with-defaults.yang"
84ALTERNATIVE_LINK_NAME[ietf-netconf] = "${datadir}/yang/ietf-netconf.yang"
85do_compile:prepend () {
86   sed -i -e 's#${RECIPE_SYSROOT_NATIVE}##g' \
87          -e 's#${RECIPE_SYSROOT}##g' ${S}/lib/version.h
88}
89
90do_compile:class-native () {
91    oe_runmake clippy-only
92}
93
94do_install:class-native () {
95    install -d ${D}${libdir}
96    install -m 755 ${S}/lib/clippy ${D}${libdir}/clippy
97}
98
99do_install:append:class-target () {
100    install -m 0755 -d ${D}${sysconfdir}/frr
101    install -m 0755 -d ${D}${libexecdir}/frr
102    install -m 0640 ${S}/tools/etc/frr/* ${D}${sysconfdir}/frr/
103    chown frr:frrvty ${D}${sysconfdir}/frr
104    chown frr:frr ${D}${sysconfdir}/frr/*
105    chown frr:frrvty ${D}${sysconfdir}/frr/vtysh.conf
106    chmod 640 ${D}${sysconfdir}/frr/*
107
108    if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
109        install -d ${D}/${sysconfdir}/pam.d
110        install -m 644 ${UNPACKDIR}/frr.pam ${D}/${sysconfdir}/pam.d/frr
111    fi
112
113    if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
114        install -d ${D}${sysconfdir}/init.d
115        install -m 0755 ${B}/tools/frrinit.sh ${D}${sysconfdir}/init.d/frr
116
117        install -d ${D}${sysconfdir}/default/volatiles
118        echo "d frr frr 0755 ${localstatedir}/run/frr none" \
119            > ${D}${sysconfdir}/default/volatiles/99_frr
120    fi
121
122    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
123        install -d ${D}${systemd_system_unitdir}
124        install -m 0644 ${B}/tools/frr*.service ${D}${systemd_system_unitdir}
125
126        install -d ${D}${sysconfdir}/tmpfiles.d
127        echo "d /run/frr 0755 frr frr -" \
128            > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
129    fi
130    oe_multilib_header frr/version.h
131}
132
133USERADD_PACKAGES = "${PN}"
134GROUPADD_PARAM:${PN} = "--system frr ; --system frrvty"
135USERADD_PARAM:${PN} = "--system --home ${localstatedir}/run/frr/ -M -g frr -G frrvty --shell /bin/false frr"
136
137FILES:${PN} += "${datadir}/yang"
138
139BBCLASSEXTEND = "native"
140