!26 支持 clang 构建,移除 CFLAGS 中的 linker 选项

From: @dillon_chen 
Reviewed-by: @overweight 
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2023-07-14 09:39:00 +00:00 committed by Gitee
commit 6228946dca
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 30 additions and 1 deletions

View File

@ -2,7 +2,7 @@
Name: dtc Name: dtc
Version: 1.7.0 Version: 1.7.0
Release: 1 Release: 2
Summary: Device tree compiler Summary: Device tree compiler
License: GPLv2+ License: GPLv2+
URL: https://devicetree.org/ URL: https://devicetree.org/
@ -14,6 +14,7 @@ Provides: libfdt
Obsoletes: libfdt Obsoletes: libfdt
Patch1: openEuler-add-secure-compile-option-in-Makefile.patch Patch1: openEuler-add-secure-compile-option-in-Makefile.patch
Patch2: remove-ldflags-in-cflags.patch
%description %description
The devicetree is a data structure for describing hardware. Rather than hard coding The devicetree is a data structure for describing hardware. Rather than hard coding
@ -47,11 +48,17 @@ This package provides python3 bindings for libfdt
%build %build
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%if "%toolchain" == "clang"
CFLAGS="$CFLAGS -Wno-error=cast-qual -Wno-error=missing-prototypes -Wno-error=unused-command-line-argument"
%endif
%make_build %make_build
%install %install
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%if "%toolchain" == "clang"
CFLAGS="$CFLAGS -Wno-error=cast-qual -Wno-error=missing-prototypes -Wno-error=unused-command-line-argument"
%endif
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=$RPM_BUILD_ROOT/usr \ make install DESTDIR=$RPM_BUILD_ROOT PREFIX=$RPM_BUILD_ROOT/usr \
LIBDIR=%{_libdir} BINDIR=%{_bindir} INCLUDEDIR=%{_includedir} V=1 LIBDIR=%{_libdir} BINDIR=%{_bindir} INCLUDEDIR=%{_includedir} V=1
@ -85,6 +92,9 @@ export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%doc Documentation/manual.txt %doc Documentation/manual.txt
%changelog %changelog
* Fri Jul 14 2023 dillon chen <dillon.chen@gmail.com> - 1.7.0-2
- add clang build from jammyjellyfish PR
* Fri Jul 14 2023 dillon chen <dillon.chen@gmail.com> - 1.7.0-1 * Fri Jul 14 2023 dillon chen <dillon.chen@gmail.com> - 1.7.0-1
- update version to 1.7.0 - update version to 1.7.0

View File

@ -0,0 +1,19 @@
diff -up dtc-1.7.0/Makefile.orig2 dtc-1.7.0/Makefile
--- dtc-1.7.0/Makefile.orig2 2023-04-21 18:28:46.693701292 +0800
+++ dtc-1.7.0/Makefile 2023-04-21 18:28:58.425735633 +0800
@@ -20,12 +20,12 @@ CONFIG_LOCALVERSION =
# See libfdt_internal.h for details
ASSUME_MASK ?= 0
-EXTRA_CFLAGS += -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wl,-z,now -fPIE
+EXTRA_CFLAGS += -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE
LDFLAGS += -Wl,-z,now -pie
CPPFLAGS = -I libfdt -I . -DFDT_ASSUME_MASK=$(ASSUME_MASK)
WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs -Wsign-compare \
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
-CFLAGS = -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS) $(EXTRA_CFLAGS)
+CFLAGS += -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS) $(EXTRA_CFLAGS)
BISON = bison
LEX = flex