From 81b889e493c7213f1878588cfebc82d4292ef5ce Mon Sep 17 00:00:00 2001 From: Ryan Carsten Schmidt Date: Fri, 29 Aug 2025 22:48:40 -0500 Subject: [PATCH] SoapyRTLSDR: Fix build with cmake >= 4 --- science/SoapyRTLSDR/Portfile | 11 +++--- science/SoapyRTLSDR/files/clang.patch | 35 +++++++++++++++++++ .../files/cmake_minimum_required.patch | 23 ++++++++++++ 3 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 science/SoapyRTLSDR/files/clang.patch create mode 100644 science/SoapyRTLSDR/files/cmake_minimum_required.patch diff --git a/science/SoapyRTLSDR/Portfile b/science/SoapyRTLSDR/Portfile index 61f9d52917f..99138f30990 100644 --- a/science/SoapyRTLSDR/Portfile +++ b/science/SoapyRTLSDR/Portfile @@ -4,7 +4,6 @@ PortSystem 1.0 PortGroup github 1.0 PortGroup cmake 1.1 -platforms darwin macosx categories science license MIT maintainers {ra1nb0w @ra1nb0w} {michaelld @michaelld} openmaintainer @@ -13,21 +12,23 @@ description Soapy SDR module for RTL-SDR long_description {*}${description} github.setup pothosware SoapyRTLSDR 0.3.0 soapy-rtlsdr- +revision 2 # Change github.tarball_from to 'releases' or 'archive' next update github.tarball_from tarball checksums rmd160 88bb56f7842b9ce4de9f32fe1df0545c543a6724 \ sha256 5fe2841548af43011381ef3da3f75be134245ccc215c12b0fea7f900760ce98f \ size 14389 -revision 1 compiler.cxx_standard 2011 depends_build-append \ - port:pkgconfig + path:bin/pkg-config:pkgconfig depends_lib-append \ port:SoapySDR \ port:rtl-sdr -configure.args-append \ - -DCMAKE_BUILD_TYPE=Release +patchfiles clang.patch \ + cmake_minimum_required.patch + +cmake.build_type Release diff --git a/science/SoapyRTLSDR/files/clang.patch b/science/SoapyRTLSDR/files/clang.patch new file mode 100644 index 00000000000..ecbf91a86d4 --- /dev/null +++ b/science/SoapyRTLSDR/files/clang.patch @@ -0,0 +1,35 @@ +Also use formerly gcc-only flags with clang: + +https://github.com/pothosware/SoapyRTLSDR/commit/448c9d0d326c2600905b7ce84222ff9d72ba2189 +--- CMakeLists.txt.orig ++++ CMakeLists.txt +@@ -1,7 +1,7 @@ + ######################################################################## + # Build Soapy SDR support module for RTL-SDR Devices + ######################################################################## +-cmake_minimum_required(VERSION 2.8.7) ++cmake_minimum_required(VERSION 2.8.12) + project(SoapyRTLSDR CXX) + + find_package(SoapySDR "0.4.0" NO_MODULE REQUIRED) +@@ -22,7 +22,7 @@ + include_directories(${RTLSDR_INCLUDE_DIRS}) + + #enable c++11 features +-if(CMAKE_COMPILER_IS_GNUCXX) ++if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + + #C++11 is a required language feature for this project + include(CheckCXXCompilerFlag) +@@ -37,9 +37,8 @@ + list(APPEND RTLSDR_LIBRARIES -pthread) + + #disable warnings for unused parameters +- add_definitions(-Wno-unused-parameter) +- +-endif(CMAKE_COMPILER_IS_GNUCXX) ++ add_compile_options(-Wall -Wextra -Wno-unused-parameter) ++endif() + + if (APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wc++11-extensions") diff --git a/science/SoapyRTLSDR/files/cmake_minimum_required.patch b/science/SoapyRTLSDR/files/cmake_minimum_required.patch new file mode 100644 index 00000000000..491f5d66d69 --- /dev/null +++ b/science/SoapyRTLSDR/files/cmake_minimum_required.patch @@ -0,0 +1,23 @@ +Fix configuration with cmake >= 4: + +Compatibility with CMake < 3.5 has been removed from CMake. + +Update the VERSION argument value. Or, use the ... syntax +to tell CMake that the project requires at least but has been updated +to work with policies introduced by or earlier. + +Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. + +https://github.com/pothosware/SoapyRTLSDR/issues/81 +https://github.com/pothosware/SoapyRTLSDR/commit/bb2d1511b957138051764c9193a3d6971e912b85 +--- CMakeLists.txt.orig ++++ CMakeLists.txt +@@ -1,7 +1,7 @@ + ######################################################################## + # Build Soapy SDR support module for RTL-SDR Devices + ######################################################################## +-cmake_minimum_required(VERSION 2.8.12) ++cmake_minimum_required(VERSION 2.8.12...3.10) + project(SoapyRTLSDR CXX) + + find_package(SoapySDR "0.4.0" NO_MODULE REQUIRED)