Blob Blame History Raw
%{?scl:%scl_package dotnet}
%{!?scl:%global pkg_name %{name}}

# lldb doesn't like our nice debug information
%undefine _include_minidebuginfo
%global _find_debuginfo_dwz_opts %{nil}

%global sdk_version 2.1.202
%global runtime_version 2.0.9

# Do not provide internal .so as standard libraries
%global __provides_exclude_from ^(%{_libdir}/dotnet/.*\\.so|%{_libdir}/dotnetcore/sdk/%{sdk_version}/.*\\.so|%{_libdir}/dotnetcore/shared/Microsoft.NETCore.App/%{runtime_version}/.*)$

# Do not generate requires for libraries provided by this own package
%global __requires_exclude ^(libmscordaccore.so\\(\\)\\(64bit\\)|libmscordaccore.so\\(V1.0\\)\\(64bit\\))$

Name:           %{?scl_prefix}dotnet
Version:        %{runtime_version}
Release:        3%{?dist}
Summary:        .NET Core is a general-purpose cross platform development platform
Group:          Development/Languages
License:        ASL 2.0 and MIT
URL:            https://www.microsoft.com/net/core

Source0:        dotnet-%{runtime_version}.tar.gz
Source1:        check_debug_symbols.py

Patch0:         coreclr-werror.patch
Patch1:         coreclr-sequential-build.patch
Patch2:         do-not-strip-debuginfo.patch
Patch3:         corefx-not-portable.patch
Patch4:         corefx-debuginfo.patch

Patch5:         templates-publish-without-manifest.patch

ExclusiveArch:  x86_64

BuildRequires:  %{?scl_prefix}clang
BuildRequires:  cmake
BuildRequires:  hostname
BuildRequires:  krb5-devel
BuildRequires:  %{?scl_prefix}libcurl-devel
BuildRequires:  libicu-devel
BuildRequires:  libuuid-devel
BuildRequires:  libunwind-devel
BuildRequires:  %{?scl_prefix}lldb-devel
BuildRequires:  %{?scl_prefix}llvm
BuildRequires:  %{?scl_prefix}lttng-ust-devel
BuildRequires:  openssl-devel
BuildRequires:  python2
BuildRequires:  unzip
BuildRequires:  %{?scl_prefix}userspace-rcu-devel
BuildRequires:  zip
BuildRequires:  zlib-devel

# For the sake of compatibility, we default to the older SDK
Requires:       %{?scl_prefix}dotnet-sdk-2.0

%description
.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.

It particularly focuses on creating console applications, web
applications and micro-services.

%package -n %{?scl_prefix}dotnet-host

Summary:        Component that runs .NET Core applications or starts the SDK
%{?scl:Requires: %scl_runtime}

%description -n %{?scl_prefix}dotnet-host
The .NET Core host is a small application that finds the right SDK to invoke
or the right framework to run a .NET Core application.

.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.

It particularly focuses on creating console applications, web
applications and micro-services.

%package -n %{?scl_prefix}dotnet-runtime-2.0

Summary:        Runtime for .NET Core applications

Requires:       %{?scl_prefix}dotnet-host
Requires:       %{?scl_prefix}libcurl%{?_isa}
# These libraries are dlopen'ed and not picked up automatically
Requires:       libicu
Requires:       openssl-libs

%{?scl:Requires: %scl_runtime}

%description -n %{?scl_prefix}dotnet-runtime-2.0
The .NET Core 2.0 runtime package contains a runtime conforming to
.NET Standard 2.0, including a set of framework libraries and a
Just-In-Time compiling Virtual Machine for high performance.

.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.

It particularly focuses on creating console applications, web
applications and micro-services.

%package -n %{?scl_prefix}dotnet-sdk-2.1

Version:        %{sdk_version}

Summary:        A software development kit for developing .NET Core applications

# SDK 2.1 requires runtime 2.0
Requires:       %{?scl_prefix}dotnet-runtime-2.0

%description -n %{?scl_prefix}dotnet-sdk-2.1
The .NET Core 2.1 SDK provides a number of command line tools to build
.NET Core applications. It includes compilers for C\#, VB.NET and F\#.

.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.

It particularly focuses on creating console applications, web
applications and micro-services.


%prep
%setup -q -n dotnet-%{runtime_version}

%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

