|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchFromGitHub, |
| 5 | + pkg-config, |
| 6 | + ncurses, |
| 7 | + rtl-sdr, |
| 8 | + zlib, |
| 9 | + zstd, |
| 10 | +}: |
| 11 | + |
| 12 | +stdenv.mkDerivation (finalAttrs: { |
| 13 | + pname = "readsb"; |
| 14 | + version = "3.14.1641"; |
| 15 | + |
| 16 | + src = fetchFromGitHub { |
| 17 | + owner = "wiedehopf"; |
| 18 | + repo = "readsb"; |
| 19 | + rev = "refs/tags/v${finalAttrs.version}"; |
| 20 | + hash = "sha256-viz/oADxdduan6W0FsetEqifR6fcyeoEZvEnoO/K5/g="; |
| 21 | + }; |
| 22 | + |
| 23 | + strictDeps = true; |
| 24 | + |
| 25 | + nativeBuildInputs = [ pkg-config ]; |
| 26 | + |
| 27 | + buildInputs = [ |
| 28 | + ncurses |
| 29 | + rtl-sdr |
| 30 | + zlib |
| 31 | + zstd |
| 32 | + ]; |
| 33 | + |
| 34 | + # remove version string magic that utilizes git and current time |
| 35 | + postPatch = '' |
| 36 | + sed --in-place '/^READSB_VERSION :=/d' Makefile |
| 37 | + ''; |
| 38 | + |
| 39 | + enableParallelBuilding = true; |
| 40 | + makeFlags = [ |
| 41 | + # set something for version, we removed the original value in postPatch |
| 42 | + "READSB_VERSION=${finalAttrs.version}" |
| 43 | + ] ++ (lib.lists.optional (rtl-sdr != null) "RTLSDR=yes"); |
| 44 | + |
| 45 | + doCheck = true; |
| 46 | + checkTarget = "cprtest"; |
| 47 | + # TODO there is a crctests target in Make, it describes how to compile ./crctests, but doesn't run |
| 48 | + # it. Compilation also fails with: |
| 49 | + # |
| 50 | + # ld: /build/cc9NI2Fd.o: in function `malloc_or_exit': |
| 51 | + # > /build/source/readsb.h:407:(.text+0xbad): undefined reference to `setExit' |
| 52 | + # |
| 53 | + # Comment this test in once this has been fixed upstream. |
| 54 | + # postCheck = '' |
| 55 | + # make crctests && ./crctests |
| 56 | + # ''; |
| 57 | + |
| 58 | + installPhase = '' |
| 59 | + runHook preInstall |
| 60 | +
|
| 61 | + mkdir --parent -- $out/bin |
| 62 | + mv readsb viewadsb $out/bin |
| 63 | +
|
| 64 | + runHook postInstall |
| 65 | + ''; |
| 66 | + |
| 67 | + meta = { |
| 68 | + description = "ADS-B decoder swiss knife"; |
| 69 | + homepage = "https://github.com/wiedehopf/readsb"; |
| 70 | + license = with lib.licenses; [ gpl3Plus ]; |
| 71 | + maintainers = with lib.maintainers; [ wucke13 ]; |
| 72 | + platforms = lib.platforms.linux; # uses epoll, hence its linux only |
| 73 | + }; |
| 74 | +}) |
0 commit comments