faust: refactored derivation

+212
+1
lib/maintainers.nix
··· 152 152 pjones = "Peter Jones <pjones@devalot.com>"; 153 153 pkmx = "Chih-Mao Chen <pkmx.tw@gmail.com>"; 154 154 plcplc = "Philip Lykke Carlsen <plcplc@gmail.com>"; 155 + pmahoney = "Patrick Mahoney <pat@polycrystal.org>"; 155 156 prikhi = "Pavan Rikhi <pavan.rikhi@gmail.com>"; 156 157 pSub = "Pascal Wittmann <mail@pascal-wittmann.de>"; 157 158 puffnfresh = "Brian McKenna <brian@brianmckenna.org>";
+209
pkgs/applications/audio/faust/default.nix
··· 1 + { stdenv 2 + , coreutils 3 + , fetchgit 4 + , makeWrapper 5 + , pkgconfig 6 + }: 7 + 8 + with stdenv.lib.strings; 9 + 10 + let 11 + 12 + version = "8-1-2015"; 13 + 14 + src = fetchgit { 15 + url = git://git.code.sf.net/p/faudiostream/code; 16 + rev = "4db76fdc02b6aec8d15a5af77fcd5283abe963ce"; 17 + sha256 = "f1ac92092ee173e4bcf6b2cb1ac385a7c390fb362a578a403b2b6edd5dc7d5d0"; 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 FAUST_LIB_PATH "${faust}/lib/faust" \ 175 + --prefix PATH : "$PATH" \ 176 + --prefix PKG_CONFIG_PATH : "$PKG_CONFIG_PATH" \ 177 + --set NIX_CFLAGS_COMPILE "\"$NIX_CFLAGS_COMPILE\"" \ 178 + --set NIX_LDFLAGS "\"$NIX_LDFLAGS\"" 179 + done 180 + ''; 181 + }); 182 + 183 + # Builder for 'faust2appl' scripts, such as faust2firefox that 184 + # simply need to be wrapped with some dependencies on PATH. 185 + # 186 + # The build input 'faust' is automatically added to the PATH. 187 + wrap = 188 + { baseName 189 + , runtimeInputs ? [ ] 190 + , ... 191 + }@args: 192 + 193 + let 194 + 195 + runtimePath = concatStringsSep ":" (map (p: "${p}/bin") ([ faust ] ++ runtimeInputs)); 196 + 197 + in stdenv.mkDerivation ((faust2ApplBase args) // { 198 + 199 + buildInputs = [ makeWrapper ]; 200 + 201 + postFixup = '' 202 + for script in "$out"/bin/*; do 203 + wrapProgram "$script" --prefix PATH : "${runtimePath}" 204 + done 205 + ''; 206 + 207 + }); 208 + 209 + in faust
+2
pkgs/top-level/all-packages.nix
··· 13516 13516 13517 13517 fakenes = callPackage ../misc/emulators/fakenes { }; 13518 13518 13519 + faust = callPackage ../applications/audio/faust { }; 13520 + 13519 13521 fceux = callPackage ../misc/emulators/fceux { }; 13520 13522 13521 13523 foldingathome = callPackage ../misc/foldingathome { };