mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
rtl-sdr: minor build fixes
This commit is contained in:
parent
79e8069df8
commit
4be05878ea
@ -1,4 +1,10 @@
|
|||||||
{ lib, stdenv, fetchgit, fetchpatch, cmake, pkg-config, libusb1 }:
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchgit
|
||||||
|
, cmake
|
||||||
|
, pkg-config
|
||||||
|
, libusb1
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rtl-sdr";
|
pname = "rtl-sdr";
|
||||||
@ -10,34 +16,25 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "0lmvsnb4xw4hmz6zs0z5ilsah5hjz29g1s0050n59fllskqr3b8k";
|
sha256 = "0lmvsnb4xw4hmz6zs0z5ilsah5hjz29g1s0050n59fllskqr3b8k";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ (fetchpatch {
|
postPatch = ''
|
||||||
name = "hardened-udev-rules.patch";
|
substituteInPlace CMakeLists.txt \
|
||||||
url = "https://osmocom.org/projects/rtl-sdr/repository/revisions/b2814731563be4d5a0a68554ece6454a2c63af12/diff?format=diff";
|
--replace '/etc/udev/rules.d' "$out/etc/udev/rules.d"
|
||||||
sha256 = "0ns740s2rys4glq4la4bh0sxfv1mn61yfjns2yllhx70rsb2fqrn";
|
|
||||||
}) ];
|
substituteInPlace rtl-sdr.rules \
|
||||||
|
--replace 'MODE:="0666"' 'ENV{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"'
|
||||||
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config cmake ];
|
nativeBuildInputs = [ pkg-config cmake ];
|
||||||
|
|
||||||
buildInputs = [ libusb1 ];
|
buildInputs = [ libusb1 ];
|
||||||
|
|
||||||
# TODO: get these fixes upstream:
|
cmakeFlags = lib.optional stdenv.isLinux "-DINSTALL_UDEV_RULES=ON";
|
||||||
# * Building with -DINSTALL_UDEV_RULES=ON tries to install udev rules to
|
|
||||||
# /etc/udev/rules.d/, and there is no option to install elsewhere. So install
|
|
||||||
# rules manually.
|
|
||||||
# * Propagate libusb-1.0 dependency in pkg-config file.
|
|
||||||
postInstall = lib.optionalString stdenv.isLinux ''
|
|
||||||
mkdir -p "$out/etc/udev/rules.d/"
|
|
||||||
cp ../rtl-sdr.rules "$out/etc/udev/rules.d/99-rtl-sdr.rules"
|
|
||||||
|
|
||||||
pcfile="$out"/lib/pkgconfig/librtlsdr.pc
|
|
||||||
grep -q "Requires:" "$pcfile" && { echo "Upstream has added 'Requires:' in $(basename "$pcfile"); update nix expression."; exit 1; }
|
|
||||||
echo "Requires: libusb-1.0" >> "$pcfile"
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
|
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
|
||||||
homepage = "http://sdr.osmocom.org/trac/wiki/rtl-sdr";
|
homepage = "http://github.com/librtlsdr/librtlsdr";
|
||||||
license = licenses.gpl2Plus;
|
license = licenses.gpl2Plus;
|
||||||
|
maintainers = with maintainers; [ bjornfor ];
|
||||||
platforms = platforms.linux ++ platforms.darwin;
|
platforms = platforms.linux ++ platforms.darwin;
|
||||||
maintainers = [ maintainers.bjornfor ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user