2020-10-14 21:49:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Usage:
|
|
|
|
# build-dotnet-tarball <tag-from-source-build>
|
|
|
|
#
|
|
|
|
# Creates a source archive from a tag (or commit) at github.com/dotnet/source-build
|
|
|
|
|
|
|
|
# Source-build is a little strange, we need to clone it, check out the
|
|
|
|
# tag, build it and then create a tarball from the archive directory
|
|
|
|
# it creates. Also, it is likely that the source archive is only
|
|
|
|
# buildable on the OS it was initially created in.
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
|
|
|
|
print_usage() {
|
|
|
|
echo "Usage:"
|
|
|
|
echo "$0 <tag-from-source-build>"
|
|
|
|
echo
|
|
|
|
echo "Creates a source archive from a tag at https://github.com/dotnet/source-build"
|
|
|
|
}
|
|
|
|
|
|
|
|
clean_dotnet_cache() {
|
|
|
|
rm -rf ~/.aspnet ~/.dotnet/ ~/.nuget/ ~/.local/share/NuGet ~/.templateengine
|
|
|
|
rm -rf /tmp/NuGet /tmp/NuGetScratch /tmp/.NETCore* /tmp/.NETStandard* /tmp/.dotnet /tmp/dotnet.* /tmp/clr-debug-pipe* /tmp/Razor-Server /tmp/CoreFxPipe* /tmp/VBCSCompiler /tmp/.NETFramework*
|
|
|
|
}
|
|
|
|
|
|
|
|
function runtime_id {
|
|
|
|
|
|
|
|
declare -A archmap
|
|
|
|
archmap=(
|
|
|
|
["aarch64"]="arm64"
|
|
|
|
["amd64"]="x64"
|
|
|
|
["armv8l"]="arm"
|
|
|
|
["i686"]="x86"
|
|
|
|
["i386"]="x86"
|
|
|
|
["x86_64"]="x64"
|
|
|
|
)
|
|
|
|
|
|
|
|
arch=${archmap["$(uname -m)"]}
|
|
|
|
|
|
|
|
source /etc/os-release
|
|
|
|
case "${ID}" in
|
|
|
|
# Remove the RHEL minor version
|
|
|
|
rhel) rid_version=${VERSION_ID%.*} ;;
|
|
|
|
|
|
|
|
*) rid_version=${VERSION_ID} ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo "${ID}.${rid_version}-${arch}"
|
|
|
|
}
|
|
|
|
|
|
|
|
positional_args=()
|
|
|
|
while [[ "$#" -gt 0 ]]; do
|
|
|
|
arg="${1}"
|
|
|
|
case "${arg}" in
|
|
|
|
-h|--help)
|
|
|
|
print_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
positional_args+=("$1")
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
tag=${positional_args[0]:-}
|
|
|
|
if [[ -z ${tag} ]]; then
|
|
|
|
echo "error: missing tag to build"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
dir_name="dotnet-${tag}"
|
|
|
|
unmodified_tarball_name="${dir_name}-original"
|
|
|
|
tarball_name="${dir_name}"
|
|
|
|
|
|
|
|
if [ -f "${tarball_name}.tar.gz" ]; then
|
|
|
|
echo "error: ${tarball_name}.tar.gz already exists"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "${unmodified_tarball_name}.tar.gz" ]; then
|
|
|
|
temp_dir=$(mktemp -d -p "$(pwd)")
|
|
|
|
pushd "${temp_dir}"
|
|
|
|
git clone https://github.com/dotnet/source-build
|
|
|
|
pushd source-build
|
|
|
|
git checkout "${tag}"
|
|
|
|
git submodule update --init --recursive
|
|
|
|
clean_dotnet_cache
|
2021-08-12 19:12:04 +00:00
|
|
|
sed -i -e 's|cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE||' repos/coreclr.common.props
|
2020-10-14 21:49:41 +00:00
|
|
|
mkdir -p patches/coreclr/
|
2021-01-17 22:32:43 +00:00
|
|
|
cp ../../build-coreclr-clang10.patch patches/coreclr/
|
|
|
|
cp ../../coreclr-libunwind-fno-common.patch patches/coreclr/
|
2020-10-14 21:49:41 +00:00
|
|
|
mkdir -p patches/corefx/
|
2021-01-17 22:32:43 +00:00
|
|
|
cp ../../corefx-42900-clang-10.patch patches/corefx/
|
2021-05-20 21:45:40 +00:00
|
|
|
mkdir -p patches/core-setup/
|
|
|
|
cp ../../core-setup-gcc11.patch patches/core-setup/
|
2020-10-14 21:49:41 +00:00
|
|
|
mkdir -p patches/aspnetcore/
|
2021-01-17 22:32:43 +00:00
|
|
|
cp ../../disable-aspnetcore-targetingpackoverride.patch patches/aspnetcore/
|
2020-10-14 21:49:41 +00:00
|
|
|
./build.sh /p:ArchiveDownloadedPackages=true /p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000 /p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000
|
|
|
|
./build-source-tarball.sh "${unmodified_tarball_name}" --skip-build
|
|
|
|
popd
|
|
|
|
popd
|
|
|
|
|
|
|
|
tar czf "${unmodified_tarball_name}.tar.gz" -C "${temp_dir}/source-build" "${unmodified_tarball_name}"
|
|
|
|
|
|
|
|
rm -rf "${temp_dir}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf "${tarball_name}"
|
|
|
|
tar xf "${unmodified_tarball_name}.tar.gz"
|
|
|
|
mv "${unmodified_tarball_name}" "${tarball_name}"
|
|
|
|
|
|
|
|
pushd "${tarball_name}"
|
|
|
|
# Remove files with funny licenses, crypto implementations and other
|
|
|
|
# not-very-useful artifacts to reduce tarball size
|
|
|
|
find -type f -iname '*.tar.gz' -delete
|
|
|
|
rm -rf .dotnet
|
|
|
|
rm -r src/aspnetcore.*/src/SignalR/clients/java/signalr/gradle*
|
|
|
|
find src/aspnetcore.*/src -type d -name samples -print0 | xargs -0 rm -r
|
|
|
|
rm -r src/NuGet.Client.*/test/EndToEnd/ProjectTemplates/NetCoreWebApplication1.0.zip
|
|
|
|
find src/coreclr.*/ -depth -name tests -print0 | xargs -0 rm -r
|
|
|
|
popd
|
|
|
|
|
|
|
|
tar czf "${tarball_name}.tar.gz" "${tarball_name}"
|