From 33aa3f3488ecd127c0564d2788cd941be23b0954 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Thu, 8 Mar 2018 23:33:35 +0100 Subject: chuck: fix darwin build --- pkgs/applications/audio/chuck/clang.patch | 58 +++++++++++++++++++++++++++++++ pkgs/applications/audio/chuck/default.nix | 19 ++++++---- 2 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 pkgs/applications/audio/chuck/clang.patch (limited to 'pkgs/applications/audio') diff --git a/pkgs/applications/audio/chuck/clang.patch b/pkgs/applications/audio/chuck/clang.patch new file mode 100644 index 000000000000..77227ef0fd44 --- /dev/null +++ b/pkgs/applications/audio/chuck/clang.patch @@ -0,0 +1,58 @@ +diff --git a/src/ugen_osc.cpp b/src/ugen_osc.cpp +index 6b93c6b..dbefe4f 100644 +--- a/src/ugen_osc.cpp ++++ b/src/ugen_osc.cpp +@@ -1232,7 +1232,7 @@ CK_DLL_CTRL( gen5_coeffs ) + Chuck_Array8 * in_args = (Chuck_Array8 *)GET_CK_OBJECT(ARGS); + + // fprintf(stdout, "calling gen10coeffs, %d\n", weights); +- if(in_args<0) return; ++ if(in_args!=0) return; + size = in_args->size(); + if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1; + +@@ -1287,7 +1287,7 @@ CK_DLL_CTRL( gen7_coeffs ) + Chuck_Array8 * in_args = (Chuck_Array8 *)GET_CK_OBJECT(ARGS); + + // fprintf(stdout, "calling gen10coeffs, %d\n", weights); +- if(in_args<0) return; ++ if(in_args!=0) return; + size = in_args->size(); + if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1; + +@@ -1340,7 +1340,7 @@ CK_DLL_CTRL( gen9_coeffs ) + Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS); + + // fprintf(stdout, "calling gen10coeffs, %d\n", weights); +- if(weights<0) return; ++ if(weights!=0) return; + size = weights->size(); + if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1; + +@@ -1390,7 +1390,7 @@ CK_DLL_CTRL( gen10_coeffs ) + Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS); + + // fprintf(stdout, "calling gen10coeffs, %d\n", weights); +- if(weights<0) return; ++ if(weights!=0) return; + size = weights->size(); + if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1; + +@@ -1441,7 +1441,7 @@ CK_DLL_CTRL( gen17_coeffs ) + Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS); + + // fprintf(stdout, "calling gen17coeffs, %d\n", weights); +- if(weights<0) return; ++ if(weights!=0) return; + size = weights->size(); + if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1; + +@@ -1502,7 +1502,7 @@ CK_DLL_CTRL( curve_coeffs ) + Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS); + + // fprintf(stdout, "calling gen17coeffs, %d\n", weights); +- if(weights<0) goto done; ++ if(weights!=0) goto done; + + nargs = weights->size(); + if (nargs < 5 || (nargs % 3) != 2) { // check number of args diff --git a/pkgs/applications/audio/chuck/default.nix b/pkgs/applications/audio/chuck/default.nix index fd7f0c2b07c2..e94172b0f879 100644 --- a/pkgs/applications/audio/chuck/default.nix +++ b/pkgs/applications/audio/chuck/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, alsaLib, bison, flex, libsndfile, which }: +{ stdenv, fetchurl, alsaLib, bison, flex, libsndfile, which +, AppKit, Carbon, CoreAudio, CoreMIDI, CoreServices, Kernel +}: stdenv.mkDerivation rec { version = "1.3.5.2"; @@ -10,19 +12,24 @@ stdenv.mkDerivation rec { }; buildInputs = [ bison flex libsndfile which ] - ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib; + ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib + ++ stdenv.lib.optional stdenv.isDarwin [ AppKit Carbon CoreAudio CoreMIDI CoreServices Kernel ]; - patches = [ ./darwin-limits.patch ]; + patches = [ ./clang.patch ./darwin-limits.patch ]; + + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-Wno-missing-sysroot"; + NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-framework MultitouchSupport"; postPatch = '' substituteInPlace src/makefile --replace "/usr/bin" "$out/bin" substituteInPlace src/makefile.osx --replace "xcodebuild" "/usr/bin/xcodebuild" substituteInPlace src/makefile.osx --replace "weak_framework" "framework" + substituteInPlace src/makefile.osx --replace "MACOSX_DEPLOYMENT_TARGET=10.5" "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET" ''; - buildPhase = - stdenv.lib.optionals stdenv.isLinux ["make -C src linux-alsa"] ++ - stdenv.lib.optionals stdenv.isDarwin ["make -C src osx"]; + buildPhase = '' + make -C src ${if stdenv.isDarwin then "osx" else "linux-alsa"} + ''; installPhase = '' install -Dm755 ./src/chuck $out/bin/chuck -- cgit 1.4.1