add clang build

This commit is contained in:
dillon_chen 2023-07-14 17:12:26 +08:00
parent 9e2032315a
commit b2bfb30dd2
2 changed files with 30 additions and 1 deletions

View File

@ -2,7 +2,7 @@
Name: dtc
Version: 1.7.0
Release: 1
Release: 2
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
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
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
%install
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 \
LIBDIR=%{_libdir} BINDIR=%{_bindir} INCLUDEDIR=%{_includedir} V=1
@ -85,6 +92,9 @@ export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%doc Documentation/manual.txt
%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
- 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