# The templates are "pre-built" into a nuget package. Lets extract, patch, and
# compile the nuget package back into it.
mkdir templates
pushd templates
unzip ../prebuilt/nuget-packages/microsoft.dotnet.web.projecttemplates.2.0.1.0.0-beta2-20170810-304.nupkg
rm ../prebuilt/nuget-packages/microsoft.dotnet.web.projecttemplates.2.0.1.0.0-beta2-20170810-304.nupkg
%patch5 -p1
zip -r ../prebuilt/nuget-packages/microsoft.dotnet.web.projecttemplates.2.0.1.0.0-beta2-20170810-304.nupkg .
popd

# Increase build verbosity
sed -i -e "s|flp:Verbosity=normal|flp:Verbosity=diag|" src/coreclr/build.sh
sed -i -e "s|/flp:v=normal|/flp:v=diag|" src/corefx/config.json

# Change text printed when SDK is not installed
sed -i -e "s|http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409|yum install %{?scl_prefix}dotnet-sdk-2.1|" src/core-setup/src/corehost/common/utils.h

%if 0%{?centos} > 6
# Replace RHEL rid with CentOS rid
sed -i -e 's|<FixRid>rhel.7.4-|<FixRid>centos.%{centos}-|g' targets/core-setup.props
sed -i -e 's|<FixRid>rhel.7.4-|<FixRid>centos.%{centos}-|g' targets/cli.props
sed -i -e 's|rhel.7.4-x64|centos.%{centos}-x64|' targets/roslyn.props
sed -i -e 's|rhel.7-x64|centos.%{centos}-x64|' build.proj
sed -i -e 's|rhel.7.4-x64|centos.%{centos}-x64|' src/cli/tools/CrossGen.Dependencies/CrossGen.Dependencies.csproj
%endif

%build
%{?scl:scl enable %scl - << \EOF}
set -xe

export CMAKE_PREFIX_PATH="%{_prefix}"
VERBOSE=1 ./build.sh /clp:v=diag || ./build.sh /clp:v=diag

%{?scl:EOF}

%install
install -dm 755 $RPM_BUILD_ROOT/%{_libdir}/%{pkg_name}/
# for debugging
find bin/x64/Release/
tar xf bin/x64/Release/dotnet-sdk-%{sdk_version}-*-x64.tar.gz -C $RPM_BUILD_ROOT/%{_libdir}/%{pkg_name}/

install -dm 755 $RPM_BUILD_ROOT/%{_root_datadir}/bash-completion/completions
# dynamic completion needs the file to be named the same as the base command
install src/cli/scripts/register-completions.bash $RPM_BUILD_ROOT/%{_root_datadir}/bash-completion/completions/dotnet

# TODO: this doesn't get picked up/used by zsh
install -dm 755 $RPM_BUILD_ROOT/%{_root_datadir}/zsh/site-functions
install src/cli/scripts/register-completions.zsh $RPM_BUILD_ROOT/%{_root_datadir}/zsh/site-functions/%{name}

# for debugging
find $RPM_BUILD_ROOT/%{_libdir}/%{pkg_name}/

# Upstream license files produced from build are bogus
# See: https://github.com/dotnet/core-setup/issues/676
rm $RPM_BUILD_ROOT/%{_libdir}/dotnet/LICENSE.txt
rm $RPM_BUILD_ROOT/%{_libdir}/dotnet/ThirdPartyNotices.txt

mkdir -p $RPM_BUILD_ROOT/%{_bindir}
ln -s %{_libdir}/%{pkg_name}/dotnet $RPM_BUILD_ROOT/%{_bindir}/

mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/
find -type f -iname 'dotnet*\.1' -exec cp {} $RPM_BUILD_ROOT/%{_mandir}/man1/ \;

echo "Testing build results for debug symbols..."
python %{SOURCE1} %{buildroot}%{_libdir}/dotnet/

%files
# empty package useful for dependencies

%files -n %{?scl_prefix}dotnet-host
#%doc LICENSE.txt
#%doc THIRD-PARTY-NOTICES.txt
%dir %{_libdir}/%{pkg_name}
%{_libdir}/%{pkg_name}/dotnet
%{_libdir}/%{pkg_name}/host
%{_bindir}/dotnet
%{_mandir}/man1/dotnet.1*

%files -n %{?scl_prefix}dotnet-runtime-2.0
#%doc LICENSE.TXT
#%doc THIRD-PARTY-NOTICES.TXT
%dir %{_libdir}/%{pkg_name}/shared
%dir %{_libdir}/%{pkg_name}/shared/Microsoft.NETCore.App
%{_libdir}/%{pkg_name}/shared/Microsoft.NETCore.App/%{runtime_version}

