about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/sh/show-midi/package.nix
blob: 4e3029921321cc63e4ec22828edfb6730bc55389 (plain) (blame)
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
74
75
76
77
78
79
80
81
82
83
{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, alsa-lib
, freetype
, libX11
, libXrandr
, libXinerama
, libXext
, libXcursor
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "show-midi";
  version = "0.9.0";

  src = fetchFromGitHub {
    owner = "gbevin";
    repo = "ShowMIDI";
    rev = finalAttrs.version;
    hash = "sha256-xt2LpoiaOWAeWM/YzaKM0WGi8aHs4T7pvMw1s/P4Oj0=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [
    alsa-lib
    freetype
    libX11
    libXrandr
    libXinerama
    libXext
    libXcursor
  ];

  enableParallelBuilding = true;

  makeFlags = [
    "-C Builds/LinuxMakefile"
    "CONFIG=Release"
    # Specify targets by hand, because it tries to build VST by default,
    # even though it's not supported in JUCE anymore
    "LV2"
    "LV2_MANIFEST_HELPER"
    "Standalone"
    "VST3"
    "VST3_MANIFEST_HELPER"
  ];

  installPhase = ''
    runHook preInstall

    install -Dt $out/share/ShowMIDI/themes Themes/*

    mkdir -p $out/bin $out/lib/lv2 $out/lib/vst3
    cd Builds/LinuxMakefile/build/
    cp -r ShowMIDI.lv2 $out/lib/lv2
    cp -r ShowMIDI.vst3 $out/lib/vst3
    cp ShowMIDI $out/bin

    runHook postInstall
  '';

  # JUCE dlopens these, make sure they are in rpath
  # Otherwise, segfault will happen
  env.NIX_LDFLAGS = toString [
    "-lX11"
    "-lXext"
    "-lXcursor"
    "-lXinerama"
    "-lXrandr"
  ];

  meta = with lib; {
    description = "Multi-platform GUI application to effortlessly visualize MIDI activity";
    homepage = "https://github.com/gbevin/ShowMIDI";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ minijackson ];
    mainProgram = "ShowMIDI";
    platforms = platforms.linux;
  };
})