[PATCH] Merge libdbus and libdbus-internal into a single shared library
Bertrand SIMONNET
bsimonnet at chromium.org
Tue Aug 26 16:10:43 PDT 2014
The resulting library can be used by dbus-daemon and dbus-daemon-launch-helper,
reducing the size of dbus by 500k.
The private symbols are exposed under the version PRIVATE_DBUS_ at VERSION_NUMBER@.
This patch is under review at:
https://bugs.freedesktop.org/show_bug.cgi?id=83115
This patch follows the discussion started at:
http://lists.freedesktop.org/archives/dbus/2014-June/016212.html.
---
bus/Makefile.am | 12 ++---
configure.ac | 1 +
dbus/Makefile.am | 27 ++---------
dbus/Version.in | 10 ++++
test/Makefile.am | 111 ++++++++++++++++-----------------------------
test/name-test/Makefile.am | 18 ++++----
6 files changed, 69 insertions(+), 110 deletions(-)
create mode 100644 dbus/Version.in
diff --git a/bus/Makefile.am b/bus/Makefile.am
index f335e30..78a2d7f 100644
--- a/bus/Makefile.am
+++ b/bus/Makefile.am
@@ -97,7 +97,7 @@ dbus_daemon_SOURCES= \
main.c
dbus_daemon_LDADD= \
- $(top_builddir)/dbus/libdbus-internal.la \
+ $(top_builddir)/dbus/libdbus-1.la \
$(EFENCE) \
$(DBUS_BUS_LIBS)
@@ -121,7 +121,7 @@ dbus_daemon_launch_helper_SOURCES= \
$(LAUNCH_HELPER_SOURCES)
dbus_daemon_launch_helper_LDADD= \
- $(top_builddir)/dbus/libdbus-internal.la \
+ $(top_builddir)/dbus/libdbus-1.la \
$(DBUS_LAUNCHER_LIBS)
## we build another binary so we can do the launch testing without root privs.
@@ -131,7 +131,7 @@ dbus_daemon_launch_helper_test_SOURCES= \
$(LAUNCH_HELPER_SOURCES)
dbus_daemon_launch_helper_test_LDADD= \
- $(top_builddir)/dbus/libdbus-internal.la \
+ $(top_builddir)/dbus/libdbus-1.la \
$(DBUS_LAUNCHER_LIBS)
dbus_daemon_launch_helper_test_CPPFLAGS = \
@@ -145,7 +145,7 @@ test_bus_launch_helper_SOURCES= \
$(LAUNCH_HELPER_SOURCES)
test_bus_launch_helper_LDADD= \
- $(top_builddir)/dbus/libdbus-internal.la \
+ $(top_builddir)/dbus/libdbus-1.la \
$(DBUS_LAUNCHER_LIBS)
test_bus_launch_helper_CPPFLAGS = \
@@ -190,13 +190,13 @@ test_bus_system_SOURCES= \
utils.h \
test-system.c
-test_bus_system_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_BUS_LIBS)
+test_bus_system_LDADD=$(top_builddir)/dbus/libdbus-1.la $(DBUS_BUS_LIBS)
test_bus_SOURCES= \
$(BUS_SOURCES) \
test-main.c
-test_bus_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_BUS_LIBS)
+test_bus_LDADD=$(top_builddir)/dbus/libdbus-1.la $(DBUS_BUS_LIBS)
## mop up the gcov files
clean-local:
diff --git a/configure.ac b/configure.ac
index cbaf874..eb4b42c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1750,6 +1750,7 @@ fi
AC_CONFIG_FILES([
Doxyfile
+dbus/Version
dbus/versioninfo.rc
dbus/dbus-arch-deps.h
bus/system.conf
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index 442fd27..5f6e3bb 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -33,7 +33,6 @@ SUFFIXES = rc
dbus_res = versioninfo.o
dbus_res_ldflag = -Wl,$(dbus_res)
no_undefined = -no-undefined
-export_symbols =
EXTRA_libdbus_1_la_DEPENDENCIES = $(dbus_res)
intllibs =
@@ -42,9 +41,6 @@ else
dbus_res =
dbus_res_ldflag =
no_undefined =
-## don't export symbols that start with "_" (we use this
-## convention for internal symbols)
-export_symbols = -export-symbols-regex "^[^_].*"
intllibs = @LTLIBINTL@
@@ -260,47 +256,32 @@ DBUS_UTIL_SOURCES= \
libdbus_1_la_SOURCES= \
$(DBUS_LIB_SOURCES) \
- $(DBUS_SHARED_SOURCES)
-
-libdbus_internal_la_SOURCES= \
- $(DBUS_LIB_SOURCES) \
$(DBUS_SHARED_SOURCES) \
$(DBUS_UTIL_SOURCES)
BUILT_SOURCES=$(nodist_dbusarchinclude_HEADERS)
EXTRA_DIST=dbus-arch-deps.h.in
-
-## this library is the same as libdbus, but exports all the symbols
-## and is only used for static linking within the dbus package.
-noinst_LTLIBRARIES=libdbus-internal.la
-
libdbus_1_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-Ddbus_1_EXPORTS \
$(NULL)
+
libdbus_1_la_LIBADD= $(LIBDBUS_LIBS)
libdbus_1_la_LDFLAGS = \
$(AM_LDFLAGS) \
- $(export_symbols) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -Wl,--version-script=Version \
-no-undefined \
$(NULL)
-libdbus_internal_la_CPPFLAGS = \
- $(AM_CPPFLAGS) \
- -DDBUS_STATIC_BUILD \
- $(NULL)
-libdbus_internal_la_LIBADD=$(LIBDBUS_LIBS)
-
if DBUS_WIN
# This must be a separate convenience library, otherwise libtool notices
# that libdbus-1 might contain C++, links it with g++ and links in libstdc++,
# even on Unix where in fact it doesn't contain any C++. For Windows, where
# this code is used, we don't actually need libstdc++.
-noinst_LTLIBRARIES += libdbus-init-win.la
+noinst_LTLIBRARIES = libdbus-init-win.la
libdbus_init_win_la_SOURCES = dbus-init-win.cpp
libdbus_1_la_LIBADD += libdbus-init-win.la
-libdbus_internal_la_LIBADD += libdbus-init-win.la
endif
noinst_PROGRAMS =
@@ -313,7 +294,7 @@ endif
test_dbus_SOURCES= \
dbus-test-main.c
-test_dbus_LDADD = libdbus-internal.la
+test_dbus_LDADD = libdbus-1.la
## mop up the gcov files
clean-local:
diff --git a/dbus/Version.in b/dbus/Version.in
new file mode 100644
index 0000000..577a895
--- /dev/null
+++ b/dbus/Version.in
@@ -0,0 +1,10 @@
+Base {
+ global:
+ dbus_*;
+ local:
+ *;
+};
+PRIVATE_ at DBUS_VERSION@ {
+ global:
+ _dbus_*;
+};
diff --git a/test/Makefile.am b/test/Makefile.am
index cec5cda..ad34940 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -7,7 +7,6 @@ DIST_SUBDIRS=name-test
# CPPFLAGS for binaries that are normally dynamic
AM_CPPFLAGS = \
-I$(top_srcdir) \
- $(DBUS_STATIC_BUILD_CPPFLAGS) \
$(GLIB_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(NULL)
@@ -15,47 +14,31 @@ AM_CPPFLAGS = \
# improve backtraces from test stuff
AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
-# CPPFLAGS for binaries that are always static
-static_cppflags = \
- $(AM_CPPFLAGS) \
- -DDBUS_STATIC_BUILD \
- -DDBUS_COMPILATION \
- -DDBUS_TEST_USE_INTERNAL \
- $(NULL)
-
-noinst_LTLIBRARIES = libdbus-testutils-internal.la
-
-# You can link either libdbus-testutils, dbus-glib and libdbus-1,
-# or libdbus-testutils-internal and libdbus-internal - never both in the
-# same binary.
-if DBUS_WITH_DBUS_GLIB
-noinst_LTLIBRARIES += libdbus-testutils.la
+noinst_LTLIBRARIES = libdbus-testutils.la
libdbus_testutils_la_SOURCES = \
test-utils.c \
test-utils.h \
$(NULL)
libdbus_testutils_la_LIBADD = \
$(top_builddir)/dbus/libdbus-1.la \
+ $(NULL)
+
+if DBUS_WITH_DBUS_GLIB
+libdbus_testutils_la_LIBADD += \
$(GLIB_LIBS) \
$(DBUS_GLIB_LIBS) \
$(NULL)
+
testutils_shared_if_possible_cppflags = $(AM_CPPFLAGS)
-testutils_shared_if_possible_libs = libdbus-testutils.la
else
-testutils_shared_if_possible_cppflags = $(static_cppflags)
-testutils_shared_if_possible_libs = libdbus-testutils-internal.la
+testutils_shared_if_possible_cppflags = \
+ $(AM_CPPFLAGS) \
+ -DDBUS_COMPILATION \
+ -DDBUS_TEST_USE_INTERNAL \
+ $(NULL)
endif
-libdbus_testutils_internal_la_CPPFLAGS = \
- $(static_cppflags) \
- $(NULL)
-libdbus_testutils_internal_la_SOURCES = \
- test-utils.c \
- test-utils.h \
- $(NULL)
-libdbus_testutils_internal_la_LIBADD = \
- $(top_builddir)/dbus/libdbus-internal.la \
- $(NULL)
+libdbus_testutils_la_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
if DBUS_ENABLE_EMBEDDED_TESTS
## break-loader removed for now
@@ -92,32 +75,31 @@ endif !DBUS_ENABLE_EMBEDDED_TESTS
noinst_PROGRAMS= $(TEST_BINARIES)
-test_service_CPPFLAGS = $(static_cppflags)
-test_service_LDADD = libdbus-testutils-internal.la
-test_names_CPPFLAGS = $(static_cppflags)
-test_names_LDADD = libdbus-testutils-internal.la
-## break_loader_CPPFLAGS = $(static_cppflags)
-## break_loader_LDADD = $(top_builddir)/dbus/libdbus-internal.la
-test_shell_service_CPPFLAGS = $(static_cppflags)
-test_shell_service_LDADD = libdbus-testutils-internal.la
+test_service_LDADD = libdbus-testutils.la
+test_service_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+test_names_LDADD = libdbus-testutils.la
+test_names_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+## break_loader_LDADD = $(top_builddir)/dbus/libdbus-1.la
+test_shell_service_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+test_shell_service_LDADD = libdbus-testutils.la
test_shell_SOURCES = shell-test.c
-test_shell_CPPFLAGS = $(static_cppflags)
-test_shell_LDADD = libdbus-testutils-internal.la
+test_shell_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+test_shell_LDADD = libdbus-testutils.la
test_spawn_SOURCES = spawn-test.c
-test_spawn_CPPFLAGS = $(static_cppflags)
-test_spawn_LDADD = $(top_builddir)/dbus/libdbus-internal.la
+test_spawn_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+test_spawn_LDADD = $(top_builddir)/dbus/libdbus-1.la
test_printf_SOURCES = internals/printf.c
-test_printf_CPPFLAGS = $(static_cppflags)
-test_printf_LDADD = $(top_builddir)/dbus/libdbus-internal.la
+test_printf_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+test_printf_LDADD = $(top_builddir)/dbus/libdbus-1.la
test_refs_SOURCES = internals/refs.c
-test_refs_CPPFLAGS = $(static_cppflags)
-test_refs_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS)
+test_refs_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS)
test_syslog_SOURCES = internals/syslog.c
-test_syslog_CPPFLAGS = $(static_cppflags)
-test_syslog_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS)
+test_syslog_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
+test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS)
EXTRA_DIST = dbus-test-runner
@@ -164,47 +146,34 @@ TESTS_ENVIRONMENT = \
DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \
$(NULL)
+testutils_with_glib = \
+ libdbus-testutils.la \
+ $(GLIB_LIBS) \
+ $(NULL)
+
manual_authz_SOURCES = manual-authz.c
manual_authz_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
-manual_authz_LDADD = \
- $(testutils_shared_if_possible_libs) \
- $(GLIB_LIBS) \
- $(NULL)
+manual_authz_LDADD = $(testutils_with_glib)
test_corrupt_SOURCES = corrupt.c
test_corrupt_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
-test_corrupt_LDADD = \
- $(testutils_shared_if_possible_libs) \
- $(GLIB_LIBS) \
- $(NULL)
+test_corrupt_LDADD = $(testutils_with_glib)
test_loopback_SOURCES = loopback.c
test_loopback_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
-test_loopback_LDADD = \
- $(testutils_shared_if_possible_libs) \
- $(GLIB_LIBS) \
- $(NULL)
+test_loopback_LDADD = $(testutils_with_glib)
test_relay_SOURCES = relay.c
test_relay_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
-test_relay_LDADD = \
- $(testutils_shared_if_possible_libs) \
- $(GLIB_LIBS) \
- $(NULL)
+test_relay_LDADD = $(testutils_with_glib)
test_dbus_daemon_SOURCES = dbus-daemon.c
test_dbus_daemon_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
-test_dbus_daemon_LDADD = \
- $(testutils_shared_if_possible_libs) \
- $(GLIB_LIBS) \
- $(NULL)
+test_dbus_daemon_LDADD = $(testutils_with_glib)
test_dbus_daemon_eavesdrop_SOURCES = dbus-daemon-eavesdrop.c
test_dbus_daemon_eavesdrop_CPPFLAGS = $(testutils_shared_if_possible_cppflags)
-test_dbus_daemon_eavesdrop_LDADD = \
- $(testutils_shared_if_possible_libs) \
- $(GLIB_LIBS) \
- $(NULL)
+test_dbus_daemon_eavesdrop_LDADD = $(testutils_with_glib)
test_marshal_SOURCES = marshal.c
test_marshal_LDADD = \
diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am
index 8ed1e16..29fa2d3 100644
--- a/test/name-test/Makefile.am
+++ b/test/name-test/Makefile.am
@@ -1,8 +1,6 @@
-# Everything in this directory is statically-linked to libdbus-internal
AM_CPPFLAGS = \
-I$(top_srcdir) \
-DDBUS_COMPILATION \
- -DDBUS_STATIC_BUILD \
-DDBUS_TEST_USE_INTERNAL \
$(NULL)
@@ -35,14 +33,14 @@ if DBUS_ENABLE_EMBEDDED_TESTS
## build even when not doing "make check"
noinst_PROGRAMS=test-pending-call-dispatch test-pending-call-timeout test-threads-init test-ids test-shutdown test-privserver test-privserver-client test-autolaunch
-test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-internal.la
-test_pending_call_timeout_LDADD=$(top_builddir)/dbus/libdbus-internal.la
-test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-internal.la
-test_ids_LDADD=$(top_builddir)/dbus/libdbus-internal.la
+test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-1.la
+test_pending_call_timeout_LDADD=$(top_builddir)/dbus/libdbus-1.la
+test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-1.la
+test_ids_LDADD=$(top_builddir)/dbus/libdbus-1.la
-test_shutdown_LDADD=../libdbus-testutils-internal.la
-test_privserver_LDADD=../libdbus-testutils-internal.la
-test_privserver_client_LDADD=../libdbus-testutils-internal.la
-test_autolaunch_LDADD=../libdbus-testutils-internal.la
+test_shutdown_LDADD=../libdbus-testutils.la
+test_privserver_LDADD=../libdbus-testutils.la
+test_privserver_client_LDADD=../libdbus-testutils.la
+test_autolaunch_LDADD=../libdbus-testutils.la
endif
--
2.1.0.rc2.206.gedb03e5
More information about the dbus
mailing list