2015-03-23 17:51:10 +01:00
|
|
|
{ stdenv
|
|
|
|
, coreutils
|
2017-06-15 01:42:55 +02:00
|
|
|
, fetchFromGitHub
|
2015-03-23 17:51:10 +01:00
|
|
|
, makeWrapper
|
|
|
|
, pkgconfig
|
2020-01-27 12:48:57 +01:00
|
|
|
, cmake
|
2015-11-17 15:29:45 +01:00
|
|
|
, llvm
|
2020-08-29 15:48:13 +02:00
|
|
|
, emscripten
|
2015-11-17 15:29:45 +01:00
|
|
|
, openssl
|
|
|
|
, libsndfile
|
|
|
|
, libmicrohttpd
|
2020-01-27 12:48:57 +01:00
|
|
|
, gnutls
|
|
|
|
, libtasn1
|
|
|
|
, p11-kit
|
2015-11-17 15:29:45 +01:00
|
|
|
, vim
|
2020-01-27 12:48:57 +01:00
|
|
|
, which
|
2015-03-23 17:51:10 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib.strings;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2020-08-27 21:07:44 +02:00
|
|
|
version = "unstable-2020-08-27";
|
2015-03-23 17:51:10 +01:00
|
|
|
|
2017-06-15 01:42:55 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grame-cncm";
|
|
|
|
repo = "faust";
|
2020-08-27 21:07:44 +02:00
|
|
|
rev = "c10f316fa90f338e248787ebf55e3795c3a0d70e";
|
|
|
|
sha256 = "068pm04ddafbsj2r8akdpqyzb0m8mp9ql0rgi83hcqs4ndr8v7sb";
|
2018-01-05 23:24:06 +01:00
|
|
|
fetchSubmodules = true;
|
2015-03-23 17:51:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://faust.grame.fr/";
|
2020-06-09 05:43:11 +02:00
|
|
|
downloadPage = "https://github.com/grame-cncm/faust/";
|
2015-03-23 17:51:10 +01:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ magnetophon pmahoney ];
|
|
|
|
};
|
|
|
|
|
|
|
|
faust = stdenv.mkDerivation {
|
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
pname = "faust";
|
|
|
|
inherit version;
|
2015-03-23 17:51:10 +01:00
|
|
|
|
|
|
|
inherit src;
|
|
|
|
|
2020-01-27 12:48:57 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper pkgconfig cmake vim which ];
|
2020-08-29 15:48:13 +02:00
|
|
|
buildInputs = [ llvm emscripten openssl libsndfile libmicrohttpd gnutls libtasn1 p11-kit ];
|
2015-11-17 15:29:45 +01:00
|
|
|
|
2015-03-23 17:51:10 +01:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit wrap wrapWithBuildEnv;
|
|
|
|
};
|
|
|
|
|
2015-11-17 15:29:45 +01:00
|
|
|
|
2015-03-23 17:51:10 +01:00
|
|
|
preConfigure = ''
|
2020-01-27 12:48:57 +01:00
|
|
|
cd build
|
2015-03-23 17:51:10 +01:00
|
|
|
'';
|
|
|
|
|
2020-01-27 12:48:57 +01:00
|
|
|
cmakeFlags = ''
|
|
|
|
-C ../backends/all.cmake -C ../targets/all.cmake ..
|
2018-05-21 17:44:15 +02:00
|
|
|
'';
|
|
|
|
|
2015-03-23 17:51:10 +01:00
|
|
|
postInstall = ''
|
|
|
|
# syntax error when eval'd directly
|
2018-04-09 14:32:35 +02:00
|
|
|
pattern="faust2!(*@(atomsnippets|graph|graphviewer|md|plot|sig|sigviewer|svg))"
|
2015-03-23 17:51:10 +01:00
|
|
|
(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;
|
|
|
|
|
2016-05-04 12:08:35 +02:00
|
|
|
dontBuild = true;
|
2015-03-23 17:51:10 +01:00
|
|
|
|
|
|
|
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" \
|
2016-10-30 15:59:25 +01:00
|
|
|
--replace " error " "echo"
|
2015-03-23 17:51:10 +01:00
|
|
|
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) // {
|
|
|
|
|
2017-09-18 21:00:50 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2017-09-05 23:26:13 +02:00
|
|
|
buildInputs = [ makeWrapper ];
|
2015-03-23 17:51:10 +01:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ faust ] ++ propagatedBuildInputs;
|
|
|
|
|
2020-01-27 12:48:57 +01:00
|
|
|
libPath = stdenv.lib.makeLibraryPath propagatedBuildInputs;
|
2018-05-21 17:44:15 +02:00
|
|
|
|
2015-03-23 17:51:10 +01:00
|
|
|
postFixup = ''
|
|
|
|
|
|
|
|
# export parts of the build environment
|
|
|
|
for script in "$out"/bin/*; do
|
|
|
|
wrapProgram "$script" \
|
2020-01-27 12:48:57 +01:00
|
|
|
--set FAUSTLDDIR "${faust}/lib" \
|
2017-06-15 01:42:55 +02:00
|
|
|
--set FAUSTLIB "${faust}/share/faust" \
|
2016-10-30 15:59:25 +01:00
|
|
|
--set FAUSTINC "${faust}/include/faust" \
|
2020-01-27 12:48:57 +01:00
|
|
|
--set FAUSTARCH "${faust}/share/faust" \
|
2015-03-23 17:51:10 +01:00
|
|
|
--prefix PATH : "$PATH" \
|
|
|
|
--prefix PKG_CONFIG_PATH : "$PKG_CONFIG_PATH" \
|
2016-07-30 10:39:34 +02:00
|
|
|
--set NIX_CFLAGS_COMPILE "$NIX_CFLAGS_COMPILE" \
|
2020-01-27 12:48:57 +01:00
|
|
|
--set NIX_LDFLAGS "$NIX_LDFLAGS -lpthread" \
|
|
|
|
--prefix LIBRARY_PATH $libPath
|
2015-03-23 17:51:10 +01:00
|
|
|
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
|