summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/or/orbuculum/package.nix
blob: 80ce39a2c83ffb6a8f6a5f2a374364b0262f4e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchzip,
  meson,
  ninja,
  pkg-config,
  czmq,
  libusb1,
  ncurses,
  SDL2,
  libelf,
}:

let
  libdwarf = fetchzip {
    url = "https://www.prevanders.net/libdwarf-0.7.0.tar.xz";
    hash = "sha256-YTTbBJkDu2BSAVpvucqtg7/hFxXrxLnNAlvAL7rmkdE=";
  };
in
stdenv.mkDerivation (finalAttrs: {
  pname = "orbuculum";
  version = "2.2.0";

  src = fetchFromGitHub {
    owner = "orbcode";
    repo = "orbuculum";
    tag = "V${finalAttrs.version}";
    hash = "sha256-n3+cfeN6G9n8pD5WyiHPENMJ0FN+bRVZe9pl81uvIrc=";
  };

  postPatch = ''
    cp --recursive --no-preserve=mode ${libdwarf} subprojects/libdwarf-0.7.0
    pushd subprojects/libdwarf-0.7.0
    patch -p1 < ../packagefiles/libdwarf/0001-fix-Use-project_source_root-for-subproject-compatibi.patch
    patch -p1 < ../packagefiles/libdwarf/0002-fix-compilation-clang.patch
    patch -p1 < ../packagefiles/libdwarf/0003-Fixed-calloc-arguments-order.patch
    popd
  '';

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
  ];

  buildInputs = [
    czmq
    libusb1
    ncurses
    SDL2
    libelf
  ];

  doInstallCheck = true;

  installFlags = [ "INSTALL_ROOT=$(out)/" ];

  postInstall = ''
    mkdir -p $out/etc/udev/rules.d/
    cp $src/Support/60-orbcode.rules $out/etc/udev/rules.d/
  '';

  meta = {
    description = "Cortex M SWO SWV Demux and Postprocess for the ORBTrace";
    homepage = "https://orbcode.org";
    changelog = "https://github.com/orbcode/orbuculum/blob/V${finalAttrs.version}/CHANGES.md";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ newam ];
    platforms = lib.platforms.linux;
  };
})