%global sdk_version 2.1.105 %global runtime_version 2.0.7 %define scl rh-dotnet20 %define prj_name coreclr %define pkg_name %{prj_name}20 %{!?scl_prefix: %define scl_prefix %{scl}-} %define pkg_dir /opt/%{pkg_name} # replace internal dependency generator %define deps_manual %{nil} %define deps_manual 1 # enable to create local package # disable to include local files in main package %define separated_local %{nil} %define separated_local 1 ################################################################################ # lldb doesn't like our nice debug information #%%undefine _include_minidebuginfo #%%global _find_debuginfo_dwz_opts %{nil} # 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: %{pkg_name}-opt Version: %{runtime_version} Release: 9%{?dist} Group: Development/Languages License: MIT #URL: https://github.com/dotnet/coreclr URL: https://www.microsoft.com/net/core Summary: .NET Core runtime 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: %{?scl_prefix}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 BuildRequires: rpm-build BuildRequires: wget curl BuildRequires: tar gzip bzip2 xz BuildRequires: systemtap systemtap-client systemtap-devel systemtap-runtime BuildRequires: redhat-lsb redhat-lsb-core redhat-lsb-cxx #BuildRequires: redhat-lsb-desktop redhat-lsb-languages redhat-lsb-printing #BuildRequires: redhat-lsb-submod-multimedia redhat-lsb-submod-security BuildRequires: %{?scl} %{?scl_prefix}runtime BuildRequires: %{?scl_prefix}dotnet-host %{?scl_prefix}dotnet-runtime-2.0 BuildRequires: %{?scl_prefix}dotnet-sdk-2.0 %{?scl_prefix}dotnet-sdk-2.1 %if "%{?scl}" != "" Requires: %{?scl} %{?scl_prefix}runtime Requires: %{?scl_prefix}dotnet-host %{?scl_prefix}dotnet-runtime-2.0 BuildRequires: %{?scl_prefix}dotnet-sdk-2.0 %{?scl_prefix}dotnet-sdk-2.1 %endif Requires: %{?scl_prefix}dotnet-runtime-2.0 # For the sake of compatibility, we default to the older SDK Requires: %{?scl_prefix}dotnet-sdk-2.0 Requires: %{?scl_prefix}dotnet-sdk-2.1 %if 0%{?deps_manual} %global _use_internal_dependency_generator 0 %global __find_provides env sh -c 'filelist=($(cat)) && { printf "%s\\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-provides && printf "%s\\n" "${filelist[@]}" | prefix=%{buildroot}%{pkg_dir} mono-find-provides; } | sed -r "s/^mono\\(/%{pkg_name}\\(/" | sort | uniq' %global __find_requires env sh -c 'filelist=($(cat)) && { printf "%s\\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires && printf "%s\\n" "${filelist[@]}" | prefix=%{buildroot}%{pkg_dir} mono-find-requires; } | sed -r "s/^mono\\(/%{pkg_name}\\(/" | sort | uniq | grep ^...' #dependency requiered for install Provides: %{pkg_name}(System.Collections) = 4.0.10.0 Provides: %{pkg_name}(System.Collections.Immutable) = 1.2.1.0 Provides: %{pkg_name}(System.Diagnostics.Debug) = 4.0.10.0 Provides: %{pkg_name}(System.IO) = 4.1.0.0 Provides: %{pkg_name}(System.IO.FileSystem) = 4.0.1.0 Provides: %{pkg_name}(System.Reflection.Metadata) = 1.4.1.0 Provides: %{pkg_name}(System.Runtime) = 4.1.0.0 Provides: %{pkg_name}(System.Runtime.Extensions) = 4.1.0.0 Provides: %{pkg_name}(System.Runtime.InteropServices) = 4.1.0.0 Provides: %{pkg_name}(SOS.NETCore) = 1.0.0.0 Provides: %{pkg_name}(System.Private.CoreLib) = 4.0.0.0 %endif %if 0%{?separated_local} # Build local package. %else Obsoletes: %{pkg_name}-local-opt %endif %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. %if 0%{?separated_local} %package -n %{pkg_name}-local-opt License: MIT Summary: Symlinks for %{name} #Group: Development/Libraries Group: Development/Languages Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: pkgconfig %description -n %{pkg_name}-local-opt Symlinks for %{name} This package provides symlinks for %{name} in %{_prefix}/local/bin/ directory. %endif %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|rhel.7.4-|centos.%{centos}-|g' "targets/core-setup.props" sed -i -e 's|rhel.7.4-|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 #find "src/" -mindepth 1 -maxdepth 1 -xtype d | sort -V | while read -r dir; do # d="$( basename "${dir}" )" # [[ "${d}" == "coreclr" || "${d}" == "reference-assemblies" || "${d}" == "cli" ]] || rm -rf "${dir}" #done #find "targets/" -mindepth 1 -maxdepth 1 -xtype f | sort -V | while read -r file; do # f="$( basename "${file}" )" # [[ "${f}" =~ ^coreclr\.[^.]+$ || "${f}" =~ ^repository\.[^.]+$ || "${f}" =~ ^cli\.[^.]+$ ]] || rm -rf "${file}" #done %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 || { find . -xtype f -iname '*.log' | sort -V | while read -r file; do echo "********"; echo "${file}"; echo "++++++++"; echo; cat "${file}"; echo; echo "// ${file}"; echo "--------"; echo; done; exit 1; } %{?scl:EOF} %install install -d "%{buildroot}%{pkg_dir}" output_path="$( find "src/coreclr/bin/Product" -mindepth 1 -maxdepth 1 -xtype d | head -n 1 )" output_dir="$( basename "${output_path}" )" cp -R "${output_path}" "%{buildroot}%{pkg_dir}/" cat > "%{buildroot}%{pkg_dir}/env.sh" << EOF #!/usr/bin/env bash export CORECLR20_HOME="%{pkg_dir}" export PATH="\${CORECLR20_HOME}/${output_dir}:\${PATH}" export LD_LIBRARY_PATH="\${CORECLR20_HOME}/${output_dir}:\${LD_LIBRARY_PATH}" EOF chmod a+x "%{buildroot}%{pkg_dir}/env.sh" install -d "%{buildroot}%{_prefix}/local/bin" pushd "%{buildroot}%{pkg_dir}/${output_dir}" >/dev/null 2>&1 find * -mindepth 0 -maxdepth 0 -xtype f -executable -not -iname '*.*' | sort -V | while read -r file; do f="$( basename "${file}" )" [[ -f "${file}" && -x "${file}" ]] || continue # create "links" in /usr/local/bin for coreclr opt apps cat << EOF > "%{buildroot}%{_prefix}/local/bin/%{pkg_name}-${f}" #!/usr/bin/env bash # %{name_base}-${f} base_dir="%{pkg_dir}" env_dir="\${base_dir}" env_file="env.sh" env_path="\${env_dir}/\${env_file}" app_dir="\${base_dir}/${output_dir}" app_name="${f}" app_path="\${app_dir}/\${app_name}" scl_name="rh-dotnet20" source scl_source enable "\${scl_name}" status="\${?}" [[ "\${status}" -eq 0 ]] || exit "\${status}" [[ -x "\${env_path}" ]] && source "\${env_path}" [[ -x "\${app_path}" ]] && "\${app_path}" "\${@}" EOF done popd >/dev/null 2>&1 pushd "%{buildroot}%{_prefix}/local/bin/" >/dev/null 2>&1 # give exec perms chmod a+x * popd >/dev/null 2>&1 #if [[ -d "bin/x64/Release" ]]; then # install -d "%{buildroot}/%{pkg_dir}/dotnet/" # tar xf "bin/x64/Release/dotnet-sdk-%{sdk_version}"-*-x64.tar.gz -C "%{buildroot}/%{pkg_dir}/dotnet/" # # echo "Testing build results for debug symbols..." # python %{SOURCE1} "%{buildroot}/%{pkg_dir}/dotnet/" #fi %files #%%doc BuildToolsVersion.txt CODE_OWNERS.TXT CONTRIBUTING.md DotnetCLIVersion.txt PATENTS.TXT README.md THIRD-PARTY-NOTICES.TXT #%%doc Documentation #%%license LICENSE.TXT %{pkg_dir} %if 0%{?separated_local} %exclude %{_prefix}/local/bin/%{pkg_name}* %else %{_prefix}/local/bin/%{pkg_name}* %endif %if 0%{?separated_local} %files -n %{pkg_name}-local-opt %{_prefix}/local/bin/%{pkg_name}* %endif %changelog * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-9 - Update requirements * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-8 - Update requirements * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-7 - Fix %%doc * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-6 - More verbose output * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-5 - Rewrite SPEC: new base = rh-dotnet20-dotnet-2.0.7-2.el7.src.rpm * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-4 - Update requirements * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-3 - Update requirements * Sat Jul 07 2018 Tomasz Tomasik - 2.0.7-2 - Separate local package * Fri Jul 06 2018 Tomasz Tomasik - 2.0.7-1 - Initial package