blob: f9aba29a43555cf61e1fd00cbd930148a31ece68 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# First argument is the executable you want to wrap,
# the second is the destination for the wrapper.
wrapDotnetProgram() {
local -r dotnetRuntime=@dotnetRuntime@
local -r wrapperPath=@wrapperPath@
local -r dotnetFromEnvScript='dotnetFromEnv() {
local dotnetPath
if command -v dotnet 2>&1 >/dev/null; then
dotnetPath=$(which dotnet) && \
dotnetPath=$(realpath "$dotnetPath") && \
dotnetPath=$(dirname "$dotnetPath") && \
export DOTNET_ROOT="$dotnetPath"
fi
}
dotnetFromEnv'
if [[ -n $__structuredAttrs ]]; then
local -r dotnetRuntimeDepsArray=( "${dotnetRuntimeDeps[@]}" )
local -r makeWrapperArgsArray=( "${makeWrapperArgs[@]}" )
else
local -r dotnetRuntimeDepsArray=($dotnetRuntimeDeps)
local -r makeWrapperArgsArray=($makeWrapperArgs)
fi
local dotnetRuntimeDepsFlags=()
if (( ${#dotnetRuntimeDepsArray[@]} > 0 )); then
local libraryPathArray=("${dotnetRuntimeDepsArray[@]/%//lib}")
local OLDIFS="$IFS" IFS=':'
dotnetRuntimeDepsFlags+=("--suffix" "LD_LIBRARY_PATH" ":" "${libraryPathArray[*]}")
IFS="$OLDIFS"
fi
local dotnetRootFlagsArray=()
if [[ -z ${dotnetSelfContainedBuild-} ]]; then
if [[ -n ${useDotnetFromEnv-} ]]; then
# if dotnet CLI is available, set DOTNET_ROOT based on it. Otherwise set to default .NET runtime
dotnetRootFlagsArray+=("--suffix" "PATH" ":" "$wrapperPath")
dotnetRootFlagsArray+=("--run" "$dotnetFromEnvScript")
dotnetRootFlagsArray+=("--set-default" "DOTNET_ROOT" "$dotnetRuntime")
dotnetRootFlagsArray+=("--suffix" "PATH" ":" "$dotnetRuntime/bin")
else
dotnetRootFlagsArray+=("--set" "DOTNET_ROOT" "$dotnetRuntime")
dotnetRootFlagsArray+=("--prefix" "PATH" ":" "$dotnetRuntime/bin")
fi
fi
makeWrapper "$1" "$2" \
"${dotnetRuntimeDepsFlags[@]}" \
"${dotnetRootFlagsArray[@]}" \
"${gappsWrapperArgs[@]}" \
"${makeWrapperArgsArray[@]}"
echo "installed wrapper to "$2""
}
dotnetFixupHook() {
echo "Executing dotnetFixupPhase"
local -r dotnetInstallPath="${dotnetInstallPath-$out/lib/$pname}"
local executable executableBasename
# check if dotnetExecutables is declared (including empty values, in which case we generate no executables)
if declare -p dotnetExecutables &>/dev/null; then
if [[ -n $__structuredAttrs ]]; then
local dotnetExecutablesArray=( "${dotnetExecutables[@]}" )
else
local dotnetExecutablesArray=($dotnetExecutables)
fi
for executable in "${dotnetExecutablesArray[@]}"; do
executableBasename=$(basename "$executable")
local path="$dotnetInstallPath/$executable"
if test -x "$path"; then
wrapDotnetProgram "$path" "$out/bin/$executableBasename"
else
echo "Specified binary \"$executable\" is either not an executable or does not exist!"
echo "Looked in $path"
exit 1
fi
done
else
while IFS= read -d '' executable; do
executableBasename=$(basename "$executable")
wrapDotnetProgram "$executable" "$out/bin/$executableBasename" \;
done < <(find "$dotnetInstallPath" ! -name "*.dll" -executable -type f -print0)
fi
echo "Finished dotnetFixupPhase"
}
if [[ -z "${dontDotnetFixup-}" ]]; then
preFixupPhases+=" dotnetFixupHook"
fi
|