3
0
Fork 0
forked from mirrors/nixpkgs

build-dotnet-module: restore for current runtime by default

This commit is contained in:
David McFarland 2022-09-26 14:35:14 -03:00
parent 13861970f4
commit 824d40aa04
15 changed files with 21 additions and 55 deletions

View file

@ -121,7 +121,6 @@ in buildDotnetModule rec {
dotnet-sdk = dotnetCorePackages.sdk_3_1;
dotnet-runtime = dotnetCorePackages.net_5_0;
dotnetFlags = [ "--runtime linux-x64" ];
executables = [ "foo" ]; # This wraps "$out/lib/$pname/foo" to `$out/bin/foo`.
executables = []; # Don't install any executables.

View file

@ -25,8 +25,6 @@ buildDotnetModule rec {
dotnet-sdk = dotnetCorePackages.sdk_3_1;
dotnet-runtime = dotnetCorePackages.aspnetcore_3_1;
dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system}" ];
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ stdenv.cc.cc.lib zlib ];

View file

@ -91,8 +91,6 @@ buildDotnetModule rec {
"/p:ExtraDefineConstants=DISABLE_UPDATER"
];
dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ];
executables = [
"Ryujinx.Headless.SDL2"
"Ryujinx.Ava"

View file

@ -25,9 +25,6 @@ buildDotnetModule rec {
nugetDeps = ./deps.nix;
# Without this dotnet attempts to restore for Windows targets, which it cannot find the dependencies for
dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ];
projectFile = "ArchiSteamFarm.sln";
executables = [ "ArchiSteamFarm" ];

View file

@ -59,6 +59,9 @@
# Libraries that need to be available at runtime should be passed through this.
# These get wrapped into `LD_LIBRARY_PATH`.
, runtimeDeps ? [ ]
# The dotnet runtime ID. If null, fetch-deps will gather dependencies for all
# platforms in meta.platforms which are supported by the sdk.
, runtimeId ? null
# Tests to disable. This gets passed to `dotnet test --filter "FullyQualifiedName!={}"`, to ensure compatibility with all frameworks.
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#filter-option-details for more details.
@ -90,6 +93,10 @@ let
inherit (callPackage ./hooks {
inherit dotnet-sdk dotnet-test-sdk disabledTests nuget-source dotnet-runtime runtimeDeps buildType;
runtimeId =
if runtimeId != null
then runtimeId
else dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system;
}) dotnetConfigureHook dotnetBuildHook dotnetCheckHook dotnetInstallHook dotnetFixupHook;
localDeps =
@ -156,16 +163,11 @@ stdenvNoCC.mkDerivation (args // {
fetch-deps =
let
# Derivations may set flags such as `--runtime <rid>` based on the host platform to avoid restoring/building nuget dependencies they dont have or dont need.
# This introduces an issue; In this script we loop over all platforms from `meta` and add the RID flag for it, as to fetch all required dependencies.
# The script would inherit the RID flag from the derivation based on the platform building the script, and set the flag for any iteration we do over the RIDs.
# That causes conflicts. To circumvent it we remove all occurances of the flag.
flags =
let
isRuntime = flag: lib.hasPrefix "--runtime" flag;
in
builtins.filter (flag: !(isRuntime flag)) (dotnetFlags ++ dotnetRestoreFlags);
runtimeIds = map (system: dotnetCorePackages.systemToDotnetRid system) platforms;
flags = dotnetFlags ++ dotnetRestoreFlags;
runtimeIds =
if runtimeId != null
then [ runtimeId ]
else map (system: dotnetCorePackages.systemToDotnetRid system) platforms;
in
writeShellScript "fetch-${pname}-deps" ''
set -euo pipefail

View file

@ -9,7 +9,9 @@
, dotnet-runtime
, runtimeDeps
, buildType
, runtimeId
}:
assert (builtins.isString runtimeId);
let
libraryPath = lib.makeLibraryPath runtimeDeps;
@ -21,6 +23,7 @@ in
deps = [ dotnet-sdk nuget-source ];
substitutions = {
nugetSource = nuget-source;
inherit runtimeId;
};
} ./dotnet-configure-hook.sh) { };
@ -29,7 +32,7 @@ in
name = "dotnet-build-hook";
deps = [ dotnet-sdk ];
substitutions = {
inherit buildType;
inherit buildType runtimeId;
};
} ./dotnet-build-hook.sh) { };
@ -49,7 +52,7 @@ in
name = "dotnet-install-hook";
deps = [ dotnet-sdk ];
substitutions = {
inherit buildType;
inherit buildType runtimeId;
};
} ./dotnet-install-hook.sh) { };

