about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2017-09-15 17:46:25 +0200
committerGitHub <noreply@github.com>2017-09-15 17:46:25 +0200
commit3a4add5de19b28c272f23cb0bd4724d99235f523 (patch)
tree062a7853c60787278dcbfafe3e90b11287d26c87 /pkgs
parentc13cf47e7971cd94553d55caca6a004dc72c98e1 (diff)
parent8550e4e520d22868e91807968c128cf83399f22e (diff)
downloadnixlib-3a4add5de19b28c272f23cb0bd4724d99235f523.tar
nixlib-3a4add5de19b28c272f23cb0bd4724d99235f523.tar.gz
nixlib-3a4add5de19b28c272f23cb0bd4724d99235f523.tar.bz2
nixlib-3a4add5de19b28c272f23cb0bd4724d99235f523.tar.lz
nixlib-3a4add5de19b28c272f23cb0bd4724d99235f523.tar.xz
nixlib-3a4add5de19b28c272f23cb0bd4724d99235f523.tar.zst
nixlib-3a4add5de19b28c272f23cb0bd4724d99235f523.zip
Merge pull request #29322 from mguentner/move_emscripten_from_top_level
emscriptenfastcomp: move wrap magic to own file, use newScope
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/emscripten-fastcomp/default.nix70
-rw-r--r--pkgs/development/compilers/emscripten-fastcomp/emscripten-fastcomp.nix54
-rw-r--r--pkgs/top-level/all-packages.nix18
3 files changed, 76 insertions, 66 deletions
diff --git a/pkgs/development/compilers/emscripten-fastcomp/default.nix b/pkgs/development/compilers/emscripten-fastcomp/default.nix
index f35ca26584f1..e543f799495f 100644
--- a/pkgs/development/compilers/emscripten-fastcomp/default.nix
+++ b/pkgs/development/compilers/emscripten-fastcomp/default.nix
@@ -1,54 +1,22 @@
-{ stdenv, fetchFromGitHub, cmake, python, ... }:
-
+{ newScope, stdenv, wrapCC, wrapCCWith, symlinkJoin }:
 let
