1{ stdenv
2, fetchFromGitHub
3, fetchpatch
4, which
5, cmake
6, clang
7, llvmPackages
8, libunwind
9, gettext
10, openssl
11, python2
12, icu
13, lttng-ust
14, liburcu
15, libuuid
16, libkrb5
17, debug ? false
18}:
19
20stdenv.mkDerivation rec {
21 name = "coreclr-${version}";
22 version = "2.0.0";
23
24 src = fetchFromGitHub {
25 owner = "dotnet";
26 repo = "coreclr";
27 rev = "v${version}";
28 sha256 = "16z58ix8kmk8csfy5qsqz8z30czhrap2vb8s8vdflmbcfnq31jcw";
29 };
30
31 patches = [
32 (fetchpatch {
33 # glibc 2.26
34 url = https://github.com/dotnet/coreclr/commit/a8f83b615708c529b112898e7d2fbc3f618b26ee.patch;
35 sha256 = "047ph5gip4z2h7liwdxsmpnlaq0sd3hliaw4nyqjp647m80g3ffq";
36 })
37 ];
38
39 buildInputs = [
40 which
41 cmake
42 clang
43 llvmPackages.llvm
44 llvmPackages.lldb
45 libunwind
46 gettext
47 openssl
48 python2
49 icu
50 lttng-ust
51 liburcu
52 libuuid
53 libkrb5
54 ];
55
56 configurePhase = ''
57 # override to avoid cmake running
58 patchShebangs .
59 '';
60
61 BuildArch = if stdenv.is64bit then "x64" else "x86";
62 BuildType = if debug then "Debug" else "Release";
63
64 hardeningDisable = [
65 "strictoverflow"
66 "format"
67 ];
68
69 buildPhase = ''
70 runHook preBuild
71 ./build.sh $BuildArch $BuildType
72 runHook postBuild
73 '';
74
75 installPhase = ''
76 runHook preInstall
77 mkdir -p $out/share/dotnet $out/bin
78 cp -r bin/Product/Linux.$BuildArch.$BuildType/* $out/share/dotnet
79 for cmd in coreconsole corerun createdump crossgen ilasm ildasm mcs superpmi; do
80 ln -s $out/share/dotnet/$cmd $out/bin/$cmd
81 done
82 runHook postInstall
83 '';
84
85 meta = with stdenv.lib; {
86 homepage = https://dotnet.github.io/core/;
87 description = ".NET is a general purpose development platform";
88 platforms = [ "x86_64-linux" ];
89 maintainers = with maintainers; [ kuznero ];
90 license = licenses.mit;
91 };
92}