File msbuild.spec of Package msbuild
#
# spec file for package msbuild
#
# Copyright (c) 2016 Xamarin, Inc (http://www.xamarin.com)
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
Name: msbuild
Version: 16.10.1+xamarinxplat.2021.05.26.14.00
%define _release 0.xamarin.7
Release: 1
Summary: Build system for .NET projects
Epoch: 1
License: MIT
Group: Development/Libraries/Other
Url: https://github.com/Microsoft/msbuild
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source1: msbuild-%{version}-%{_release}.epel7.noarch.rpm
Source2: msbuild-sdkresolver-%{version}-%{_release}.epel7.noarch.rpm
#Source3: System.Reflection.Metadata.v1.4.3.0.dll
Patch0: copy_hostfxr.patch
BuildArch: noarch
BuildRequires: mono-core
BuildRequires: mono-devel
BuildRequires: libcurl-devel
BuildRequires: openssl-devel
#BuildRequires: /usr/bin/mono-find-provides
#BuildRequires: /usr/bin/mono-find-requires
#!BuildIgnore: mono(Microsoft.Build.Framework)
#!BuildIgnore: mono(Microsoft.Build.Tasks.Core)
#!BuildIgnore: mono(Microsoft.Build.Utilities.Core)
Requires: msbuild-libhostfxr
Provides: mono(Microsoft.Build.Framework) = 15.1.0.0
Provides: mono(Microsoft.Build.Tasks.Core) = 15.1.0.0
Provides: mono(Microsoft.Build.Utilities.Core) = 15.1.0.0
# build package only for platforms that support roslyn
ExclusiveArch: x86_64 aarch64 noarch
%description
The Microsoft Build Engine is a platform for building applications.
This 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.
%package sdkresolver
Summary: Build system for .NET projects - .NET Core location resolver
License: MIT
Group: Development/Libraries/Other
Requires: msbuild = %{epoch}:%{version}-%{release}
%description sdkresolver
The Microsoft Build Engine is a platform for building applications.
This 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. This package
contains components needed to build with .NET Core.
%prep
# nothing to do
%define provides_filesfix printf "%s\\n" "${filelist[@]}" \\\
| cat -
%define requires_filesfix printf "%s\\n" "${filelist[@]}" \\\
| cat -
%define provides_filter cat -
%define requires_filter grep ^... \\\
| sed "s/mono\(System.Collections.Immutable\).*/mono\(System.Collections.Immutable\) = 5.0.0.0/" \\\
| sed "s/mono\(System.Threading.Tasks\).*/mono\(System.Threading.Tasks\) = 4.0.0.0/" \\\
| sed "s/mono\(System.Threading\).*/mono\(System.Threading\) = 4.0.0.0/" \\\
| sed "s/mono\(System.Linq.Expressions\).*/mono\(System.Linq.Expressions\) = 4.0.0.0/" \\\
| grep -v "System.IO" \\\
| grep -v "System.Xml" \\\
| grep -v "System.Net" \\\
| grep -v "System.Text" \\\
| grep -v "System.Data" \\\
| grep -v "System.Collections" \\\
| grep -v "System.Security" \\\
| grep -v "System.Reflection" \\\
| grep -v "System.Runtime" \\\
| grep -v "System.Composition" \\\
| grep -v "System.ServiceModel" \\\
| grep -v "System.Globalization" \\\
| grep -v "System.Diagnostics" \\\
| grep -v "System.Threading.Overlapped" \\\
| grep -v "System.Buffers" \\\
| grep -v "Microsoft.Web" \\\
| grep -v "Microsoft.CodeAnalysis" \\\
| grep -v "Microsoft.Build.Tasks.CodeAnalysis" \\\
| grep -v "Microsoft.AspNetCore" \\\
| grep -v "Newtonsoft.Json" \\\
| grep -v "NuGet" \\\
| grep -v "xunit" \\\
| grep -v "0\\.0\\.0\\.0"
%define _use_internal_dependency_generator 0
%global __find_provides env sh -c 'filelist=($(cat)) && { \\\
%{provides_filesfix} | /usr/lib/rpm/redhat/find-provides && \\\
%{provides_filesfix} | /usr/bin/mono-find-provides; \\\
} | sort | uniq | %{provides_filter}'
%global __find_requires env sh -c 'filelist=($(cat)) && { \\\
%{requires_filesfix} | /usr/lib/rpm/redhat/find-requires && \\\
%{requires_filesfix} | /usr/bin/mono-find-requires; \\\
} | sort | uniq | %{requires_filter}'
%build
# do nothing
%install
pushd %{buildroot}
rpm2cpio %{SOURCE1}| cpio -idmv
rpm2cpio %{SOURCE2}| cpio -idmv
# hack to resolve a cyclic dependency problem between msbuild and mono-devel
# remove the dead symbolic link here and create it in the post script
#rm usr/lib/mono/msbuild/Current/bin/System.Reflection.Metadata.dll
## msbuild 16.4-2019.11.27.22.07 depends on Sys.Reflection.Metadata.dll 1.4.3.0
## which does not always match the version provided by mono/roslyn.
#rm -f usr/lib/mono/msbuild/Current/bin/System.Reflection.Metadata.dll
#cp %{SOURCE3} usr/lib/mono/msbuild/Current/bin/System.Reflection.Metadata.dll
popd
%pretrans -p <lua>
path = "/usr/lib/mono/msbuild/15.0"
st = posix.stat(path)
if st and st.type == "directory" then
status = os.rename(path, path .. ".rpmmoved")
if not status then
suffix = 0
while not status do
suffix = suffix + 1
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
end
os.rename(path, path .. ".rpmmoved")
end
end
path = "/usr/lib/mono/xbuild/15.0"
st = posix.stat(path)
if st and st.type == "directory" then
status = os.rename(path, path .. ".rpmmoved")
if not status then
suffix = 0
while not status do
suffix = suffix + 1
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
end
os.rename(path, path .. ".rpmmoved")
end
end
%post
# hack to resolve a cyclic dependency problem between msbuild and mono-devel
# do not pack the dead symbolic link but create it in the post script
#cd %{_prefix}/lib/mono/msbuild/Current/bin
#rm -f System.Reflection.Metadata.dll
#ln -s Roslyn/System.Reflection.Metadata.dll .
%files
%defattr(-,root,root)
%{_bindir}/msbuild
%{_prefix}/lib/mono/msbuild
%exclude %{_prefix}/lib/mono/msbuild/Current/bin/SdkResolvers
%{_prefix}/lib/mono/xbuild
%{_mandir}/man1/msbuild.1%{?ext_man}
%files sdkresolver
%defattr(-,root,root
%dir %{_prefix}/lib/mono/msbuild/Current/bin/SdkResolvers
%{_prefix}/lib/mono/msbuild/Current/bin/SdkResolvers/*