Make xserver-launcher a module

This commit is contained in:
Kristian Høgsberg 2012-04-12 10:37:23 -04:00
parent 02e79dc935
commit d012e9dfa4
3 changed files with 30 additions and 22 deletions

View File

@ -11,8 +11,7 @@ AM_CPPFLAGS = \
weston_LDFLAGS = -export-dynamic
weston_CFLAGS = $(GCC_CFLAGS)
weston_LDADD = \
$(COMPOSITOR_LIBS) $(DLOPEN_LIBS) $(XSERVER_LAUNCHER_LIBS) -lm \
../shared/libconfig-parser.la
$(COMPOSITOR_LIBS) $(DLOPEN_LIBS) -lm ../shared/libconfig-parser.la
weston_SOURCES = \
compositor.c \
@ -23,8 +22,7 @@ weston_SOURCES = \
util.c \
matrix.c \
matrix.h \
weston-launch.h \
$(xserver_launcher_sources)
weston-launch.h
if BUILD_WESTON_LAUNCH
weston_launch = weston-launch
@ -50,19 +48,11 @@ endif
endif # BUILD_WESTON_LAUNCH
if ENABLE_XSERVER_LAUNCHER
xserver_launcher_sources = \
xserver-launcher.c \
xserver-protocol.c \
xserver-server-protocol.h \
hash.c \
hash.h
endif
moduledir = @libdir@/weston
module_LTLIBRARIES = \
$(desktop_shell) \
$(tablet_shell) \
$(tablet_shell) \
$(xserver_launcher) \
$(x11_backend) \
$(drm_backend) \
$(wayland_backend) \
@ -80,7 +70,8 @@ endif
if ENABLE_DRM_COMPOSITOR
drm_backend = drm-backend.la
drm_backend_la_LDFLAGS = -module -avoid-version
drm_backend_la_LIBADD = $(COMPOSITOR_LIBS) $(DRM_COMPOSITOR_LIBS)
drm_backend_la_LIBADD = $(COMPOSITOR_LIBS) $(DRM_COMPOSITOR_LIBS) \
../shared/libconfig-parser.la
drm_backend_la_CFLAGS = $(DRM_COMPOSITOR_CFLAGS) $(GCC_CFLAGS)
drm_backend_la_SOURCES = \
compositor-drm.c \
@ -110,6 +101,19 @@ openwfd_backend_la_CFLAGS = $(OPENWFD_COMPOSITOR_CFLAGS) $(GCC_CFLAGS)
openwfd_backend_la_SOURCES = compositor-openwfd.c tty.c evdev.c evdev.h
endif
if ENABLE_XSERVER_LAUNCHER
xserver_launcher = xserver-launcher.la
xserver_launcher_la_LDFLAGS = -module -avoid-version
xserver_launcher_la_LIBADD = $(XSERVER_LAUNCHER_LIBS)
xserver_launcher_la_CFLAGS = $(GCC_CFLAGS)
xserver_launcher_la_SOURCES = \
xserver-launcher.c \
xserver-protocol.c \
xserver-server-protocol.h \
hash.c \
hash.h
endif
if ENABLE_DESKTOP_SHELL
desktop_shell = desktop-shell.la
desktop_shell_la_LDFLAGS = -module -avoid-version

View File

@ -2509,8 +2509,9 @@ int main(int argc, char *argv[])
struct wl_event_source *signals[4];
struct wl_event_loop *loop;
struct sigaction segv_action;
void *shell_module, *backend_module;
void *shell_module, *backend_module, *xserver_module;
int (*shell_init)(struct weston_compositor *ec);
int (*xserver_init)(struct weston_compositor *ec);
struct weston_compositor
*(*backend_init)(struct wl_display *display,
int argc, char *argv[]);
@ -2600,14 +2601,17 @@ int main(int argc, char *argv[])
ec->option_idle_time = idle_time;
ec->idle_time = idle_time;
#ifdef BUILD_XSERVER_LAUNCHER
if (xserver)
weston_xserver_init(ec);
#endif
if (shell_init(ec) < 0)
exit(EXIT_FAILURE);
xserver_init = NULL;
if (xserver)
xserver_init = load_module("xserver-launcher.so",
"weston_xserver_init",
&xserver_module);
if (xserver_init)
xserver_init(ec);
if (wl_display_add_socket(display, socket_name)) {
fprintf(stderr, "failed to add socket: %m\n");
exit(EXIT_FAILURE);

View File

@ -1701,7 +1701,7 @@ weston_xserver_destroy(struct wl_listener *l, void *data)
free(wxs);
}
int
WL_EXPORT int
weston_xserver_init(struct weston_compositor *compositor)
{
struct wl_display *display = compositor->wl_display;