-  rev = "1.37.16";
-  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
-in
-stdenv.mkDerivation rec {
-  name = "emscripten-fastcomp-${rev}";
-
-  src = fetchFromGitHub {
-    owner = "kripken";
-    repo = "emscripten-fastcomp";
-    sha256 = "0wj9sc0gciaiidcjv6wb0qn6ks06xds7q34351masc7qpvd217by";
-    inherit rev;
-  };
-
-  srcFL = fetchFromGitHub {
-    owner = "kripken";
-    repo = "emscripten-fastcomp-clang";
-    sha256 = "1akdgxzxhzjbhp4d14ajcrp9jrf39x004a726ly2gynqc185l4j7";
-    inherit rev;
-  };
-
-  nativeBuildInputs = [ cmake python ];
-  preConfigure = ''
-    cp -Lr ${srcFL} tools/clang
-    chmod +w -R tools/clang
-  '';
-  cmakeFlags = [
-    "-DCMAKE_BUILD_TYPE=Release"
-    "-DLLVM_TARGETS_TO_BUILD='X86;JSBackend'"
-    "-DLLVM_INCLUDE_EXAMPLES=OFF"
-    "-DLLVM_INCLUDE_TESTS=OFF"
-    # "-DCLANG_INCLUDE_EXAMPLES=OFF"
-    "-DCLANG_INCLUDE_TESTS=OFF"
-  ] ++ (stdenv.lib.optional stdenv.isLinux
-    # necessary for clang to find crtend.o
-    "-DGCC_INSTALL_PREFIX=${gcc}"
-  );
-  enableParallelBuilding = true;
-
-  passthru = {
-    isClang = true;
-    inherit gcc;
-  };
+  callPackage = newScope (self // {inherit stdenv;});
 
-  meta = with stdenv.lib; {
-    homepage = https://github.com/kripken/emscripten-fastcomp;
-    description = "Emscripten LLVM";
-    platforms = platforms.all;
-    maintainers = with maintainers; [ qknight matthewbauer ];
-    license = stdenv.lib.licenses.ncsa;
+  self = {
+    emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {};
+    emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc ''
+      # hardening flags break WASM support
+      cat > $out/nix-support/add-hardening.sh
+    '' self.emscriptenfastcomp-unwrapped;
+    emscriptenfastcomp = symlinkJoin {
+      name = "emscriptenfastcomp";
+      paths = [ self.emscriptenfastcomp-wrapped self.emscriptenfastcomp-unwrapped ];
+      preferLocalBuild = false;
+      allowSubstitutes = true;
+      postBuild = ''
+        # replace unwrapped clang-3.9 binary by wrapper
+        ln -sf $out/bin/clang $out/bin/clang-[0-9]*
+      '';
+    };
   };
-}
+in self
diff --git a/pkgs/development/compilers/emscripten-fastcomp/emscripten-fastcomp.nix b/pkgs/development/compilers/emscripten-fastcomp/emscripten-fastcomp.nix
new file mode 100644
index 000000000000..f35ca26584f1
--- /dev/null
+++ b/pkgs/development/compilers/emscripten-fastcomp/emscripten-fastcomp.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchFromGitHub, cmake, python, ... }:
+
+let
+  rev = "1.37.16";
+  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
+in
+stdenv.mkDerivation rec {
+  name = "emscripten-fastcomp-${rev}";
+
+  src = fetchFromGitHub {
+    owner = "kripken";
+    repo = "emscripten-fastcomp";
+    sha256 = "0wj9sc0gciaiidcjv6wb0qn6ks06xds7q34351masc7qpvd217by";
+    inherit rev;
+  };
+
+  srcFL = fetchFromGitHub {
+    owner = "kripken";
+    repo = "emscripten-fastcomp-clang";
+    sha256 = "1akdgxzxhzjbhp4d14ajcrp9jrf39x004a726ly2gynqc185l4j7";
+    inherit rev;
+  };
+
+  nativeBuildInputs = [ cmake python ];
+  preConfigure = ''
+    cp -Lr ${srcFL} tools/clang
+    chmod +w -R tools/clang
+  '';
+  cmakeFlags = [
+    "-DCMAKE_BUILD_TYPE=Release"
+    "-DLLVM_TARGETS_TO_BUILD='X86;JSBackend'"
+    "-DLLVM_INCLUDE_EXAMPLES=OFF"
+    "-DLLVM_INCLUDE_TESTS=OFF"
+    # "-DCLANG_INCLUDE_EXAMPLES=OFF"
+    "-DCLANG_INCLUDE_TESTS=OFF"
+  ] ++ (stdenv.lib.optional stdenv.isLinux
+    # necessary for clang to find crtend.o
+    "-DGCC_INSTALL_PREFIX=${gcc}"
+  );
+  enableParallelBuilding = true;
+
+  passthru = {
+    isClang = true;
+    inherit gcc;
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/kripken/emscripten-fastcomp;
+    description = "Emscripten LLVM";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ qknight matthewbauer ];
+    license = stdenv.lib.licenses.ncsa;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e2c7ac55350e..659bf3b30d54 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1823,21 +1823,9 @@ with pkgs;
 
   emscripten = callPackage ../development/compilers/emscripten { };
 
-  emscriptenfastcomp-unwrapped = callPackage ../development/compilers/emscripten-fastcomp { };
-  emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc ''
-    # hardening flags break WASM support
-    cat > $out/nix-support/add-hardening.sh
-  '' emscriptenfastcomp-unwrapped;
-  emscriptenfastcomp = symlinkJoin {
-    name = "emscriptenfastcomp";
-    paths = [ emscriptenfastcomp-wrapped emscriptenfastcomp-unwrapped ];
-    preferLocalBuild = false;
-    allowSubstitutes = true;
-    postBuild = ''
-      # replace unwrapped clang-3.9 binary by wrapper
-      ln -sf $out/bin/clang $out/bin/clang-[0-9]*
-    '';
-  };
+  emscriptenfastcompPackages = callPackage ../development/compilers/emscripten-fastcomp { };
+
+  emscriptenfastcomp = emscriptenfastcompPackages.emscriptenfastcomp;
 
   emscriptenPackages = recurseIntoAttrs (callPackage ./emscripten-packages.nix { });