xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.2.2.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
10                    file://COPYING-LGPLv2.1;md5=4fbd65380cdd255951079008b364516c"
11
12SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/8.2 \
13           file://CVE-2022-37035.patch \
14           file://CVE-2022-37032.patch \
15           file://CVE-2022-42917.patch \
16           file://frr.pam \
17	      "
18
19SRCREV = "79188bf710e92acf42fb5b9b0a2e9593a5ee9b05"
20
21S = "${WORKDIR}/git"
22
23# Due to libyang not supported on these arches:
24COMPATIBLE_HOST:riscv32 = "null"
25COMPATIBLE_HOST:riscv64 = "null"
26COMPATIBLE_HOST:armv5 = "null"
27
28# Fail to build on mips64 with error:
29# Error: PC-relative reference to a different section
30COMPATIBLE_HOST:mips64 = "null"
31
32inherit autotools-brokensep python3native pkgconfig useradd systemd
33
34DEPENDS:class-native = "bison-native elfutils-native"
35DEPENDS:class-target = "bison-native json-c readline c-ares libyang frr-native"
36
37RDEPENDS:${PN}:class-target = "iproute2 python3-core bash"
38
39PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
40PACKAGECONFIG:class-native = ""
41
42PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam"
43PACKAGECONFIG[grpc] = "--enable-grpc,--disable-grpc,grpc-native grpc"
44PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp"
45PACKAGECONFIG[zeromq] = "--enable-zeromq,--disable-zeromq,zeromq"
46PACKAGECONFIG[protobuf] = "--enable-protobuf,--disable-protobuf,protobuf-c-native protobuf-c"
47PACKAGECONFIG[capabilities] = "--enable-capabilities,--disable-capabilities,libcap"
48PACKAGECONFIG[cumulus] = "--enable-cumulus,--disable-cumulus"
49PACKAGECONFIG[datacenter] = "--enable-datacenter,--disable-datacenter"
50PACKAGECONFIG[ospfclient] = "--enable-ospfapi --enable-ospfclient,--disable-ospfapi --disable-ospfclient"
51
52EXTRA_OECONF:class-native = "--enable-clippy-only"
53
54EXTRA_OECONF:class-target = "--sbindir=${libdir}/frr \
55                             --sysconfdir=${sysconfdir}/frr \
56                             --localstatedir=${localstatedir}/run/frr \
57                             --enable-vtysh \
58                             --enable-fpm \
59                             --enable-multipath=64 \
60                             --enable-user=frr \
61                             --enable-group=frr \
62                             --enable-vty-group=frrvty \
63                             --enable-configfile-mask=0640 \
64                             --enable-logfile-mask=0640 \
65                             --disable-doc \
66                             --with-clippy=${RECIPE_SYSROOT_NATIVE}/usr/lib/clippy \
67                            "
68
69CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
70
71LDFLAGS:append:mips = " -latomic"
72LDFLAGS:append:mipsel = " -latomic"
73LDFLAGS:append:powerpc = " -latomic"
74
75SYSTEMD_PACKAGES = "${PN}"
76SYSTEMD_SERVICE:${PN} = "frr.service"
77SYSTEMD_AUTO_ENABLE = "disable"
78
79do_compile:prepend () {
80   sed -i -e 's#${RECIPE_SYSROOT_NATIVE}##g' \
81          -e 's#${RECIPE_SYSROOT}##g' ${S}/lib/version.h
82}
83
84do_compile:class-native () {
85    oe_runmake clippy-only
86}
87
88do_install:class-native () {
89    install -d ${D}${libdir}
90    install -m 755 ${S}/lib/clippy ${D}${libdir}/clippy
91}
92
93do_install:append:class-target () {
94    install -m 0755 -d ${D}${sysconfdir}/frr
95    install -m 0640 ${S}/tools/etc/frr/* ${D}${sysconfdir}/frr/
96    chown frr:frrvty ${D}${sysconfdir}/frr
97    chown frr:frr ${D}${sysconfdir}/frr/*
98    chown frr:frrvty ${D}${sysconfdir}/frr/vtysh.conf
99    chmod 640 ${D}${sysconfdir}/frr/*
100
101    if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
102        install -d ${D}/${sysconfdir}/pam.d
103        install -m 644 ${WORKDIR}/frr.pam ${D}/${sysconfdir}/pam.d/frr
104    fi
105
106    if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
107        install -d ${D}${sysconfdir}/init.d
108        install -m 0755 ${B}/tools/frrinit.sh ${D}${sysconfdir}/init.d/frr
109
110        install -d ${D}${sysconfdir}/default/volatiles
111        echo "d frr frr 0755 ${localstatedir}/run/frr none" \
112            > ${D}${sysconfdir}/default/volatiles/99_frr
113    fi
114
115    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
116        install -d ${D}${systemd_system_unitdir}
117        install -m 0644 ${B}/tools/frr*.service ${D}${systemd_system_unitdir}
118
119        install -d ${D}${sysconfdir}/tmpfiles.d
120        echo "d /run/frr 0755 frr frr -" \
121            > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
122    fi
123}
124
125USERADD_PACKAGES = "${PN}"
126GROUPADD_PARAM:${PN} = "--system frr ; --system frrvty"
127USERADD_PARAM:${PN} = "--system --home ${localstatedir}/run/frr/ -M -g frr -G frrvty --shell /bin/false frr"
128
129FILES:${PN} += "${datadir}/yang"
130
131BBCLASSEXTEND = "native"
132