forked from filipnavara/dotnet-riscv
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpatch_runtime.sh
More file actions
executable file
·56 lines (49 loc) · 1.76 KB
/
Copy pathpatch_runtime.sh
File metadata and controls
executable file
·56 lines (49 loc) · 1.76 KB
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
#!/bin/bash
export TOP_DIR="$(cd "$(dirname "$(which "$0")")" ; pwd -P)"
# Fixup profile: "minimal" (default) applies only the correctness fixups;
# "perf" additionally applies the riscv64 code-quality fixups on top.
profile="${1:-minimal}"
case "$profile" in
minimal)
profile_dirs="minimal"
;;
perf|performance)
profile_dirs="minimal perf"
;;
*)
echo "Unknown fixup profile: $profile (expected minimal or perf)" >&2
exit 1
;;
esac
if [ ! -d dotnet/src/runtime ] ; then
echo "dotnet/src/runtime not found: the cloned VMR branch has no runtime sources." >&2
echo "SDK-only feature bands (e.g. release/10.0.3xx/4xx) cannot source-build the runtime;" >&2
echo "use a full-VMR ref such as release/10.0.1xx or a vN.n.nnn tag." >&2
exit 1
fi
# Fixups are versioned per .NET major (fixup/<major>/profile/<profile>).
major="$(sed -n 's/.*<MajorVersion>\([0-9][0-9]*\)<\/MajorVersion>.*/\1/p' dotnet/src/runtime/eng/Versions.props | head -n1)"
if [ -z "$major" ] ; then
echo "Cannot determine the .NET major version from dotnet/src/runtime/eng/Versions.props" >&2
exit 1
fi
echo "Detected .NET major version: $major"
for dir in $profile_dirs ; do
if [ ! -d "${TOP_DIR}/fixup/$major/profile/$dir" ] ; then
echo "No '$dir' fixups for .NET $major (fixup/$major/profile/$dir does not exist)." >&2
exit 1
fi
done
pushd dotnet/src/runtime
for dir in $profile_dirs ; do
for file in $(ls ${TOP_DIR}/fixup/$major/profile/$dir/*.patch | xargs) ; do
echo Applying $file
patch -p1 < $file
res="$?"
if [ "$res" != "0" ] ; then
echo Failed to apply patch $file >&2
exit 1
fi
done
done
popd