blob: ba941e3206fad69b95ee3d9af4e1f92f02bfd15f (
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
# Modified from https://src.fedoraproject.org/rpms/uhd/blob/rawhide/f/uhd.spec
#%%global git_commit c52f3f41806622c95573de21be042f966f675543
#%%global git_date 201904023
#%%global git_short_commit %%(echo %{git_commit} | cut -c -8)
#%%global git_suffix %%{git_date}git%{git_short_commit}
# By default include binary_firmware, otherwise try to rebuild
# the firmware from sources. If you want to rebuild all firmware
# images you need to install appropriate tools (e.g. Xilinx ISE).
%bcond_without binary_firmware
# Currently broken: https://github.com/EttusResearch/uhd/issues/413
%bcond_with wireshark
# NEON support is by default disabled on ARMs
# building with --with=neon will enable auto detection
%bcond_with neon
# X.Y.Z
%global wireshark_ver_full %((%{__awk} '/^#define VERSION[ \t]+/ { print $NF }' /usr/include/wireshark/config.h 2>/dev/null||echo none)|/usr/bin/tr -d '"')
# X.Y
%global wireshark_ver %(VF="%{wireshark_ver_full}"; echo ${VF%.*})
%ifarch %{arm} aarch64
%if ! %{with neon}
%global have_neon -DHAVE_ARM_NEON_H=0
%endif
%endif
Name: uhd
URL: http://github.com/EttusResearch/uhd
Version: 4.7.0.0
%global images_ver %{version}
Release: 1
# Automatically converted from old format: GPLv3+ - review is highly recommended.
License: GPL-3.0-or-later
BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: boost-devel
BuildRequires: libusb1-devel
BuildRequires: python3-cheetah
BuildRequires: ncurses-devel
BuildRequires: python3-docutils
BuildRequires: doxygen
BuildRequires: pkgconfig
BuildRequires: libpcap-devel
BuildRequires: python3-numpy
BuildRequires: vim-common
BuildRequires: libatomic
%if %{with wireshark}
BuildRequires: wireshark-devel
BuildRequires: libgcrypt-devel
BuildRequires: gnutls-devel
%endif
BuildRequires: pybind11-devel
BuildRequires: python3-mako
BuildRequires: python3-requests
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: tar
%if ! %{with binary_firmware}
BuildRequires: sdcc
BuildRequires: sed
%endif
Requires(pre): shadow-utils, glibc-common
Requires: python3-tkinter
Summary: Universal Hardware Driver for Ettus Research products
Source0: %{url}/archive/v%{version}/uhd-%{version}.tar.gz
Source1: %{name}-limits.conf
Source2: %{url}/releases/download/v%{images_ver}/uhd-images_%{images_ver}.tar.xz
# dirty workaround for the https://github.com/EttusResearch/uhd/issues/551
# until the better fix is available
Patch0: uhd-4.2.0.0-imagepath-fix.patch
%description
The UHD is the universal hardware driver for Ettus Research products.
The goal of the UHD is to provide a host driver and API for current and
future Ettus Research products. It can be used standalone without GNU Radio.
%package firmware
Summary: Firmware files for UHD
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description firmware
Firmware files for the Universal Hardware driver (UHD).
%package devel
Summary: Development files for UHD
Requires: %{name} = %{version}-%{release}
%description devel
Development files for the Universal Hardware Driver (UHD).
# arch due to bug in doxygen
%package doc
Summary: Documentation files for UHD
%description doc
Documentation for the Universal Hardware Driver (UHD).
%package tools
Summary: Tools for working with / debugging USRP device
Requires: %{name} = %{version}-%{release}
%description tools
Tools that are useful for working with and/or debugging USRP device.
%if %{with wireshark}
%package wireshark
Summary: Wireshark dissector plugins
Requires: %{name} = %{version}-%{release}
Requires: %{_libdir}/wireshark/plugins/%{wireshark_ver}
%description wireshark
Wireshark dissector plugins.
%endif
%prep
%setup -q
%patch -P0 -p1 -b .imagepath-fix
# firmware
%if %{with binary_firmware}
# extract binary firmware
mkdir -p images/images
tar -xJf %{SOURCE2} -C images/images --strip-components=1
rm -f images/images/{LICENSE.txt,*.tag}
# remove Windows drivers
rm -rf images/winusb_driver
%endif
# fix python shebangs
find . -type f -name "*.py" -exec sed -i '/^#!/ s|.*|#!%{__python3}|' {} \;
%build
# firmware
%if ! %{with binary_firmware}
# rebuilt from sources
export PATH=$PATH:%{_libexecdir}/sdcc
pushd images
sed -i '/-name "\*\.twr" | xargs grep constraint | grep met/ s/^/#/' Makefile
make %{?_smp_mflags} images
popd
%endif
pushd host
%cmake %{?have_neon} -DPYTHON_EXECUTABLE="%{__python3}" \
-DPYBIND11_INCLUDE_DIR="/usr/include/pybind11/" \
-DUHD_VERSION="%{version}" \
-DENABLE_TESTS=off ../
%cmake_build
popd
# tools
pushd tools/uhd_dump
make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}"
popd
%if %{with wireshark}
# wireshark dissectors
pushd tools/dissectors
%cmake -DENABLE_RFNOC=ON -DENABLE_OCTOCLOCK=ON -DENABLE_ZPU=ON
%cmake_build
popd
%endif
#%%check
#cd host/%%{_vpath_builddir}
#make test
%install
# fix python shebangs (run again for generated scripts)
find . -type f -name "*.py" -exec sed -i '/^#!/ s|.*|#!%{__python3}|' {} \;
pushd host
%cmake_install
# Fix udev rules and use dynamic ACL management for device
sed -i 's/BUS==/SUBSYSTEM==/;s/SYSFS{/ATTRS{/;s/MODE:="0666"/GROUP:="usrp", MODE:="0660", ENV{ID_SOFTWARE_RADIO}="1"/' %{buildroot}%{_libdir}/uhd/utils/uhd-usrp.rules
mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d
mv %{buildroot}%{_libdir}/uhd/utils/uhd-usrp.rules %{buildroot}%{_prefix}/lib/udev/rules.d/10-usrp-uhd.rules
# Remove tests, examples binaries
rm -rf %{buildroot}%{_libdir}/uhd/{tests,examples}
# Move the utils stuff to libexec dir
mkdir -p %{buildroot}%{_libexecdir}/uhd
mv %{buildroot}%{_libdir}/uhd/utils/* %{buildroot}%{_libexecdir}/uhd
popd
# Package base docs to base package
mkdir _tmpdoc
mv %{buildroot}%{_docdir}/%{name}/{LICENSE,README.md} _tmpdoc
install -m 644 -D %{SOURCE1} %{buildroot}%{_sysconfdir}/security/limits.d/99-usrp.conf
# firmware
mkdir -p %{buildroot}%{_datadir}/uhd/images
cp -r images/images/* %{buildroot}%{_datadir}/uhd/images
# remove win stuff
rm -rf %{buildroot}%{_datadir}/uhd/images/winusb_driver
# convert hardlinks to symlinks (to not package the file twice)
pushd %{buildroot}%{_bindir}
for f in uhd_images_downloader usrp2_card_burner
do
unlink $f
ln -s ../..%{_libexecdir}/uhd/${f}.py $f
done
popd
# tools
install -Dpm 0755 tools/usrp_x3xx_fpga_jtag_programmer.sh %{buildroot}%{_bindir}/usrp_x3xx_fpga_jtag_programmer.sh
install -Dpm 0755 tools/uhd_dump/chdr_log %{buildroot}%{_bindir}/chdr_log
%if %{with wireshark}
# wireshark dissectors
pushd tools/dissectors
%cmake_install
popd
# fix wireshark dissectors location
mkdir -p %{buildroot}%{_libdir}/wireshark/plugins/%{wireshark_ver}
mv %{buildroot}%{_prefix}/epan %{buildroot}%{_libdir}/wireshark/plugins/%{wireshark_ver}
%endif
# add directory for modules
mkdir -p %{buildroot}%{_libdir}/uhd/modules
%ldconfig_scriptlets
%pre
getent group usrp >/dev/null || \
%{_sbindir}/groupadd -r usrp >/dev/null 2>&1
exit 0
%files
%exclude %{_docdir}/%{name}/doxygen
%exclude %{_datadir}/uhd/images
%doc _tmpdoc/*
%dir %{_libdir}/uhd
%{_bindir}/usrpctl
%{_bindir}/uhd_*
%{_bindir}/usrp2_*
%{_bindir}/rfnoc_image_builder
%{_bindir}/usrp_hwd.py
%{_prefix}/lib/udev/rules.d/10-usrp-uhd.rules
%config(noreplace) %{_sysconfdir}/security/limits.d/*.conf
%{_libdir}/lib*.so.*
%{_libdir}/uhd/modules
%{_libexecdir}/uhd
%{_mandir}/man1/*.1*
%{_datadir}/uhd
%{python3_sitearch}/uhd
%{python3_sitearch}/usrp_mpm
%files firmware
%dir %{_datadir}/uhd/images
%{_datadir}/uhd/images/*
%files devel
%{_includedir}/*
%{_libdir}/lib*.so
%{_libdir}/cmake/uhd/*.cmake
%{_libdir}/pkgconfig/*.pc
%files doc
%doc %{_docdir}/%{name}/doxygen
%files tools
%doc tools/README.md
%{_bindir}/usrp_x3xx_fpga_jtag_programmer.sh
%{_bindir}/chdr_log
%if %{with wireshark}
%files wireshark
%{_libdir}/wireshark/plugins/%{wireshark_ver}/epan/*
%endif
%changelog
* Sat Feb 08 2025 Suyun <ziyu.oerv@isrc.iscas.ac.cn> - 4.7.0.0-1
- Init package at 4.7.0.0
|