git.iko.soy/typeable/nixpkgs
on master help sign in
emscriptenfastcomp: move wrap magic to own file, use newScope
commit8550e4e520d22868e91807968c128cf83399f22e authorMaximilian Güntner <code@sourcediver.org> dateWed 13 Sep 2017, 19:12 (9 years ago) parent1b1fc65
3 files changed+76−66
pkgs/development/compilers/emscripten-fastcomp/default.nix+19−51 pkgs/development/compilers/emscripten-fastcomp/emscripten-fastcomp.nix+54 pkgs/top-level/all-packages.nix+3−15
pkgs/development/compilers/emscripten-fastcomp/default.nix+19−51
@@ -1,54 +1,22 @@
1−{ stdenv, fetchFromGitHub, cmake, python, ... }:
2−
1+{ newScope, stdenv, wrapCC, wrapCCWith, symlinkJoin }:
32let
4− rev = "1.37.16";
5− gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
6−in
7−stdenv.mkDerivation rec {
8− name = "emscripten-fastcomp-${rev}";
9−
10− src = fetchFromGitHub {
11− owner = "kripken";
12− repo = "emscripten-fastcomp";
13− sha256 = "0wj9sc0gciaiidcjv6wb0qn6ks06xds7q34351masc7qpvd217by";
14− inherit rev;
15− };
16−
17− srcFL = fetchFromGitHub {
18− owner = "kripken";
19− repo = "emscripten-fastcomp-clang";
20− sha256 = "1akdgxzxhzjbhp4d14ajcrp9jrf39x004a726ly2gynqc185l4j7";
21− inherit rev;
22− };
23−
24− nativeBuildInputs = [ cmake python ];
25− preConfigure = ''
26− cp -Lr ${srcFL} tools/clang
27− chmod +w -R tools/clang
28− '';
29− cmakeFlags = [
30− "-DCMAKE_BUILD_TYPE=Release"
31− "-DLLVM_TARGETS_TO_BUILD='X86;JSBackend'"
32− "-DLLVM_INCLUDE_EXAMPLES=OFF"
33− "-DLLVM_INCLUDE_TESTS=OFF"
34− # "-DCLANG_INCLUDE_EXAMPLES=OFF"
35− "-DCLANG_INCLUDE_TESTS=OFF"
36− ] ++ (stdenv.lib.optional stdenv.isLinux
37− # necessary for clang to find crtend.o
38− "-DGCC_INSTALL_PREFIX=${gcc}"
39− );
40− enableParallelBuilding = true;
41−
42− passthru = {
43− isClang = true;
44− inherit gcc;
45− };
3+ callPackage = newScope (self // {inherit stdenv;});
464
47− meta = with stdenv.lib; {
48− homepage = https://github.com/kripken/emscripten-fastcomp;
49− description = "Emscripten LLVM";
50− platforms = platforms.all;
51− maintainers = with maintainers; [ qknight matthewbauer ];
52− license = stdenv.lib.licenses.ncsa;
5+ self = {
6+ emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {};
7+ emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc ''
8+ # hardening flags break WASM support
9+ cat > $out/nix-support/add-hardening.sh
10+ '' self.emscriptenfastcomp-unwrapped;
11+ emscriptenfastcomp = symlinkJoin {
12+ name = "emscriptenfastcomp";
13+ paths = [ self.emscriptenfastcomp-wrapped self.emscriptenfastcomp-unwrapped ];
14+ preferLocalBuild = false;
15+ allowSubstitutes = true;
16+ postBuild = ''
17+ # replace unwrapped clang-3.9 binary by wrapper
18+ ln -sf $out/bin/clang $out/bin/clang-[0-9]*
19+ '';
20+ };
5321 };
54−}
22+in self
pkgs/development/compilers/emscripten-fastcomp/emscripten-fastcomp.nixnew file+54
@@ -0,0 +1,54 @@
1+{ stdenv, fetchFromGitHub, cmake, python, ... }:
2+
3+let
4+ rev = "1.37.16";
5+ gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
6+in
7+stdenv.mkDerivation rec {
8+ name = "emscripten-fastcomp-${rev}";
9+
10+ src = fetchFromGitHub {
11+ owner = "kripken";
12+ repo = "emscripten-fastcomp";
13+ sha256 = "0wj9sc0gciaiidcjv6wb0qn6ks06xds7q34351masc7qpvd217by";
14+ inherit rev;
15+ };
16+
17+ srcFL = fetchFromGitHub {
18+ owner = "kripken";
19+ repo = "emscripten-fastcomp-clang";
20+ sha256 = "1akdgxzxhzjbhp4d14ajcrp9jrf39x004a726ly2gynqc185l4j7";
21+ inherit rev;
22+ };
23+
24+ nativeBuildInputs = [ cmake python ];
25+ preConfigure = ''
26+ cp -Lr ${srcFL} tools/clang
27+ chmod +w -R tools/clang
28+ '';
29+ cmakeFlags = [
30+ "-DCMAKE_BUILD_TYPE=Release"
31+ "-DLLVM_TARGETS_TO_BUILD='X86;JSBackend'"
32+ "-DLLVM_INCLUDE_EXAMPLES=OFF"
33+ "-DLLVM_INCLUDE_TESTS=OFF"
34+ # "-DCLANG_INCLUDE_EXAMPLES=OFF"
35+ "-DCLANG_INCLUDE_TESTS=OFF"
36+ ] ++ (stdenv.lib.optional stdenv.isLinux
37+ # necessary for clang to find crtend.o
38+ "-DGCC_INSTALL_PREFIX=${gcc}"
39+ );
40+ enableParallelBuilding = true;
41+
42+ passthru = {
43+ isClang = true;
44+ inherit gcc;
45+ };
46+
47+ meta = with stdenv.lib; {
48+ homepage = https://github.com/kripken/emscripten-fastcomp;
49+ description = "Emscripten LLVM";
50+ platforms = platforms.all;
51+ maintainers = with maintainers; [ qknight matthewbauer ];
52+ license = stdenv.lib.licenses.ncsa;
53+ };
54+}
pkgs/top-level/all-packages.nix+3−15
@@ -1816,21 +1816,9 @@ with pkgs;
18161816
18171817 emscripten = callPackage ../development/compilers/emscripten { };
18181818
1819− emscriptenfastcomp-unwrapped = callPackage ../development/compilers/emscripten-fastcomp { };
1820− emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc ''
1821− # hardening flags break WASM support
1822− cat > $out/nix-support/add-hardening.sh
1823− '' emscriptenfastcomp-unwrapped;
1824− emscriptenfastcomp = symlinkJoin {
1825− name = "emscriptenfastcomp";
1826− paths = [ emscriptenfastcomp-wrapped emscriptenfastcomp-unwrapped ];
1827− preferLocalBuild = false;
1828− allowSubstitutes = true;
1829− postBuild = ''
1830− # replace unwrapped clang-3.9 binary by wrapper
1831− ln -sf $out/bin/clang $out/bin/clang-[0-9]*
1832− '';
1833− };
1819+ emscriptenfastcompPackages = callPackage ../development/compilers/emscripten-fastcomp { };
1820+
1821+ emscriptenfastcomp = emscriptenfastcompPackages.emscriptenfastcomp;
18341822
18351823 emscriptenPackages = recurseIntoAttrs (callPackage ./emscripten-packages.nix { });
18361824