summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-12-13 16:08:36 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-12-13 16:08:36 -0500
commit7ef4448c97a8f13f0bd18bb67a84919121b941ea (patch)
treebae7bbf73a4f08bb11a3b355da6a91a2d0a5a158 /pkgs/development/compilers/llvm
parent26a5612aebd10668e10a67ad54092a2690ffa281 (diff)
parent9d8f9b2e531bf95a700a949d879927fb6996ffc9 (diff)
downloadnixpkgs-7ef4448c97a8f13f0bd18bb67a84919121b941ea.tar
nixpkgs-7ef4448c97a8f13f0bd18bb67a84919121b941ea.tar.gz
nixpkgs-7ef4448c97a8f13f0bd18bb67a84919121b941ea.tar.bz2
nixpkgs-7ef4448c97a8f13f0bd18bb67a84919121b941ea.tar.lz
nixpkgs-7ef4448c97a8f13f0bd18bb67a84919121b941ea.tar.xz
nixpkgs-7ef4448c97a8f13f0bd18bb67a84919121b941ea.tar.zst
nixpkgs-7ef4448c97a8f13f0bd18bb67a84919121b941ea.zip
Merge commit '9d8f9b2e531bf95a700a949d879927fb6996ffc9' into binutils-wrapper
Diffstat (limited to 'pkgs/development/compilers/llvm')
-rw-r--r--pkgs/development/compilers/llvm/multi.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/development/compilers/llvm/multi.nix b/pkgs/development/compilers/llvm/multi.nix
new file mode 100644
index 00000000000..0fa0eb3404d
--- /dev/null
+++ b/pkgs/development/compilers/llvm/multi.nix
@@ -0,0 +1,44 @@
+{ runCommand,
+clang,
+gcc64,
+gcc32,
+glibc_multi
+}:
+
+let
+  combine = basegcc: runCommand "combine-gcc-libc" {} ''
+    mkdir -p $out
+    cp -r ${basegcc.cc}/lib $out/lib
+
+    chmod u+rw -R $out/lib
+    cp -r ${basegcc.libc}/lib/* $(ls -d $out/lib/gcc/*/*)
+  '';
+  gcc_multi_sysroot = runCommand "gcc-multi-sysroot" {} ''
+    mkdir -p $out/lib/gcc
+
+    ln -s ${combine gcc64}/lib/gcc/* $out/lib/gcc/
+    ln -s ${combine gcc32}/lib/gcc/* $out/lib/gcc/
+    # XXX: This shouldn't be needed, clang just doesn't look for "i686-unknown"
+    ln -s $out/lib/gcc/i686-unknown-linux-gnu $out/lib/gcc/i686-pc-linux-gnu
+
+
+    # includes
+    ln -s ${glibc_multi.dev}/include $out/
+
+    # dynamic linkers
+    mkdir -p $out/lib/32
+    ln -s ${glibc_multi.out}/lib/ld-linux* $out/lib
+    ln -s ${glibc_multi.out}/lib/32/ld-linux* $out/lib/32/
+  '';
+
+  clangMulti = clang.override {
+    # Only used for providing expected structure re:dynamic linkers, AFAIK
+    # Most of the magic is done by setting the --gcc-toolchain option below
+    libc = gcc_multi_sysroot;
+
+    extraBuildCommands = ''
+      sed -e '$a --gcc-toolchain=${gcc_multi_sysroot}' -i $out/nix-support/libc-cflags
+    '';
+  };
+
+in clangMulti