Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnspy: init at 6.5.1 #348390

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10701,6 +10701,14 @@
githubId = 3267697;
name = "Joshua Potter";
};
js6pak = {
name = "js6pak";
email = "me@6pak.dev";
matrix = "@6pak:matrix.org";
github = "js6pak";
githubId = 35262707;
keys = [ { fingerprint = "66D1 1EA6 571D E4F9 16B3 B8EB 3E3C D91E B1AA FB06"; } ];
};
jshcmpbll = {
email = "me@joshuadcampbell.com";
github = "jshcmpbll";
Expand Down
9 changes: 5 additions & 4 deletions pkgs/build-support/dotnet/add-nuget-deps/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
cacert,
fetchNupkg,
callPackage,
buildPackages,
}:

{
Expand Down Expand Up @@ -65,8 +66,8 @@ attrs
innerScript = substituteAll {
src = ./fetch-deps.sh;
isExecutable = true;
inherit cacert;
nugetToNix = nuget-to-nix;
inherit (buildPackages) cacert;
nugetToNix = buildPackages.nuget-to-nix;
};

defaultDepsFile =
Expand All @@ -81,7 +82,7 @@ attrs
''$(mktemp -t "${finalAttrs.pname or finalPackage.name}-deps-XXXXXX.nix")'';

in
writeShellScript "${finalPackage.name}-fetch-deps" ''
buildPackages.writeShellScript "${finalPackage.name}-fetch-deps" ''
set -eu

echo 'fetching dependencies for' ${lib.escapeShellArg finalPackage.name} >&2
Expand All @@ -101,7 +102,7 @@ attrs

cd "$TMPDIR"

NIX_BUILD_SHELL=${lib.escapeShellArg runtimeShell} ${nix}/bin/nix-shell \
NIX_BUILD_SHELL=${lib.escapeShellArg buildPackages.runtimeShell} ${buildPackages.nix}/bin/nix-shell \
--pure --keep NUGET_HTTP_CACHE_PATH --run 'source '${lib.escapeShellArg innerScript}' '"''${depsFile@Q}" "${drv}"
'';
};
Expand Down
8 changes: 4 additions & 4 deletions pkgs/build-support/dotnet/build-dotnet-module/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
callPackage,
substituteAll,
writeShellScript,
makeWrapper,
makeBinaryWrapper,
dotnetCorePackages,
cacert,
addNuGetDeps,
Expand Down Expand Up @@ -93,7 +93,7 @@ let

platforms =
if args ? meta.platforms then
lib.intersectLists args.meta.platforms dotnet-sdk.meta.platforms
args.meta.platforms
else
dotnet-sdk.meta.platforms;

Expand Down Expand Up @@ -146,7 +146,7 @@ let
dotnetFixupHook

cacert
makeWrapper
makeBinaryWrapper
dotnet-sdk
];

Expand All @@ -173,7 +173,7 @@ let
++ (if (lib.length components) < 4 then lib.replicate (4 - (lib.length components)) "0" else [ ])
);

