Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / compilers / coreclr / default.nix
blobf38a38059624b61034f95b5d126f5cf97ef773f0
1 { config, lib, stdenv
2 , fetchFromGitHub
3 , fetchpatch
4 , which
5 , cmake
6 , llvmPackages
7 , libunwind
8 , gettext
9 , openssl
10 , python2
11 , icu
12 , lttng-ust
13 , liburcu
14 , libuuid
15 , libkrb5
16 , debug ? config.coreclr.debug or false
19 stdenv.mkDerivation rec {
20   pname = "coreclr";
21   version = "2.0.7";
23   src = fetchFromGitHub {
24     owner  = "dotnet";
25     repo   = "coreclr";
26     rev    = "v${version}";
27     sha256 = "0pzkrfgqywhpijbx7j1v4lxa6270h6whymb64jdkp7yj56ipqh2n";
28   };
30   patches = [
31     (fetchpatch {
32       # glibc 2.26
33       url = "https://github.com/dotnet/coreclr/commit/a8f83b615708c529b112898e7d2fbc3f618b26ee.patch";
34       sha256 = "047ph5gip4z2h7liwdxsmpnlaq0sd3hliaw4nyqjp647m80g3ffq";
35     })
36     (fetchpatch {
37       # clang 5
38       url = "https://github.com/dotnet/coreclr/commit/9b22e1a767dee38f351001c5601f56d78766a43e.patch";
39       sha256 = "1w1lxw5ryvhq8m5m0kv880c4bh6y9xdgypkr76sqbh3v568yghzg";
40     })
41   ];
43   nativeBuildInputs = [
44     which
45     cmake
46     llvmPackages.clang
47   ];
49   buildInputs = [
50     llvmPackages.llvm
51     llvmPackages.lldb
52     libunwind
53     gettext
54     openssl
55     python2
56     icu
57     lttng-ust
58     liburcu
59     libuuid
60     libkrb5
61   ];
63   configurePhase = ''
64     # override to avoid cmake running
65     patchShebangs .
66   '';
68   BuildArch = if stdenv.is64bit then "x64" else "x86";
69   BuildType = if debug then "Debug" else "Release";
71   hardeningDisable = [
72     "strictoverflow"
73     "format"
74   ];
76   buildPhase = ''
77     runHook preBuild
78     # disable -Werror which can potentially breaks with every compiler upgrade
79     ./build.sh $BuildArch $BuildType cmakeargs "-DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF"
80     runHook postBuild
81   '';
83   installPhase = ''
84     runHook preInstall
85     mkdir -p $out/share/dotnet $out/bin
86     cp -r bin/Product/Linux.$BuildArch.$BuildType/* $out/share/dotnet
87     for cmd in coreconsole corerun createdump crossgen ilasm ildasm mcs superpmi; do
88       ln -s $out/share/dotnet/$cmd $out/bin/$cmd
89     done
90     runHook postInstall
91   '';
93   meta = with lib; {
94     homepage = "https://github.com/dotnet/core/";
95     description = ".NET is a general purpose development platform";
96     platforms = [ "x86_64-linux" ];
97     maintainers = with maintainers; [ kuznero ];
98     license = licenses.mit;
99   };