@@ -1,210 +0,0 @@
1−{ stdenv
2−, coreutils
3−, fetchgit
4−, makeWrapper
5−, pkgconfig
6−}:
7−
8−with stdenv.lib.strings;
9−
10−let
11−
12− version = "2016-07-19";
13−
14− src = fetchgit {
15− url = "git://git.code.sf.net/p/faudiostream/code";
16− rev = "16c22dc0193c10521b1dc16f98443d9c206bb5dd";
17− sha256 = "01rbcjfhpd5casi72ffi1j95f65ji60l629sgav93pvs0kpdacz5";
18− };
19−
20− meta = with stdenv.lib; {
21− homepage = http://faust.grame.fr/;
22− downloadPage = http://sourceforge.net/projects/faudiostream/files/;
23− license = licenses.gpl2;
24− platforms = platforms.linux;
25− maintainers = with maintainers; [ magnetophon pmahoney ];
26− };
27−
28− faust = stdenv.mkDerivation {
29−
30− name = "faust-${version}";
31−
32− inherit src;
33−
34− buildInputs = [ makeWrapper ];
35−
36− passthru = {
37− inherit wrap wrapWithBuildEnv;
38− };
39−
40− preConfigure = ''
41− makeFlags="$makeFlags prefix=$out"
42−
43− # The faust makefiles use 'system ?= $(shell uname -s)' but nix
44− # defines 'system' env var, so undefine that so faust detects the
45− # correct system.
46− unset system
47− '';
48−
49− # Remove most faust2appl scripts since they won't run properly
50− # without additional paths setup. See faust.wrap,
51− # faust.wrapWithBuildEnv.
52− postInstall = ''
53− # syntax error when eval'd directly
54− pattern="faust2!(svg)"
55− (shopt -s extglob; rm "$out"/bin/$pattern)
56− '';
57−
58− postFixup = ''
59− # Set faustpath explicitly.
60− substituteInPlace "$out"/bin/faustpath \
61− --replace "/usr/local /usr /opt /opt/local" "$out"
62−
63− # The 'faustoptflags' is 'source'd into other faust scripts and
64− # not used as an executable, so patch 'uname' usage directly
65− # rather than use makeWrapper.
66− substituteInPlace "$out"/bin/faustoptflags \
67− --replace uname "${coreutils}/bin/uname"
68−
69− # wrapper for scripts that don't need faust.wrap*
70− for script in "$out"/bin/faust2*; do
71− wrapProgram "$script" \
72− --prefix PATH : "$out"/bin
73− done
74− '';
75−
76− meta = meta // {
77− description = "A functional programming language for realtime audio signal processing";
78− longDescription = ''
79− FAUST (Functional Audio Stream) is a functional programming
80− language specifically designed for real-time signal processing
81− and synthesis. FAUST targets high-performance signal processing
82− applications and audio plug-ins for a variety of platforms and
83− standards.
84− The Faust compiler translates DSP specifications into very
85− efficient C++ code. Thanks to the notion of architecture,
86− FAUST programs can be easily deployed on a large variety of
87− audio platforms and plugin formats (jack, alsa, ladspa, maxmsp,
88− puredata, csound, supercollider, pure, vst, coreaudio) without
89− any change to the FAUST code.
90−
91− This package has just the compiler, libraries, and headers.
92− Install faust2* for specific faust2appl scripts.
93− '';
94− };
95−
96− };
97−
98− # Default values for faust2appl.
99− faust2ApplBase =
100− { baseName
101− , dir ? "tools/faust2appls"
102− , scripts ? [ baseName ]
103− , ...
104− }@args:
105−
106− args // {
107− name = "${baseName}-${version}";
108−
109− inherit src;
110−
111− configurePhase = ":";
112−
113− buildPhase = ":";
114−
115− installPhase = ''
116− runHook preInstall
117−
118− mkdir -p "$out/bin"
119− for script in ${concatStringsSep " " scripts}; do
120− cp "${dir}/$script" "$out/bin/"
121− done
122−
123− runHook postInstall
124− '';
125−
126− postInstall = ''
127− # For the faust2appl script, change 'faustpath' and
128− # 'faustoptflags' to absolute paths.
129− for script in "$out"/bin/*; do
130− substituteInPlace "$script" \
131− --replace ". faustpath" ". '${faust}/bin/faustpath'" \
132− --replace ". faustoptflags" ". '${faust}/bin/faustoptflags'"
133− done
134− '';
135−
136− meta = meta // {
137− description = "The ${baseName} script, part of faust functional programming language for realtime audio signal processing";
138− };
139− };
140−
141− # Some 'faust2appl' scripts, such as faust2alsa, run faust to
142− # generate cpp code, then invoke the c++ compiler to build the code.
143− # This builder wraps these scripts in parts of the stdenv such that
144− # when the scripts are called outside any nix build, they behave as
145− # if they were running inside a nix build in terms of compilers and
146− # paths being configured (e.g. rpath is set so that compiled
147− # binaries link to the libs inside the nix store)
148− #
149− # The function takes two main args: the appl name (e.g.
150− # 'faust2alsa') and an optional list of propagatedBuildInputs. It
151− # returns a derivation that contains only the bin/${appl} script,
152− # wrapped up so that it will run as if it was inside a nix build
153− # with those build inputs.
154− #
155− # The build input 'faust' is automatically added to the
156− # propagatedBuildInputs.
157− wrapWithBuildEnv =
158− { baseName
159− , propagatedBuildInputs ? [ ]
160− , ...
161− }@args:
162−
163− stdenv.mkDerivation ((faust2ApplBase args) // {
164−
165− buildInputs = [ makeWrapper pkgconfig ];
166−
167− propagatedBuildInputs = [ faust ] ++ propagatedBuildInputs;
168−
169− postFixup = ''
170−
171− # export parts of the build environment
172− for script in "$out"/bin/*; do
173− wrapProgram "$script" \
174− --set FAUSTLIB "${faust}/lib/faust" \
175− --set FAUSTINC "${faust}/include/faust" \
176− --prefix PATH : "$PATH" \
177− --prefix PKG_CONFIG_PATH : "$PKG_CONFIG_PATH" \
178− --set NIX_CFLAGS_COMPILE "$NIX_CFLAGS_COMPILE" \
179− --set NIX_LDFLAGS "$NIX_LDFLAGS"
180− done
181− '';
182− });
183−
184− # Builder for 'faust2appl' scripts, such as faust2firefox that
185− # simply need to be wrapped with some dependencies on PATH.
186− #
187− # The build input 'faust' is automatically added to the PATH.
188− wrap =
189− { baseName
190− , runtimeInputs ? [ ]
191− , ...
192− }@args:
193−
194− let
195−
196− runtimePath = concatStringsSep ":" (map (p: "${p}/bin") ([ faust ] ++ runtimeInputs));
197−
198− in stdenv.mkDerivation ((faust2ApplBase args) // {
199−
200− buildInputs = [ makeWrapper ];
201−
202− postFixup = ''
203− for script in "$out"/bin/*; do
204− wrapProgram "$script" --prefix PATH : "${runtimePath}"
205− done
206− '';
207−
208− });
209−
210−in faust