about summary refs log tree commit diff
path: root/pkgs/applications/radio/soapysdr
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-09-14 11:31:01 +0000
committerAlyssa Ross <hi@alyssa.is>2023-09-14 11:31:01 +0000
commit4a027948f943c5e81d32b1ca70a86aa64cb7bae3 (patch)
tree332a139a9dc30c492425e987c172fc7d15325590 /pkgs/applications/radio/soapysdr
parentd8be5d0c710412b5187815b52c2ddcc6661466ea (diff)
parent12aa32e71e41eb2fbf3d59db9eaacc6bedacf877 (diff)
Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
	pkgs/applications/radio/soapysdr/default.nix
Diffstat (limited to 'pkgs/applications/radio/soapysdr')
-rw-r--r--pkgs/applications/radio/soapysdr/default.nix97
-rw-r--r--pkgs/applications/radio/soapysdr/fix-pkgconfig.patch14
2 files changed, 57 insertions, 54 deletions
diff --git a/pkgs/applications/radio/soapysdr/default.nix b/pkgs/applications/radio/soapysdr/default.nix
index 201a5055e601d..ee03d67d59862 100644
--- a/pkgs/applications/radio/soapysdr/default.nix
+++ b/pkgs/applications/radio/soapysdr/default.nix
@@ -1,64 +1,81 @@
-{ stdenv, lib, lndir, makeWrapper
-, fetchFromGitHub, cmake
-, libusb-compat-0_1, pkg-config
+{ stdenv
+, lib
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, pkg-config
+, makeWrapper
+, libusb-compat-0_1
+, ncurses
 , usePython ? false
 , python ? null
-, ncurses, swig2
-, extraPackages ? []
-, testers
+, swig2
+, extraPackages ? [ ]
 , buildPackages
+, testers
 }:
 
-let
-
-  version = "0.8.1";
-  modulesVersion = with lib; versions.major version + "." + versions.minor version;
-  modulesPath = "lib/SoapySDR/modules" + modulesVersion;
-  extraPackagesSearchPath = lib.makeSearchPath modulesPath extraPackages;
-
-in stdenv.mkDerivation (finalAttrs: {
+stdenv.mkDerivation (finalAttrs: {
   pname = "soapysdr";
-  inherit version;
+  version = "0.8.1";
 
   src = fetchFromGitHub {
     owner = "pothosware";
     repo = "SoapySDR";
-    rev = "soapy-sdr-${version}";
+    rev = "soapy-sdr-${finalAttrs.version}";
     sha256 = "19f2x0pkxvf9figa0pl6xqlcz8fblvqb19mcnj632p0l8vk6qdv2";
   };
 
   patches = [
-    # see https://github.com/pothosware/SoapySDR/issues/352 for upstream issue
-    ./fix-pkgconfig.patch
+    # Fix for https://github.com/pothosware/SoapySDR/issues/352
+    (fetchpatch {
+      url = "https://github.com/pothosware/SoapySDR/commit/10c05b3e52caaa421147d6b4623eccd3fc3be3f4.patch";
+      hash = "sha256-D7so6NSZiU6SXbzns04Q4RjSZW0FJ+MYobvvVpVMjws=";
+    })
   ];
 
-  nativeBuildInputs = [ cmake makeWrapper pkg-config ];
-  buildInputs = [ libusb-compat-0_1 ncurses ]
-    ++ lib.optionals usePython [ python swig2 ];
-
-  propagatedBuildInputs = lib.optional usePython python.pkgs.numpy;
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+    makeWrapper
+  ];
+  buildInputs = [
+    libusb-compat-0_1
+    ncurses
+  ] ++ lib.optionals usePython [
+    python
+    swig2
+  ];
 
-  cmakeFlags = lib.optional usePython "-DUSE_PYTHON_CONFIG=ON";
+  propagatedBuildInputs = lib.optionals usePython [
+    python.pkgs.numpy
+  ];
 
-  # https://github.com/pothosware/SoapySDR/issues/352
-  postPatch = ''
-    substituteInPlace lib/SoapySDR.in.pc \
-      --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
-      --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
-  '';
+  cmakeFlags = lib.optionals usePython [
+    "-DUSE_PYTHON_CONFIG=ON"
+  ];
 
-  postFixup = lib.optionalString (lib.length extraPackages != 0) ''
+  postFixup = lib.optionalString (extraPackages != [ ]) (
     # Join all plugins via symlinking
-    for i in ${toString extraPackages}; do
-      ${buildPackages.xorg.lndir}/bin/lndir -silent $i $out
-    done
-    # Needed for at least the remote plugin server
-    for file in $out/bin/*; do
-        wrapProgram "$file" --prefix SOAPY_SDR_PLUGIN_PATH : ${lib.escapeShellArg extraPackagesSearchPath}
-    done
-  '';
+    lib.pipe extraPackages [
+      (map (pkg: ''
+        ${buildPackages.xorg.lndir}/bin/lndir -silent ${pkg} $out
+      ''))
+      lib.concatStrings
+    ] + ''
+      # Needed for at least the remote plugin server
+      for file in $out/bin/*; do
+          wrapProgram "$file" --prefix SOAPY_SDR_PLUGIN_PATH : ${lib.escapeShellArg (
+            lib.makeSearchPath finalAttrs.passthru.searchPath extraPackages
+          )}
+      done
+    ''
+  );
 
-  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+  passthru = {
+    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+    searchPath = "lib/SoapySDR/modules${lib.versions.majorMinor finalAttrs.version}";
+  };
 
   meta = with lib; {
     homepage = "https://github.com/pothosware/SoapySDR";
diff --git a/pkgs/applications/radio/soapysdr/fix-pkgconfig.patch b/pkgs/applications/radio/soapysdr/fix-pkgconfig.patch
deleted file mode 100644
index d4b15e3f99bce..0000000000000
--- a/pkgs/applications/radio/soapysdr/fix-pkgconfig.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/lib/SoapySDR.in.pc b/lib/SoapySDR.in.pc
-index a1ca698..fd2f4c0 100644
---- a/lib/SoapySDR.in.pc
-+++ b/lib/SoapySDR.in.pc
-@@ -1,7 +1,5 @@
--prefix=@CMAKE_INSTALL_PREFIX@
--exec_prefix=${prefix}
--libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
--includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
-+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
-+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
- 
- Name: Soapy SDR
- Description: Vendor and platform neutral SDR interface library.