[Fontconfig] fontconfig: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jan 4 15:26:18 UTC 2018


 fontconfig/fcprivate.h |    9 ++++++++-
 src/makealias          |    4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit b8a225b3c3495942480377b7b3404710c70be914
Author: Tom Anderson <thomasanderson at chromium.org>
Date:   Wed Jan 3 11:42:45 2018 -0800

    Allow overriding symbol visibility.
    
    Fontconfig symbols were hardcoded to be either hidden or exported.  This patch
    adds configurable symbol visibility.  This is useful for projects that want to
    do in-tree fontconfig builds and not export any symbols, otherwise they would
    conflict with the system library's symbols
    
    Chromium is a project that does in-tree fontconfig builds, and the workaround
    currently used is "#define visibility(x) // nothing" [1] and building with
    "-fvisibility=hidden".
    [1] https://cs.chromium.org/chromium/src/third_party/fontconfig/BUILD.gn?rcl=ce146f1f300988c960e1eecf8a61b238d6fd7f7f&l=62

diff --git a/fontconfig/fcprivate.h b/fontconfig/fcprivate.h
index a6ee5c2..23021b2 100644
--- a/fontconfig/fcprivate.h
+++ b/fontconfig/fcprivate.h
@@ -123,5 +123,12 @@ _FcObjectSetVapBuild_bail0:						\
     ;									\
 }
 
-#endif /* _FCPRIVATE_H_ */
+#ifndef FC_ATTRIBUTE_VISIBILITY_HIDDEN
+#define FC_ATTRIBUTE_VISIBILITY_HIDDEN __attribute((visibility("hidden")))
+#endif
+
+#ifndef FC_ATTRIBUTE_VISIBILITY_EXPORT
+#define FC_ATTRIBUTE_VISIBILITY_EXPORT __attribute((visibility("default")))
+#endif
 
+#endif /* _FCPRIVATE_H_ */
diff --git a/src/makealias b/src/makealias
index e2f31c6..21de72e 100755
--- a/src/makealias
+++ b/src/makealias
@@ -14,7 +14,7 @@ while read name; do
 		;;
 	*)
 		alias="IA__$name"
-		hattr='__attribute((visibility("hidden")))'
+		hattr='FC_ATTRIBUTE_VISIBILITY_HIDDEN'
 		echo "extern __typeof ($name) $alias $hattr;" >> $HEAD
 		echo "#define $name $alias" >> $HEAD
 		ifdef=`grep -l '^'$name'[ (]' "$SRCDIR"/*.c | sed -n 1p | sed -e 's/^.*\/\([^.]*\)\.c/__\1__/'`
@@ -28,7 +28,7 @@ while read name; do
 			last=$ifdef
 		fi
 		echo "# undef $name" >> $TAIL
-		cattr='__attribute((alias("'$alias'"), visibility("default")))'
+		cattr='__attribute((alias("'$alias'"))) FC_ATTRIBUTE_VISIBILITY_EXPORT'
 		echo "extern __typeof ($name) $name $cattr;" >> $TAIL
 		;;
 	esac


More information about the Fontconfig mailing list