[PATCH weston 06/11] build a libweston.so used by the weston binary

Jon A. Cruz jonc at osg.samsung.com
Tue Jun 23 18:52:39 PDT 2015


On 06/22/2015 01:02 PM, Giulio Camuffo wrote:
> The library is versioned, so a -N is appended to its name, e.g. libweston-1.so.
> The same is done for the pc file, the include and lib/weston dirs.
> This allows multiple libweston versions to be installed together.

Ooooh! ABI-versions. Nice. I've been in a few situations where this
really helps. Looks good.

Reviewed-by: Jon A. Cruz <jonc at osg.samsung.com>

> ---
>  Makefile.am  | 59 ++++++++++++++++++++++++++++++++++++++---------------------
>  configure.ac |  3 +++
>  src/input.c  |  2 +-
>  3 files changed, 42 insertions(+), 22 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 29430e3..581014f 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I m4
>  bin_PROGRAMS =
>  noinst_PROGRAMS =
>  libexec_PROGRAMS =
> -moduledir = $(libdir)/weston
> +moduledir = $(libdir)/weston-$(ABI_VERSION)
>  module_LTLIBRARIES =
>  noinst_LTLIBRARIES =
>  BUILT_SOURCES =
> @@ -59,26 +59,20 @@ CLEANFILES = weston.ini				\
>  	internal-screenshot-00.png		\
>  	$(BUILT_SOURCES)
>  
> -bin_PROGRAMS += weston
> -
> -weston_LDFLAGS = -export-dynamic
> -weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON
> -weston_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS)
> -weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \
> +lib_LTLIBRARIES = libweston- at ABI_VERSION@.la
> +libweston_ at ABI_VERSION@_la_CPPFLAGS = 			\
> +	$(AM_CPPFLAGS) -DIN_WESTON
> +libweston_ at ABI_VERSION@_la_CFLAGS = 			\
> +	$(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)		\
> +	$(LIBUNWIND_CFLAGS)
> +libweston_ at ABI_VERSION@_la_LIBADD =			\
> +	$(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) 		\
>  	$(DLOPEN_LIBS) -lm libshared.la
>  
> -weston_SOURCES =					\
> +libweston_ at ABI_VERSION@_la_SOURCES =			\
>  	src/git-version.h				\
> -	src/log.c					\
>  	src/compositor.c				\
>  	src/compositor.h				\
> -	src/compositor-x11.h				\
> -	src/compositor-wayland.h			\
> -	src/compositor-drm.h				\
> -	src/compositor-headless.h			\
> -	src/compositor-fbdev.h				\
> -	src/compositor-rdp.h				\
> -	src/compositor-rpi.h				\
>  	src/input.c					\
>  	src/data-device.c				\
>  	src/screenshooter.c				\
> @@ -93,7 +87,6 @@ weston_SOURCES =					\
>  	src/timeline.c					\
>  	src/timeline.h					\
>  	src/timeline-object.h				\
> -	src/weston.c					\
>  	shared/helpers.h				\
>  	shared/matrix.c					\
>  	shared/matrix.h					\
> @@ -101,7 +94,7 @@ weston_SOURCES =					\
>  	shared/platform.h				\
>  	src/weston-egl-ext.h
>  
> -nodist_weston_SOURCES =					\
> +nodist_libweston_ at ABI_VERSION@_la_SOURCES =		\
>  	protocol/screenshooter-protocol.c		\
>  	protocol/screenshooter-server-protocol.h	\
>  	protocol/text-cursor-position-protocol.c	\
> @@ -117,7 +110,28 @@ nodist_weston_SOURCES =					\
>  	protocol/scaler-protocol.c			\
>  	protocol/scaler-server-protocol.h
>  
> -BUILT_SOURCES += $(nodist_weston_SOURCES)
> +BUILT_SOURCES += $(nodist_libweston_ at ABI_VERSION@_la_SOURCES)
> +
> +bin_PROGRAMS += weston
> +
> +weston_LDFLAGS = -export-dynamic
> +weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON
> +weston_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS)
> +weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \
> +	$(DLOPEN_LIBS) -lm libshared.la			\
> +	libweston- at ABI_VERSION@.la
> +
> +weston_SOURCES =					\
> +	src/weston.c					\
> +	src/compositor-x11.h				\
> +	src/compositor-wayland.h			\
> +	src/compositor-drm.h				\
> +	src/compositor-headless.h			\
> +	src/compositor-fbdev.h				\
> +	src/compositor-rdp.h				\
> +	src/compositor-rpi.h				\
> +	src/log.c					\
> +	shared/helpers.h
>  
>  # Track this dependency explicitly instead of using BUILT_SOURCES.  We
>  # add BUILT_SOURCES to CLEANFILES, but we want to keep git-version.h
> @@ -185,13 +199,16 @@ endif
>  endif # BUILD_WESTON_LAUNCH
>  
>  pkgconfigdir = $(libdir)/pkgconfig
> -pkgconfig_DATA = src/weston.pc
> +pkgconfig_DATA = weston-$(ABI_VERSION).pc
> +
> +weston-$(ABI_VERSION).pc: src/weston.pc
> +	$(AM_V_GEN) cp src/weston.pc weston-$(ABI_VERSION).pc
>  
>  wayland_sessiondir = $(datadir)/wayland-sessions
>  wayland_session_DATA = src/weston.desktop
>  dist_wayland_session_DATA = $(wayland_session_DATA)
>  
> -westonincludedir = $(includedir)/weston
> +westonincludedir = $(includedir)/weston-$(ABI_VERSION)
>  westoninclude_HEADERS =				\
>  	src/version.h				\
>  	src/compositor.h			\
> diff --git a/configure.ac b/configure.ac
> index e047fd5..f6780e8 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -31,6 +31,9 @@ AM_SILENT_RULES([yes])
>  AC_PROG_CC
>  AC_PROG_SED
>  
> +ABI_VERSION=1
> +AC_SUBST(ABI_VERSION)
> +
>  # Initialize libtool
>  LT_PREREQ([2.2])
>  LT_INIT([disable-static])
> diff --git a/src/input.c b/src/input.c
> index 568985f..21ad499 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -1914,7 +1914,7 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
>  }
>  
>  #ifdef ENABLE_XKBCOMMON
> -int
> +WL_EXPORT int
>  weston_compositor_xkb_init(struct weston_compositor *ec,
>  			   struct xkb_rule_names *names)
>  {
> 

-- 
Jon A. Cruz - Senior Open Source Developer
Samsung Open Source Group
jonc at osg.samsung.com


More information about the wayland-devel mailing list