View file

@ -15,7 +15,7 @@ dotnetBuildHook() {
fi
if [ "${selfContainedBuild-}" ]; then
dotnetBuildFlags+=("-p:SelfContained=true")
dotnetBuildFlags+=(--runtime "@runtimeId@" "-p:SelfContained=true")
else
dotnetBuildFlags+=("-p:SelfContained=false")
fi

View file

@ -18,6 +18,7 @@ dotnetConfigureHook() {
env dotnet restore ${project-} \
-p:ContinuousIntegrationBuild=true \
-p:Deterministic=true \
--runtime "@runtimeId@" \
--source "@nugetSource@/lib" \
${parallelFlag-} \
${dotnetRestoreFlags[@]} \

View file

@ -7,7 +7,7 @@ dotnetInstallHook() {
runHook preInstall
if [ "${selfContainedBuild-}" ]; then
dotnetInstallFlags+=("--self-contained")
dotnetInstallFlags+=(--runtime "@runtimeId@" "--self-contained")
else
dotnetInstallFlags+=("--no-self-contained")
fi
@ -21,7 +21,6 @@ dotnetInstallHook() {
env dotnet publish ${project-} \
-p:ContinuousIntegrationBuild=true \
-p:Deterministic=true \
-p:UseAppHost=true \
--output "$out/lib/${pname}" \
--configuration "@buildType@" \
--no-build \

View file

@ -26,8 +26,6 @@ buildDotnetModule rec {
dotnet-sdk = dotnetCorePackages.sdk_3_1;
dotnet-runtime = dotnetCorePackages.runtime_3_1;
dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system}" ];
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ stdenv.cc.cc.lib ];
runtimeDeps = [ openssl icu ];

View file

@ -29,7 +29,6 @@ let finalPackage = buildDotnetModule rec {
patchelf
];
dotnetRestoreFlags = [ "--runtime ${dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system}" ];
dotnetInstallFlags = [ "--framework net6.0" ];
dotnetBuildFlags = [ "--framework net6.0" "--no-self-contained" ];
dotnetFlags = [

View file

@ -28,10 +28,6 @@ buildDotnetModule rec {
nativeBuildInputs = [ copyDesktopItems ];
dotnetFlags = [
"--runtime linux-x64"
];
runtimeDeps = [
ffmpeg
alsa-lib

View file

@ -23,12 +23,8 @@ in
nugetDeps = ./deps.nix; # File generated with `nix-build -A xivlauncher.passthru.fetch-deps`
dotnetFlags = [
"--runtime linux-x64"
"-p:BuildHash=${rev}"
];
dotnetBuildFlags = [
"--no-self-contained"
"-p:PublishSingleFile=false"
];
postPatch = ''

View file

@ -12,21 +12,6 @@
, sqlite
}:
let
os = if stdenv.isDarwin then "osx" else "linux";
arch =
with stdenv.hostPlatform;
if isx86_32 then "x86"
else if isx86_64 then "x64"
else if isAarch32 then "arm"
else if isAarch64 then "arm64"
else lib.warn "Unsupported architecture, some image processing features might be unavailable" "unknown";
musl = lib.optionalString stdenv.hostPlatform.isMusl
(lib.warnIf (arch != "x64") "Some image processing features might be unavailable for non x86-64 with Musl"
"musl-");
# https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#using-rids
runtimeId = "${os}-${musl}${arch}";
in
buildDotnetModule rec {
pname = "jellyfin";
version = "10.8.8"; # ensure that jellyfin-web has matching version
@ -57,7 +42,6 @@ buildDotnetModule rec {
];
dotnet-sdk = dotnetCorePackages.sdk_6_0;
dotnet-runtime = dotnetCorePackages.aspnetcore_6_0;
dotnetFlags = [ "--runtime=${runtimeId}" ];
dotnetBuildFlags = [ "--no-self-contained" ];
preInstall = ''

View file

@ -27,10 +27,6 @@ buildDotnetModule rec {
openssl
];
dotnetFlags = [
"--runtime linux-x64"
];
meta = with lib; {
homepage = "https://github.com/13xforever/ps3-disc-dumper";
description = "A handy utility to make decrypted PS3 disc dumps";