From a6899536366ccd9fe7e8fcc0c94d633710cd46da Mon Sep 17 00:00:00 2001 From: jammyjellyfish Date: Fri, 21 Apr 2023 21:27:11 +0800 Subject: [PATCH] Fix clang build error --- dtc.spec | 13 ++++++++++++- remove-ldflags-in-cflags.patch | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 remove-ldflags-in-cflags.patch diff --git a/dtc.spec b/dtc.spec index aedccf2..3b3b38b 100644 --- a/dtc.spec +++ b/dtc.spec @@ -2,7 +2,7 @@ Name: dtc Version: 1.6.1 -Release: 2 +Release: 3 Summary: Device tree compiler License: GPLv2+ URL: https://devicetree.org/ @@ -14,6 +14,7 @@ Provides: libfdt Obsoletes: libfdt Patch1: openEuler-add-secure-compile-option-in-Makefile.patch +Patch2: remove-ldflags-in-cflags.patch %description @@ -47,9 +48,16 @@ This package provides python3 bindings for libfdt %autosetup -n %{name}-%{version} -p1 %build +%if "%toolchain" == "clang" + CFLAGS="$CFLAGS -Wno-error=cast-qual -Wno-error=missing-prototypes -Wno-error=unused-command-line-argument" +%endif + %make_build %install +%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 \ LIBDIR=%{_libdir} BINDIR=%{_bindir} INCLUDEDIR=%{_includedir} V=1 @@ -80,6 +88,9 @@ make install DESTDIR=$RPM_BUILD_ROOT PREFIX=$RPM_BUILD_ROOT/usr \ %doc Documentation/manual.txt %changelog +* Fri Apr 21 2023 jammyjellyfish - 1.6.1-3 +- Fix clang build error + * Wed Oct 26 2022 yanglongkang - 1.6.1-2 - rebuild for next release diff --git a/remove-ldflags-in-cflags.patch b/remove-ldflags-in-cflags.patch new file mode 100644 index 0000000..6141461 --- /dev/null +++ b/remove-ldflags-in-cflags.patch @@ -0,0 +1,18 @@ +diff -up dtc-1.6.1/Makefile.orig2 dtc-1.6.1/Makefile +--- dtc-1.6.1/Makefile.orig2 2023-04-21 18:28:46.693701292 +0800 ++++ dtc-1.6.1/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 \ + -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 -- Gitee