Skip to content

Instantly share code, notes, and snippets.

@dubrsl
Created January 4, 2023 19:54
Show Gist options
  • Save dubrsl/924d8d515ac25374ba6bc7c3ccad4c6d to your computer and use it in GitHub Desktop.
Save dubrsl/924d8d515ac25374ba6bc7c3ccad4c6d to your computer and use it in GitHub Desktop.
%global uname bladeRF
%global no_os_commit 0bba46e6f6f75785a65d425ece37d0a04daf6157
Name: bladerf
Version: 2022.11
Release: 1%{?dist}
Summary: A Software Defined Radio (SDR) platform
License: GPLv2+
URL: http://nuand.com/
Source0: https://github.com/Nuand/%{uname}/archive/%{version}/%{name}-%{version}.tar.gz
Source1: https://github.com/analogdevicesinc/no-OS/archive/%{no_os_commit}/no-OS-%{no_os_commit}.tar.gz
Source2: bladeRF-download
BuildRequires: cmake gcc-c++ doxygen pandoc help2man libedit-devel
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(libusb-1.0)
Provides: %{uname} = %{version}-%{release}
Provides: %{uname}%{?_isa} = %{version}-%{release}
Requires: lib%{name}%{?_isa} = %{version}-%{release}
%description
%{uname} is a Software Defined Radio (SDR) platform designed to enable a
community of hobbyists, and professionals to explore and experiment with the
multidisciplinary facets of RF communication.
%package -n lib%{name}
Summary: Library files for %{uname}
%description -n lib%{name}
bladerf library files.
%package -n lib%{name}-devel
Summary: Development files for %{uname}
Requires: lib%{name}%{?_isa} = %{version}-%{release}
Provides: %{uname}-devel = %{version}-%{release}
Provides: %{uname}-devel%{?_isa} = %{version}-%{release}
%description -n lib%{name}-devel
Files needed to develop software against libbladerf.
%package -n lib%{name}-doc
Summary: HTML documentation for %{uname}
BuildArch: noarch
Provides: %{uname}-doc = %{version}-%{release}
%description -n lib%{name}-doc
HTML documentation for %{uname}
%package fpga-hostedx40
Summary: Nuand bladeRF FPGA bitstream downloader (hostedx40)
BuildArch: noarch
Requires: wget
%description fpga-hostedx40
This package will, at the time of installation, download an appropriate
FPGA bitstream for using the Nuand bladeRF in a hosted (USB-controlled)
configuration. The FPGA bitstream will be downloaded from
https://nuand.com/fpga/ and saved to /usr/share/Nuand/bladeRF.
This bitstream is for the bladeRF x40 with the Altera Cyclone IV
EP4CE40 FPGA.
Note that this will not upgrade the bladeRF itself. That can be done
with the bladeRF-cli utility.
%package fpga-hostedx115
Summary: Nuand bladeRF FPGA bitstream downloader (hostedx115)
BuildArch: noarch
Requires: wget
%description fpga-hostedx115
This package will, at the time of installation, download an appropriate
FPGA bitstream for using the Nuand bladeRF in a hosted (USB-controlled)
configuration. The FPGA bitstream will be downloaded from
https://nuand.com/fpga/ and saved to /usr/share/Nuand/bladeRF.
This bitstream is for the bladeRF x115 with the Altera Cyclone IV
EP4CE115 FPGA.
Note that this will not upgrade the bladeRF itself. That can be done
with the bladeRF-cli utility.
%package fpga-hostedxa4
Summary: Nuand bladeRF FPGA bitstream downloader (hostedxA4)
BuildArch: noarch
Requires: wget
%description fpga-hostedxa4
This package will, at the time of installation, download an appropriate
FPGA bitstream for using the Nuand bladeRF in a hosted (USB-controlled)
configuration. The FPGA bitstream will be downloaded from
https://nuand.com/fpga/ and saved to /usr/share/Nuand/bladeRF.
This bitstream is for the bladeRF 2.0 Micro xA4 with the Altera Cyclone V
5CEBA4 FPGA.
Note that this will not upgrade the bladeRF itself. That can be done
with the bladeRF-cli utility.
%package fpga-hostedxa5
Summary: Nuand bladeRF FPGA bitstream downloader (hostedxA5)
BuildArch: noarch
Requires: wget
%description fpga-hostedxa5
This package will, at the time of installation, download an appropriate
FPGA bitstream for using the Nuand bladeRF in a hosted (USB-controlled)
configuration. The FPGA bitstream will be downloaded from
https://nuand.com/fpga/ and saved to /usr/share/Nuand/bladeRF.
This bitstream is for the bladeRF 2.0 Micro xA5 with the Altera Cyclone V
5CEBA5 FPGA.
Note that this will not upgrade the bladeRF itself. That can be done
with the bladeRF-cli utility.
%package fpga-hostedxa9
Summary: Nuand bladeRF FPGA bitstream downloader (hostedxA9)
BuildArch: noarch
Requires: wget
%description fpga-hostedxa9
This package will, at the time of installation, download an appropriate
FPGA bitstream for using the Nuand bladeRF in a hosted (USB-controlled)
configuration. The FPGA bitstream will be downloaded from
https://nuand.com/fpga/ and saved to /usr/share/Nuand/bladeRF.
This bitstream is for the bladeRF 2.0 Micro xA9 with the Altera Cyclone V
5CEBA9 FPGA.
Note that this will not upgrade the bladeRF itself. That can be done
with the bladeRF-cli utility.
%package firmware-fx3
Summary: Nuand bladeRF firmware downloader (FX3)
BuildArch: noarch
Requires: wget
%description firmware-fx3
This package will, at the time of installation, download an appropriate
firmware image for using the Nuand bladeRF with a Cypress FX3 USB
controller. The image will be downloaded from https://nuand.com/fx3/
and saved to /usr/share/Nuand/bladeRF.
This bitstream will work for either the Nuand bladeRF x40 or the x115,
as well as the bladeRF 2.0 Micro xA4 or xA5 or xA9.
Note that this will not upgrade the bladeRF itself. That can be done
with the bladeRF-cli utility.
%prep
%setup -q -n %{uname}-%{version}
tar -zx -C thirdparty/analogdevicesinc/no-OS -f %{SOURCE1} --strip-components=1
%build
pushd host
%cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON -DVERSION_INFO_EXTRA="" -DBLADERF_GROUP=%name -DUDEV_RULES_PATH=%{_udevrulesdir}
%cmake_build
popd
%install
pushd host
%cmake_install
popd
install -p -D -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/%{uname}-download
install -d %{buildroot}%{_datarootdir}/Nuand/%{uname}
%pre
getent group %name >/dev/null || \
%{_sbindir}/groupadd -r %name >/dev/null 2>&1
exit 0
%ldconfig_scriptlets -n lib%{name}
%post fpga-hostedx40
export UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedx40.rbf'
export CHECKSUM='25f402b3734c9aa0d37db9531f93335c'
export DATAFILE='/usr/share/Nuand/bladeRF/hostedx40.rbf'
export DESCRIPT='FPGA bitstream'
export MYNAMEIS='bladerf-fpga-hostedx40'
/usr/bin/bladeRF-download
%preun fpga-hostedx40
RBFFILE=/usr/share/Nuand/bladeRF/hostedx40.rbf
if [ "$1" = "remove" -o "$1" = "purge" ]; then
echo "Deleting downloaded FPGA bitstream: $RBFFILE"
rm -f $RBFFILE
fi
%post fpga-hostedx115
export UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedx115.rbf'
export CHECKSUM='94ee5c7f68abe5c3392202246789fedd'
export DATAFILE='/usr/share/Nuand/bladeRF/hostedx115.rbf'
export DESCRIPT='FPGA bitstream'
export MYNAMEIS='bladerf-fpga-hostedx115'
/usr/bin/bladeRF-download
%preun fpga-hostedx115
RBFFILE=/usr/share/Nuand/bladeRF/hostedx115.rbf
if [ "$1" = "remove" -o "$1" = "purge" ]; then
echo "Deleting downloaded FPGA bitstream: $RBFFILE"
rm -f $RBFFILE
fi
%post fpga-hostedxa4
export UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedxA4.rbf'
export CHECKSUM='c24af70cf56b13123295125a22d5e921'
export DATAFILE='/usr/share/Nuand/bladeRF/hostedxA4.rbf'
export DESCRIPT='FPGA bitstream'
export MYNAMEIS='bladerf-fpga-hostedxa4'
/usr/bin/bladeRF-download
%preun fpga-hostedxa4
RBFFILE=/usr/share/Nuand/bladeRF/hostedxa4.rbf
if [ "$1" = "remove" -o "$1" = "purge" ]; then
echo "Deleting downloaded FPGA bitstream: $RBFFILE"
rm -f $RBFFILE
fi
%post fpga-hostedxa5
export UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedxA5.rbf'
export CHECKSUM='ae6391cc3fd467bbb07868450612ce17'
export DATAFILE='/usr/share/Nuand/bladeRF/hostedxA5.rbf'
export DESCRIPT='FPGA bitstream'
export MYNAMEIS='bladerf-fpga-hostedxa5'
/usr/bin/bladeRF-download
%preun fpga-hostedxa5
RBFFILE=/usr/share/Nuand/bladeRF/hostedxA5.rbf
if [ "$1" = "remove" -o "$1" = "purge" ]; then
echo "Deleting downloaded FPGA bitstream: $RBFFILE"
rm -f $RBFFILE
fi
%post fpga-hostedxa9
export UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedxA9.rbf'
export CHECKSUM='7dfe8c32f260d43a14b9583375a1a6eb'
export DATAFILE='/usr/share/Nuand/bladeRF/hostedxA9.rbf'
export DESCRIPT='FPGA bitstream'
export MYNAMEIS='bladerf-fpga-hostedxa9'
/usr/bin/bladeRF-download
%preun fpga-hostedxa9
RBFFILE=/usr/share/Nuand/bladeRF/hostedxA9.rbf
if [ "$1" = "remove" -o "$1" = "purge" ]; then
echo "Deleting downloaded FPGA bitstream: $RBFFILE"
rm -f $RBFFILE
fi
%post firmware-fx3
export UPSTREAM='https://www.nuand.com/fx3/bladeRF_fw_v2.4.0.img'
export CHECKSUM='337f570f2e3fdb26abde0f0765196d92'
export DATAFILE='/usr/share/Nuand/bladeRF/bladeRF_fw.img'
export DESCRIPT='firmware'
export MYNAMEIS='bladerf-firmware-fx3'
/usr/bin/bladeRF-download
%preun firmware-fx3
DATAFILE=/usr/share/Nuand/bladeRF/bladeRF_fw.img
if [ "$1" = "remove" -o "$1" = "purge" ]; then
echo "Deleting downloaded firmware: $DATAFILE"
rm -f $DATAFILE
fi
%files
%license COPYING
%doc CONTRIBUTORS README.md
%{_udevrulesdir}/88-nuand-*.rules
%{_bindir}/%{uname}-cli
%{_bindir}/%{uname}-fsk
%{_bindir}/%{uname}-download
%{_mandir}/man1/%{uname}-cli.1*
%files -n lib%{name}
%license COPYING
%{_libdir}/lib%{uname}.so.*
%files -n lib%{name}-devel
%{_includedir}/lib%{uname}.h
%{_includedir}/%{uname}*.h
%{_libdir}/pkgconfig/lib%{uname}.pc
%{_libdir}/lib%{uname}.so
%files -n lib%{name}-doc
%license COPYING
%{_docdir}/lib%{uname}/html
%files fpga-hostedx40
%dir %{_datarootdir}/Nuand/%{uname}
%files fpga-hostedx115
%dir %{_datarootdir}/Nuand/%{uname}
%files fpga-hostedxa4
%dir %{_datarootdir}/Nuand/%{uname}
%files fpga-hostedxa5
%dir %{_datarootdir}/Nuand/%{uname}
%files fpga-hostedxa9
%dir %{_datarootdir}/Nuand/%{uname}
%files firmware-fx3
%dir %{_datarootdir}/Nuand/%{uname}
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment