1{ newScope, stdenv, binutils-raw, wrapCCWith, symlinkJoin }:
2let
3 callPackage = newScope (self // {inherit stdenv;});
4
5 self = {
6 emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {};
7 emscriptenfastcomp-wrapped = wrapCCWith {
8 cc = self.emscriptenfastcomp-unwrapped;
9 # Never want Apple's cctools for WASM target
10 bintools = binutils-raw;
11 libc = stdenv.cc.libc;
12 extraBuildCommands = ''
13 # hardening flags break WASM support
14 cat > $out/nix-support/add-hardening.sh
15 '';
16 };
17 emscriptenfastcomp = symlinkJoin {
18 name = "emscriptenfastcomp";
19 paths = [ self.emscriptenfastcomp-wrapped self.emscriptenfastcomp-unwrapped ];
20 preferLocalBuild = false;
21 allowSubstitutes = true;
22 postBuild = ''
23 # replace unwrapped clang-3.9 binary by wrapper
24 ln -sf $out/bin/clang $out/bin/clang-[0-9]*
25 '';
26 };
27 };
28in self