Kaydet (Commit) c0b4bd74 authored tarafından David Tardon's avatar David Tardon

fix fontconfig build with new glibc and gperf

Change-Id: Ia89f068d93b810b0c32df5df62a582322f3e5588
Reviewed-on: https://gerrit.libreoffice.org/35142Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 2e497bb9
From 31010a2cc6f2d0596dac640b190df3472e0089dd Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Thu, 23 Feb 2017 21:39:10 +0900
Subject: [PATCH] Fix the build issue with gperf 3.1
To support the one of changes in gperf 3.1:
* The 'len' parameter of the hash function and of the lookup function is now
of type 'size_t' instead of 'unsigned int'. This makes it safe to call these
functions with strings of length > 4 GB, on 64-bit machines.
---
config.h.in | 3 +++
configure | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 20 ++++++++++++++++++++
src/fcobjs.c | 4 ++--
4 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/config.h.in b/config.h.in
index ffff4cd..d5c14a1 100644
--- a/config.h.in
+++ b/config.h.in
@@ -21,6 +21,9 @@
/* System font directory */
#undef FC_DEFAULT_FONTS
+/* The type of len parameter of the gperf hash/lookup function */
+#undef FC_GPERF_SIZE_T
+
/* Define to nothing if C supports flexible array members, and to 1 if it does
not. That way, with a declaration like `struct s { int n; double
d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99
diff --git a/configure b/configure
index eed481c..9eddc2b 100755
--- a/configure
+++ b/configure
@@ -14946,6 +14946,62 @@ _ACEOF
fi
+# Check the argument type of the gperf hash/lookup function
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking The type of len parameter of gperf hash/lookup function" >&5
+$as_echo_n "checking The type of len parameter of gperf hash/lookup function... " >&6; }
+fc_gperf_test="$(echo 'foo' | gperf -L ANSI-C)"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <string.h>
+
+ const char *in_word_set(register const char *, register size_t);
+ $fc_gperf_test
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ FC_GPERF_SIZE_T=size_t
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <string.h>
+
+ const char *in_word_set(register const char *, register unsigned int);
+ $fc_gperf_test
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ FC_GPERF_SIZE_T="unsigned int"
+else
+ as_fn_error $? "Unable to determine the type of the len parameter of the gperf hash/lookup function" "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+cat >>confdefs.h <<_ACEOF
+#define FC_GPERF_SIZE_T $FC_GPERF_SIZE_T
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FC_GPERF_SIZE_T" >&5
+$as_echo "$FC_GPERF_SIZE_T" >&6; }
+
#
# Checks for iconv
#
diff --git a/src/fcobjs.c b/src/fcobjs.c
index 16ff31c..33bba8d 100644
--- a/src/fcobjs.c
+++ b/src/fcobjs.c
@@ -25,10 +25,10 @@
#include "fcint.h"
static unsigned int
-FcObjectTypeHash (register const char *str, register unsigned int len);
+FcObjectTypeHash (register const char *str, register FC_GPERF_SIZE_T len);
static const struct FcObjectTypeInfo *
-FcObjectTypeLookup (register const char *str, register unsigned int len);
+FcObjectTypeLookup (register const char *str, register FC_GPERF_SIZE_T len);
#include "fcobjshash.h"
--
2.12.0
...@@ -13,6 +13,8 @@ $(eval $(call gb_UnpackedTarball_set_tarball,fontconfig,$(FONTCONFIG_TARBALL),,f ...@@ -13,6 +13,8 @@ $(eval $(call gb_UnpackedTarball_set_tarball,fontconfig,$(FONTCONFIG_TARBALL),,f
$(eval $(call gb_UnpackedTarball_add_patches,fontconfig,\ $(eval $(call gb_UnpackedTarball_add_patches,fontconfig,\
external/fontconfig/fontconfig-2.12.1.patch.1 \ external/fontconfig/fontconfig-2.12.1.patch.1 \
external/fontconfig/fontconfig-glibc-limits.patch.1 \
external/fontconfig/0001-Fix-the-build-issue-with-gperf-3.1.patch.1 \
)) ))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
From 1ab5258f7c2abfafcd63a760ca08bf93591912da Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 14 Dec 2016 16:11:05 -0800
Subject: [PATCH] Avoid conflicts with integer width macros from TS
18661-1:2014
glibc 2.25+ has now defined these macros in <limits.h>
https://sourceware.org/git/?p=glibc.git;a=commit;h=5b17fd0da62bf923cb61d1bb7b08cf2e1f1f9c1a
Create an alias for FC_CHAR_WIDTH for ABI compatibility
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
fontconfig/fontconfig.h | 3 ++-
src/fcobjs.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index 5c72b22..070a557 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -128,7 +128,8 @@ typedef int FcBool;
#define FC_USER_CACHE_FILE ".fonts.cache-" FC_CACHE_VERSION
/* Adjust outline rasterizer */
-#define FC_CHAR_WIDTH "charwidth" /* Int */
+#define FC_CHARWIDTH "charwidth" /* Int */
+#define FC_CHAR_WIDTH FC_CHARWIDTH
#define FC_CHAR_HEIGHT "charheight"/* Int */
#define FC_MATRIX "matrix" /* FcMatrix */
diff --git a/src/fcobjs.h b/src/fcobjs.h
index 1fc4f65..d27864b 100644
--- a/src/fcobjs.h
+++ b/src/fcobjs.h
@@ -51,7 +51,7 @@ FC_OBJECT (DPI, FcTypeDouble, NULL)
FC_OBJECT (RGBA, FcTypeInteger, NULL)
FC_OBJECT (SCALE, FcTypeDouble, NULL)
FC_OBJECT (MINSPACE, FcTypeBool, NULL)
-FC_OBJECT (CHAR_WIDTH, FcTypeInteger, NULL)
+FC_OBJECT (CHARWIDTH, FcTypeInteger, NULL)
FC_OBJECT (CHAR_HEIGHT, FcTypeInteger, NULL)
FC_OBJECT (MATRIX, FcTypeMatrix, NULL)
FC_OBJECT (CHARSET, FcTypeCharSet, FcCompareCharSet)
--
2.9.3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment