summary refs log tree commit diff
path: root/pkgs/development/compilers/emscripten
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-04-17 15:40:30 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2018-04-17 15:42:25 -0500
commit1592e03abaed9be050e1546fb6dd28d2436f9c39 (patch)
treed4318f6faaa2bb43d66564fa2328da22ead732fc /pkgs/development/compilers/emscripten
parent6bd83e624c1d3478a255044704fd173ad84198fd (diff)
downloadnixpkgs-1592e03abaed9be050e1546fb6dd28d2436f9c39.tar
nixpkgs-1592e03abaed9be050e1546fb6dd28d2436f9c39.tar.gz
nixpkgs-1592e03abaed9be050e1546fb6dd28d2436f9c39.tar.bz2
nixpkgs-1592e03abaed9be050e1546fb6dd28d2436f9c39.tar.lz
nixpkgs-1592e03abaed9be050e1546fb6dd28d2436f9c39.tar.xz
nixpkgs-1592e03abaed9be050e1546fb6dd28d2436f9c39.tar.zst
nixpkgs-1592e03abaed9be050e1546fb6dd28d2436f9c39.zip
treewide: rename bad filenames
Most of these can easily be moved to subdirectories of other
directories. This helps reduce clutter in the main trees.
Diffstat (limited to 'pkgs/development/compilers/emscripten')
-rw-r--r--pkgs/development/compilers/emscripten/fastcomp/default.nix28
-rw-r--r--pkgs/development/compilers/emscripten/fastcomp/emscripten-fastcomp.nix55
2 files changed, 83 insertions, 0 deletions
diff --git a/pkgs/development/compilers/emscripten/fastcomp/default.nix b/pkgs/development/compilers/emscripten/fastcomp/default.nix
new file mode 100644
index 00000000000..10c1107da02
--- /dev/null
+++ b/pkgs/development/compilers/emscripten/fastcomp/default.nix
@@ -0,0 +1,28 @@
+{ newScope, stdenv, binutils, wrapCCWith, symlinkJoin }:
+let
+  callPackage = newScope (self // {inherit stdenv;});
+
+  self = {
+    emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {};
+    emscriptenfastcomp-wrapped = wrapCCWith {
+      cc = self.emscriptenfastcomp-unwrapped;
+      # Never want Apple's cctools for WASM target
+      bintools = binutils;
+      libc = stdenv.cc.libc;
+      extraBuildCommands = ''
+        # hardening flags break WASM support
+        cat > $out/nix-support/add-hardening.sh
+      '';
+    };
+    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 00000000000..5317cf25d41
--- /dev/null
+++ b/pkgs/development/compilers/emscripten/fastcomp/emscripten-fastcomp.nix
@@ -0,0 +1,55 @@
+{ emscriptenVersion, stdenv, llvm, fetchFromGitHub, cmake, python, gtest, ... }:
+
+let
+  rev = emscriptenVersion;
+  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 = "04j698gmp686b5lricjakm5hyh2z2kh28m1ffkghmkyz4zkzmx98";
+    inherit rev;
+  };
+
+  srcFL = fetchFromGitHub {
+    owner = "kripken";
+    repo = "emscripten-fastcomp-clang";
+    sha256 = "1ici51mmpgg80xk3y8f376nbbfak6rz27qdy98l8lxkrymklp5g5";
+    inherit rev;
+  };
+
+  nativeBuildInputs = [ cmake python gtest ];
+  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=ON"
+    #"-DLLVM_CONFIG=${llvm}/bin/llvm-config"
+    "-DLLVM_BUILD_TESTS=ON"
+    "-DCLANG_INCLUDE_TESTS=ON"
+  ] ++ (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;
+  };
+}