%files -n %{?scl_prefix}dotnet-sdk-2.1
#%doc LICENSE.TXT
#%doc THIRD-PARTY-NOTICES.TXT
%dir %{_libdir}/%{pkg_name}/sdk
%{_libdir}/%{pkg_name}/sdk/%{sdk_version}
%{_mandir}/man1/dotnet-*.1.*
# shell completions are currently only picked up from %{_root_datadir}
%dir %{_root_datadir}/bash-completion
%dir %{_root_datadir}/bash-completion/completions
%{_root_datadir}/bash-completion/completions/dotnet
%dir %{_root_datadir}/zsh
%dir %{_root_datadir}/zsh/site-functions
%{_root_datadir}/zsh/site-functions/%{name}

%changelog
* Wed Jul 4 2018 Omair Majid <omajid@redhat.com> - 2.0.9-1
- Update to .NET Core 2.0.9

* Mon Jun 25 2018 Omair Majid <omajid@redhat.com> - 2.0.7-3
- Rebuild to link against updated libcurl
- Resolves: rhbz#1549574

* Mon Apr 23 2018 Omair Majid <omajid@redhat.com> - 2.0.7-2
- Fix build for CentOS

* Fri Apr 20 2018 Omair Majid <omajid@redhat.com> - 2.0.7-1
- Update to .NET Core 2.0.7

* Fri Mar 2 2018 Omair Majid <omajid@redhat.com> - 2.0.6-1
- Update to .NET Core 2.0.6

* Thu Feb 8 2018 Omair Majid <omajid@redhat.com> - 2.0.5-1
- Update to .NET Core 2.0.5

* Mon Dec 11 2017 Omair Majid <omajid@redhat.com> - 2.0.3-6
- Add fixes to build on CentOS

* Fri Dec 01 2017 Andrew Slice <andrew.slice@redhat.com> - 2.0.3-5
- Add a test script to sanity check debug and symbol info.

* Fri Nov 10 2017 Omair Majid <omajid@redhat.com> - 2.0.3-4
- Make corefx build non-portable, which was how it was in 2.0.0

* Thu Nov 9 2017 Omair Majid <omajid@redhat.com> - 2.0.3-3
- Do not strip debuginfo

* Thu Nov 9 2017 Omair Majid <omajid@redhat.com> - 2.0.3-2
- Add explicit requires for libssl

* Tue Oct 31 2017 Omair Majid <omajid@redhat.com> - 2.0.3-1
- Update to .NET Core 2.0.3

* Sat Oct 28 2017 Omair Majid <omajid@redhat.com> - 2.0.3-0.1
- Update to new drop for .NET Core 2.0.3

* Sat Aug 12 2017 Omair Majid <omajid@redhat.com> - 2.0.0-4
- Update to new .NET Core drop

* Thu Aug 10 2017 Omair Majid <omajid@redhat.com> - 2.0.0-4
- Update to new .NET Core drop

* Thu Aug 10 2017 Omair Majid <omajid@redhat.com> - 2.0.0-3
- Update to new .NET Core drop

* Fri Aug 04 2017 Omair Majid <omajid@redhat.com> - 2.0.0-2
- Update to new .NET Core drop

* Wed Aug 02 2017 Omair Majid <omajid@redhat.com> - 2.0.0-1
- Update to final .NET Core 2.0 release

* Wed Jul 19 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.10
- Modify templates to not use the ASP.NET runtime store

* Wed Jul 19 2017 Omair Majid <omajid@redhat> - 2.0.0-0.9
- Use non-scl cmake to build

* Fri Jun 23 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.8
- Update to newer SDK drop
- Add requires on libicu

* Tue Jun 20 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.7
- Move more stuff to prep section
- Install shell completion

* Wed Jun 14 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.6
- Do not print first-run message on every dotnet invocation

* Fri Jun 9 2017 Omair Majid <omajid@redhat.com> - 2.0-0.5
- Update to latest source drop

* Thu Jun 8 2017 Omair Majid <omajid@redhat.com> - 2.0-0.4
- Minor spec file fixes
- Do not depend on git

* Wed Jun 7 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.3
- Update to latest source drop.

* Fri Jun 2 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.2
- Add a meta-package for simply installing all of .NET Core

* Thu May 25 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.1
- Initial package for .NET Core 2.0