From f07de82a529064fcd206f098ad5eca2dcdc5c2ca Mon Sep 17 00:00:00 2001 From: Conrad Kostecki Date: Sun, 9 Mar 2025 23:41:36 +0100 Subject: [PATCH] net-wireless/rtl-sdr-blog: new package, add 1.3.6 Signed-off-by: Conrad Kostecki --- net-wireless/rtl-sdr-blog/Manifest | 1 + .../rtl-sdr-blog-1.3.6-disable-static.patch | 55 ++++++++++++++++++ .../rtl-sdr-blog-1.3.6-pkgconfig-libdir.patch | 11 ++++ .../rtl-sdr-blog-1.3.6-udev-rules-path.patch | 11 ++++ net-wireless/rtl-sdr-blog/files/rtl_tcp.confd | 7 +++ net-wireless/rtl-sdr-blog/files/rtl_tcp.initd | 11 ++++ net-wireless/rtl-sdr-blog/metadata.xml | 20 +++++++ .../rtl-sdr-blog/rtl-sdr-blog-1.3.6.ebuild | 58 +++++++++++++++++++ 8 files changed, 174 insertions(+) create mode 100644 net-wireless/rtl-sdr-blog/Manifest create mode 100644 net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-disable-static.patch create mode 100644 net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-pkgconfig-libdir.patch create mode 100644 net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-udev-rules-path.patch create mode 100644 net-wireless/rtl-sdr-blog/files/rtl_tcp.confd create mode 100644 net-wireless/rtl-sdr-blog/files/rtl_tcp.initd create mode 100644 net-wireless/rtl-sdr-blog/metadata.xml create mode 100644 net-wireless/rtl-sdr-blog/rtl-sdr-blog-1.3.6.ebuild diff --git a/net-wireless/rtl-sdr-blog/Manifest b/net-wireless/rtl-sdr-blog/Manifest new file mode 100644 index 0000000000000..6ef92af993689 --- /dev/null +++ b/net-wireless/rtl-sdr-blog/Manifest @@ -0,0 +1 @@ +DIST rtl-sdr-blog-1.3.6.gh.tar.gz 138270 BLAKE2B a310eb44d1f65c882db35ecb694c4ce4f4e1b295558f61f15f3f7c6e11ca6f9860cd063f58062f2051b93d17af0d710928e95e3b806b17b317ab98143c12057d SHA512 3689fdafd111bae4b033e52b157ba800a6ec3ead8b045f2cf3572059ef49b76fa61aad384c0be6ff1a1c0a73cb46081c0ff9af67f05b0371e738c6dd2f21436c diff --git a/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-disable-static.patch b/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-disable-static.patch new file mode 100644 index 0000000000000..aff87deed7561 --- /dev/null +++ b/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-disable-static.patch @@ -0,0 +1,55 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -34,25 +34,6 @@ + generate_export_header(rtlsdr) + + ######################################################################## +-# Setup static library variant +-######################################################################## +-add_library(rtlsdr_static STATIC librtlsdr.c +- tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c) +-target_link_libraries(rtlsdr ${LIBUSB_LIBRARIES} ${THREADS_PTHREADS_LIBRARY}) +-target_include_directories(rtlsdr_static PUBLIC +- $ +- $ # /include +- ${LIBUSB_INCLUDE_DIRS} +- ${THREADS_PTHREADS_INCLUDE_DIR} +- ) +-set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" ) +-if(NOT WIN32) +-# Force same library filename for static and shared variants of the library +-set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr) +-endif() +-generate_export_header(rtlsdr_static) +- +-######################################################################## + # Set up Windows DLL resource files + ######################################################################## + IF(MSVC) +@@ -63,7 +44,6 @@ + ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc + @ONLY) + target_sources(rtlsdr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc) +- target_sources(rtlsdr_static PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc) + ENDIF(MSVC) + + ######################################################################## +@@ -94,7 +74,7 @@ + add_executable(rtl_adsb rtl_adsb.c) + add_executable(rtl_power rtl_power.c) + add_executable(rtl_biast rtl_biast.c) +-set(INSTALL_TARGETS rtlsdr rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) ++set(INSTALL_TARGETS rtlsdr rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) + + target_link_libraries(rtl_sdr rtlsdr convenience_static + ${LIBUSB_LIBRARIES} +@@ -163,9 +143,6 @@ + install(TARGETS rtlsdr EXPORT RTLSDR-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file + ) +-install(TARGETS rtlsdr_static EXPORT RTLSDR-export +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file +- ) + install(TARGETS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast + DESTINATION ${CMAKE_INSTALL_BINDIR} + ) diff --git a/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-pkgconfig-libdir.patch b/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-pkgconfig-libdir.patch new file mode 100644 index 0000000000000..831fc00639472 --- /dev/null +++ b/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-pkgconfig-libdir.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -174,7 +174,7 @@ + set(prefix "${CMAKE_INSTALL_PREFIX}") + set(exec_prefix \${prefix}) + set(includedir \${prefix}/include) +-set(libdir \${exec_prefix}/lib) ++set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR}) + + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/librtlsdr.pc.in diff --git a/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-udev-rules-path.patch b/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-udev-rules-path.patch new file mode 100644 index 0000000000000..e164bc5539561 --- /dev/null +++ b/net-wireless/rtl-sdr-blog/files/rtl-sdr-blog-1.3.6-udev-rules-path.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -113,7 +113,7 @@ + if (INSTALL_UDEV_RULES) + install ( + FILES rtl-sdr.rules +- DESTINATION "/etc/udev/rules.d" ++ DESTINATION "/lib/udev/rules.d" + COMPONENT "udev" + ) + else (INSTALL_UDEV_RULES) diff --git a/net-wireless/rtl-sdr-blog/files/rtl_tcp.confd b/net-wireless/rtl-sdr-blog/files/rtl_tcp.confd new file mode 100644 index 0000000000000..653d292de3cd6 --- /dev/null +++ b/net-wireless/rtl-sdr-blog/files/rtl_tcp.confd @@ -0,0 +1,7 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Options which will be passed to rtl_tcp. +# Default is listen on localhost with default port 1234 on first device. +# See `rtl_tcp -h` for all available options. +RTL_TCP_OPTIONS="-a localhost -d0 -p 1234" diff --git a/net-wireless/rtl-sdr-blog/files/rtl_tcp.initd b/net-wireless/rtl-sdr-blog/files/rtl_tcp.initd new file mode 100644 index 0000000000000..6dd8f795e1902 --- /dev/null +++ b/net-wireless/rtl-sdr-blog/files/rtl_tcp.initd @@ -0,0 +1,11 @@ +#!/sbin/openrc-run +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +error_log="/var/log/rtl_tcp.log" +pidfile="/run/rtl_tcp.pid" +output_log="/var/log/rtl_tcp.log" + +command="/usr/bin/rtl_tcp" +command_background="true" +command_args="${RTL_TCP_OPTIONS}" diff --git a/net-wireless/rtl-sdr-blog/metadata.xml b/net-wireless/rtl-sdr-blog/metadata.xml new file mode 100644 index 0000000000000..9e824e3e6fb6f --- /dev/null +++ b/net-wireless/rtl-sdr-blog/metadata.xml @@ -0,0 +1,20 @@ + + + + + conikost@gentoo.org + Conrad Kostecki + + + This package aims to replace the net-wireless/rtl-sdr package, + as it contains various improvments for RTL-SDR Blog V3 and V4 units. + Since it's based on a modified net-wireless/rtl-sdr package, + it cannot co-exist with it. + + + may cause a bus error on some ARM systems + + + osmocom/rtl-sdr + + diff --git a/net-wireless/rtl-sdr-blog/rtl-sdr-blog-1.3.6.ebuild b/net-wireless/rtl-sdr-blog/rtl-sdr-blog-1.3.6.ebuild new file mode 100644 index 0000000000000..35b727fd2a294 --- /dev/null +++ b/net-wireless/rtl-sdr-blog/rtl-sdr-blog-1.3.6.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake udev + +DESCRIPTION="Modified Osmocom drivers with enhancements for RTL-SDR Blog V3 and V4 units" +HOMEPAGE="https://github.com/rtlsdrblog/rtl-sdr-blog" +SRC_URI="https://github.com/rtlsdrblog/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz" + +LICENSE="GPL-2+ GPL-3+" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="+zerocopy" + +RDEPEND="virtual/libusb:1" +DEPEND="${RDEPEND}" + +PATCHES=( + "${FILESDIR}/${PN}-1.3.6-disable-static.patch" + "${FILESDIR}/${PN}-1.3.6-pkgconfig-libdir.patch" + "${FILESDIR}/${PN}-1.3.6-udev-rules-path.patch" + +) + +src_prepare() { + cmake_src_prepare + + # Set proper so file version name + sed -e '/VERSION_INFO_PATCH_VERSION/ s/git/0/g' -i CMakeLists.txt || die +} + +src_configure() { + local mycmakeargs=( + -DCVF_VERSION="${PV}" + -DDETACH_KERNEL_DRIVER="ON" + -DENABLE_ZEROCOPY="$(usex zerocopy)" + -DINSTALL_UDEV_RULES="ON" + ) + cmake_src_configure +} + +src_install() { + cmake_src_install + newinitd "${FILESDIR}"/rtl_tcp.initd rtl_tcp + newconfd "${FILESDIR}"/rtl_tcp.confd rtl_tcp +} + +pkg_postinst() { + udev_reload + elog "Only users in the usb group can capture." + elog "Just run 'gpasswd -a usb', then have re-login." +} + +pkg_postrm() { + udev_reload +}