From d7b891ddd0fa03724d80e97d7604b39e40ab5681 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Mon, 11 May 2026 09:58:59 +0300 Subject: [PATCH] fontconfig: fix build with SDK producing -dD style output Some SDK/host GCC configurations, when meson invokes cc.preprocess() to expand fcobjshash.gperf.h, produce output that includes predefined macro dumps (e.g. #define __STDC__ 1) alongside linemarker lines. The upstream cutout.py script, which strips CUT_OUT_BEGIN/END-delimited sections from the preprocessed output before feeding it to gperf, passes these lines through verbatim into fcobjshash.gperf. gperf then copies them into the declarations section of fcobjshash.h. When fcobjs.c includes fcobjshash.h, the compiler encounters #define redefinitions and stray # tokens, causing a build failure. Fix cutout.py to skip any line starting with # (C preprocessor linemarkers and predefined macro definitions) before writing to the output gperf file. Signed-off-by: Alexandru Ardelean --- utils/fontconfig/Makefile | 2 +- .../001-cutout-strip-preprocessor-artifacts.patch | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 utils/fontconfig/patches/001-cutout-strip-preprocessor-artifacts.patch diff --git a/utils/fontconfig/Makefile b/utils/fontconfig/Makefile index 69409d9914..e1eb0073e0 100644 --- a/utils/fontconfig/Makefile +++ b/utils/fontconfig/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fontconfig PKG_VERSION:=2.16.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.freedesktop.org/software/fontconfig/release/ diff --git a/utils/fontconfig/patches/001-cutout-strip-preprocessor-artifacts.patch b/utils/fontconfig/patches/001-cutout-strip-preprocessor-artifacts.patch new file mode 100644 index 0000000000..ceaa694d98 --- /dev/null +++ b/utils/fontconfig/patches/001-cutout-strip-preprocessor-artifacts.patch @@ -0,0 +1,11 @@ +--- a/src/cutout.py ++++ b/src/cutout.py +@@ -19,6 +19,8 @@ if __name__== '__main__': + + if write and l: + stripped = re.sub(r'^\s+', '', l) ++ if stripped.startswith('#'): ++ continue + stripped = re.sub(r'\s*,\s*', ',', stripped) + if not stripped.isspace() and stripped: + out.write('%s\n' % stripped)