buildsystem: Prepare _G*_API internal macros for symbol visibility

To switch GLib to have private-by-default symbols, we need to have a
macro which expands to G_PUBLIC_API only when compiling a particular
"sublibrary" in GLib (e.g. gmodule, gio).

This patch implements that with a two-level scheme.  First, each
sublibrary has its own preprocessor macro e.g. _GTHREAD_API.  Then,
the Makefiles are modified to define this to G_PUBLIC_API only when
building that library - so when building libgthread, _GMODULE_API is
left undefined.

Now, we could simply add _G*_API to every entry point, but because
we've already been annotating all the headers with
GLIB_AVAILABLE_IN_XX, let's modify those macros to automatically
depend on a new "_G_API".  Then the Makefiles further define _G_API to
the target such as _GTHREAD_API.  This indirection avoids a
(glib version)*(sublibrary) explosion of preprocessor definitions in
gversionmacros.h.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
This commit is contained in:
Colin Walters
2012-11-29 09:26:01 -05:00
parent 216d4d619d
commit b390e41325
7 changed files with 55 additions and 25 deletions

View File

@@ -6,6 +6,8 @@ BUILT_SOURCES =
AM_CPPFLAGS = \
$(glib_INCLUDES) \
-DG_LOG_DOMAIN=\"GModule\" \
-D_GMODULE_API=G_PUBLIC_API \
-D_G_API=_GMODULE_API \
@GLIB_DEBUG_FLAGS@ \
-DG_DISABLE_DEPRECATED