about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/audio/faust
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/audio/faust')
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2.nix244
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2alqt.nix41
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2alsa.nix29
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2csound.nix20
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2firefox.nix14
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2jack.nix28
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2jackrust.nix17
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2jaqt.nix53
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2ladspa.nix12
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2lv2.nix19
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faust2sc.nix32
-rw-r--r--nixpkgs/pkgs/applications/audio/faust/faustlive.nix99
12 files changed, 608 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2.nix b/nixpkgs/pkgs/applications/audio/faust/faust2.nix
new file mode 100644
index 000000000000..dc5dc477b03a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2.nix
@@ -0,0 +1,244 @@
+{ lib
+, stdenv
+, coreutils
+, fetchFromGitHub
+, makeWrapper
+, pkg-config
+, cmake
+, llvm
+, emscripten
+, openssl
+, libsndfile
+, libmicrohttpd
+, gnutls
+, libtasn1
+, p11-kit
+, vim
+, which
+, ncurses
+, fetchpatch
+}:
+
+with lib.strings;
+
+let
+
+  version = "2.70.3";
+
+  src = fetchFromGitHub {
+    owner = "grame-cncm";
+    repo = "faust";
+    rev = version;
+    sha256 = "sha256-z6fW/T7wJZxugmvABlpvyMXvR4WkmC16INOKyyfKx8k=";
+    fetchSubmodules = true;
+  };
+
+  meta = with lib; {
+    homepage = "https://faust.grame.fr/";
+    downloadPage = "https://github.com/grame-cncm/faust/";
+    license = licenses.gpl2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ magnetophon pmahoney ];
+  };
+
+  faust =
+    let ncurses_static = ncurses.override { enableStatic = true; };
+    in stdenv.mkDerivation {
+
+      pname = "faust";
+      inherit version;
+
+      inherit src;
+
+      nativeBuildInputs = [ makeWrapper pkg-config cmake vim which ];
+      buildInputs = [
+        llvm
+        emscripten
+        openssl
+        libsndfile
+        libmicrohttpd
+        gnutls
+        libtasn1
+        p11-kit
+        ncurses_static
+      ];
+
+      patches = [
+        (fetchpatch {
+          name = "fix-CsigFFun-API-declaration.patch";
+          url = "https://github.com/grame-cncm/faust/commit/10ce960e91a6237c7bff14a338e770757076ce9e.patch";
+          hash = "sha256-WMFLpLGTZpG7ni3lhI5VJHsmJViWZf4pAFuhYmFVRCE=";
+        })
+      ];
+
+      passthru = { inherit wrap wrapWithBuildEnv faust2ApplBase; };
+
+      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:
+
+    args // {
+      name = "${baseName}-${version}";
+
+      inherit src;
+
+      dontBuild = true;
+
+      installPhase = ''
+        runHook preInstall
+
+        mkdir -p "$out/bin"
+        for script in ${concatStringsSep " " scripts}; do
+          cp "${dir}/$script" "$out/bin/"
+        done
+
+        runHook postInstall
+      '';
+
+      postInstall = ''
+        # For the faust2appl script, change 'faustpath' and
+        # 'faustoptflags' to absolute paths.
+        for script in "$out"/bin/*; do
+          substituteInPlace "$script" \
+            --replace " error " "echo"
+        done
+      '';
+
+      meta = meta // {
+        description =
+          "The ${baseName} script, part of faust functional programming language for realtime audio signal processing";
+      };
+    };
+
+  # Some 'faust2appl' scripts, such as faust2alsa, run faust to
+  # generate cpp code, then invoke the c++ compiler to build the code.
+  # This builder wraps these scripts in parts of the stdenv such that
+  # when the scripts are called outside any nix build, they behave as
+  # if they were running inside a nix build in terms of compilers and
+  # paths being configured (e.g. rpath is set so that compiled
+  # binaries link to the libs inside the nix store)
+  #
+  # The function takes two main args: the appl name (e.g.
+  # 'faust2alsa') and an optional list of propagatedBuildInputs. It
+  # returns a derivation that contains only the bin/${appl} script,
+  # wrapped up so that it will run as if it was inside a nix build
+  # with those build inputs.
+  #
+  # The build input 'faust' is automatically added to the
+  # propagatedBuildInputs.
+  wrapWithBuildEnv = { baseName, propagatedBuildInputs ? [ ], ... }@args:
+
+    stdenv.mkDerivation ((faust2ApplBase args) // {
+
+      nativeBuildInputs = [ pkg-config makeWrapper ];
+
+      propagatedBuildInputs = [ faust ] ++ propagatedBuildInputs;
+
+      libPath = lib.makeLibraryPath propagatedBuildInputs;
+
+      postFixup = ''
+
+        # export parts of the build environment
+        for script in "$out"/bin/*; do
+          # e.g. NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu
+          nix_cc_wrapper_target_host="$(printenv | grep ^NIX_CC_WRAPPER_TARGET_HOST | sed 's/=.*//')"
+
+          # e.g. NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu
+          nix_bintools_wrapper_target_host="$(printenv | grep ^NIX_BINTOOLS_WRAPPER_TARGET_HOST | sed 's/=.*//')"
+
+          wrapProgram "$script" \
+            --set FAUSTLDDIR "${faust}/lib" \
+            --set FAUSTLIB "${faust}/share/faust" \
+            --set FAUSTINC "${faust}/include/faust" \
+            --set FAUSTARCH "${faust}/share/faust" \
+            --prefix PATH : "$PATH" \
+            --prefix PKG_CONFIG_PATH : "$PKG_CONFIG_PATH" \
+            --set NIX_CFLAGS_COMPILE "$NIX_CFLAGS_COMPILE" \
+            --set NIX_LDFLAGS "$NIX_LDFLAGS -lpthread" \
+            --set "$nix_cc_wrapper_target_host" "''${!nix_cc_wrapper_target_host}" \
+            --set "$nix_bintools_wrapper_target_host" "''${!nix_bintools_wrapper_target_host}" \
+            --prefix LIBRARY_PATH "$libPath"
+        done
+      '';
+    });
+
+  # Builder for 'faust2appl' scripts, such as faust2firefox that
+  # simply need to be wrapped with some dependencies on PATH.
+  #
+  # The build input 'faust' is automatically added to the PATH.
+  wrap = { baseName, runtimeInputs ? [ ], ... }@args:
+
+    let
+
+      runtimePath =
+        concatStringsSep ":" (map (p: "${p}/bin") ([ faust ] ++ runtimeInputs));
+
+    in
+      stdenv.mkDerivation ((faust2ApplBase args) // {
+
+        nativeBuildInputs = [ makeWrapper ];
+
+        postFixup = ''
+        for script in "$out"/bin/*; do
+          wrapProgram "$script" --prefix PATH : "${runtimePath}"
+        done
+      '';
+
+      });
+
+in
+faust
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2alqt.nix b/nixpkgs/pkgs/applications/audio/faust/faust2alqt.nix
new file mode 100644
index 000000000000..b12b41763ba5
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2alqt.nix
@@ -0,0 +1,41 @@
+{ faust
+, alsa-lib
+, qtbase
+, writeText
+, buildPackages
+}:
+let
+  # Wrap the binary coming out of the the compilation script, so it knows QT_PLUGIN_PATH
+  wrapBinary = writeText "wrapBinary" ''
+    source ${buildPackages.makeWrapper}/nix-support/setup-hook
+    for p in $FILES; do
+      workpath=$PWD
+      cd -- "$(dirname "$p")"
+      binary=$(basename --suffix=.dsp "$p")
+      rm -f .$binary-wrapped
+      wrapProgram $binary --set QT_PLUGIN_PATH "${qtbase}/${qtbase.qtPluginPrefix}"
+      sed -i $binary -e 's@exec@cd "$(dirname "$(readlink -f "''${BASH_SOURCE[0]}")")" \&\& exec@g'
+      cd $workpath
+    done
+  '';
+in
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2alqt";
+
+  propagatedBuildInputs = [
+    alsa-lib
+    qtbase
+  ];
+
+  dontWrapQtApps = true;
+
+  preFixup = ''
+    for script in "$out"/bin/*; do
+      # append the wrapping code to the compilation script
+      cat ${wrapBinary} >> $script
+      # prevent the qmake error when running the script
+      sed -i "/QMAKE=/c\ QMAKE="${qtbase.dev}/bin/qmake"" $script
+    done
+  '';
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2alsa.nix b/nixpkgs/pkgs/applications/audio/faust/faust2alsa.nix
new file mode 100644
index 000000000000..bb6121a5d70b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2alsa.nix
@@ -0,0 +1,29 @@
+{ faust
+, alsa-lib
+, atk
+, cairo
+, fontconfig
+, freetype
+, gdk-pixbuf
+, glib
+, gtk2
+, pango
+}:
+
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2alsa";
+
+  propagatedBuildInputs = [
+    alsa-lib
+    atk
+    cairo
+    fontconfig
+    freetype
+    gdk-pixbuf
+    glib
+    gtk2
+    pango
+  ];
+
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2csound.nix b/nixpkgs/pkgs/applications/audio/faust/faust2csound.nix
new file mode 100644
index 000000000000..eb5e5831cddd
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2csound.nix
@@ -0,0 +1,20 @@
+{ faust
+, csound
+}:
+
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2csound";
+
+  propagatedBuildInputs = [
+    csound
+  ];
+
+  # faust2csound generated .cpp files have
+  #   #include "csdl.h"
+  # but that file is in the csound/ subdirectory
+  preFixup = ''
+    NIX_CFLAGS_COMPILE="$(printf '%s' "$NIX_CFLAGS_COMPILE" | sed 's%${csound}/include%${csound}/include/csound%')"
+  '';
+
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2firefox.nix b/nixpkgs/pkgs/applications/audio/faust/faust2firefox.nix
new file mode 100644
index 000000000000..c718aa06806a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2firefox.nix
@@ -0,0 +1,14 @@
+{ faust
+, xdg-utils
+}:
+
+# This just runs faust2svg, then attempts to open a browser using
+# 'xdg-open'.
+
+faust.wrap {
+
+  baseName = "faust2firefox";
+
+  runtimeInputs = [ xdg-utils ];
+
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2jack.nix b/nixpkgs/pkgs/applications/audio/faust/faust2jack.nix
new file mode 100644
index 000000000000..bd213bfcadbe
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2jack.nix
@@ -0,0 +1,28 @@
+{ faust
+, gtk2
+, jack2
+, alsa-lib
+, opencv
+, libsndfile
+, which
+}:
+
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2jack";
+
+  scripts = [
+    "faust2jack"
+    "faust2jackconsole"
+  ];
+
+  propagatedBuildInputs = [
+    gtk2
+    jack2
+    alsa-lib
+    opencv
+    libsndfile
+    which
+  ];
+
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2jackrust.nix b/nixpkgs/pkgs/applications/audio/faust/faust2jackrust.nix
new file mode 100644
index 000000000000..a93251c8d2d2
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2jackrust.nix
@@ -0,0 +1,17 @@
+{ faust
+, libjack2
+, cargo
+, binutils
+, gcc
+, gnumake
+, openssl
+, pkg-config
+
+}:
+
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2jackrust";
+
+  propagatedBuildInputs = [ libjack2 cargo binutils gcc gnumake openssl pkg-config ];
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2jaqt.nix b/nixpkgs/pkgs/applications/audio/faust/faust2jaqt.nix
new file mode 100644
index 000000000000..90b6ca218dd4
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2jaqt.nix
@@ -0,0 +1,53 @@
+{ faust
+, jack2
+, qtbase
+, libsndfile
+, alsa-lib
+, writeText
+, buildPackages
+, which
+}:
+let
+  # Wrap the binary coming out of the the compilation script, so it knows QT_PLUGIN_PATH
+  wrapBinary = writeText "wrapBinary" ''
+    source ${buildPackages.makeWrapper}/nix-support/setup-hook
+    for p in $FILES; do
+      workpath=$PWD
+      cd -- "$(dirname "$p")"
+      binary=$(basename --suffix=.dsp "$p")
+      rm -f .$binary-wrapped
+      wrapProgram $binary --set QT_PLUGIN_PATH "${qtbase}/${qtbase.qtPluginPrefix}"
+      sed -i $binary -e 's@exec@cd "$(dirname "$(readlink -f "''${BASH_SOURCE[0]}")")" \&\& exec@g'
+      cd $workpath
+    done
+  '';
+in
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2jaqt";
+
+  scripts = [
+    "faust2jaqt"
+    "faust2jackserver"
+  ];
+
+  propagatedBuildInputs = [
+    jack2
+    qtbase
+    libsndfile
+    alsa-lib
+    which
+  ];
+
+
+  dontWrapQtApps = true;
+
+  preFixup = ''
+    for script in "$out"/bin/*; do
+      # append the wrapping code to the compilation script
+      cat ${wrapBinary} >> $script
+      # prevent the qmake error when running the script
+      sed -i "/QMAKE=/c\ QMAKE="${qtbase.dev}/bin/qmake"" $script
+    done
+  '';
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2ladspa.nix b/nixpkgs/pkgs/applications/audio/faust/faust2ladspa.nix
new file mode 100644
index 000000000000..67de98cab9a2
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2ladspa.nix
@@ -0,0 +1,12 @@
+{ boost
+, faust
+, ladspaH
+}:
+
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2ladspa";
+
+  propagatedBuildInputs = [ boost ladspaH ];
+
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2lv2.nix b/nixpkgs/pkgs/applications/audio/faust/faust2lv2.nix
new file mode 100644
index 000000000000..b7e9ffb488c4
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2lv2.nix
@@ -0,0 +1,19 @@
+{ boost
+, faust
+, lv2
+, qtbase
+, which
+}:
+
+faust.wrapWithBuildEnv {
+
+  baseName = "faust2lv2";
+
+  propagatedBuildInputs = [ boost lv2 qtbase ];
+
+  dontWrapQtApps = true;
+
+  preFixup = ''
+    sed -i "/QMAKE=/c\ QMAKE="${qtbase.dev}/bin/qmake"" "$out"/bin/faust2lv2;
+  '';
+}
diff --git a/nixpkgs/pkgs/applications/audio/faust/faust2sc.nix b/nixpkgs/pkgs/applications/audio/faust/faust2sc.nix
new file mode 100644
index 000000000000..acdc54434dc6
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faust2sc.nix
@@ -0,0 +1,32 @@
+{ faust
+, baseName ? "faust2sc"
+, supercollider
+, makeWrapper
+, python3
+, stdenv
+}@args:
+let
+  faustDefaults = faust.faust2ApplBase
+    (args // {
+      baseName = "${baseName}.py";
+    });
+in
+stdenv.mkDerivation (faustDefaults // {
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  propagatedBuildInputs = [ python3 faust supercollider ];
+
+  postInstall = ''
+    mv "$out/bin/${baseName}.py" "$out"/bin/${baseName}
+  '';
+
+  postFixup = ''
+    wrapProgram "$out"/bin/${baseName} \
+      --append-flags "--import-dir ${faust}/share/faust" \
+      --append-flags "--architecture-dir ${faust}/share/faust" \
+      --append-flags "--architecture-dir ${faust}/include" \
+      --append-flags "-p ${supercollider}" \
+      --prefix PATH : "$PATH"
+  '';
+})
diff --git a/nixpkgs/pkgs/applications/audio/faust/faustlive.nix b/nixpkgs/pkgs/applications/audio/faust/faustlive.nix
new file mode 100644
index 000000000000..3826bb8b4bad
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/faust/faustlive.nix
@@ -0,0 +1,99 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, pkg-config
+, which
+, alsa-lib
+, curl
+, faust
+, flac
+, gnutls
+, libjack2
+, libmicrohttpd
+, libmpg123
+, libogg
+, libopus
+, libsndfile
+, libtasn1
+, libvorbis
+, libxcb
+, llvm
+, p11-kit
+, qrencode
+, qt5
+}:
+
+stdenv.mkDerivation rec {
+  pname = "faustlive";
+  version = "2.5.17";
+  src = fetchFromGitHub {
+    owner = "grame-cncm";
+    repo = "faustlive";
+    rev = version;
+    hash = "sha256-RqtdDkP63l/30sL5PDocvpar5TI4LdKfeeliSNeOHog=";
+    fetchSubmodules = true;
+  };
+
+  patches = [
+    # move mutex initialization outside assert call
+    # https://github.com/grame-cncm/faustlive/pull/59
+    (fetchpatch {
+      name = "initalize-mutexes.patch";
+      url = "https://github.com/grame-cncm/faustlive/commit/fdd46b12202def9731b9ed2f6363287af16be892.patch";
+      hash = "sha256-yH95Y4Jbqgs8siE9rtutmu5C2sNZwQMJzCgDYqNBDj4=";
+    })
+  ];
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    faust
+    llvm
+    pkg-config
+    qt5.wrapQtAppsHook
+    which
+  ];
+
+  buildInputs = [
+    alsa-lib
+    curl
+    faust
+    flac
+    gnutls
+    libjack2
+    libmicrohttpd
+    libmpg123
+    libogg
+    libopus
+    libsndfile
+    libtasn1
+    libvorbis
+    libxcb
+    llvm
+    p11-kit
+    qrencode
+    qt5.qtbase
+  ];
+
+  cmakeFlags = [
+    "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
+  ];
+
+  postPatch = "cd Build";
+
+  meta = with lib; {
+    description = "A standalone just-in-time Faust compiler";
+    mainProgram = "FaustLive";
+    longDescription = ''
+      FaustLive is a standalone just-in-time Faust compiler. It tries to bring
+      together the convenience of a standalone interpreted language with the
+      efficiency of a compiled language. It's ideal for fast prototyping.
+    '';
+    homepage = "https://faust.grame.fr/";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ magnetophon ];
+  };
+}