Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv
2, lib
3, fetchFromGitHub
4, fetchpatch
5, cmake
6, pkg-config
7, alsaSupport ? stdenv.hostPlatform.isLinux
8, alsa-lib
9, jackSupport ? true
10, jack
11, coremidiSupport ? stdenv.hostPlatform.isDarwin
12, CoreMIDI
13, CoreAudio
14, CoreServices
15}:
16
17stdenv.mkDerivation rec {
18 pname = "rtmidi";
19 version = "5.0.0";
20
21 src = fetchFromGitHub {
22 owner = "thestk";
23 repo = "rtmidi";
24 rev = version;
25 sha256 = "1r1sqmdi499zfh6z6kjkab6d4a7kz3il5kkcdfz9saa6ry992211";
26 };
27
28 patches = [
29 # Remove when https://github.com/thestk/rtmidi/pull/278 merged
30 (fetchpatch {
31 name = "0001-rtmidi-Use-posix-sched_yield-instead-of-pthread_yield.patch";
32 url = "https://github.com/thestk/rtmidi/pull/278/commits/cfe34c02112c256235b62b45895fc2c401fd874d.patch";
33 sha256 = "0yzq7zbdkl5r4i0r6vy2kq986cqdxz2cpzb7s977mvh09kdikrw1";
34 })
35 # Remove when https://github.com/thestk/rtmidi/pull/277 merged
36 (fetchpatch {
37 name = "0002-rtmidi-include-TargetConditionals.h-on-Apple-platforms.patch";
38 url = "https://github.com/thestk/rtmidi/pull/277/commits/9d863beb28f03ec53f3e4c22cc0d3c34a1e1789b.patch";
39 sha256 = "1hlrg23c1ycnwdvxpic8wvypiril04rlph0g820qn1naf92imfjg";
40 })
41 ];
42
43 nativeBuildInputs = [ cmake pkg-config ];
44
45 buildInputs = lib.optional alsaSupport alsa-lib
46 ++ lib.optional jackSupport jack
47 ++ lib.optionals coremidiSupport [ CoreMIDI CoreAudio CoreServices ];
48
49 cmakeFlags = [
50 "-DRTMIDI_API_ALSA=${if alsaSupport then "ON" else "OFF"}"
51 "-DRTMIDI_API_JACK=${if jackSupport then "ON" else "OFF"}"
52 "-DRTMIDI_API_CORE=${if coremidiSupport then "ON" else "OFF"}"
53 ];
54
55 meta = with lib; {
56 description = "A set of C++ classes that provide a cross platform API for realtime MIDI input/output";
57 homepage = "https://www.music.mcgill.ca/~gary/rtmidi/";
58 license = licenses.mit;
59 maintainers = with maintainers; [ magnetophon ];
60 platforms = platforms.unix;
61 };
62}