276.4. gr-osmosdr-0.2.6
GNU Radio source and sink blocks for RTL-SDR, HackRF, Airspy, bladeRF, SoapySDR and network radios
| Version | 0.2.6, release 1 |
| Shelf | sdr — SDR DSP libraries, GNU Radio and its blocks, receivers, decoders and signal analysis |
| Phase | 43_toolkits (Toolkits), 316 of 344 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://osmocom.org/projects/gr-osmosdr/wiki |
| Build time | 1.8 SBU |
| Installed size | 2.2 MiB in 24 files |
| Recipe | ports/core/sdr/gr-osmosdr/kpkgbuild |
About
gr-osmosdr is one GNU Radio source block and one sink block that front many kinds of radio hardware behind a single device string, such as rtl=0 or hackrf=0. A program written against it opens whichever radio is plugged in without code of its own for each. In KDOS it is how gqrx reaches a radio, and it installs osmocom_fft and the other osmocom_* tools.
Sources
gr-osmosdr-0.2.6.tar.gz(261.9 KiB)
sha256c50514d42be5a56a5b6b26fc12a8539ea9a433c28a3b96506084bd646879f91f
upstream: https://github.com/osmocom/gr-osmosdr/archive/refs/tags/v0.2.6.tar.gz
archive copy: sources-4/sdr--gr-osmosdr-0.2.6.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, python3, python3-pybind11, gnuradio, boost, libvolk, rtl-sdr, hackrf, airspy, bladerf, airspyhf, libmirisdr, uhd, gr-funcube, gr-iqbal, soapysdr, python3-pyqt5.
Required by (1): gqrx.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/43_toolkits/phase.env && kpkg install gr-osmosdr'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/sdr/gr-osmosdr.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/sdr/gr-osmosdr
echo 'c50514d42be5a56a5b6b26fc12a8539ea9a433c28a3b96506084bd646879f91f gr-osmosdr-0.2.6.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/gr-osmosdr
SRC=$SRC_ROOT/gr-osmosdr-0.2.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gr-osmosdr-0.2.6.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
_pyinc=$(python3 -c 'import sysconfig; print(sysconfig.get_path("include"))')
_pylib=$(python3 -c 'import sysconfig; print(sysconfig.get_config_var("LIBDIR") + "/" + sysconfig.get_config_var("LDLIBRARY"))')
cmake -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_POLICY_DEFAULT_CMP0167=NEW \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPYTHON_INCLUDE_DIR="$_pyinc" \
-DPYTHON_LIBRARY="$_pylib" \
-Dpybind11_DIR="$(python3 -m pybind11 --cmakedir)" \
-DENABLE_DEFAULT=OFF \
-DENABLE_NONFREE=OFF \
-DENABLE_DOXYGEN=OFF \
-DENABLE_PYTHON=ON \
-DENABLE_FILE=ON \
-DENABLE_RTL=ON \
-DENABLE_RTL_TCP=ON \
-DENABLE_HACKRF=ON \
-DENABLE_BLADERF=ON \
-DENABLE_AIRSPY=ON \
-DENABLE_SOAPY=ON \
-DENABLE_RFSPACE=ON \
-DENABLE_REDPITAYA=ON \
-DENABLE_UHD=ON \
-DENABLE_FCD=ON \
-DENABLE_AIRSPYHF=ON \
-DENABLE_MIRI=ON \
-DENABLE_FREESRP=OFF \
-DENABLE_XTRX=OFF \
-DENABLE_IQBALANCE=ON \
-Wno-dev
ninja -C build
DESTDIR=$PKG ninja -C build install
test -f "$PKG/usr/lib/libgnuradio-osmosdr.so"
test -x "$PKG/usr/bin/osmocom_fft"
The switches, and why each is set:
-DENABLE_DEFAULT=OFF— start from no device support, then name each wanted oneON. The build uses GNU Radio’s component machinery, so a device namedONwhose library is missing is a configure error instead of a device the string parser silently does not know.-DENABLE_RTL=ON— and the other devices namedON: RTL-SDR dongles and anrtl_tcpserver, HackRF, bladeRF, Airspy and Airspy HF+, MiriSDR, RFSPACE and Red Pitaya receivers, anything SoapySDR drives, IQ files, Ettus radios through GNU Radio’s gr-uhd, the FUNcube Dongle through gr-funcube, and I/Q imbalance correction through gr-iqbal. Each library is a port independs.-DENABLE_FREESRP=OFF— with-DENABLE_XTRX=OFF: no FreeSRP or XTRX support. Their libraries, libfreesrp and libxtrx, are not ports.-DENABLE_NONFREE=OFF— never look for the SDRplay API, a closed library and the one component upstream marks nonfree. Upstream’s default, named.-DCMAKE_POLICY_DEFAULT_CMP0167=NEW— makefind_package(Boost)read Boost’s own CMake package, which knows Boost.System is header-only; the oldFindBoostmodule looks for alibboost_systemlibrary.-DPYTHON_INCLUDE_DIR— with-DPYTHON_LIBRARY: Python’s header directory and shared library, assysconfigreports them for/usr/bin/python3. CMake’sFindPythonLibsruns twice: throughGrPython.cmake, which GNU Radio’s CMake package includes and which asks for the interpreter’s exact version, and through the configure’s ownfind_package(PythonLibs 3). With both cache variables set, each takes these paths instead of searching for them.-Dpybind11_DIR— the CMake package directory of python3-pybind11, for theosmosdrPython module.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/gr-osmosdr, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf gr-osmosdr-0.2.6-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/gr-osmosdr, and runs the triggers its paths call for.
Contents
Installed programs: osmocom_fft, osmocom_siggen_nogui.
Installed libraries: libgnuradio-osmosdr.so.
Installed directories: /usr/include/osmosdr, /usr/lib/cmake/osmosdr, /usr/lib/python3.14/site-packages/osmosdr, /usr/share/licenses/gr-osmosdr.
Notes
The last two lines of build.sh stop the build when libgnuradio-osmosdr.so or osmocom_fft is missing from the package.