Loading pkgs/build-support/dotnet/auto-patchcil-hook/auto-patchcil.sh 0 → 100644 +118 −0 Original line number Diff line number Diff line #!@shell@ # shellcheck shell=bash declare -a autoPatchcilLibs declare -a extraAutoPatchcilLibs gatherLibraries() { if [ -d "$1/lib" ]; then autoPatchcilLibs+=("$1/lib") fi } addEnvHooks "${targetOffset:?}" gatherLibraries # Can be used to manually add additional directories with shared object files # to be included for the next autoPatchcil invocation. addAutoPatchcilSearchPath() { local -a findOpts=() while [ $# -gt 0 ]; do case "$1" in --) shift break ;; --no-recurse) shift findOpts+=("-maxdepth" 1) ;; --*) echo "addAutoPatchcilSearchPath: ERROR: Invalid command line" \ "argument: $1" >&2 return 1 ;; *) break ;; esac done local dir= while IFS= read -r -d '' dir; do extraAutoPatchcilLibs+=("$dir") done < <( find "$@" "${findOpts[@]}" \! -type d \ \( -name '*.so' -o -name '*.so.*' \) -print0 | sed -z 's#/[^/]*$##' | uniq -z ) } autoPatchcil() { local rid= local norecurse= while [ $# -gt 0 ]; do case "$1" in --) shift break ;; --rid) rid="$2" shift 2 ;; --no-recurse) shift norecurse=1 ;; --*) echo "autoPatchcil: ERROR: Invalid command line" \ "argument: $1" >&2 return 1 ;; *) break ;; esac done if [ -z "$rid" ]; then echo "autoPatchcil: ERROR: No RID (Runtime ID) provided." >&2 return 1 fi local ignoreMissingDepsArray=("--ignore-missing") concatTo ignoreMissingDepsArray autoPatchcilIgnoreMissingDeps if [ ${#ignoreMissingDepsArray[@]} -lt 2 ]; then ignoreMissingDepsArray=() fi local autoPatchcilFlags=( ${norecurse:+--no-recurse} --rid "$rid" "${ignoreMissingDepsArray[@]}" --paths "$@" --libs "${autoPatchcilLibs[@]}" ) # shellcheck disable=SC2016 echoCmd 'patchcil auto flags' "${autoPatchcilFlags[@]}" @patchcil@ auto "${autoPatchcilFlags[@]}" } autoPatchcilFixupOutput() { if [[ -z "${dontAutoPatchcil-}" ]]; then if [ -n "${dotnetRuntimeIds+x}" ]; then if [[ -n $__structuredAttrs ]]; then local dotnetRuntimeIdsArray=("${dotnetRuntimeIds[@]}") else # shellcheck disable=SC2206 # Intentionally expanding it to preserve old behavior local dotnetRuntimeIdsArray=($dotnetRuntimeIds) fi else local dotnetRuntimeIdsArray=("") fi autoPatchcil --rid "${autoPatchcilRuntimeId:-${dotnetRuntimeIdsArray[0]}}" -- "${prefix:?}" fi } fixupOutputHooks+=(autoPatchcilFixupOutput) pkgs/build-support/dotnet/auto-patchcil-hook/default.nix 0 → 100644 +14 −0 Original line number Diff line number Diff line { lib, bash, patchcil, makeSetupHook, }: makeSetupHook { name = "auto-patchcil-hook"; substitutions = { shell = lib.getExe bash; patchcil = lib.getExe patchcil; }; } ./auto-patchcil.sh pkgs/development/compilers/dotnet/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ let patchNupkgs = callPackage ./patch-nupkgs.nix { }; nugetPackageHook = callPackage ./nuget-package-hook.nix { }; autoPatchcilHook = callPackage ../../../build-support/dotnet/auto-patchcil-hook { }; buildDotnetModule = callPackage ../../../build-support/dotnet/build-dotnet-module { }; buildDotnetGlobalTool = callPackage ../../../build-support/dotnet/build-dotnet-global-tool { }; Loading pkgs/top-level/all-packages.nix +1 −0 Original line number Diff line number Diff line Loading @@ -495,6 +495,7 @@ with pkgs; buildDotnetGlobalTool mkNugetSource mkNugetDeps autoPatchcilHook ; dotnetenv = callPackage ../build-support/dotnet/dotnetenv { Loading Loading
pkgs/build-support/dotnet/auto-patchcil-hook/auto-patchcil.sh 0 → 100644 +118 −0 Original line number Diff line number Diff line #!@shell@ # shellcheck shell=bash declare -a autoPatchcilLibs declare -a extraAutoPatchcilLibs gatherLibraries() { if [ -d "$1/lib" ]; then autoPatchcilLibs+=("$1/lib") fi } addEnvHooks "${targetOffset:?}" gatherLibraries # Can be used to manually add additional directories with shared object files # to be included for the next autoPatchcil invocation. addAutoPatchcilSearchPath() { local -a findOpts=() while [ $# -gt 0 ]; do case "$1" in --) shift break ;; --no-recurse) shift findOpts+=("-maxdepth" 1) ;; --*) echo "addAutoPatchcilSearchPath: ERROR: Invalid command line" \ "argument: $1" >&2 return 1 ;; *) break ;; esac done local dir= while IFS= read -r -d '' dir; do extraAutoPatchcilLibs+=("$dir") done < <( find "$@" "${findOpts[@]}" \! -type d \ \( -name '*.so' -o -name '*.so.*' \) -print0 | sed -z 's#/[^/]*$##' | uniq -z ) } autoPatchcil() { local rid= local norecurse= while [ $# -gt 0 ]; do case "$1" in --) shift break ;; --rid) rid="$2" shift 2 ;; --no-recurse) shift norecurse=1 ;; --*) echo "autoPatchcil: ERROR: Invalid command line" \ "argument: $1" >&2 return 1 ;; *) break ;; esac done if [ -z "$rid" ]; then echo "autoPatchcil: ERROR: No RID (Runtime ID) provided." >&2 return 1 fi local ignoreMissingDepsArray=("--ignore-missing") concatTo ignoreMissingDepsArray autoPatchcilIgnoreMissingDeps if [ ${#ignoreMissingDepsArray[@]} -lt 2 ]; then ignoreMissingDepsArray=() fi local autoPatchcilFlags=( ${norecurse:+--no-recurse} --rid "$rid" "${ignoreMissingDepsArray[@]}" --paths "$@" --libs "${autoPatchcilLibs[@]}" ) # shellcheck disable=SC2016 echoCmd 'patchcil auto flags' "${autoPatchcilFlags[@]}" @patchcil@ auto "${autoPatchcilFlags[@]}" } autoPatchcilFixupOutput() { if [[ -z "${dontAutoPatchcil-}" ]]; then if [ -n "${dotnetRuntimeIds+x}" ]; then if [[ -n $__structuredAttrs ]]; then local dotnetRuntimeIdsArray=("${dotnetRuntimeIds[@]}") else # shellcheck disable=SC2206 # Intentionally expanding it to preserve old behavior local dotnetRuntimeIdsArray=($dotnetRuntimeIds) fi else local dotnetRuntimeIdsArray=("") fi autoPatchcil --rid "${autoPatchcilRuntimeId:-${dotnetRuntimeIdsArray[0]}}" -- "${prefix:?}" fi } fixupOutputHooks+=(autoPatchcilFixupOutput)
pkgs/build-support/dotnet/auto-patchcil-hook/default.nix 0 → 100644 +14 −0 Original line number Diff line number Diff line { lib, bash, patchcil, makeSetupHook, }: makeSetupHook { name = "auto-patchcil-hook"; substitutions = { shell = lib.getExe bash; patchcil = lib.getExe patchcil; }; } ./auto-patchcil.sh
pkgs/development/compilers/dotnet/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ let patchNupkgs = callPackage ./patch-nupkgs.nix { }; nugetPackageHook = callPackage ./nuget-package-hook.nix { }; autoPatchcilHook = callPackage ../../../build-support/dotnet/auto-patchcil-hook { }; buildDotnetModule = callPackage ../../../build-support/dotnet/build-dotnet-module { }; buildDotnetGlobalTool = callPackage ../../../build-support/dotnet/build-dotnet-global-tool { }; Loading
pkgs/top-level/all-packages.nix +1 −0 Original line number Diff line number Diff line Loading @@ -495,6 +495,7 @@ with pkgs; buildDotnetGlobalTool mkNugetSource mkNugetDeps autoPatchcilHook ; dotnetenv = callPackage ../build-support/dotnet/dotnetenv { Loading