Name: p4lang-p4c Version: 1.2.5.5 Release: 1%{?dist} Summary: P4 language compiler License: ASL 2.0 URL: https://github.com/p4lang/p4c Source0: https://github.com/p4lang/p4c/archive/v%{version}/p4c-%{version}.tar.gz Source1: https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protobuf-25.3.tar.gz Source2: https://github.com/abseil/abseil-cpp/releases/download/20240116.1/abseil-cpp-20240116.1.tar.gz Source3: https://github.com/Z3Prover/z3/archive/z3-4.14.1.tar.gz Source4: https://github.com/p4lang/p4runtime/archive/ec4eb5ef70dbcbcbf2f8357a4b2b8c2f218845a5.tar.gz Source5: https://github.com/pantor/inja/archive/v3.4.0/inja-3.4.0.tar.gz Source6: https://github.com/libbpf/libbpf/archive/v1.5.0/libbpf-1.5.0.tar.gz BuildRequires: cmake BuildRequires: bison BuildRequires: flex BuildRequires: gcc-c++ BuildRequires: boost-devel BuildRequires: gc-devel BuildRequires: gmp-devel BuildRequires: libbpf-devel BuildRequires: elfutils-libelf-devel BuildRequires: llvm-devel BuildRequires: python3-devel BuildRequires: python3-grpcio BuildRequires: python3-pyroute2 BuildRequires: python3-ply BuildRequires: python3-scapy BuildRequires: python3-setuptools BuildRequires: python3-thrift BuildRequires: python3-googleapis-common-protos BuildRequires: p4lang-bmv2 Recommends: p4lang-bmv2 %description A reference compiler for the P4 programming language, supporting P4_14 and P4_16, with backends for BMv2, eBPF, DPDK, and more. %prep %autosetup -n p4c-%{version} mkdir -p %{_vpath_builddir}/_deps tar -xzf %{SOURCE1} -C %{_vpath_builddir}/_deps --transform='s/protobuf-25.3/protobuf-src/' tar -xzf %{SOURCE2} -C %{_vpath_builddir}/_deps --transform='s/abseil-cpp-20240116.1/abseil-src/' tar -xzf %{SOURCE3} -C %{_vpath_builddir}/_deps --transform='s/z3-z3-4.14.1/z3-src/' tar -xzf %{SOURCE4} -C %{_vpath_builddir}/_deps --transform='s/p4runtime-ec4eb5ef70dbcbcbf2f8357a4b2b8c2f218845a5/p4runtime-src/' tar -xzf %{SOURCE5} -C %{_vpath_builddir}/_deps --transform='s/inja-3.4.0/inja-src/' tar -xzf %{SOURCE6} -C backends/ebpf/runtime/contrib --transform='s/libbpf-1.5.0/libbpf/' sed -i 's/add_custom_target(uninstall/add_custom_target(z3_uninstall/' %{_vpath_builddir}/_deps/z3-src/CMakeLists.txt %ifnarch x86_64 sed -i '/PUBLIC "-mbmi"/d' cmake/Abseil.cmake %endif %build mkdir -p %{_builddir}/tmp export TMPDIR=%{_builddir}/tmp %cmake -B %{_vpath_builddir} \ -DBUILD_SHARED_LIBS=OFF \ -DFETCHCONTENT_FULLY_DISCONNECTED=ON \ -DP4C_USE_PREINSTALLED_BDWGC=ON \ -DENABLE_BMV2=ON \ -DENABLE_EBPF=ON \ -DENABLE_UBPF=ON \ -DENABLE_DPDK=ON \ -DENABLE_P4C_GRAPHS=ON \ -DENABLE_P4TEST=ON \ -DENABLE_DOCS=OFF\ -DENABLE_GC=ON \ -DENABLE_GTESTS=OFF \ -DENABLE_MULTITHREAD=OFF \ -DENABLE_TEST_TOOLS=ON %make_build -C %{_vpath_builddir} %install %make_install -C %{_vpath_builddir} %files %license LICENSE %doc README.md %{_bindir}/p4c %{_bindir}/p4c-bm2-pna %{_bindir}/p4c-bm2-psa %{_bindir}/p4c-bm2-ss %{_bindir}/p4c-dpdk %{_bindir}/p4c-ebpf %{_bindir}/p4c-graphs %{_bindir}/p4c-pna-p4tc %{_bindir}/p4c-ubpf %{_bindir}/p4smith %{_bindir}/p4test %{_bindir}/p4testgen %{_datadir}/p4c %changelog