From a017ae016ac348b5d89b4c106223dd63505986ee Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 20 Nov 2025 17:05:40 +0100 Subject: [PATCH] spandsp3: fix leaking host header for build tools It was discovered that spandsp3 leaks host header on building build tools. This was caused by the Makefile not permitting to pass custom header on compiling build tools. To be more precise it was possible to leak host header for the tiff library for the tiffio.h header. Add pending patch to fix this and not depend on the host system header. Signed-off-by: Christian Marangi --- libs/spandsp3/Makefile | 6 ++ ...ig.patch => 100-spandsp3-pkg-config.patch} | 0 ...tch => 101-do-not-check-for-libxml2.patch} | 2 +- ...to-provide-custom-CPPFLAGS_FOR_BUILD.patch | 27 +++++++ ...e-CPPFLAGS_FOR_BUILD-for-build-tools.patch | 78 +++++++++++++++++++ 5 files changed, 112 insertions(+), 1 deletion(-) rename libs/spandsp3/patches/{01-spandsp3-pkg-config.patch => 100-spandsp3-pkg-config.patch} (100%) rename libs/spandsp3/patches/{02-do-not-check-for-libxml2.patch => 101-do-not-check-for-libxml2.patch} (95%) create mode 100644 libs/spandsp3/patches/103-Permit-to-provide-custom-CPPFLAGS_FOR_BUILD.patch create mode 100644 libs/spandsp3/patches/104-Propagate-CPPFLAGS_FOR_BUILD-for-build-tools.patch diff --git a/libs/spandsp3/Makefile b/libs/spandsp3/Makefile index 0888584..3e4dace 100644 --- a/libs/spandsp3/Makefile +++ b/libs/spandsp3/Makefile @@ -22,6 +22,8 @@ PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING PKG_MAINTAINER:=Jiri Slachta +PKG_BUILD_DEPENDS:=tiff/host + include $(INCLUDE_DIR)/package.mk define Package/libspandsp3 @@ -34,6 +36,10 @@ define Package/libspandsp3 ABI_VERSION:=3 endef +CONFIGURE_VARS += \ + CC_FOR_BUILD="$(HOSTCC)" \ + CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" + # Use fixed point math when soft float support is enabled for target devices. ifeq ($(CONFIG_SOFT_FLOAT),y) CONFIGURE_ARGS+= \ diff --git a/libs/spandsp3/patches/01-spandsp3-pkg-config.patch b/libs/spandsp3/patches/100-spandsp3-pkg-config.patch similarity index 100% rename from libs/spandsp3/patches/01-spandsp3-pkg-config.patch rename to libs/spandsp3/patches/100-spandsp3-pkg-config.patch diff --git a/libs/spandsp3/patches/02-do-not-check-for-libxml2.patch b/libs/spandsp3/patches/101-do-not-check-for-libxml2.patch similarity index 95% rename from libs/spandsp3/patches/02-do-not-check-for-libxml2.patch rename to libs/spandsp3/patches/101-do-not-check-for-libxml2.patch index 25aefae..be3f569 100644 --- a/libs/spandsp3/patches/02-do-not-check-for-libxml2.patch +++ b/libs/spandsp3/patches/101-do-not-check-for-libxml2.patch @@ -10,7 +10,7 @@ # Determine XML2 include path AC_MSG_CHECKING(for libxml/xmlmemory.h) -@@ -259,6 +262,7 @@ fi +@@ -254,6 +257,7 @@ fi AC_CHECK_HEADERS([libxml/xmlmemory.h]) AC_CHECK_HEADERS([libxml/parser.h]) AC_CHECK_HEADERS([libxml/xinclude.h]) diff --git a/libs/spandsp3/patches/103-Permit-to-provide-custom-CPPFLAGS_FOR_BUILD.patch b/libs/spandsp3/patches/103-Permit-to-provide-custom-CPPFLAGS_FOR_BUILD.patch new file mode 100644 index 0000000..b4ef3d1 --- /dev/null +++ b/libs/spandsp3/patches/103-Permit-to-provide-custom-CPPFLAGS_FOR_BUILD.patch @@ -0,0 +1,27 @@ +From b9aa8b79270bb5241508b2c3864c8069f73e75e5 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 20 Nov 2025 16:39:06 +0100 +Subject: [PATCH 1/2] Permit to provide custom CPPFLAGS_FOR_BUILD + +In the context of cross compilation the CPPFLAGS for the target might be +different than the one for build tools. + +Permit to provide custom CPPFLAGS_FOR_BUILD value to handle this +scenario. + +Signed-off-by: Christian Marangi +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -61,7 +61,7 @@ then + # are not the same, we set reasonable default values for the tools. + + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} +- CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" ++ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"\$(CPPFLAGS)"} + CC=${CC-${host_alias}-gcc} + CFLAGS=${CFLAGS-"-g -O2"} + CXX=${CXX-${host_alias}-c++} diff --git a/libs/spandsp3/patches/104-Propagate-CPPFLAGS_FOR_BUILD-for-build-tools.patch b/libs/spandsp3/patches/104-Propagate-CPPFLAGS_FOR_BUILD-for-build-tools.patch new file mode 100644 index 0000000..5d3a6d1 --- /dev/null +++ b/libs/spandsp3/patches/104-Propagate-CPPFLAGS_FOR_BUILD-for-build-tools.patch @@ -0,0 +1,78 @@ +From 6f5014881a436cf2ad2a87e3e2e2a0594dc83ff7 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 20 Nov 2025 16:40:44 +0100 +Subject: [PATCH 2/2] Propagate CPPFLAGS_FOR_BUILD for build tools + +On building build tools, only CC_FOR_BUILD is used with +CPPFLAGS_FOR_BUILD never actually passed. This was probably an oversight +when CPPFLAGS_FOR_BUILD was introduced. + +This is especially needed on cross compilation where the header are +placed on a standard location. + +To address this case, and make building build tool more robust, actually +pass the CPPFLAGS_FOR_BUILD for each tool. + +Signed-off-by: Christian Marangi +--- + src/Makefile.am | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -395,43 +395,43 @@ noinst_HEADERS = cielab_luts.h \ + v34_tables.h + + make_at_dictionary$(EXEEXT): $(top_srcdir)/src/make_at_dictionary.c +- $(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c -DHAVE_CONFIG_H -I$(top_builddir)/src ++ $(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src + + make_cielab_luts$(EXEEXT): $(top_srcdir)/src/make_cielab_luts.c +- $(CC_FOR_BUILD) -o make_cielab_luts$(EXEEXT) $(top_srcdir)/src/make_cielab_luts.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_cielab_luts$(EXEEXT) $(top_srcdir)/src/make_cielab_luts.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_math_fixed_tables$(EXEEXT): $(top_srcdir)/src/make_math_fixed_tables.c +- $(CC_FOR_BUILD) -o make_math_fixed_tables$(EXEEXT) $(top_srcdir)/src/make_math_fixed_tables.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_math_fixed_tables$(EXEEXT) $(top_srcdir)/src/make_math_fixed_tables.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_modem_filter$(EXEEXT): $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c +- $(CC_FOR_BUILD) -o make_modem_filter$(EXEEXT) $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_modem_filter$(EXEEXT) $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_modem_godard_descriptor$(EXEEXT): $(top_srcdir)/src/make_modem_godard_descriptor.c $(top_srcdir)/src/filter_tools.c +- $(CC_FOR_BUILD) -o make_modem_godard_descriptor$(EXEEXT) $(top_srcdir)/src/make_modem_godard_descriptor.c $(top_srcdir)/src/filter_tools.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_modem_godard_descriptor$(EXEEXT) $(top_srcdir)/src/make_modem_godard_descriptor.c $(top_srcdir)/src/filter_tools.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_t43_gray_code_tables$(EXEEXT): $(top_srcdir)/src/make_t43_gray_code_tables.c +- $(CC_FOR_BUILD) -o make_t43_gray_code_tables$(EXEEXT) $(top_srcdir)/src/make_t43_gray_code_tables.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_t43_gray_code_tables$(EXEEXT) $(top_srcdir)/src/make_t43_gray_code_tables.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_v17_v32_constellation_map$(EXEEXT): $(top_srcdir)/src/make_v17_v32_constellation_map.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c +- $(CC_FOR_BUILD) -o make_v17_v32_constellation_map$(EXEEXT) $(top_srcdir)/src/make_v17_v32_constellation_map.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_v17_v32_constellation_map$(EXEEXT) $(top_srcdir)/src/make_v17_v32_constellation_map.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_v17_v32_convolutional_encoder$(EXEEXT): $(top_srcdir)/src/make_v17_v32_convolutional_encoder.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c +- $(CC_FOR_BUILD) -o make_v17_v32_convolutional_encoder$(EXEEXT) $(top_srcdir)/src/make_v17_v32_convolutional_encoder.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_v17_v32_convolutional_encoder$(EXEEXT) $(top_srcdir)/src/make_v17_v32_convolutional_encoder.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_v29_constellation_map$(EXEEXT): $(top_srcdir)/src/make_v29_constellation_map.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c +- $(CC_FOR_BUILD) -o make_v29_constellation_map$(EXEEXT) $(top_srcdir)/src/make_v29_constellation_map.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_v29_constellation_map$(EXEEXT) $(top_srcdir)/src/make_v29_constellation_map.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_v34_convolutional_coders$(EXEEXT): $(top_srcdir)/src/make_v34_convolutional_coders.c +- $(CC_FOR_BUILD) -o make_v34_convolutional_coders$(EXEEXT) $(top_srcdir)/src/make_v34_convolutional_coders.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_v34_convolutional_coders$(EXEEXT) $(top_srcdir)/src/make_v34_convolutional_coders.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_v34_probe_signals$(EXEEXT): $(top_srcdir)/src/make_v34_probe_signals.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c +- $(CC_FOR_BUILD) -o make_v34_probe_signals$(EXEEXT) $(top_srcdir)/src/make_v34_probe_signals.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm ++ $(CC_FOR_BUILD) -o make_v34_probe_signals$(EXEEXT) $(top_srcdir)/src/make_v34_probe_signals.c $(top_srcdir)/src/g711.c $(top_srcdir)/src/alloc.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + + make_v34_shell_map$(EXEEXT): $(top_srcdir)/src/make_v34_shell_map.c + $(CC_FOR_BUILD) -o make_v34_shell_map$(EXEEXT) $(top_srcdir)/src/make_v34_shell_map.c -DHAVE_CONFIG_H -I$(top_builddir)/src + + make_v34_tx_pre_emphasis_filters$(EXEEXT): $(top_srcdir)/src/make_v34_tx_pre_emphasis_filters.c $(top_srcdir)/tools/meteor-engine.c +- $(CC_FOR_BUILD) -o make_v34_tx_pre_emphasis_filters$(EXEEXT) $(top_srcdir)/src/make_v34_tx_pre_emphasis_filters.c $(top_srcdir)/tools/meteor-engine.c -DHAVE_CONFIG_H -I$(top_builddir)/src -I$(top_builddir)/tools -lm ++ $(CC_FOR_BUILD) -o make_v34_tx_pre_emphasis_filters$(EXEEXT) $(top_srcdir)/src/make_v34_tx_pre_emphasis_filters.c $(top_srcdir)/tools/meteor-engine.c $(CPPFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -I$(top_builddir)/src -I$(top_builddir)/tools -lm + + # We need to run make_at_dictionary, so it generates the + # at_interpreter_dictionary.h file -- 2.30.2