diff --git a/pkgs/applications/audio/faust/faust2.nix b/pkgs/applications/audio/faust/faust2.nix index 8ac13f1c7e4..4ecf879460c 100644 --- a/pkgs/applications/audio/faust/faust2.nix +++ b/pkgs/applications/audio/faust/faust2.nix @@ -1,4 +1,5 @@ -{ lib, stdenv +{ lib +, stdenv , coreutils , fetchFromGitHub , makeWrapper @@ -14,19 +15,21 @@ , p11-kit , vim , which +, ncurses +, fetchpatch }: with lib.strings; let - version = "2.54.9"; + version = "2.59.6"; src = fetchFromGitHub { owner = "grame-cncm"; repo = "faust"; rev = version; - sha256 = "sha256-7eSZUsZ0h0vWJIpZWXaS+SHV6N2i9nv6Gr6a9cuu4Fg="; + sha256 = "sha256-m6dimBxI9C3KDhUxbJAn2Pf9z+LRahjrzD34W/bf1XA="; fetchSubmodules = true; }; @@ -38,80 +41,97 @@ let maintainers = with maintainers; [ magnetophon pmahoney ]; }; - faust = stdenv.mkDerivation { + faust = + let ncurses_static = ncurses.override { enableStatic = true; }; + in stdenv.mkDerivation { - pname = "faust"; - inherit version; + pname = "faust"; + inherit version; - inherit src; + inherit src; - nativeBuildInputs = [ makeWrapper pkg-config cmake vim which ]; - buildInputs = [ llvm emscripten openssl libsndfile libmicrohttpd gnutls libtasn1 p11-kit ]; + nativeBuildInputs = [ makeWrapper pkg-config cmake vim which ]; + buildInputs = [ + llvm + emscripten + openssl + libsndfile + libmicrohttpd + gnutls + libtasn1 + p11-kit + ncurses_static + ]; + patches = [ + # make preset management thread safe + # needed for magnetophonDSP.VoiceOfFaust + # see: https://github.com/grame-cncm/faust/issues/899 + (fetchpatch { + url = "https://github.com/grame-cncm/faust/commit/a1c3a515abbcafea0a6e4e2ec7ecb0f092de5349.patch"; + hash = "sha256-1Ndm+CgxvGEbS6TKGggeu9hW7N3pC+d1kluT2vhGzL8="; + }) + ]; - passthru = { - inherit wrap wrapWithBuildEnv faust2ApplBase; - }; + passthru = { inherit wrap wrapWithBuildEnv faust2ApplBase; }; - - preConfigure = '' - cd build - ''; - - cmakeFlags = [ - "-C../backends/all.cmake" - "-C../targets/all.cmake" - ]; - - postInstall = '' - # syntax error when eval'd directly - pattern="faust2!(*@(atomsnippets|graph|graphviewer|md|plot|sig|sigviewer|svg))" - (shopt -s extglob; rm "$out"/bin/$pattern) - ''; - - postFixup = '' - # The 'faustoptflags' is 'source'd into other faust scripts and - # not used as an executable, so patch 'uname' usage directly - # rather than use makeWrapper. - substituteInPlace "$out"/bin/faustoptflags \ - --replace uname "${coreutils}/bin/uname" - - # wrapper for scripts that don't need faust.wrap* - for script in "$out"/bin/faust2*; do - wrapProgram "$script" \ - --prefix PATH : "$out"/bin - done - ''; - - meta = meta // { - description = "A functional programming language for realtime audio signal processing"; - longDescription = '' - FAUST (Functional Audio Stream) is a functional programming - language specifically designed for real-time signal processing - and synthesis. FAUST targets high-performance signal processing - applications and audio plug-ins for a variety of platforms and - standards. - The Faust compiler translates DSP specifications into very - efficient C++ code. Thanks to the notion of architecture, - FAUST programs can be easily deployed on a large variety of - audio platforms and plugin formats (jack, alsa, ladspa, maxmsp, - puredata, csound, supercollider, pure, vst, coreaudio) without - any change to the FAUST code. - - This package has just the compiler, libraries, and headers. - Install faust2* for specific faust2appl scripts. + preConfigure = '' + cd build + sed -i 's@LIBNCURSES_PATH ?= .*@LIBNCURSES_PATH ?= ${ncurses_static}/lib/libncurses.a@' Make.llvm.static + substituteInPlace Make.llvm.static \ + --replace 'mkdir -p $@ && cd $@ && ar -x ../../$<' 'mkdir -p $@ && cd $@ && ar -x ../source/build/lib/libfaust.a && cd ../source/build/' + substituteInPlace Make.llvm.static \ + --replace 'rm -rf $(TMP)' ' ' ''; - }; - }; + cmakeFlags = [ "-C../backends/all.cmake" "-C../targets/all.cmake" ]; + + postInstall = '' + # syntax error when eval'd directly + pattern="faust2!(*@(atomsnippets|graph|graphviewer|md|plot|sig|sigviewer|svg))" + (shopt -s extglob; rm "$out"/bin/$pattern) + ''; + + postFixup = '' + # The 'faustoptflags' is 'source'd into other faust scripts and + # not used as an executable, so patch 'uname' usage directly + # rather than use makeWrapper. + substituteInPlace "$out"/bin/faustoptflags \ + --replace uname "${coreutils}/bin/uname" + + # wrapper for scripts that don't need faust.wrap* + for script in "$out"/bin/faust2*; do + wrapProgram "$script" \ + --prefix PATH : "$out"/bin + done + ''; + + meta = meta // { + description = + "A functional programming language for realtime audio signal processing"; + longDescription = '' + FAUST (Functional Audio Stream) is a functional programming + language specifically designed for real-time signal processing + and synthesis. FAUST targets high-performance signal processing + applications and audio plug-ins for a variety of platforms and + standards. + The Faust compiler translates DSP specifications into very + efficient C++ code. Thanks to the notion of architecture, + FAUST programs can be easily deployed on a large variety of + audio platforms and plugin formats (jack, alsa, ladspa, maxmsp, + puredata, csound, supercollider, pure, vst, coreaudio) without + any change to the FAUST code. + + This package has just the compiler, libraries, and headers. + Install faust2* for specific faust2appl scripts. + ''; + }; + + }; # Default values for faust2appl. faust2ApplBase = - { baseName - , dir ? "tools/faust2appls" - , scripts ? [ baseName ] - , ... - }@args: + { baseName, dir ? "tools/faust2appls", scripts ? [ baseName ], ... }@args: args // { name = "${baseName}-${version}"; @@ -141,7 +161,8 @@ let ''; meta = meta // { - description = "The ${baseName} script, part of faust functional programming language for realtime audio signal processing"; + description = + "The ${baseName} script, part of faust functional programming language for realtime audio signal processing"; }; }; @@ -161,11 +182,7 @@ let # # The build input 'faust' is automatically added to the # propagatedBuildInputs. - wrapWithBuildEnv = - { baseName - , propagatedBuildInputs ? [ ] - , ... - }@args: + wrapWithBuildEnv = { baseName, propagatedBuildInputs ? [ ], ... }@args: stdenv.mkDerivation ((faust2ApplBase args) // { @@ -205,26 +222,25 @@ let # simply need to be wrapped with some dependencies on PATH. # # The build input 'faust' is automatically added to the PATH. - wrap = - { baseName - , runtimeInputs ? [ ] - , ... - }@args: + wrap = { baseName, runtimeInputs ? [ ], ... }@args: let - runtimePath = concatStringsSep ":" (map (p: "${p}/bin") ([ faust ] ++ runtimeInputs)); + runtimePath = + concatStringsSep ":" (map (p: "${p}/bin") ([ faust ] ++ runtimeInputs)); - in stdenv.mkDerivation ((faust2ApplBase args) // { + in + stdenv.mkDerivation ((faust2ApplBase args) // { - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; - postFixup = '' + postFixup = '' for script in "$out"/bin/*; do wrapProgram "$script" --prefix PATH : "${runtimePath}" done ''; - }); + }); -in faust +in +faust