diff options
author | cillianderoiste <cillian.deroiste@gmail.com> | 2015-04-04 14:15:51 +0200 |
---|---|---|
committer | cillianderoiste <cillian.deroiste@gmail.com> | 2015-04-04 14:15:51 +0200 |
commit | 174d924b6e938e0d403d96aabcbc4e4cd93267dd (patch) | |
tree | bacdf62efa3d825b96ea7d63c8a74b5405107785 | |
parent | 63a4722d7b9a551694a1acfde1c7ab8a74f48460 (diff) | |
parent | 7503d606e437271c70c7fc25d39fb2bdbfe92867 (diff) | |
download | nixpkgs-174d924b6e938e0d403d96aabcbc4e4cd93267dd.tar nixpkgs-174d924b6e938e0d403d96aabcbc4e4cd93267dd.tar.gz nixpkgs-174d924b6e938e0d403d96aabcbc4e4cd93267dd.tar.bz2 nixpkgs-174d924b6e938e0d403d96aabcbc4e4cd93267dd.tar.lz nixpkgs-174d924b6e938e0d403d96aabcbc4e4cd93267dd.tar.xz nixpkgs-174d924b6e938e0d403d96aabcbc4e4cd93267dd.tar.zst nixpkgs-174d924b6e938e0d403d96aabcbc4e4cd93267dd.zip |
Merge pull request #6951 from nix-faust/faust-redux
Faust redux
-rw-r--r-- | lib/maintainers.nix | 1 | ||||
-rw-r--r-- | pkgs/applications/audio/faust-compiler/default.nix | 110 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/default.nix | 275 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/faust2alqt.nix | 15 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/faust2alsa.nix | 29 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/faust2csound.nix | 20 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/faust2firefox.nix | 14 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/faust2jack.nix | 23 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/faust2jaqt.nix | 22 | ||||
-rw-r--r-- | pkgs/applications/audio/faust/faust2lv2.nix | 11 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 15 |
11 files changed, 340 insertions, 195 deletions
diff --git a/lib/maintainers.nix b/lib/maintainers.nix index fcc78723f4b..6bfd3a29a76 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -154,6 +154,7 @@ pjones = "Peter Jones <pjones@devalot.com>"; pkmx = "Chih-Mao Chen <pkmx.tw@gmail.com>"; plcplc = "Philip Lykke Carlsen <plcplc@gmail.com>"; + pmahoney = "Patrick Mahoney <pat@polycrystal.org>"; prikhi = "Pavan Rikhi <pavan.rikhi@gmail.com>"; pSub = "Pascal Wittmann <mail@pascal-wittmann.de>"; puffnfresh = "Brian McKenna <brian@brianmckenna.org>"; diff --git a/pkgs/applications/audio/faust-compiler/default.nix b/pkgs/applications/audio/faust-compiler/default.nix deleted file mode 100644 index f4bf9d4c659..00000000000 --- a/pkgs/applications/audio/faust-compiler/default.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ fetchgit, stdenv, unzip, pkgconfig, makeWrapper, libsndfile, libmicrohttpd, vim }: - -stdenv.mkDerivation rec { - - version = "8-1-2015"; - name = "faust-compiler-${version}"; - src = fetchgit { - url = git://git.code.sf.net/p/faudiostream/code; - rev = "4db76fdc02b6aec8d15a5af77fcd5283abe963ce"; - sha256 = "f1ac92092ee173e4bcf6b2cb1ac385a7c390fb362a578a403b2b6edd5dc7d5d0"; - }; - - # this version has a bug that manifests when doing faust2jack: - /*version = "0.9.67";*/ - /*name = "faust-compiler-${version}";*/ - /*src = fetchurl {*/ - /*url = "http://downloads.sourceforge.net/project/faudiostream/faust-${version}.zip";*/ - /*sha256 = "068vl9536zn0j4pknwfcchzi90rx5pk64wbcbd67z32w0csx8xm1";*/ - /*};*/ - - buildInputs = [ unzip pkgconfig makeWrapper libsndfile libmicrohttpd vim]; - - - makeFlags="PREFIX = $(out)"; - FPATH="$out"; # <- where to search - - patchPhase = '' - sed -i 's@?= $(shell uname -s)@:= Linux@g' architecture/osclib/oscpack/Makefile - sed -i 's@faust/misc.h@../../architecture/faust/misc.h@g' tools/sound2faust/sound2faust.cpp - sed -i 's@faust/gui/@../../architecture/faust/gui/@g' architecture/faust/misc.h - ''; - - buildPhase = '' - make -C compiler -f Makefile.unix - make -C architecture/osclib - g++ -O3 tools/sound2faust/sound2faust.cpp `pkg-config --cflags --static --libs sndfile` -o tools/sound2faust/sound2faust - make httpd - - ''; - - installPhase = '' - - echo install faust itself - mkdir -p $out/bin/ - mkdir -p $out/include/ - mkdir -p $out/include/faust/ - mkdir -p $out/include/faust/osc/ - install compiler/faust $out/bin/ - - echo install architecture and faust library files - mkdir -p $out/lib/faust - cp architecture/*.lib $out/lib/faust/ - cp architecture/*.cpp $out/lib/faust/ - - echo install math documentation files - cp architecture/mathdoctexts-*.txt $out/lib/faust/ - cp architecture/latexheader.tex $out/lib/faust/ - - echo install additional binary libraries: osc, http - ([ -e architecture/httpdlib/libHTTPDFaust.a ] && cp architecture/httpdlib/libHTTPDFaust.a $out/lib/faust/) || echo libHTTPDFaust not available - cp architecture/osclib/*.a $out/lib/faust/ - cp -r architecture/httpdlib/html/js $out/lib/faust/js - ([ -e architecture/httpdlib/src/hexa/stylesheet ] && cp architecture/httpdlib/src/hexa/stylesheet $out/lib/faust/js/stylesheet.js) || echo stylesheet not available - ([ -e architecture/httpdlib/src/hexa/jsscripts ] && cp architecture/httpdlib/src/hexa/jsscripts $out/lib/faust/js/jsscripts.js) || echo jsscripts not available - - echo install includes files for architectures - cp -r architecture/faust $out/include/ - - echo install additional includes files for binary libraries: osc, http - cp architecture/osclib/faust/faust/OSCControler.h $out/include/faust/gui/ - cp architecture/osclib/faust/faust/osc/*.h $out/include/faust/osc/ - cp architecture/httpdlib/src/include/*.h $out/include/faust/gui/ - - - echo patch header and cpp files - find $out/include/ -name "*.h" -type f | xargs sed "s@#include \"faust/@#include \"$out/include/faust/@g" -i - find $out/lib/faust/ -name "*.cpp" -type f | xargs sed "s@#include \"faust/@#include \"$out/include/faust/@g" -i - sed -i "s@../../architecture/faust/gui/@$out/include/faust/gui/@g" $out/include/faust/misc.h - - wrapProgram $out/bin/faust \ - --set FAUSTLIB $out/lib/faust \ - --set FAUST_LIB_PATH $out/lib/faust \ - --set FAUSTINC $out/include/ - ''; - - meta = with stdenv.lib; { - 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. Install faust for the full - set of faust2somethingElse tools. - ''; - homepage = http://faust.grame.fr/; - downloadPage = http://sourceforge.net/projects/faudiostream/files/; - license = licenses.gpl2; - platforms = platforms.linux; - maintainers = [ maintainers.magnetophon ]; - }; -} - diff --git a/pkgs/applications/audio/faust/default.nix b/pkgs/applications/audio/faust/default.nix index 96258cefca3..722c762b7b4 100644 --- a/pkgs/applications/audio/faust/default.nix +++ b/pkgs/applications/audio/faust/default.nix @@ -1,100 +1,209 @@ -{ fetchgit, stdenv, bash, alsaLib, atk, cairo, faust-compiler, fontconfig, freetype -, gcc, gdk_pixbuf, glib, gtk, jack2, makeWrapper, opencv, pango, pkgconfig, unzip -, gtkSupport ? true -, jackaudioSupport ? true +{ stdenv +, coreutils +, fetchgit +, makeWrapper +, pkgconfig }: -stdenv.mkDerivation rec { +with stdenv.lib.strings; + +let version = "8-1-2015"; - name = "faust-${version}"; + src = fetchgit { url = git://git.code.sf.net/p/faudiostream/code; rev = "4db76fdc02b6aec8d15a5af77fcd5283abe963ce"; sha256 = "f1ac92092ee173e4bcf6b2cb1ac385a7c390fb362a578a403b2b6edd5dc7d5d0"; }; - # this version has a bug that manifests when doing faust2jack: - /*version = "0.9.67";*/ - /*name = "faust-${version}";*/ - /*src = fetchurl {*/ - /*url = "http://downloads.sourceforge.net/project/faudiostream/faust-${version}.zip";*/ - /*sha256 = "068vl9536zn0j4pknwfcchzi90rx5pk64wbcbd67z32w0csx8xm1";*/ - /*};*/ - - buildInputs = [ bash unzip faust-compiler gcc makeWrapper pkgconfig ] - ++ stdenv.lib.optionals gtkSupport [ - alsaLib atk cairo fontconfig freetype gdk_pixbuf glib gtk pango - ] - ++ stdenv.lib.optional jackaudioSupport jack2 - ; - - makeFlags="PREFIX=$(out)"; - FPATH="$out"; # <- where to search - - phases = [ "unpackPhase installPhase postInstall" ]; - - installPhase = '' - sed -i 23,24d tools/faust2appls/faust2jack - mkdir $out/bin - install tools/faust2appls/faust2alsaconsole $out/bin - install tools/faust2appls/faustpath $out/bin - install tools/faust2appls/faustoptflags $out/bin - install tools/faust2appls/faust2alsa $out/bin - install tools/faust2appls/faust2jack $out/bin - - patchShebangs $out/bin - - wrapProgram $out/bin/faust2alsaconsole \ - --prefix PKG_CONFIG_PATH : ${alsaLib}/lib/pkgconfig \ - --set FAUSTLIB ${faust-compiler}/lib/faust \ - --set FAUSTINC ${faust-compiler}/include/ - - GTK_PKGCONFIG_PATHS=${gtk}/lib/pkgconfig:${pango}/lib/pkgconfig:${glib}/lib/pkgconfig:${cairo}/lib/pkgconfig:${gdk_pixbuf}/lib/pkgconfig:${atk}/lib/pkgconfig:${freetype}/lib/pkgconfig:${fontconfig}/lib/pkgconfig - - wrapProgram $out/bin/faust2alsa \ - --prefix PKG_CONFIG_PATH : ${alsaLib}/lib/pkgconfig:$GTK_PKGCONFIG_PATHS \ - --set FAUSTLIB ${faust-compiler}/lib/faust \ - --set FAUSTINC ${faust-compiler}/include/ \ - - - wrapProgram $out/bin/faust2jack \ - --prefix PKG_CONFIG_PATH : ${jack2}/lib/pkgconfig:${opencv}/lib/pkgconfig:$GTK_PKGCONFIG_PATHS \ - --set FAUSTLIB ${faust-compiler}/lib/faust \ - --set FAUSTINC ${faust-compiler}/include/ \ - - '' - + stdenv.lib.optionalString (!gtkSupport) "rm $out/bin/faust2alsa" - + stdenv.lib.optionalString (!gtkSupport || !jackaudioSupport) "rm $out/bin/faust2jack" - ; - postInstall = '' - sed -e "s@\$FAUST_INSTALL /usr/local /usr /opt /opt/local@${faust-compiler}@g" -i $out/bin/faustpath - sed -i "s@/bin/bash@${bash}/bin/bash@g" $out/bin/faustoptflags - find $out/bin/ -name "*faust2*" -type f | xargs sed "s@pkg-config@${pkgconfig}/bin/pkg-config@g" -i - find $out/bin/ -name "*faust2*" -type f | xargs sed "s@CXX=g++@CXX=${gcc}/bin/g++@g" -i - find $out/bin/ -name "*faust2*" -type f | xargs sed "s@faust -i -a @${faust-compiler}/bin/faust -i -a ${faust-compiler}/lib/faust/@g" -i - ''; - meta = with stdenv.lib; { - 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. - ''; homepage = http://faust.grame.fr/; downloadPage = http://sourceforge.net/projects/faudiostream/files/; license = licenses.gpl2; platforms = platforms.linux; - maintainers = [ maintainers.magnetophon ]; + maintainers = with maintainers; [ magnetophon pmahoney ]; + }; + + faust = stdenv.mkDerivation { + + name = "faust-${version}"; + + inherit src; + + buildInputs = [ makeWrapper ]; + + passthru = { + inherit wrap wrapWithBuildEnv; + }; + + preConfigure = '' + makeFlags="$makeFlags prefix=$out" + + # The faust makefiles use 'system ?= $(shell uname -s)' but nix + # defines 'system' env var, so undefine that so faust detects the + # correct system. + unset system + ''; + + # Remove most faust2appl scripts since they won't run properly + # without additional paths setup. See faust.wrap, + # faust.wrapWithBuildEnv. + postInstall = '' + # syntax error when eval'd directly + pattern="faust2!(svg)" + (shopt -s extglob; rm "$out"/bin/$pattern) + ''; + + postFixup = '' + # Set faustpath explicitly. + substituteInPlace "$out"/bin/faustpath \ + --replace "/usr/local /usr /opt /opt/local" "$out" + + # 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; + + configurePhase = ":"; + + buildPhase = ":"; + + 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 ". faustpath" ". '${faust}/bin/faustpath'" \ + --replace ". faustoptflags" ". '${faust}/bin/faustoptflags'" + 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) // { + + buildInputs = [ makeWrapper pkgconfig ]; + + propagatedBuildInputs = [ faust ] ++ propagatedBuildInputs; + + postFixup = '' + + # export parts of the build environment + for script in "$out"/bin/*; do + wrapProgram "$script" \ + --set FAUST_LIB_PATH "${faust}/lib/faust" \ + --prefix PATH : "$PATH" \ + --prefix PKG_CONFIG_PATH : "$PKG_CONFIG_PATH" \ + --set NIX_CFLAGS_COMPILE "\"$NIX_CFLAGS_COMPILE\"" \ + --set NIX_LDFLAGS "\"$NIX_LDFLAGS\"" + 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) // { + + buildInputs = [ makeWrapper ]; + + postFixup = '' + for script in "$out"/bin/*; do + wrapProgram "$script" --prefix PATH : "${runtimePath}" + done + ''; + + }); + +in faust diff --git a/pkgs/applications/audio/faust/faust2alqt.nix b/pkgs/applications/audio/faust/faust2alqt.nix new file mode 100644 index 00000000000..8ac26e488b3 --- /dev/null +++ b/pkgs/applications/audio/faust/faust2alqt.nix @@ -0,0 +1,15 @@ +{ faust +, alsaLib +, qt4 +}: + +faust.wrapWithBuildEnv { + + baseName = "faust2alqt"; + + propagatedBuildInputs = [ + alsaLib + qt4 + ]; + +} diff --git a/pkgs/applications/audio/faust/faust2alsa.nix b/pkgs/applications/audio/faust/faust2alsa.nix new file mode 100644 index 00000000000..2fe03d73a23 --- /dev/null +++ b/pkgs/applications/audio/faust/faust2alsa.nix @@ -0,0 +1,29 @@ +{ faust +, alsaLib +, atk +, cairo +, fontconfig +, freetype +, gdk_pixbuf +, glib +, gtk +, pango +}: + +faust.wrapWithBuildEnv { + + baseName = "faust2alsa"; + + propagatedBuildInputs = [ + alsaLib + atk + cairo + fontconfig + freetype + gdk_pixbuf + glib + gtk + pango + ]; + +} diff --git a/pkgs/applications/audio/faust/faust2csound.nix b/pkgs/applications/audio/faust/faust2csound.nix new file mode 100644 index 00000000000..eb5e5831cdd --- /dev/null +++ b/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/pkgs/applications/audio/faust/faust2firefox.nix b/pkgs/applications/audio/faust/faust2firefox.nix new file mode 100644 index 00000000000..b2cc6f46457 --- /dev/null +++ b/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/pkgs/applications/audio/faust/faust2jack.nix b/pkgs/applications/audio/faust/faust2jack.nix new file mode 100644 index 00000000000..bec523ad021 --- /dev/null +++ b/pkgs/applications/audio/faust/faust2jack.nix @@ -0,0 +1,23 @@ +{ faust +, gtk +, jack2 +, opencv +}: + +faust.wrapWithBuildEnv { + + baseName = "faust2jack"; + + scripts = [ + "faust2jack" + "faust2jackinternal" + "faust2jackconsole" + ]; + + propagatedBuildInputs = [ + gtk + jack2 + opencv + ]; + +} diff --git a/pkgs/applications/audio/faust/faust2jaqt.nix b/pkgs/applications/audio/faust/faust2jaqt.nix new file mode 100644 index 00000000000..3590bc6860d --- /dev/null +++ b/pkgs/applications/audio/faust/faust2jaqt.nix @@ -0,0 +1,22 @@ +{ faust +, jack2 +, opencv +, qt4 +}: + +faust.wrapWithBuildEnv { + + baseName = "faust2jaqt"; + + scripts = [ + "faust2jaqt" + "faust2jackserver" + ]; + + propagatedBuildInputs = [ + jack2 + opencv + qt4 + ]; + +} diff --git a/pkgs/applications/audio/faust/faust2lv2.nix b/pkgs/applications/audio/faust/faust2lv2.nix new file mode 100644 index 00000000000..4d11395e738 --- /dev/null +++ b/pkgs/applications/audio/faust/faust2lv2.nix @@ -0,0 +1,11 @@ +{ faust +, lv2 +}: + +faust.wrapWithBuildEnv { + + baseName = "faust2lv2"; + + propagatedBuildInputs = [ lv2 ]; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ef579c9ac32..e5a674824f3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13665,10 +13665,21 @@ let fakenes = callPackage ../misc/emulators/fakenes { }; - faust = callPackage ../applications/audio/faust { }; - faust-compiler = callPackage ../applications/audio/faust-compiler { }; + faust2alqt = callPackage ../applications/audio/faust/faust2alqt.nix { }; + + faust2alsa = callPackage ../applications/audio/faust/faust2alsa.nix { }; + + faust2csound = callPackage ../applications/audio/faust/faust2csound.nix { }; + + faust2firefox = callPackage ../applications/audio/faust/faust2firefox.nix { }; + + faust2jack = callPackage ../applications/audio/faust/faust2jack.nix { }; + + faust2jaqt = callPackage ../applications/audio/faust/faust2jaqt.nix { }; + + faust2lv2 = callPackage ../applications/audio/faust/faust2lv2.nix { }; fceux = callPackage ../misc/emulators/fceux { }; |