Skip to content

Instantly share code, notes, and snippets.

@tpokorra
Last active March 31, 2017 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpokorra/31051cfe67bb34524ca7b582a5236db9 to your computer and use it in GitHub Desktop.
Save tpokorra/31051cfe67bb34524ca7b582a5236db9 to your computer and use it in GitHub Desktop.
msbuild spec file for RPM package
# Note: this only works if you are able to modify /etc/os-release!
# for some reason, we cannot build on CentOS7, but only if we pretend to be Ubuntu 16.04!
Name: msbuild
Version: 15.1
Release: 1%{?dist}
Summary: The Microsoft Build Engine is a platform for building applications.
License: MIT
URL: https://github.com/Microsoft/msbuild
Source0: http://download.mono-project.com/repo/debian/pool/main/m/msbuild/msbuild_15.1+xamarinxplat.2017.02.14.47.38.orig.tar.gz
BuildRequires: mono-devel
BuildRequires: libunwind-devel
BuildRequires: libicu-devel = 50.1.2
Provides: mono(Microsoft.CodeAnalysis) = 1.3.0.0
Provides: mono(Microsoft.CodeAnalysis.CSharp) = 1.3.0.0
Provides: mono(Microsoft.Win32.Primitives) = 4.0.0.0
Provides: mono(Newtonsoft.Json) = 7.0.0.0
Provides: mono(System.Collections) = 4.0.0.0
Provides: mono(System.Collections.Concurrent) = 4.0.0.0
Provides: mono(System.Collections.Concurrent) = 4.0.12.0
Provides: mono(System.Diagnostics.Debug) = 4.0.0.0
Provides: mono(System.Diagnostics.Tracing) = 4.0.0.0
Provides: mono(System.Diagnostics.Tracing) = 4.0.20.0
Provides: mono(System.Dynamic.Runtime) = 4.0.0.0
Provides: mono(System.Globalization) = 4.0.0.0
Provides: mono(System.Globalization.Calendars) = 4.0.0.0
Provides: mono(System.IO) = 4.0.0.0
Provides: mono(System.IO) = 4.0.10.0
Provides: mono(System.IO.Compression) = 4.1.0.0
Provides: mono(System.IO.FileSystem) = 4.0.0.0
Provides: mono(System.IO.FileSystem.Primitives) = 4.0.0.0
Provides: mono(System.Linq) = 4.0.0.0
Provides: mono(System.Linq.Expressions) = 4.0.0.0
Provides: mono(System.Linq.Expressions) = 4.0.10.0
Provides: mono(System.Net.Http) = 4.1.0.0
Provides: mono(System.ObjectModel) = 4.0.0.0
Provides: mono(System.Reflection) = 4.0.0.0
Provides: mono(System.Reflection) = 4.0.10.0
Provides: mono(System.Reflection.Emit) = 4.0.0.0
Provides: mono(System.Reflection.Emit.ILGeneration) = 4.0.0.0
Provides: mono(System.Reflection.Emit.Lightweight) = 4.0.0.0
Provides: mono(System.Reflection.Metadata) = 1.0.22.0
Provides: mono(System.Reflection.TypeExtensions) = 4.0.0.0
Provides: mono(System.Runtime) = 4.0.0.0
Provides: mono(System.Runtime) = 4.0.20.0
Provides: mono(System.Runtime.Extensions) = 4.0.0.0
Provides: mono(System.Runtime.Extensions) = 4.0.10.0
Provides: mono(System.Runtime.InteropServices) = 4.0.0.0
Provides: mono(System.Runtime.InteropServices) = 4.0.20.0
Provides: mono(System.Runtime.Serialization.Primitives) = 4.0.0.0
Provides: mono(System.Security.Claims) = 4.0.0.0
Provides: mono(System.Security.Cryptography.Algorithms) = 4.1.0.0
Provides: mono(System.Security.Cryptography.Algorithms) = 4.2.0.0
Provides: mono(System.Text.Encoding) = 4.0.0.0
Provides: mono(System.Text.Encoding.Extensions) = 4.0.0.0
Provides: mono(System.Text.RegularExpressions) = 4.0.0.0
Provides: mono(System.Text.RegularExpressions) = 4.0.10.0
Provides: mono(System.Threading) = 4.0.0.0
Provides: mono(System.Threading.Tasks) = 4.0.0.0
Provides: mono(System.Xml.ReaderWriter) = 4.0.0.0
Provides: mono(System.Xml.XDocument) = 4.0.0.0
Provides: mono(System.Xml.XPath) = 4.0.0.0
Provides: mono(System.Xml.XPath.XmlDocument) = 4.0.0.0
Provides: mono(System.Xml.XmlDocument) = 4.0.0.0
Provides: mono(mscorlib) = 2.0.0.0
Provides: mono(System.Private.CoreLib) = 4.0.0.0
%description
The Microsoft Build Engine, which is also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software. Visual Studio uses MSBuild, but MSBuild does not depend on Visual Studio. By invoking msbuild.exe on your project or solution file, you can orchestrate and build products in environments where Visual Studio isn't installed.
%prep
%setup -q -n %{name}-c9-osx-release
%build
sed -i 's/get_current_linux_name() {/get_current_linux_name() { echo "centos"; return 0;/g' init-tools.sh
sed -i 's/<AutoGenerateBindingRedirects>false/<AutoGenerateBindingRedirects>true/g' src/XMakeCommandLine/MSBuild.csproj
sed -i 's/ID="centos"/ID="ubuntu"/g' /etc/os-release
sed -i 's/VERSION_ID="7"/VERSION_ID="16.04"/g' /etc/os-release
./cibuild.sh --scope Compile --host Mono --target Mono || exit -1
sed -i 's/ID="ubuntu"/ID="centos"/g' /etc/os-release
sed -i 's/VERSION_ID="16.04"/VERSION_ID="7"/g' /etc/os-release
%install
DESTDIR=%{buildroot} ./install-mono-prefix.sh /usr
mkdir %{buildroot}/msbuild-bin
mv %{buildroot}/usr/bin/* %{buildroot}/msbuild-bin
mv %{buildroot}/msbuild-bin %{buildroot}/usr/bin/
cp bin/Bootstrap/*.dll %{buildroot}/usr/bin/msbuild-bin
cp Tools/*.dll %{buildroot}/usr/bin/msbuild-bin
cp Tools/dotnetcli/shared/Microsoft.NETCore.App/1.0.1/mscorlib.dll %{buildroot}/usr/bin/msbuild-bin
echo '#!/bin/bash' > %{buildroot}/usr/bin/msbuild
echo 'cd /usr/bin/msbuild-bin && msbuild $@' >> %{buildroot}/usr/bin/msbuild
chmod a+x %{buildroot}/usr/bin/msbuild
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
# TODO license or copyright
/usr/bin/msbuild
/usr/bin/msbuild-bin/*
/usr/lib/*
%changelog
* Mon Mar 27 2017 Timotheus Pokorra <tp@tbits.net> - 15.1-1
- initial package for msbuild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment