blob: 843b21eac5cc3e5588b01f20cc5ecba2ad3247a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
Name: p4lang-pi
Version: 0.1.0
Release: 1%{?dist}
Summary: Protocol Independent API
License: ASL 2.0
URL: https://github.com/p4lang/PI
# Architectures supported by PI
ExclusiveArch: x86_64
%define submodule_googletest_version 1.8.0
%define submodule_gnmi_version 9c8d9e965b3e854107ea02c12ab11b70717456f2
%define submodule_public_version 1040d11c089c74084c64c234bee3691ec70e8a9f
%define submodule_p4runtime_version 1.3.0
%define submodule_uthash_version bf15263081be6229be31addd48566df93921cb46
Source0: https://github.com/p4lang/PI/archive/refs/tags/v%{version}.tar.gz
Source1: https://github.com/google/googletest/archive/refs/tags/release-%{submodule_googletest_version}.tar.gz
Source2: https://github.com/openconfig/gnmi/archive/%{submodule_gnmi_version}.tar.gz
Source3: https://github.com/openconfig/public/archive/%{submodule_public_version}.tar.gz
Source4: https://github.com/p4lang/p4runtime/archive/refs/tags/v%{submodule_p4runtime_version}.tar.gz
Source5: https://github.com/troydhanson/uthash/archive/%{submodule_uthash_version}.tar.gz
BuildRequires: valgrind
BuildRequires: libtool
BuildRequires: glibc-devel g++
BuildRequires: boost-devel boost-system boost-thread
BuildRequires: grpc-devel grpc-plugins
BuildRequires: protobuf-devel
BuildRequires: python3
%description
Protocol Independent API (PI or P4 Runtime) defines a set of APIs that allow
interacting with entities defined in a P4 program, such as tables, counters,
meters.
%prep
%setup -q -c -n p4lang-pi-%{version}
%setup -q -T -D -a 1 -n p4lang-pi-%{version}
cp -r googletest-release-%{submodule_googletest_version}/* PI-%{version}/third_party/googletest/
%setup -q -T -D -a 2 -n p4lang-pi-%{version}
cp -r gnmi-%{submodule_gnmi_version}/* PI-%{version}/proto/openconfig/gnmi/
%setup -q -T -D -a 3 -n p4lang-pi-%{version}
cp -r public-%{submodule_public_version}/* PI-%{version}/proto/openconfig/public/
%setup -q -T -D -a 4 -n p4lang-pi-%{version}
cp -r p4runtime-%{submodule_p4runtime_version}/* PI-%{version}/proto/p4runtime/
%setup -q -T -D -a 5 -n p4lang-pi-%{version}
cp -r uthash-%{submodule_uthash_version}/* PI-%{version}/third_party/uthash/
%build
cd PI-%{version}
./autogen.sh
mkdir build
cd build
# --with-cli and --with-internal-rpc are mostly deprecated.
# The internal RPC mechanism predates P4Runtime, and the CLI
# (very incomplete) should ideally be replaced by one built
# over P4Runtime.
#
# --with-sysrepo is to enable supporting gNMI and OpenConfig
# YANG models as part of the P4 Runtime server.
../configure \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--without-bmv2 \
--without-sysrepo \
--without-internal-rpc \
--without-cli \
--with-proto
make %{?_smp_mflags}
%install
cd PI-%{version}
# license
%{__mkdir_p} %{buildroot}%{_datadir}/p4lang-pi
%{__cp} LICENSE %{buildroot}%{_datadir}/p4lang-pi/LICENSE
cd build
make install prefix=%{buildroot}%{_prefix} libdir=%{buildroot}/%{_libdir}
%files
%{_bindir}/pi_convert_p4info
%{_bindir}/pi_gen_fe_defines
%{_bindir}/pi_gen_native_json
%{_includedir}/gnmi/*
%{_includedir}/google/rpc/*
%{_includedir}/p4/*
%{_includedir}/PI/*
%{python3_sitelib}/gnmi/*
%{python3_sitelib}/google/*
%{python3_sitelib}/p4/*
%{_libdir}/libpi*
%{_datadir}/p4lang-pi/LICENSE
%changelog
* Sun Mar 27 2022 <rstoyanov@fedoraproject.org> - 0.1.0
- Initial release
|