dotnet: fix cross compilation
This commit is contained in:
parent
71003947fc
commit
051f3f948f
@ -4,12 +4,14 @@
|
||||
, icu #passing icu as an argument, because dotnet 3.1 has troubles with icu71
|
||||
}:
|
||||
|
||||
assert builtins.elem type [ "aspnetcore" "runtime" "sdk"];
|
||||
assert builtins.elem type [ "aspnetcore" "runtime" "sdk" ];
|
||||
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, writeText
|
||||
, autoPatchelfHook
|
||||
, makeWrapper
|
||||
, libunwind
|
||||
, openssl
|
||||
, libuuid
|
||||
@ -19,19 +21,21 @@ assert builtins.elem type [ "aspnetcore" "runtime" "sdk"];
|
||||
}:
|
||||
|
||||
let
|
||||
pname = if type == "aspnetcore" then
|
||||
"aspnetcore-runtime"
|
||||
else if type == "runtime" then
|
||||
"dotnet-runtime"
|
||||
else
|
||||
"dotnet-sdk";
|
||||
pname =
|
||||
if type == "aspnetcore" then
|
||||
"aspnetcore-runtime"
|
||||
else if type == "runtime" then
|
||||
"dotnet-runtime"
|
||||
else
|
||||
"dotnet-sdk";
|
||||
|
||||
descriptions = {
|
||||
aspnetcore = "ASP.NET Core Runtime ${version}";
|
||||
runtime = ".NET Runtime ${version}";
|
||||
sdk = ".NET SDK ${version}";
|
||||
};
|
||||
in stdenv.mkDerivation rec {
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version;
|
||||
|
||||
# Some of these dependencies are `dlopen()`ed.
|
||||
@ -47,8 +51,19 @@ in stdenv.mkDerivation rec {
|
||||
lttng-ust_2_12
|
||||
]);
|
||||
|
||||
src = fetchurl (srcs."${stdenv.hostPlatform.system}" or (throw
|
||||
"Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}"));
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
stdenv.cc.cc
|
||||
];
|
||||
|
||||
src = fetchurl (
|
||||
srcs."${stdenv.hostPlatform.system}" or (throw
|
||||
"Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")
|
||||
);
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
@ -68,10 +83,16 @@ in stdenv.mkDerivation rec {
|
||||
patchelf --set-rpath "${rpath}" $out/dotnet
|
||||
find $out -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \;
|
||||
find $out -type f \( -name "apphost" -or -name "createdump" \) -exec patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" --set-rpath '$ORIGIN:${rpath}' {} \;
|
||||
|
||||
wrapProgram $out/bin/dotnet \
|
||||
--prefix LD_LIBRARY_PATH : ${icu}/lib
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
# Fixes cross
|
||||
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
||||
|
||||
$out/bin/dotnet --info
|
||||
'';
|
||||
|
||||
@ -85,6 +106,10 @@ in stdenv.mkDerivation rec {
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit icu;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = builtins.getAttr type descriptions;
|
||||
homepage = "https://dotnet.github.io/";
|
||||
|
Loading…
Reference in New Issue
Block a user