Projects
Mega:23.09
openEuler-rpm-config
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 7
View file
_service:tar_scm:openEuler-rpm-config.spec
Changed
@@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 30 -Release: 47 +Release: 48 License: GPL+ Summary: specific rpm configuration files URL: https://gitee.com/openeuler/openEuler-rpm-config @@ -34,6 +34,8 @@ Patch21: check-if-the-file-is-a-symbolic-link-in-brp-digest-list.patch Patch22: fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch Patch23: Add-ppc64le-support.patch +Patch24: Add-support-for-selecting-clang-as-a-toolchain.patch +Patch25: Call-set_build_flags-cc-before-build-check-and-insta.patch Provides: python-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} Provides: python2-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} @@ -145,6 +147,9 @@ %{rpmvdir}/find-requires.ksyms %changelog +* Tue Jan 9 2024 liyunfei <liyunfei33@huawei.com> - 30-48 +- Add clang toolchain support + * Mon Dec 11 2023 jiahua.yu <jiahua.yu@shingroup.cn> - 30-47 - Init support for arch ppc64le
View file
_service:tar_scm:Add-support-for-selecting-clang-as-a-toolchain.patch
Added
@@ -0,0 +1,135 @@ +From f2a6af2ce79e26bf47604b610056d8c524b647f2 Mon Sep 17 00:00:00 2001 +From: liyunfei <liyunfei33@huawei.com> +Date: Tue, 9 Jan 2024 20:39:10 +0800 +Subject: PATCH 1/2 Add support for selecting clang as a toolchain + +--- + generic-hardened-clang.cfg | 1 + + macros | 58 ++++++++++++++++++++++++++++++++++++-- + rpmrc | 4 +-- + 3 files changed, 58 insertions(+), 5 deletions(-) + create mode 100644 generic-hardened-clang.cfg + +diff --git a/generic-hardened-clang.cfg b/generic-hardened-clang.cfg +new file mode 100644 +index 0000000..ac596df +--- /dev/null ++++ b/generic-hardened-clang.cfg +@@ -0,0 +1 @@ ++-fPIE +\ No newline at end of file +diff --git a/macros b/macros +index 5fdaf0a..0062126 100755 +--- a/macros ++++ b/macros +@@ -23,6 +23,46 @@ + + %_build_id_links none + ++# GCC toolchain ++%__cc_gcc gcc ++%__cxx_gcc g++ ++%__cpp_gcc gcc -E ++ ++# Clang toolchain ++%__cc_clang clang ++%__cxx_clang clang++ ++%__cpp_clang clang-cpp ++ ++# Default to the GCC toolchain ++# ++# It is enough to override `toolchain` macro and all relevant macro for C/C++ ++# compilers will be switched. Either in the spec or in the command-line. ++# ++# %global toolchain clang ++# ++# or: ++# ++# rpmbuild -D "toolchain clang" … ++# ++# Inside a spec file it is also possible to determine which toolchain is in use ++# by testing the same macro. For example: ++# ++# %if "%{toolchain}" == "gcc" ++# BuildRequires: gcc ++# %endif ++# ++# or: ++# ++# %if "%{toolchain}" == "clang" ++# BuildRequires: clang compiler-rt ++# %endif ++# ++%toolchain gcc ++ ++%__cc %{expand:%%{__cc_%{toolchain}}} ++%__cxx %{expand:%%{__cxx_%{toolchain}}} ++%__cpp %{expand:%%{__cpp_%{toolchain}}} ++ + #============================================================================== + # ---- compiler flags. + +@@ -31,6 +71,11 @@ + %build_fflags %{optflags} -fexceptions -I%{_fmoddir} + %build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} + ++%set_build_cc \ ++ CC=%{__cc}; export CC ; \ ++ CXX=%{__cxx}; export CXX ; \ ++ CCC="${CCC:-%{__cxx}}" ; export CCC ++ + %set_build_flags \ + CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \ +@@ -67,6 +112,7 @@ + + %configure \ + %{set_build_flags}; \ ++ % "%{toolchain}" == "gcc" ? "" : "%{set_build_cc};" \ + "%_configure_gnuconfig_hack" = 1 && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \ + -f /usr/lib/rpm/%{_vendor}/$(basename $i) && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(basename $i) $i ; \ + done ; \ +@@ -162,8 +208,10 @@ + # secure options for rpmbuild + # + # #hardened options +-%_hardening_cflags -specs=/usr/lib/rpm/generic-hardened-cc1 +-%_hardening_ldflags -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld ++%_hardening_gcc_cflags -specs=/usr/lib/rpm/generic-hardened-cc1 ++%_hardening_clang_cflags --config /usr/lib/rpm/generic-hardened-clang.cfg ++%_hardening_cflags %{expand:%%{_hardening_%{toolchain}_cflags}} -fstack-protector-strong ++%_hardening_ldflags -Wl,-z,now % "%{toolchain}" == "gcc" ? "-specs=/usr/lib/rpm/generic-hardened-ld" : "" + # Use "%undefine _hardened_build" to disable. + %_hardened_build 1 + %_hardened_cflags %{?_hardened_build:%{_hardening_cflags}} +@@ -195,7 +243,11 @@ + #%_ld_as_needed 1 + %_ld_as_needed_flags %{?_ld_as_needed:-Wl,--as-needed} + +-%__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches %{_hardened_cflags} ++%_general_options -O2 -g -grecord-gcc-switches -pipe % "%{toolchain}" == "clang" ? "-fgcc-compatible" : "" ++%_warning_options -Wall -Werror=format-security ++%_preprocessor_defines -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS ++ ++%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} + + # Automatically trim changelog entries after 2 years + %_changelog_trimtime %{lua:print(os.time() - 2 * 365 * 86400)} +diff --git a/rpmrc b/rpmrc +index 10d7c86..b5e569c 100755 +--- a/rpmrc ++++ b/rpmrc +@@ -5,8 +5,8 @@ optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-un + optflags: ia64 %{__global_compiler_flags} + optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection + +-optflags: aarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection +-optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection ++optflags: aarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables % "%{toolchain}" == "gcc" ? "-fstack-clash-protection" : "" ++optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables % "%{toolchain}" == "gcc" ? "-fstack-clash-protection" : "" + + optflags: ppc64le %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection + +-- +2.27.0 +
View file
_service:tar_scm:Call-set_build_flags-cc-before-build-check-and-insta.patch
Added
@@ -0,0 +1,47 @@ +From c6b15b8c17f957d736dd975d106b10d419070ebd Mon Sep 17 00:00:00 2001 +From: liyunfei <liyunfei33@huawei.com> +Date: Tue, 9 Jan 2024 20:50:34 +0800 +Subject: PATCH 2/2 Call %set_build_flags&cc before %build, %check, and + %install stages + +--- + macros | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/macros b/macros +index 0062126..8c16706 100755 +--- a/macros ++++ b/macros +@@ -83,6 +83,20 @@ + FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \ + LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS + ++# Automatically use set_build_flags macro for build, check, and ++# install phases. ++# Use "%undefine _auto_set_build_flags" to disable" ++%_auto_set_build_flags 0 ++%__spec_build_pre %{___build_pre} %%{_auto_set_build_flags} ? "%{set_build_flags}" : "" ++%__spec_check_pre %{___check_pre} %%{_auto_set_build_flags} ? "%{set_build_flags}" : "" ++ ++# Automatically use set_build_cc macro for build, check, and ++# install phases. ++# Use "%undefine _auto_set_build_cc" to disable" ++%_auto_set_build_cc %"%{toolchain}" == "gcc" ? 0 : 1 ++%__spec_build_pre %{___build_pre} %%{_auto_set_build_cc} ? "%{set_build_cc}" : "" ++%__spec_check_pre %{___check_pre} %%{_auto_set_build_cc} ? "%{set_build_cc}" : "" ++ + #For backwards compatibility only. + %__global_cflags %{build_cflags} + %__global_cxxflags %{build_cxxflags} +@@ -144,6 +158,8 @@ + "$RPM_BUILD_ROOT" != "/" && rm -rf "${RPM_BUILD_ROOT}"\ + mkdir -p `dirname "$RPM_BUILD_ROOT"`\ + mkdir "$RPM_BUILD_ROOT"\ ++ %%{_auto_set_build_flags} ? "%{set_build_flags}" : ""\ ++ %%{_auto_set_build_cc} ? "%{set_build_cc}" : ""\ + %{nil} + + # ---- Expanded at end of %install scriptlet. +-- +2.27.0 +
View file
_service
Changed
@@ -1,6 +1,7 @@ <services> <service name="tar_scm"> - <param name="url">git@gitee.com:src-openeuler/openEuler-rpm-config.git</param> + <!-- git@gitee.com:src-openeuler/openEuler-rpm-config.git --> + <param name="url">git@gitee.com:liyunfei33/openEuler-rpm-config-master.git</param> <param name="scm">git</param> <param name="revision">master</param> <param name="exclude">*</param>
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2