From 1971282a7f2b49f8e776642824f227939095563f Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Sep 05 2018 18:24:43 +0000 Subject: Use distro-standard flags when building .NET Core --- diff --git a/corefx-optflags-support.patch b/corefx-optflags-support.patch new file mode 100644 index 0000000..2d0c603 --- /dev/null +++ b/corefx-optflags-support.patch @@ -0,0 +1,39 @@ +diff --git a/src/Native/Unix/CMakeLists.txt b/src/Native/Unix/CMakeLists.txt +index 7d804a1e54..717c2718d7 100644 +--- a/src/Native/Unix/CMakeLists.txt ++++ b/src/Native/Unix/CMakeLists.txt +@@ -25,7 +25,6 @@ add_compile_options(-fPIC) + add_compile_options(-I${CMAKE_CURRENT_SOURCE_DIR}/Common) + add_compile_options(-I${CMAKE_CURRENT_BINARY_DIR}/Common) + add_compile_options(-g) +-add_compile_options(-Werror) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + add_compile_options(-Wno-unreachable-code) + endif () +diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake +index f4a30ad6cb..f2db68402a 100644 +--- a/src/Native/Unix/configure.cmake ++++ b/src/Native/Unix/configure.cmake +@@ -27,6 +27,12 @@ else () + message(FATAL_ERROR "Unknown platform. Cannot define PAL_UNIX_NAME, used by RuntimeInformation.") + endif () + ++ ++set (PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) ++set (CMAKE_CXX_FLAGS "") ++set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) ++set (CMAKE_C_FLAGS "") ++ + # We compile with -Werror, so we need to make sure these code fragments compile without warnings. + # Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors + # which are not distinguished from the test failing. So no error for that one. +@@ -698,6 +704,9 @@ endif() + + set (CMAKE_REQUIRED_LIBRARIES) + ++set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}") ++set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}") ++ + check_c_source_compiles( + " + #include diff --git a/dotnet.spec b/dotnet.spec index 10428dc..9252f3d 100644 --- a/dotnet.spec +++ b/dotnet.spec @@ -12,12 +12,18 @@ %global __provides_exclude ^(%{privlibs})\\.so %global __requires_exclude ^(%{privlibs})\\.so +# Filter flags not supported by clang/dotnet: +# -fcf-protection is not supported by clang +# -specs= is not supported by clang +%global dotnet_cflags %(echo %optflags | sed -e 's/-fcf-protection//' | sed -re 's/-specs=[^ ]*//g') +%global dotnet_ldflags %(echo %{__global_ldflags} | sed -re 's/-specs=[^ ]*//g') + %global sdk_version 2.1.401 %global runtime_version 2.1.3 Name: dotnet Version: %{sdk_version} -Release: 1%{?dist} +Release: 2%{?dist} Summary: .NET Core CLI tools and runtime License: MIT and ASL 2.0 and BSD URL: https://github.com/dotnet/ @@ -32,6 +38,8 @@ URL: https://github.com/dotnet/ Source0: https://omajid.fedorapeople.org/dotnet/dotnet-%{runtime_version}.tar.gz Source1: check-debug-symbols.py +Patch1: corefx-optflags-support.patch + ExclusiveArch: x86_64 BuildRequires: clang @@ -149,10 +157,18 @@ rm -rf Tools/configuration/configuration.props # Fix bad hardcoded path in build sed -i 's|/usr/share/dotnet|%{_libdir}/%{name}|' src/core-setup/src/corehost/common/pal.unix.cpp +pushd src/corefx +%patch1 -p1 +popd + %build # strace -fo strace.log \ +export CFLAGS="%{dotnet_cflags}" +export CXXFLAGS="%{dotnet_cflags}" +export LDFLAGS="%{dotnet_ldflags}" + ./build.sh /v:diag /p:MinimalConsoleLogOutput=false %install @@ -217,6 +233,9 @@ echo "Testing build results for debug symbols..." %{_libdir}/%{name}/sdk/%{sdk_version} %changelog +* Wed Sep 05 2018 Omair Majid - 2.1.401-2 +- Use distro-standard flags when building .NET Core + * Tue Aug 21 2018 Omair Majid - 2.1.401-1 - Update to .NET Core Runtime 2.1.3 and SDK 2.1.401