makeWrapperArgs = args.makeWrapperArgs or [ ] ++ [
makeWrapperArgs = args.makeWrapperArgs or [ ] ++ lib.optionals (!stdenvNoCC.hostPlatform.isWindows) [
"--prefix"
"LD_LIBRARY_PATH"
":"
Expand Down
18 changes: 1 addition & 17 deletions pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
, stdenv
, which
, coreutils
, zlib
, openssl
, makeSetupHook
, zip
# Passed from ../default.nix
, dotnet-sdk
, dotnet-runtime
Expand All @@ -14,16 +11,6 @@
dotnetConfigureHook = makeSetupHook
{
name = "dotnet-configure-hook";
substitutions = {
dynamicLinker = "${stdenv.cc}/nix-support/dynamic-linker";
libPath = lib.makeLibraryPath [
stdenv.cc.cc.lib
stdenv.cc.libc
dotnet-sdk.passthru.icu
zlib
openssl
];
};
}
./dotnet-configure-hook.sh;

Expand All @@ -42,9 +29,6 @@
dotnetInstallHook = makeSetupHook
{
name = "dotnet-install-hook";
substitutions = {
inherit zip;
};
}
./dotnet-install-hook.sh;

Expand All @@ -53,7 +37,7 @@
name = "dotnet-fixup-hook";
substitutions = {
dotnetRuntime = dotnet-runtime;
wrapperPath = lib.makeBinPath [ which coreutils ];
wrapperPath = lib.optionals (!stdenv.hostPlatform.isWindows) (lib.makeBinPath [ which coreutils ]);
};
}
./dotnet-fixup-hook.sh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ dotnetConfigureHook() {

runHook preConfigure

local -r dynamicLinker=@dynamicLinker@
local -r libPath=@libPath@

if [[ -n $__structuredAttrs ]]; then
local dotnetProjectFilesArray=( "${dotnetProjectFiles[@]}" )
local dotnetTestProjectFilesArray=( "${dotnetTestProjectFiles[@]}" )
Expand Down
6 changes: 6 additions & 0 deletions pkgs/build-support/dotnet/fetch-nupkg/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ lib.makeOverridable (
binaryBytecode
binaryNativeCode
];

# TODO https://github.com/dotnet/runtime/issues/108905
license = lib.optional (
lib.hasPrefix "Microsoft.NETCore.App.Runtime.win-" pname
|| lib.hasPrefix "Microsoft.WindowsDesktop.App.Runtime." pname
) lib.licenses.unfree;
};
};
in
Expand Down
17 changes: 15 additions & 2 deletions pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
{ targetPackages
{ stdenv
, targetPackages
, lib
, makeSetupHook
, dieHook
, writeShellScript
, tests
, cc ? targetPackages.stdenv.cc
, cc ? if (stdenv.targetPlatform.isMinGW) then
targetPackages.stdenv.cc.override
(old: {
cc = old.cc.override {
threadsCross = {
# Disable threading on mingw so we don't have to ship mcfgthreads
model = "single";
package = null;
};
};
})
else
targetPackages.stdenv.cc
, sanitizers ? []
}:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,31 @@ makeCWrapper() {
[ -z "$uses_stdio" ] || printf '%s\n' "#include <stdio.h>"
[ -z "$uses_string" ] || printf '%s\n' "#include <string.h>"
[ -z "$uses_assert_success" ] || printf '\n%s\n' "#define assert_success(e) do { if ((e) < 0) { perror(#e); abort(); } } while (0)"
printf '%s' '
#ifdef _WIN32
#include <windows.h>

int setenv(const char *name, const char *value, int overwrite) {
if (!name || !*name || strchr(name, '\''='\'')) {
return -1;
}

if (!overwrite && GetEnvironmentVariable(name, NULL, 0)) {
return 0;
}

if (SetEnvironmentVariable(name, value) == 0) {
return -1;
}

return 0;
}

int unsetenv(const char *name) {
return setenv(name, NULL, 1);
}
#endif
'
[ -z "$uses_prefix" ] || printf '\n%s\n' "$(setEnvPrefixFn)"
[ -z "$uses_suffix" ] || printf '\n%s\n' "$(setEnvSuffixFn)"
[ -z "$resolve_argv0" ] || printf '\n%s\n' "$(resolveArgv0Fn)"
Expand Down
80 changes: 80 additions & 0 deletions pkgs/by-name/dn/dnspy/deps.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions pkgs/by-name/dn/dnspy/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
lib,
callPackage,
pkgsCross,
stdenvNoCC,
buildDotnetModule,
fetchFromGitHub,
fetchpatch,
dotnetCorePackages,

is32Bit ? stdenvNoCC.hostPlatform.parsed.cpu.bits == 32,
}:
if (!stdenvNoCC.hostPlatform.isWindows) then
callPackage ./wrapper.nix {
inherit (if is32Bit then pkgsCross.mingw32 else pkgsCross.mingwW64) dnspy;
inherit is32Bit;
}
else
let
self = buildDotnetModule {
pname = "dnspy${lib.optionalString is32Bit "32"}";
version = "6.5.1";

src = fetchFromGitHub {
owner = "dnSpyEx";
repo = "dnSpy";
rev = "v${self.version}";
hash = "sha256-ttGQpwFLj7px1z+SZv1eelOkXA9bbG0F5nGUSNCsC6k=";
fetchSubmodules = true;
};

patches = [
# Disable WPF hardware acceleration when running dnSpy under Wine
(fetchpatch {
url = "https://github.com/dnSpyEx/dnSpy/commit/f20c00583c15d91214dee7e97e4f680a48e891a5.patch";
hash = "sha256-hpSXjm01ohePRmNopb0sm/KQM825gRm5kLznzauB81c=";
})

# Add Liberation Mono as monospace font fallback for Wine compatibility
(fetchpatch {
url = "https://github.com/dnSpyEx/dnSpy/commit/5ea1e361a457c7602832be2768655410294c930b.patch";
hash = "sha256-FgDxqFlPPIWE91O4Ie6tIYIbD3O/U33i+3XtD1kB7is=";
})
];

projectFile = [
"dnSpy/dnSpy/dnSpy.csproj"
"dnSpy/dnSpy.Console/dnSpy.Console.csproj"

"Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy/dnSpy.Decompiler.ILSpy.csproj"
"Extensions/dnSpy.Analyzer/dnSpy.Analyzer.csproj"
"Extensions/dnSpy.AsmEditor/dnSpy.AsmEditor.csproj"
"Extensions/dnSpy.BamlDecompiler/dnSpy.BamlDecompiler.csproj"
"Extensions/dnSpy.Debugger/dnSpy.Debugger/dnSpy.Debugger.csproj"
"Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet/dnSpy.Debugger.DotNet.csproj"
"Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/dnSpy.Debugger.DotNet.CorDebug.csproj"
"Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.Mono/dnSpy.Debugger.DotNet.Mono.csproj"
"Extensions/dnSpy.Scripting.Roslyn/dnSpy.Scripting.Roslyn.csproj"
];
nugetDeps = ./deps.nix;

dotnet-sdk = dotnetCorePackages.sdk_8_0;
dotnet-runtime =
with dotnetCorePackages;
combinePackages [
runtime_8_0
windowsdesktop_8_0
];

dotnetFlags = [ "-p:TargetFramework=net8.0-windows" ];

meta = {
description = ".NET debugger and assembly editor";
homepage = "https://github.com/dnSpyEx/dnSpy";
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryBytecode
binaryNativeCode
];
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ js6pak ];
platforms = [
"x86_64-windows"
"i686-windows"
];
};
};
in
self
Loading
Loading