Re: [PATCH] Build a libweston library
On 11/05/2016 21:31, Giulio Camuffo wrote: This patch creates a libweston-N.so library, where N is the "libweston_abi_version" defined in configure.ac. Almost all the code that was previously built in the weston binary is now in libweston.sp, except main.c and log.c. Possibly other files will need to be moved to weston but it can be done when we identify which files are they. When the API/ABI of libweston changes in an incompatible way, the abi version will be bumped so that multiple versions can live together. Also a libweston-N.pc file is created and installed together with weston.pc. Signed-off-by: Giulio Camuffo--- Makefile.am | 39 --- configure.ac| 3 +++ src/input.c | 4 ++-- src/libweston.pc.in | 11 +++ 4 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 src/libweston.pc.in diff --git a/Makefile.am b/Makefile.am index 0b7aa35..fbc509d 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-${LIBWESTON_ABI_VERSION} As Benoit said, you must split what is weston and what is libweston here. Let’s introduce libweston*dir. I prefer …/libweston-${abi}, because …/weston-${abi} is confusing and can look like a leftover or wrong rename. Also see an unrelated (to libweston) comment at the end of this email. module_LTLIBRARIES = noinst_LTLIBRARIES = BUILT_SOURCES = @@ -59,17 +59,15 @@ CLEANFILES = weston.ini \ internal-screenshot-00.png \ $(BUILT_SOURCES) -bin_PROGRAMS += weston +lib_LTLIBRARIES = libweston.la +libweston_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON +libweston_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) You are missing $(AM_CFLAGS) here. If adding it breaks something, then fix AM_CFLAGS. +libweston_la_LIBADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ +$(DLOPEN_LIBS) -lm libshared.la +libweston_la_LDFLAGS = -release ${LIBWESTON_ABI_VERSION} -weston_LDFLAGS = -export-dynamic -weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON -weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) -weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ - $(DLOPEN_LIBS) -lm $(CLOCK_GETTIME_LIBS) libshared.la - -weston_SOURCES = \ +libweston_la_SOURCES = \ src/git-version.h \ - src/log.c \ src/compositor.c\ src/compositor.h\ src/compositor-drm.h\ @@ -92,7 +90,6 @@ weston_SOURCES = \ src/timeline.c \ src/timeline.h \ src/timeline-object.h \ - src/main.c \ src/linux-dmabuf.c \ src/linux-dmabuf.h \ shared/helpers.h\ @@ -119,7 +116,7 @@ systemd_notify_la_SOURCES = \ src/compositor.h endif -nodist_weston_SOURCES =\ +nodist_libweston_la_SOURCES = \ protocol/weston-screenshooter-protocol.c\ protocol/weston-screenshooter-server-protocol.h \ protocol/text-cursor-position-protocol.c\ @@ -135,7 +132,19 @@ nodist_weston_SOURCES = \ protocol/linux-dmabuf-unstable-v1-protocol.c\ protocol/linux-dmabuf-unstable-v1-server-protocol.h -BUILT_SOURCES += $(nodist_weston_SOURCES) +BUILT_SOURCES += $(nodist_libweston_la_SOURCES) + +bin_PROGRAMS += weston + +weston_LDFLAGS = -export-dynamic +weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON +weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) +weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ + $(DLOPEN_LIBS) -lm libshared.la libweston.la + +weston_SOURCES = \ + src/main.c \ + src/log.c # Track this dependency explicitly instead of using BUILT_SOURCES. We # add BUILT_SOURCES to CLEANFILES, but we want to keep git-version.h @@ -205,12 +214,12 @@ endif endif # BUILD_WESTON_LAUNCH pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = src/weston.pc +pkgconfig_DATA = src/weston.pc src/libweston-${LIBWESTON_ABI_VERSION}.pc wayland_sessiondir = $(datadir)/wayland-sessions dist_wayland_session_DATA = src/weston.desktop -westonincludedir = $(includedir)/weston +westonincludedir = $(includedir)/weston-${LIBWESTON_ABI_VERSION} Same as
Re: [PATCH] Build a libweston library
Hello Giulio, First I have comments about the generated weston-0.pc file. The current file does not look to follow the usual .pc file content as described in [1]. First the "Cflags" look to be the place for -I options, while "Libs" and "Libs.private" are dedicated to -L and -l options. Also note that pkg-config use "Requires" and "Requires.private" to hold dependency that implement .pc file. This mean that you may use weston.pc, wayland-server.pc or what ever is needed here at first place. Then, If the library does not implement a .pc file, you must fall-back to "Libs" or "Libs.private". The other point is also that you keeped a single {prefix}/lib/weston-0 directory that hold, for instance, gl-renderer.so, x11-backend.so, desktop-shell.so or fullscreen-shell.so. gl-renderer.so and x11-backend.so are both implementation of libweston internals details, as already stated in others discussions. Otherwise, fullscreen-shell.so and desktop-shell.so are weston(-compositor) modules, that are not tie to libweston. Thus I suggest, as we starting libweston, to split weston modules in another directory, and keeping libweston implementation detail to weston-0. Outside this comments the patch is working and is making what he claim. I did not already tested to create a compositor from the library. But it's probably something we can tackle later. Tested-by: Benoit GschwindBest regards. [1] https://people.freedesktop.org/~dbn/pkg-config-guide.html#writing -- Benoit Gschwind ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] Build a libweston library
This patch creates a libweston-N.so library, where N is the "libweston_abi_version" defined in configure.ac. Almost all the code that was previously built in the weston binary is now in libweston.sp, except main.c and log.c. Possibly other files will need to be moved to weston but it can be done when we identify which files are they. When the API/ABI of libweston changes in an incompatible way, the abi version will be bumped so that multiple versions can live together. Also a libweston-N.pc file is created and installed together with weston.pc. Signed-off-by: Giulio Camuffo--- Makefile.am | 39 --- configure.ac| 3 +++ src/input.c | 4 ++-- src/libweston.pc.in | 11 +++ 4 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 src/libweston.pc.in diff --git a/Makefile.am b/Makefile.am index 0b7aa35..fbc509d 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-${LIBWESTON_ABI_VERSION} module_LTLIBRARIES = noinst_LTLIBRARIES = BUILT_SOURCES = @@ -59,17 +59,15 @@ CLEANFILES = weston.ini \ internal-screenshot-00.png \ $(BUILT_SOURCES) -bin_PROGRAMS += weston +lib_LTLIBRARIES = libweston.la +libweston_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON +libweston_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) +libweston_la_LIBADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ +$(DLOPEN_LIBS) -lm libshared.la +libweston_la_LDFLAGS = -release ${LIBWESTON_ABI_VERSION} -weston_LDFLAGS = -export-dynamic -weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON -weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) -weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ - $(DLOPEN_LIBS) -lm $(CLOCK_GETTIME_LIBS) libshared.la - -weston_SOURCES = \ +libweston_la_SOURCES = \ src/git-version.h \ - src/log.c \ src/compositor.c\ src/compositor.h\ src/compositor-drm.h\ @@ -92,7 +90,6 @@ weston_SOURCES = \ src/timeline.c \ src/timeline.h \ src/timeline-object.h \ - src/main.c \ src/linux-dmabuf.c \ src/linux-dmabuf.h \ shared/helpers.h\ @@ -119,7 +116,7 @@ systemd_notify_la_SOURCES = \ src/compositor.h endif -nodist_weston_SOURCES =\ +nodist_libweston_la_SOURCES = \ protocol/weston-screenshooter-protocol.c\ protocol/weston-screenshooter-server-protocol.h \ protocol/text-cursor-position-protocol.c\ @@ -135,7 +132,19 @@ nodist_weston_SOURCES = \ protocol/linux-dmabuf-unstable-v1-protocol.c\ protocol/linux-dmabuf-unstable-v1-server-protocol.h -BUILT_SOURCES += $(nodist_weston_SOURCES) +BUILT_SOURCES += $(nodist_libweston_la_SOURCES) + +bin_PROGRAMS += weston + +weston_LDFLAGS = -export-dynamic +weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON +weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) +weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ + $(DLOPEN_LIBS) -lm libshared.la libweston.la + +weston_SOURCES = \ + src/main.c \ + src/log.c # Track this dependency explicitly instead of using BUILT_SOURCES. We # add BUILT_SOURCES to CLEANFILES, but we want to keep git-version.h @@ -205,12 +214,12 @@ endif endif # BUILD_WESTON_LAUNCH pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = src/weston.pc +pkgconfig_DATA = src/weston.pc src/libweston-${LIBWESTON_ABI_VERSION}.pc wayland_sessiondir = $(datadir)/wayland-sessions dist_wayland_session_DATA = src/weston.desktop -westonincludedir = $(includedir)/weston +westonincludedir = $(includedir)/weston-${LIBWESTON_ABI_VERSION} westoninclude_HEADERS =\ src/version.h \ src/compositor.h\ diff --git a/configure.ac b/configure.ac index 2ca1f4e..94aad57 100644 --- a/configure.ac +++ b/configure.ac @@ -3,6 +3,7 @@ m4_define([weston_minor_version], [10]) m4_define([weston_micro_version], [91]) m4_define([weston_version],