[PATCH wayland 3/4] wayland-util: build/ship as separate shared library
Emil Velikov
emil.l.velikov at gmail.com
Tue Aug 30 17:24:21 UTC 2016
From: Emil Velikov <emil.velikov at collabora.com>
Currently both of libwayland-{client,server} export the same util
(amongst other) symbols.
Although not crucial this is something which should be avoided where
possible.
As such let's move the library to a shared one and introduce a static
one for the purposes of wayland-scanner.
Any old (existing) users of the new libwayland-{client,server} will be
safe since the libwayland* libraries will pull the util one and the
symbols will be resolved at runtime.
Any programs building against the new libraries will have the dependency
(both compile and link-wise) resolved automatically by the Requires
field of the .pc file.
Note: it's not possible to 'hide' the wl_list/wl_array API since it's
been part for the ABI (implicitly pulled via the wayland headers) for a
while, plus doing so will break KF5 and mpv, at least.
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Not too happy on the -static library 'duplication' so if anyone has some
tips that'll be appreciated.
---
Makefile.am | 18 ++++++++++++------
configure.ac | 2 ++
src/wayland-client-uninstalled.pc.in | 1 +
src/wayland-client.pc.in | 1 +
src/wayland-server-uninstalled.pc.in | 1 +
src/wayland-server.pc.in | 1 +
src/wayland-util-uninstalled.pc.in | 8 ++++++++
src/wayland-util.pc.in | 12 ++++++++++++
8 files changed, 38 insertions(+), 6 deletions(-)
create mode 100644 src/wayland-util-uninstalled.pc.in
create mode 100644 src/wayland-util.pc.in
diff --git a/Makefile.am b/Makefile.am
index a0d9b12..c9d5b50 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,7 +25,7 @@ pkgconfig_DATA =
bin_PROGRAMS = wayland-scanner
wayland_scanner_SOURCES = src/scanner.c
wayland_scanner_CFLAGS = $(EXPAT_CFLAGS) $(LIBXML_CFLAGS) $(AM_CFLAGS)
-wayland_scanner_LDADD = $(EXPAT_LIBS) $(LIBXML_LIBS) libwayland-util.la
+wayland_scanner_LDADD = $(EXPAT_LIBS) $(LIBXML_LIBS) libwayland-util-static.la
pkgconfig_DATA += src/wayland-scanner.pc
if DTD_VALIDATION
@@ -40,16 +40,17 @@ $(BUILT_SOURCES) : wayland-scanner
wayland_scanner = $(top_builddir)/wayland-scanner
endif
-libwayland_util_la_CFLAGS = $(AM_CFLAGS)
-libwayland_util_la_SOURCES = \
+noinst_LTLIBRARIES = libwayland-util-static.la
+
+libwayland_util_static_la_CFLAGS = $(AM_CFLAGS)
+libwayland_util_static_la_SOURCES = \
src/wayland-util.c \
src/wayland-util.h
-noinst_LTLIBRARIES = libwayland-util.la
if ENABLE_LIBRARIES
noinst_LTLIBRARIES += libwayland-private.la
-lib_LTLIBRARIES = libwayland-server.la libwayland-client.la
+lib_LTLIBRARIES = libwayland-util.la libwayland-server.la libwayland-client.la
libwayland_private_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS)
libwayland_private_la_SOURCES = \
@@ -73,6 +74,11 @@ nodist_include_HEADERS = \
protocol/wayland-server-protocol.h \
protocol/wayland-client-protocol.h
+libwayland_util_la_CFLAGS = $(AM_CFLAGS)
+libwayland_util_la_SOURCES = \
+ src/wayland-util.c \
+ src/wayland-util.h
+
libwayland_server_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread
libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
libwayland_server_la_LDFLAGS = -version-info 1:0:1
@@ -95,7 +101,7 @@ nodist_libwayland_client_la_SOURCES = \
protocol/wayland-client-protocol.h \
protocol/wayland-protocol.c
-pkgconfig_DATA += src/wayland-client.pc src/wayland-server.pc
+pkgconfig_DATA += src/wayland-util.pc src/wayland-client.pc src/wayland-server.pc
protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
diff --git a/configure.ac b/configure.ac
index 9af3574..016a0b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,8 +196,10 @@ AC_CONFIG_FILES([Makefile
src/wayland-server-uninstalled.pc
src/wayland-client-uninstalled.pc
src/wayland-scanner-uninstalled.pc
+ src/wayland-util-uninstalled.pc
src/wayland-server.pc
src/wayland-client.pc
src/wayland-scanner.pc
+ src/wayland-util.pc
src/wayland-version.h])
AC_OUTPUT
diff --git a/src/wayland-client-uninstalled.pc.in b/src/wayland-client-uninstalled.pc.in
index 3086621..9dd035a 100644
--- a/src/wayland-client-uninstalled.pc.in
+++ b/src/wayland-client-uninstalled.pc.in
@@ -4,5 +4,6 @@ includedir=@abs_srcdir@
Name: Wayland Client
Description: Wayland client side library (not installed)
Version: @PACKAGE_VERSION@
+Requires.private: wayland-util
Cflags: -I${includedir}
Libs: -L${libdir} -lwayland-client
diff --git a/src/wayland-client.pc.in b/src/wayland-client.pc.in
index eef61da..d76f83d 100644
--- a/src/wayland-client.pc.in
+++ b/src/wayland-client.pc.in
@@ -8,5 +8,6 @@ includedir=@includedir@
Name: Wayland Client
Description: Wayland client side library
Version: @WAYLAND_VERSION@
+Requires.private: wayland-util
Cflags: -I${includedir}
Libs: -L${libdir} -lwayland-client
diff --git a/src/wayland-server-uninstalled.pc.in b/src/wayland-server-uninstalled.pc.in
index 9057782..892e92d 100644
--- a/src/wayland-server-uninstalled.pc.in
+++ b/src/wayland-server-uninstalled.pc.in
@@ -4,5 +4,6 @@ includedir=@abs_srcdir@
Name: Wayland Server
Description: Server side implementation of the Wayland protocol (not installed)
Version: @PACKAGE_VERSION@
+Requires.private: wayland-util
Cflags: -I${includedir}
Libs: -L${libdir} -lwayland-server
diff --git a/src/wayland-server.pc.in b/src/wayland-server.pc.in
index 50dff53..a6edf3e 100644
--- a/src/wayland-server.pc.in
+++ b/src/wayland-server.pc.in
@@ -8,5 +8,6 @@ includedir=@includedir@
Name: Wayland Server
Description: Server side implementation of the Wayland protocol
Version: @WAYLAND_VERSION@
+Requires: wayland-util
Cflags: -I${includedir}
Libs: -L${libdir} -lwayland-server
diff --git a/src/wayland-util-uninstalled.pc.in b/src/wayland-util-uninstalled.pc.in
new file mode 100644
index 0000000..723b7fb
--- /dev/null
+++ b/src/wayland-util-uninstalled.pc.in
@@ -0,0 +1,8 @@
+libdir=@abs_builddir@/.libs
+includedir=@abs_srcdir@
+
+Name: Wayland utilities
+Description: Wayland utility library (not installed)
+Version: @PACKAGE_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lwayland-util
diff --git a/src/wayland-util.pc.in b/src/wayland-util.pc.in
new file mode 100644
index 0000000..0ae0a02
--- /dev/null
+++ b/src/wayland-util.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+datarootdir=@datarootdir@
+pkgdatadir=@datadir@/@PACKAGE@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Wayland utilities
+Description: Wayland utility library
+Version: @WAYLAND_VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lwayland-util
--
2.9.0
More information about the wayland-devel
mailing list