Skip to content

Commit 865cb23

Browse files
committed
build: use patch rather than sed in fontconfig package
1 parent 335bd7f commit 865cb23

File tree

3 files changed

+92
-6
lines changed

3 files changed

+92
-6
lines changed

depends/packages/fontconfig.mk

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ $(package)_download_path=https://www.freedesktop.org/software/fontconfig/release
44
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
55
$(package)_sha256_hash=b449a3e10c47e1d1c7a6ec6e2016cca73d3bd68fbbd4f0ae5cc6b573f7d6c7f3
66
$(package)_dependencies=freetype expat
7+
$(package)_patches=remove_char_width_usage.patch gperf_header_regen.patch
78

89
define $(package)_set_vars
910
$(package)_config_opts=--disable-docs --disable-static --disable-libxml2 --disable-iconv
1011
$(package)_config_opts += --disable-dependency-tracking --enable-option-checking
1112
endef
1213

14+
define $(package)_preprocess_cmds
15+
patch -p1 < $($(package)_patch_dir)/remove_char_width_usage.patch && \
16+
patch -p1 < $($(package)_patch_dir)/gperf_header_regen.patch
17+
endef
18+
1319
define $(package)_config_cmds
1420
$($(package)_autoconf)
1521
endef
1622

17-
# 2.12.1 uses CHAR_WIDTH which is reserved and clashes with some glibc versions, but newer versions of fontconfig
18-
# have broken makefiles which needlessly attempt to re-generate headers with gperf.
19-
# Instead, change all uses of CHAR_WIDTH, and disable the rule that forces header re-generation.
20-
# This can be removed once the upstream build is fixed.
2123
define $(package)_build_cmds
22-
sed -i 's/CHAR_WIDTH/CHARWIDTH/g' fontconfig/fontconfig.h src/fcobjshash.gperf src/fcobjs.h src/fcobjshash.h && \
23-
sed -i 's/fcobjshash.h: fcobjshash.gperf/fcobjshash.h:/' src/Makefile && \
2424
$(MAKE)
2525
endef
2626

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
commit 7b6eb33ecd88768b28c67ce5d2d68a7eed5936b6
2+
Author: fanquake <[email protected]>
3+
Date: Tue Aug 25 14:34:53 2020 +0800
4+
5+
Remove rule that causes inadvertant header regeneration
6+
7+
Otherwise the makefile will needlessly attempt to re-generate the
8+
headers with gperf. This can be dropped once the upstream build is fixed.
9+
10+
See #10851.
11+
12+
diff --git a/src/Makefile.in b/src/Makefile.in
13+
index f4626ad..4ae1b00 100644
14+
--- a/src/Makefile.in
15+
+++ b/src/Makefile.in
16+
@@ -903,7 +903,7 @@ fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
17+
' - > [email protected] && \
18+
mv -f [email protected] $@ || ( $(RM) [email protected] && false )
19+
20+
-fcobjshash.h: fcobjshash.gperf
21+
+fcobjshash.h:
22+
$(AM_V_GEN) $(GPERF) -m 100 $< > [email protected] && \
23+
mv -f [email protected] $@ || ( $(RM) [email protected] && false )
24+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
commit 28165a9b078583dc8e9e5c344510e37582284cef
2+
Author: fanquake <[email protected]>
3+
Date: Mon Aug 17 20:35:42 2020 +0800
4+
5+
Remove usage of CHAR_WIDTH
6+
7+
CHAR_WIDTH which is reserved and clashes with glibc 2.25+
8+
9+
See #10851.
10+
11+
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
12+
index 5c72b22..843c532 100644
13+
--- a/fontconfig/fontconfig.h
14+
+++ b/fontconfig/fontconfig.h
15+
@@ -128,7 +128,7 @@ typedef int FcBool;
16+
#define FC_USER_CACHE_FILE ".fonts.cache-" FC_CACHE_VERSION
17+
18+
/* Adjust outline rasterizer */
19+
-#define FC_CHAR_WIDTH "charwidth" /* Int */
20+
+#define FC_CHARWIDTH "charwidth" /* Int */
21+
#define FC_CHAR_HEIGHT "charheight"/* Int */
22+
#define FC_MATRIX "matrix" /* FcMatrix */
23+
24+
diff --git a/src/fcobjs.h b/src/fcobjs.h
25+
index 1fc4f65..d27864b 100644
26+
--- a/src/fcobjs.h
27+
+++ b/src/fcobjs.h
28+
@@ -51,7 +51,7 @@ FC_OBJECT (DPI, FcTypeDouble, NULL)
29+
FC_OBJECT (RGBA, FcTypeInteger, NULL)
30+
FC_OBJECT (SCALE, FcTypeDouble, NULL)
31+
FC_OBJECT (MINSPACE, FcTypeBool, NULL)
32+
-FC_OBJECT (CHAR_WIDTH, FcTypeInteger, NULL)
33+
+FC_OBJECT (CHARWIDTH, FcTypeInteger, NULL)
34+
FC_OBJECT (CHAR_HEIGHT, FcTypeInteger, NULL)
35+
FC_OBJECT (MATRIX, FcTypeMatrix, NULL)
36+
FC_OBJECT (CHARSET, FcTypeCharSet, FcCompareCharSet)
37+
diff --git a/src/fcobjshash.gperf b/src/fcobjshash.gperf
38+
index 80a0237..eb4ad84 100644
39+
--- a/src/fcobjshash.gperf
40+
+++ b/src/fcobjshash.gperf
41+
@@ -44,7 +44,7 @@ int id;
42+
"rgba",FC_RGBA_OBJECT
43+
"scale",FC_SCALE_OBJECT
44+
"minspace",FC_MINSPACE_OBJECT
45+
-"charwidth",FC_CHAR_WIDTH_OBJECT
46+
+"charwidth",FC_CHARWIDTH_OBJECT
47+
"charheight",FC_CHAR_HEIGHT_OBJECT
48+
"matrix",FC_MATRIX_OBJECT
49+
"charset",FC_CHARSET_OBJECT
50+
diff --git a/src/fcobjshash.h b/src/fcobjshash.h
51+
index 5a4d1ea..4e66bb0 100644
52+
--- a/src/fcobjshash.h
53+
+++ b/src/fcobjshash.h
54+
@@ -284,7 +284,7 @@ FcObjectTypeLookup (register const char *str, register unsigned int len)
55+
{(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str43,FC_CHARSET_OBJECT},
56+
{-1},
57+
#line 47 "fcobjshash.gperf"
58+
- {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str45,FC_CHAR_WIDTH_OBJECT},
59+
+ {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str45,FC_CHARWIDTH_OBJECT},
60+
#line 48 "fcobjshash.gperf"
61+
{(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str46,FC_CHAR_HEIGHT_OBJECT},
62+
#line 55 "fcobjshash.gperf"

0 commit comments

Comments
 (0)