diff --git a/0000-build-the-same-so-api-with-Makefile.patch b/0000-build-the-same-so-api-with-Makefile.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5b69cf9ad10b8879f7879941e243ff1add4b237 --- /dev/null +++ b/0000-build-the-same-so-api-with-Makefile.patch @@ -0,0 +1,33 @@ +From e6c1fb931a77d82d89229ff3c8749cde9a359361 Mon Sep 17 00:00:00 2001 +From: Funda Wang +Date: Tue, 4 Nov 2025 11:59:35 +0800 +Subject: [PATCH] build the same so api with Makefile + +--- + libfdt/meson.build | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/libfdt/meson.build b/libfdt/meson.build +index 240bdf4..6db3aea 100644 +--- a/libfdt/meson.build ++++ b/libfdt/meson.build +@@ -17,12 +17,13 @@ sources = files( + ) + + libfdt = library( +- 'fdt', sources, +- version: '1.6.0', +- link_args: ['-Wl,--no-undefined', version_script], ++ 'fdt-@0@'.format(meson.project_version()), sources, ++ link_args: ['-Wl,--no-undefined', '-Wl,-soname,libfdt.so.1', version_script], + link_depends: 'version.lds', + install: true, + ) ++install_symlink('libfdt.so.1', pointing_to: 'libfdt-@0@.so'.format(meson.project_version()), install_dir: get_option('libdir')) ++install_symlink('libfdt.so', pointing_to: 'libfdt-@0@.so'.format(meson.project_version()), install_dir: get_option('libdir')) + + libfdt_a = static_library( + 'fdt', sources, +-- +2.47.3 + diff --git a/6001-meson-Fix-cell-overflow-tests-when-running-from-meso.patch b/6001-meson-Fix-cell-overflow-tests-when-running-from-meso.patch new file mode 100644 index 0000000000000000000000000000000000000000..584480377666768df946218c19ec29bd4aa0c931 --- /dev/null +++ b/6001-meson-Fix-cell-overflow-tests-when-running-from-meso.patch @@ -0,0 +1,32 @@ +From 32174a66efa4ad19fc6a2a6422e4af2ae4f055cb Mon Sep 17 00:00:00 2001 +From: David Gibson +Date: Tue, 28 Feb 2023 10:33:58 +1100 +Subject: [PATCH] meson: Fix cell overflow tests when running from meson + +Because meson always builds out-of-tree we need to reference things in the +original source tree via $SRCDIR from run_tests.sh. We forgot a couple of +cases for the cell overflow tests. Fix them. + +Signed-off-by: David Gibson +--- + tests/run_tests.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/run_tests.sh b/tests/run_tests.sh +index 91350ad..f899d8c 100755 +--- a/tests/run_tests.sh ++++ b/tests/run_tests.sh +@@ -519,8 +519,8 @@ libfdt_tests () { + check_tests "$SRCDIR/phandle-args-overflow.dts" clocks_property + + ## https://github.com/dgibson/dtc/issues/74 +- run_dtc_test -I dts -O dtb -o cell-overflow-results.test.dtb cell-overflow-results.dts +- run_dtc_test -I dts -O dtb -o cell-overflow.test.dtb cell-overflow.dts ++ run_dtc_test -I dts -O dtb -o cell-overflow-results.test.dtb "$SRCDIR/cell-overflow-results.dts" ++ run_dtc_test -I dts -O dtb -o cell-overflow.test.dtb "$SRCDIR/cell-overflow.dts" + run_test dtbs_equal_ordered cell-overflow.test.dtb cell-overflow-results.test.dtb + + # check full tests +-- +2.47.3 + diff --git a/6002-meson.build-bump-version-to-1.7.0.patch b/6002-meson.build-bump-version-to-1.7.0.patch new file mode 100644 index 0000000000000000000000000000000000000000..fad11bc11bda16ccba8fcff3eef046585d94f564 --- /dev/null +++ b/6002-meson.build-bump-version-to-1.7.0.patch @@ -0,0 +1,26 @@ +From 64a907f08b9bedd89833c1eee674148cff2343c6 Mon Sep 17 00:00:00 2001 +From: Nikolay Letov +Date: Wed, 22 Feb 2023 13:36:07 +0300 +Subject: [PATCH] meson.build: bump version to 1.7.0 + +[This was botched in the actual 1.7.0 release :( - David Gibson] + +Signed-off-by: Nikolay Letov +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index f50cf1e..b2c53b9 100644 +--- a/meson.build ++++ b/meson.build +@@ -1,5 +1,5 @@ + project('dtc', 'c', +- version: '1.6.0', ++ version: '1.7.0', + license: ['GPL2+', 'BSD-2'], + default_options: 'werror=true', + ) +-- +2.47.3 + diff --git a/dtc.spec b/dtc.spec index 28f7ef949be63df89e39fac6dc949612a4e2be82..59ece7700ded623d8402867c0f5b93cca53ffb85 100644 --- a/dtc.spec +++ b/dtc.spec @@ -1,25 +1,19 @@ -%define _wrong_version_format_terminate_build 0 - Name: dtc Version: 1.7.0 -Release: 4 +Release: 5 Summary: Device tree compiler -License: GPLv2+ +License: GPL-2.0-or-later URL: https://devicetree.org/ Source0: https://www.kernel.org/pub/software/utils/%{name}/%{name}-%{version}.tar.xz +Patch0000: 0000-build-the-same-so-api-with-Makefile.patch +Patch6001: 6001-meson-Fix-cell-overflow-tests-when-running-from-meso.patch +Patch6002: 6002-meson.build-bump-version-to-1.7.0.patch -BuildRequires: gcc make flex bison swig +BuildRequires: gcc meson flex bison swig BuildRequires: python3-devel python3-setuptools python3-setuptools_scm python3-pip python3-wheel Provides: libfdt Obsoletes: libfdt -Patch1: openEuler-add-secure-compile-option-in-Makefile.patch -Patch2: remove-ldflags-in-cflags.patch - -%ifarch ppc64le -Patch3: fix-secure-compile-option-error-in-Makefile.patch -%endif - %description The devicetree is a data structure for describing hardware. Rather than hard coding every detail of a device into an operating system, many aspects of the hardware can @@ -52,31 +46,20 @@ 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 - +%meson -Dvalgrind=disabled -Dyaml=disabled +%meson_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 +%meson_install +pushd %{_vpath_builddir}/libfdt +ln -s libfdt-%{version}.so libfdt.so.1 +popd +rm -f %{buildroot}%{_libdir}/pkgconfig/*.pc %check export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} -%make_build check - -%pre - -%preun - -%post - -%postun +%meson_test %files %license GPL README.license @@ -96,6 +79,9 @@ export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %doc Documentation/manual.txt %changelog +* Mon Nov 03 2025 Funda Wang - 1.7.0-5 +- build with meson + * Mon Aug 25 2025 wangjiang - 1.7.0-4 - fix changelog diff --git a/fix-secure-compile-option-error-in-Makefile.patch b/fix-secure-compile-option-error-in-Makefile.patch deleted file mode 100644 index 7a093defa03ee4b5294778fd0405a4980fef3369..0000000000000000000000000000000000000000 --- a/fix-secure-compile-option-error-in-Makefile.patch +++ /dev/null @@ -1,29 +0,0 @@ -From de1f376fd21c7a8f46d67597fca57cfd2be66cd8 Mon Sep 17 00:00:00 2001 -From: Yingjun Ni -Date: Thu, 18 Jul 2024 10:40:34 +0800 -Subject: [PATCH] Fix secure compile option error in Makefile. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -dtc rpm包会生成dtc bin和libfdt.so,-fPIE不作用于libfdt.so,其他应用(如qemu)调用libfdt.so时会出现段错误,使用-fPIC代替-fPIE。 ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index 5ef6edd..d2124da 100644 ---- a/Makefile -+++ b/Makefile -@@ -20,7 +20,7 @@ CONFIG_LOCALVERSION = - # See libfdt_internal.h for details - ASSUME_MASK ?= 0 - --EXTRA_CFLAGS += -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE -+EXTRA_CFLAGS += -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIC - LDFLAGS += -Wl,-z,now -pie - CPPFLAGS = -I libfdt -I . -DFDT_ASSUME_MASK=$(ASSUME_MASK) - WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs -Wsign-compare \ --- -2.43.0 - diff --git a/openEuler-add-secure-compile-option-in-Makefile.patch b/openEuler-add-secure-compile-option-in-Makefile.patch deleted file mode 100644 index 8806902151aba075c12334b76289ecc2bd3f0e09..0000000000000000000000000000000000000000 --- a/openEuler-add-secure-compile-option-in-Makefile.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1c3f9fea2f808ae9eb481bc344ff589b42a106a7 Mon Sep 17 00:00:00 2001 -From: Yangyang Shen -Date: Sat, 20 Mar 2021 16:40:13 +0800 -Subject: [PATCH] openEuler add secure compile option in Makefile - ---- - Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Makefile b/Makefile -index f02aa19..a37a2db 100644 ---- a/Makefile -+++ b/Makefile -@@ -20,6 +20,8 @@ CONFIG_LOCALVERSION = - # See libfdt_internal.h for details - ASSUME_MASK ?= 0 - -+EXTRA_CFLAGS += -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wl,-z,now -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 --- -2.23.0 - diff --git a/remove-ldflags-in-cflags.patch b/remove-ldflags-in-cflags.patch deleted file mode 100644 index d5baa1967f8442fef1fb2cd60f85962aa4321fe2..0000000000000000000000000000000000000000 --- a/remove-ldflags-in-cflags.patch +++ /dev/null @@ -1,19 +0,0 @@ -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 -