summary refs log tree commit diff
path: root/pkgs/applications/audio/chuck/default.nix
blob: a6509256881b3884da3773c3ca44b7ca54a38f1a (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
{ stdenv, lib, fetchurl, alsa-lib, bison, flex, libsndfile, which
, AppKit, Carbon, CoreAudio, CoreMIDI, CoreServices, Kernel
}:

stdenv.mkDerivation rec {
  version = "1.4.1.0";
  pname = "chuck";

  src = fetchurl {
    url = "http://chuck.cs.princeton.edu/release/files/chuck-${version}.tgz";
    sha256 = "sha256-dL+ZrVFeMRPFW4MxUpNvrQKjzwBqVBBf8Rd3xHMZSSg=";
  };

  nativeBuildInputs = [ flex bison which ];

  buildInputs = [ libsndfile ]
    ++ lib.optional (!stdenv.isDarwin) alsa-lib
    ++ lib.optional stdenv.isDarwin [ AppKit Carbon CoreAudio CoreMIDI CoreServices Kernel ];

  patches = [ ./darwin-limits.patch ];

  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-Wno-missing-sysroot";
  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework MultitouchSupport";

  postPatch = ''
    substituteInPlace src/core/makefile.x/makefile.osx \
      --replace "weak_framework" "framework" \
      --replace "MACOSX_DEPLOYMENT_TARGET=10.9" "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET"
  '';

  makeFlags = [ "-C src" "DESTDIR=$(out)/bin" ];
  buildFlags = [ (if stdenv.isDarwin then "osx" else "linux-alsa") ];

  meta = with lib; {
    description = "Programming language for real-time sound synthesis and music creation";
    homepage = "http://chuck.cs.princeton.edu";
    license = licenses.gpl2;
    platforms = platforms.unix;
    maintainers = with maintainers; [ ftrvxmtrx ];
  };
}