package.nix (2112B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 fftwFloat, 7 libsamplerate, 8 libsndfile, 9 libusb1, 10 portaudio, 11 rtl-sdr, 12 qt5, 13 libsForQt5, 14 }: 15 16 stdenv.mkDerivation (finalAttrs: { 17 pname = "fmreceiver"; 18 version = "2.1"; 19 20 src = fetchFromGitHub { 21 owner = "JvanKatwijk"; 22 repo = "sdr-j-fm"; 23 tag = finalAttrs.version; 24 hash = "sha256-U0m9PIB+X+TBoz5FfXMvR/tZjkNIy7B613I7eLT5UIs="; 25 }; 26 27 patches = [ 28 # support qwt-6.2.0 29 (fetchpatch { 30 url = "https://github.com/JvanKatwijk/sdr-j-fm/commit/4ca2f3a28e3e3460dc95be851fcd923e91488573.patch"; 31 hash = "sha256-tjNsg9Rc8kBn+6UzPsf1WLt+ZRYv8neG/CSyZKjObh0="; 32 }) 33 ]; 34 35 postPatch = '' 36 substituteInPlace fmreceiver.pro \ 37 --replace-fail "-lqwt-qt5" "-lqwt" \ 38 --replace-fail "CONFIG" "#CONFIG" 39 '' 40 + lib.optionalString stdenv.isDarwin '' 41 substituteInPlace fmreceiver.pro --replace-fail "-lrt " "" 42 substituteInPlace includes/fm-constants.h --replace-fail "<malloc.h>" "<stdlib.h>" 43 substituteInPlace devices/rtlsdr-handler/rtlsdr-handler.cpp --replace-fail ".so" ".dylib" 44 ''; 45 46 nativeBuildInputs = [ 47 qt5.qmake 48 qt5.wrapQtAppsHook 49 ]; 50 51 buildInputs = [ 52 fftwFloat 53 libsamplerate 54 libsndfile 55 libusb1 56 portaudio 57 libsForQt5.qwt 58 ]; 59 60 qmakeFlags = [ "CONFIG+=dabstick" ]; 61 62 qtWrapperArgs = [ 63 "--prefix ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH : ${ 64 lib.makeLibraryPath [ rtl-sdr ] 65 }" 66 ]; 67 68 installPhase = 69 if stdenv.isDarwin then 70 '' 71 mkdir -p $out/Applications 72 mv linux-bin/fmreceiver-2.0.app $out/Applications/fmreceiver.app 73 install_name_tool -change {,${libsForQt5.qwt}/lib/}libqwt.6.dylib "$out/Applications/fmreceiver.app/Contents/MacOS/fmreceiver-2.0" 74 '' 75 else 76 '' 77 install -Dm755 linux-bin/fmreceiver-2.0 $out/bin/fmreceiver 78 ''; 79 80 meta = { 81 description = "A simple FM receiver"; 82 homepage = "https://github.com/JvanKatwijk/sdr-j-fm"; 83 license = lib.licenses.gpl2Plus; 84 maintainers = [ lib.maintainers.sikmir ]; 85 platforms = lib.platforms.unix; 86 }; 87 })
