Skip to content

Instantly share code, notes, and snippets.

@alistairbill
Last active August 6, 2016 11:44
Show Gist options
  • Save alistairbill/a95f4a558f3f91824c8aa107475dd030 to your computer and use it in GitHub Desktop.
Save alistairbill/a95f4a558f3f91824c8aa107475dd030 to your computer and use it in GitHub Desktop.
Install dotnet core cli on Fedora 24
#!/bin/bash
echo "Building and installing dotnet cli..."
# Install the dependencies (I think this is all...)
dnf install -y clang cmake llvm gettext libunwind libunwind-devel \
lldb-devel libuuid-devel libcurl-devel libicu-devel \
lttng-ust lttng-ust-devel curl icu
# Make build directory
mkdir /home/$USER/dotnet
cd /home/$USER/dotnet
# Fetch source
wget https://github.com/dotnet/coreclr/archive/v1.0.0.tar.gz
wget https://github.com/dotnet/corefx/archive/v1.0.0.tar.gz
# Untar the sources
tar xfz coreclr-1.0.0.tar.gz
tar xfz corefx-1.0.0.tar.gz
# Get the patches
wget https://aur.archlinux.org/cgit/aur.git/plain/gcc6-github-pull-5304.patch?h=dotnet-cli -O gcc6-github-pull-5304.patch
wget https://aur.archlinux.org/cgit/aur.git/plain/segv-github-pull-6027.patch?h=dotnet-cli -O segv-github-pull-6027.patch
wget https://aur.archlinux.org/cgit/aur.git/plain/unused-attr-coreclr.patch?h=dotnet-cli -O unused-attr-coreclr.patch
wget https://aur.archlinux.org/cgit/aur.git/plain/unused-attr-corefx.patch?h=dotnet-cli -O unused-attr-corefx.patch
# Patch coreclr
cd /home/$USER/dotnet/coreclr-1.0.0/
patch -p1 < "/home/$USER/dotnet/gcc6-github-pull-5304.patch"
patch -p1 < "/home/$USER/dotnet/segv-github-pull-6027.patch"
patch -p1 < "/home/$USER/dotnet/unused-attr-coreclr.patch"
# Patch corefx
cd /home/$USER/dotnet/corefx-1.0.0/
patch -p1 < "/home/$USER/dotnet/unused-attr-corefx.patch"
# Build coreclr
cd /home/$USER/dotnet/coreclr-1.0.0/
./build.sh x64 release
# Build corefx
cd /home/$USER/dotnet/corefx-1.0.0/
./build.sh native x64 release
# Make install directory
mkdir -p /opt/dotnet
# Get dotnet
cd /home/$USER/dotnet
wget https://download.microsoft.com/download/1/5/2/1523EBE1-3764-4328-8961-D1BD8ECA9295/dotnet-dev-fedora.23-x64.1.0.0-preview2-003121.tar.gz -O dotnet-v1.0.0.tar.gz
# Untar it into the install directory
tar -C "/opt/dotnet" -xzf "dotnet-v1.0.0.tar.gz"
# Copy the coreclr libs
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libclrjit.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libcoreclr.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libcoreclrtraceptprovider.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libdbgshim.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libmscordaccore.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libmscordbi.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libsos.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/libsosplugin.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/coreclr-1.0.0/bin/Product/Linux.x64.Release/System.Globalization.Native.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
# Copy the corefx libs
cp --force --preserve=mode "/home/$USER/dotnet/corefx-1.0.0/bin/Linux.x64.Release/Native/System.IO.Compression.Native.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/corefx-1.0.0/bin/Linux.x64.Release/Native/System.Native.a" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/corefx-1.0.0/bin/Linux.x64.Release/Native/System.Native.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/corefx-1.0.0/bin/Linux.x64.Release/Native/System.Net.Http.Native.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/corefx-1.0.0/bin/Linux.x64.Release/Native/System.Net.Security.Native.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
cp --force --preserve=mode "/home/$USER/dotnet/corefx-1.0.0/bin/Linux.x64.Release/Native/System.Security.Cryptography.Native.so" "/opt/dotnet/shared/Microsoft.NETCore.App/1.0.0/"
ln -s "/opt/dotnet/dotnet" "/usr/bin/dotnet"
echo "Finished."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment