File dotnet.spec of Package dotnet

#
# spec file for package dotnet
#
# Copyright (c) 2024 SUSE LLC
#
# 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.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%global dotnetver 10.0
%global runtime_version 10.0.3
%global hostfxr_version %{runtime_version}
%global aspnetcore_runtime_version 10.0.3
%global templates_version %{aspnetcore_runtime_version}
%global runtime_rpm_version %{runtime_version}
%global aspnetcore_runtime_rpm_version %{aspnetcore_runtime_version}

Name:           dotnet
Version:        10.0.103
Release:        0.1
Summary:        Dotnet binaries for building software
License:        GPL-2.0
URL:            https://dotnet.microsoft.com/en-us/download/dotnet
Source0:       	https://builds.dotnet.microsoft.com/dotnet/Sdk/%{version}/dotnet-sdk-%{version}-linux-x64.tar.gz
Source1:        %{name}-rpmlintrc
Source2:        dotnet.sh
BuildRequires:  chrpath
BuildRequires:  fdupes

%description
The .NET SDK is a collection of command line applications to
create, build, publish and run .NET applications.
.NET 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 dotnet-host-%{dotnetver}
Version:        %{runtime_rpm_version}
Summary:        A generic driver for the .NET Core Command Line Interface (binary)
 
%description -n dotnet-host-%{dotnetver}
The .NET host is a command line program that runs a standalone
.NET application or launches the SDK.
.NET 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 dotnet-runtime-%{dotnetver}
Version:        %{runtime_rpm_version}
Summary:        NET %{dotnetver} runtime
Requires:		liblttng-ust0
Provides:		dotnet-runtime = %runtime_version
 
%description -n dotnet-runtime-%{dotnetver}
The .NET runtime contains everything needed to run .NET applications.
It includes a high performance Virtual Machine as well as the framework
libraries used by .NET applications.
.NET 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 aspnet-runtime-%{dotnetver}
Version:        %{aspnetcore_runtime_rpm_version}
Summary:        ASP.NET Core %{dotnetver} runtime
Requires:       dotnet-runtime
Provides:		aspnet-runtime = %runtime_version

%description -n aspnet-runtime-%{dotnetver}
The ASP.NET Core runtime contains everything needed to run .NET
web applications. It includes a high performance Virtual Machine as
well as the framework libraries used by .NET applications.
ASP.NET Core is a fast, lightweight and modular platform for creating
cross platform web applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.

%package -n dotnet-sdk-%{dotnetver}
Version:        %{version}
Summary:        .NET %{dotnetver} Software Development Kit
Requires:		dotnet-runtime
Requires:		dotnet-targeting-pack
Requires:		aspnet-runtime
Requires:		aspnet-targeting-pack

%description -n dotnet-sdk-%{dotnetver}
The .NET SDK is a collection of command line applications to
create, build, publish and run .NET applications.
.NET 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 dotnet-targeting-pack-%{dotnetver}
Version:        %{version}
Summary:		The .NET Core targeting pack
Provides:		dotnet-targeting-pack = %runtime_version

%description -n dotnet-targeting-pack-%{dotnetver}
The ASP.NET Core runtime contains everything needed to run .NET
web applications. It includes a high performance Virtual Machine as
well as the framework libraries used by .NET applications.
ASP.NET Core is a fast, lightweight and modular platform for creating
cross platform web applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.

%package -n aspnet-targeting-pack-%{dotnetver}
Version:        %{version}
Summary:		The ASP Core targeting pack
Provides:		dotnet-targeting-pack = %runtime_version

%description -n aspnet-targeting-pack-%{dotnetver}
The ASP.NET Core runtime contains everything needed to run .NET
web applications. It includes a high performance Virtual Machine as
well as the framework libraries used by .NET applications.
ASP.NET Core is a fast, lightweight and modular platform for creating
cross platform web applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.

%prep
tar xzf %{SOURCE0}

%install
# dotnet-host
install -d -m 0755 %{buildroot}/usr/{bin,lib,share/{dotnet,dnx,licenses/dotnet-host}}
install -D -m 0755 dotnet %{buildroot}/%{_datadir}/dotnet/
install -D -m 0755 dnx %{buildroot}/%{_datadir}/dotnet/
install -D -m 0644 LICENSE.txt %{buildroot}/%{_datadir}/licenses/dotnet-host
install -D -m 0644 ThirdPartyNotices.txt %{buildroot}/%{_datadir}/licenses/dotnet-host
install -d -m 0755 %{buildroot}/%{_datadir}/dotnet/host/fxr/%{runtime_version}/
install -D -m 0644 host/fxr/%{runtime_version}/libhostfxr.so %{buildroot}/%{_datadir}/dotnet/host/fxr/%{runtime_version}/
ln -sf %{_datadir}/dotnet/dotnet %{buildroot}/%{_bindir}/dotnet
ln -sf %{_datadir}/dotnet/dnx %{buildroot}/%{_bindir}/dnx
ln -sf %{_datadir}/dotnet/host/fxr/%{runtime_version}/libhostfxr.so %{buildroot}/usr/lib/libhostfxr.so
install -d -m 0755 %{buildroot}/%{_sysconfdir}/profile.d/
install -D -m 0644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/profile.d/

