fontconfig: fix build with SDK producing -dD style output
authorAlexandru Ardelean <redacted>
Mon, 11 May 2026 06:58:59 +0000 (09:58 +0300)
committerAlexandru Ardelean <redacted>
Wed, 13 May 2026 04:27:14 +0000 (07:27 +0300)
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 <redacted>
utils/fontconfig/Makefile
utils/fontconfig/patches/001-cutout-strip-preprocessor-artifacts.patch [new file with mode: 0644]

index 69409d991483ffaf0ead934ab59a8a33278235ce..e1eb0073e0903e902530fa5e536345eb717c25bc 100644 (file)
@@ -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 (file)
index 0000000..ceaa694
--- /dev/null
@@ -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)
git clone https://git.99rst.org/PROJECT