# dotnet-runtime
install -dm 755 %{buildroot}/%{_datadir}/{dotnet/shared,licenses}
cp -dr --no-preserve='ownership' shared/Microsoft.NETCore.App %{buildroot}/%{_datadir}/dotnet/shared/

# aspnet-runtime
install -dm 755 %{buildroot}/%{_datadir}/{dotnet/shared,licenses}
cp -dr --no-preserve='ownership' shared/Microsoft.AspNetCore.App %{buildroot}/%{_datadir}/dotnet/shared/

# dotnet-sdk
install -dm 755 %{buildroot}/%{_datadir}/{dotnet,licenses}
cp -dr --no-preserve='ownership' sdk sdk-manifests templates %{buildroot}/%{_datadir}/dotnet/

# dotnet-targeting-pack
install -dm 755 %{buildroot}/%{_datadir}/{dotnet,dotnet/packs,licenses}
cp -dr --no-preserve='ownership' packs/Microsoft.NETCore.App.{Host.linux-x64,Ref} %{buildroot}/%{_datadir}/dotnet/packs/

# aspnet-targeting-pack
install -dm 755 %{buildroot}/%{_datadir}/{dotnet,dotnet/packs,licenses}
cp -dr --no-preserve='ownership' packs/Microsoft.AspNetCore.App.Ref %{buildroot}/%{_datadir}/dotnet/packs/

# Fixes - Perms
chmod -x %{buildroot}/%{_datadir}/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/10.0.3/runtimes/linux-x64/native/coreclr_delegates.h
chmod -x %{buildroot}/%{_datadir}/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/10.0.3/runtimes/linux-x64/native/hostfxr.h
chmod -x %{buildroot}/%{_datadir}/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/10.0.3/runtimes/linux-x64/native/libnethost.a
chmod -x %{buildroot}/%{_datadir}/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/10.0.3/runtimes/linux-x64/native/nethost.h

# Fixes - Rpath
chrpath --delete %{buildroot}/%{_datadir}/dotnet/shared/Microsoft.NETCore.App/10.0.3/createdump
chrpath --delete %{buildroot}/%{_datadir}/dotnet/shared/Microsoft.NETCore.App/10.0.3/libmscordbi.so


%files -n dotnet-host-%{dotnetver}
%dir %{_datadir}/dotnet
%dir %{_datadir}/dnx
%dir %{_datadir}/licenses/dotnet-host
%dir %{_datadir}/dotnet/host
%dir %{_datadir}/dotnet/host/fxr
%dir %{_datadir}/dotnet/host/fxr/%{runtime_version}
%{_datadir}/dotnet/host/fxr/%{runtime_version}/libhostfxr.so
/usr/lib/libhostfxr.so
%{_datadir}/dotnet/dotnet
%{_datadir}/dotnet/dnx
%{_bindir}/dotnet
%{_bindir}/dnx
%{_sysconfdir}/profile.d/dotnet.sh
%{_datadir}/licenses/dotnet-host/LICENSE.txt
%{_datadir}/licenses/dotnet-host/ThirdPartyNotices.txt

%files -n dotnet-runtime-%{dotnetver}
%dir %{_datadir}/dotnet/shared
%dir %{_datadir}/dotnet/shared/Microsoft.NETCore.App
%{_datadir}/dotnet/shared/Microsoft.NETCore.App

%files -n aspnet-runtime-%{dotnetver}
%dir %{_datadir}/dotnet/shared
%dir %{_datadir}/dotnet/shared/Microsoft.AspNetCore.App
%{_datadir}/dotnet/shared/Microsoft.AspNetCore.App

%files -n dotnet-sdk-%{dotnetver}
%dir %{_datadir}/dotnet/sdk
%dir %{_datadir}/dotnet/sdk-manifests
%dir %{_datadir}/dotnet/templates
%{_datadir}/dotnet/sdk
%{_datadir}/dotnet/sdk-manifests
%{_datadir}/dotnet/templates

%files -n dotnet-targeting-pack-%{dotnetver}
%dir %{_datadir}/dotnet/packs/
%dir %{_datadir}/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64
%dir %{_datadir}/dotnet/packs/Microsoft.NETCore.App.Ref
%{_datadir}/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64
%{_datadir}/dotnet/packs/Microsoft.NETCore.App.Ref

%files -n aspnet-targeting-pack-%{dotnetver}
%dir %{_datadir}/dotnet/packs
%dir %{_datadir}/dotnet/packs/Microsoft.AspNetCore.App.Ref
%{_datadir}/dotnet/packs/Microsoft.AspNetCore.App.Ref

%changelog
openSUSE Build Service is sponsored by