Implementing building two separate binaries for x11 and wayland

Build gnome-shell for x11, and gnome-shell-wayland for wayland
(as well as the associated libgnome-shell and libgnome-shell-wayland).
The first one links to libmutter, the second to libmutter-wayland.

libgnome-shell and libgnome-shell-wayland are now compiled from
libgnome-shell-base (with all sources that are independent of mutter),
libgnome-shell-menu (with the copy-pasted gtk sources), plus the
sources that use mutter API

https://bugzilla.gnome.org/show_bug.cgi?id=705497
This commit is contained in:
Giovanni Campagna 2013-08-16 15:47:17 +02:00
parent 254efdd122
commit 21a85832b3
5 changed files with 105 additions and 56 deletions

View File

@ -75,26 +75,29 @@ NETWORKMANAGER_MIN_VERSION=0.9.8
PULSE_MIN_VERS=2.0
# Collect more than 20 libraries for a prize!
PKG_CHECK_MODULES(GNOME_SHELL, gio-unix-2.0 >= $GIO_MIN_VERSION
libxml-2.0
gtk+-3.0 >= $GTK_MIN_VERSION
atk-bridge-2.0
libmutter >= $MUTTER_MIN_VERSION
gjs-internals-1.0 >= $GJS_MIN_VERSION
libgnome-menu-3.0 >= $GNOME_MENUS_REQUIRED_VERSION
$recorder_modules
gdk-x11-3.0 libsoup-2.4
xtst
clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
clutter-glx-1.0 >= $CLUTTER_MIN_VERSION
libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_MIN_VERSION
gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_MIN_VERSION
libcanberra libcanberra-gtk3
telepathy-glib >= $TELEPATHY_GLIB_MIN_VERSION
polkit-agent-1 >= $POLKIT_MIN_VERSION
libnm-glib libnm-util >= $NETWORKMANAGER_MIN_VERSION
libnm-gtk >= $NETWORKMANAGER_MIN_VERSION
libsecret-unstable gcr-base-3 >= $GCR_MIN_VERSION)
SHARED_PCS="gio-unix-2.0 >= $GIO_MIN_VERSION
libxml-2.0
gtk+-3.0 >= $GTK_MIN_VERSION
atk-bridge-2.0
gjs-internals-1.0 >= $GJS_MIN_VERSION
libgnome-menu-3.0 >= $GNOME_MENUS_REQUIRED_VERSION
$recorder_modules
gdk-x11-3.0 libsoup-2.4
xtst
clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
clutter-glx-1.0 >= $CLUTTER_MIN_VERSION
libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_MIN_VERSION
gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_MIN_VERSION
libcanberra libcanberra-gtk3
telepathy-glib >= $TELEPATHY_GLIB_MIN_VERSION
polkit-agent-1 >= $POLKIT_MIN_VERSION
libnm-glib libnm-util >= $NETWORKMANAGER_MIN_VERSION
libnm-gtk >= $NETWORKMANAGER_MIN_VERSION
libsecret-unstable gcr-base-3 >= $GCR_MIN_VERSION"
PKG_CHECK_MODULES(GNOME_SHELL, $SHARED_PCS)
PKG_CHECK_MODULES(MUTTER, libmutter >= $MUTTER_MIN_VERSION)
PKG_CHECK_MODULES(MUTTER_WAYLAND, libmutter-wayland >= $MUTTER_MIN_VERSION)
PKG_CHECK_MODULES(GNOME_SHELL_JS, gio-2.0 gjs-internals-1.0 >= $GJS_MIN_VERSION)
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.8 x11)
@ -133,6 +136,10 @@ MUTTER_GIR_DIR=`$PKG_CONFIG --variable=girdir libmutter`
MUTTER_TYPELIB_DIR=`$PKG_CONFIG --variable=typelibdir libmutter`
AC_SUBST(MUTTER_GIR_DIR)
AC_SUBST(MUTTER_TYPELIB_DIR)
MUTTER_WAYLAND_GIR_DIR=`$PKG_CONFIG --variable=girdir libmutter`
MUTTER_WAYLAND_TYPELIB_DIR=`$PKG_CONFIG --variable=typelibdir libmutter-wayland`
AC_SUBST(MUTTER_WAYLAND_GIR_DIR)
AC_SUBST(MUTTER_WAYLAND_TYPELIB_DIR)
GJS_CONSOLE=`$PKG_CONFIG --variable=gjs_console gjs-1.0`
AC_SUBST(GJS_CONSOLE)

View File

@ -99,6 +99,9 @@ function start() {
global.logError = window.log;
global.log = window.log;
if (!Meta.is_wayland_compositor)
Meta.is_wayland_compositor = function () { return false; };
// Chain up async errors reported from C
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });

View File

@ -33,7 +33,7 @@ bin_SCRIPTS += gnome-shell-extension-tool gnome-shell-extension-prefs \
gnome-shell-perf-tool
EXTRA_DIST += gnome-shell-extension-tool.in gnome-shell-extension-prefs.in \
gnome-shell-perf-tool.in
bin_PROGRAMS = gnome-shell
bin_PROGRAMS = gnome-shell gnome-shell-wayland
generated_script_substitutions = \
-e "s|@bindir[@]|$(bindir)|g" \
@ -72,11 +72,11 @@ gnome_shell_cflags = \
-DGNOME_SHELL_LIBEXECDIR=\"$(libexecdir)\" \
-DGNOME_SHELL_DATADIR=\"$(pkgdatadir)\" \
-DGNOME_SHELL_PKGLIBDIR=\"$(pkglibdir)\" \
-DJSDIR=\"$(pkgdatadir)/js\" \
-DMUTTER_TYPELIB_DIR=\"$(MUTTER_TYPELIB_DIR)\"
-DJSDIR=\"$(pkgdatadir)/js\"
privlibdir = $(pkglibdir)
privlib_LTLIBRARIES = libgnome-shell.la libgnome-shell-js.la
privlib_LTLIBRARIES = libgnome-shell-js.la libgnome-shell-menu.la libgnome-shell.la libgnome-shell-wayland.la
noinst_LTLIBRARIES += libgnome-shell-base.la
shell_built_sources = \
shell-enum-types.h \
@ -107,7 +107,7 @@ shell_public_headers_h = \
shell-window-tracker.h \
shell-wm.h
shell_private_sources = \
libgnome_shell_menu_la_SOURCES = \
gtkactionmuxer.h \
gtkactionmuxer.c \
gtkactionobservable.h \
@ -120,24 +120,12 @@ shell_private_sources = \
gtkmenutracker.h \
$(NULL)
libgnome_shell_la_SOURCES = \
$(shell_built_sources) \
libgnome_shell_base_la_SOURCES = \
$(shell_public_headers_h) \
$(shell_private_sources) \
shell-app-private.h \
shell-app-system-private.h \
shell-embedded-window-private.h \
shell-global-private.h \
shell-window-tracker-private.h \
shell-wm-private.h \
gnome-shell-plugin.c \
shell-app.c \
shell-app-system.c \
shell-app-usage.c \
shell-embedded-window.c \
shell-generic-container.c \
shell-gtk-embed.c \
shell-global.c \
shell-invert-lightness-effect.c \
shell-keyring-prompt.h \
shell-keyring-prompt.c \
@ -148,12 +136,28 @@ libgnome_shell_la_SOURCES = \
shell-perf-log.c \
shell-polkit-authentication-agent.h \
shell-polkit-authentication-agent.c \
shell-screenshot.c \
shell-secure-text-buffer.c \
shell-secure-text-buffer.h \
shell-slicer.c \
shell-stack.c \
shell-tp-client.c \
shell-tp-client.c \
$(NULL)
libgnome_shell_sources = \
$(shell_built_sources) \
$(shell_public_headers_h) \
shell-app-private.h \
shell-app-system-private.h \
shell-global-private.h \
shell-window-tracker-private.h \
shell-wm-private.h \
gnome-shell-plugin.c \
shell-app.c \
shell-app-system.c \
shell-app-usage.c \
shell-global.c \
shell-gtk-embed.c \
shell-screenshot.c \
shell-tray-icon.c \
shell-tray-manager.c \
shell-util.c \
@ -161,14 +165,33 @@ libgnome_shell_la_SOURCES = \
shell-wm.c \
$(NULL)
libgnome_shell_la_SOURCES = $(libgnome_shell_sources)
libgnome_shell_wayland_la_SOURCES = $(libgnome_shell_sources)
libgnome_shell_la_gir_sources = \
$(filter-out %-private.h $(shell_private_sources), $(shell_public_headers_h) $(libgnome_shell_la_SOURCES))
$(filter-out %-private.h $(shell_private_sources), $(shell_public_headers_h) $(libgnome_shell_base_la_SOURCES) $(libgnome_shell_sources))
gnome_shell_SOURCES = main.c
gnome_shell_CPPFLAGS = $(gnome_shell_cflags)
gnome_shell_LDADD = libgnome-shell.la libgnome-shell-js.la $(libgnome_shell_la_LIBADD)
gnome_shell_CPPFLAGS = \
-DMUTTER_TYPELIB_DIR=\"$(MUTTER_TYPELIB_DIR)\" \
$(MUTTER_CFLAGS) \
$(gnome_shell_cflags)
# Here, and after, we repeat mutter and bluetooth libraries just for the rpath
# The dependency is already pulled in by libtool
gnome_shell_LDADD = libgnome-shell.la libgnome-shell-js.la $(MUTTER_LIBS) $(BLUETOOTH_LIBS)
gnome_shell_DEPENDENCIES = libgnome-shell.la
gnome_shell_wayland_SOURCES = main.c
gnome_shell_wayland_CPPFLAGS = \
-DHAVE_WAYLAND \
-DMUTTER_TYPELIB_DIR=\"$(MUTTER_WAYLAND_TYPELIB_DIR)\" \
$(MUTTER_WAYLAND_CFLAGS) \
$(gnome_shell_cflags)
gnome_shell_wayland_LDADD = libgnome-shell-wayland.la libgnome-shell-js.la $(MUTTER_WAYLAND_LIBS) $(BLUETOOTH_LIBS)
gnome_shell_wayland_DEPENDENCIES = libgnome-shell-wayland.la
########################################
libgnome_shell_js_la_SOURCES = \
@ -202,7 +225,7 @@ shell_recorder_private_sources = \
shell-recorder-src.h \
$(NULL)
shell_private_sources += $(shell_recorder_private_sources)
shell_private_sources = $(shell_recorder_private_sources)
endif BUILD_RECORDER
@ -218,8 +241,8 @@ gnome_shell_perf_helper_LDADD = $(SHELL_PERF_HELPER_LIBS)
noinst_PROGRAMS += run-js-test
run_js_test_CPPFLAGS = $(gnome_shell_cflags)
run_js_test_LDADD = libgnome-shell.la $(libgnome_shell_la_LIBADD)
run_js_test_CPPFLAGS = $(MUTTER_CFLAGS) $(gnome_shell_cflags)
run_js_test_LDADD = libgnome-shell.la $(MUTTER_LIBS) $(BLUETOOTH_LIBS)
run_js_test_LDFLAGS = -export-dynamic
run_js_test_SOURCES = \
@ -249,22 +272,34 @@ shell-enum-types.c: $(srcdir)/shell-enum-types.c.in stamp-shell-enum-types.h
rm -f $(@F).tmp
EXTRA_DIST += shell-enum-types.c.in
libgnome_shell_la_LDFLAGS = -avoid-version
libgnome_shell_la_LIBADD = \
libgnome_shell_ldflags = -avoid-version
libgnome_shell_libadd = \
-lm \
$(GNOME_SHELL_LIBS) \
$(BLUETOOTH_LIBS) \
libgnome-shell-menu.la \
libst-1.0.la \
libtray.la \
gvc/libgvc.la \
$(NULL)
libgnome_shell_la_CPPFLAGS = $(gnome_shell_cflags)
libgnome_shell_menu_la_LIBADD = $(GNOME_SHELL_LIBS)
libgnome_shell_menu_la_CPPFLAGS = $(GNOME_SHELL_CFLAGS)
ShellMenu-0.1.gir: libgnome-shell.la
libgnome_shell_base_la_LIBADD = $(libgnome_shell_libadd)
libgnome_shell_base_la_CPPFLAGS = $(gnome_shell_cflags)
libgnome_shell_la_LDFLAGS = $(libgnome_shell_ldflags)
libgnome_shell_la_LIBADD = $(MUTTER_LIBS) libgnome-shell-base.la
libgnome_shell_la_CPPFLAGS = $(MUTTER_CFLAGS) $(gnome_shell_cflags)
libgnome_shell_wayland_la_LDFLAGS = $(libgnome_shell_ldflags)
libgnome_shell_wayland_la_LIBADD = $(MUTTER_WAYLAND_LIBS) libgnome-shell-base.la
libgnome_shell_wayland_la_CPPFLAGS = $(MUTTER_WAYLAND_CFLAGS) -DHAVE_WAYLAND $(gnome_shell_cflags)
ShellMenu-0.1.gir: libgnome-shell-menu.la
ShellMenu_0_1_gir_INCLUDES = Gio-2.0
ShellMenu_0_1_gir_CFLAGS = $(libgnome_shell_la_CPPFLAGS) -I $(srcdir)
ShellMenu_0_1_gir_LIBS = libgnome-shell.la
ShellMenu_0_1_gir_CFLAGS = $(libgnome_shell_menu_la_CPPFLAGS) -I $(srcdir)
ShellMenu_0_1_gir_LIBS = libgnome-shell-menu.la
ShellMenu_0_1_gir_FILES = \
gtkactionmuxer.h \
gtkactionmuxer.c \
@ -281,10 +316,14 @@ ShellMenu_0_1_gir_SCANNERFLAGS = \
INTROSPECTION_GIRS += ShellMenu-0.1.gir
CLEANFILES += ShellMenu-0.1.gir
Shell-0.1.gir: libgnome-shell.la St-1.0.gir ShellMenu-0.1.gir
Shell-0.1.gir: gnome-shell St-1.0.gir ShellMenu-0.1.gir
Shell_0_1_gir_INCLUDES = Clutter-1.0 ClutterX11-1.0 Meta-3.0 TelepathyGLib-0.12 Soup-2.4 GMenu-3.0 NetworkManager-1.0 NMClient-1.0
Shell_0_1_gir_CFLAGS = $(libgnome_shell_la_CPPFLAGS) -I $(srcdir)
Shell_0_1_gir_LIBS = libgnome-shell.la
# Hack! we use PROGRAM instead of LIBS so that the soname is not included
# in the typelib. This way the symbols will be resolved with the libgnome-shell
# linked against the executable (which will be libgnome-shell-wayland for
# gnome-shell-wayland)
Shell_0_1_gir_PROGRAM = $(builddir)/gnome-shell
Shell_0_1_gir_FILES = $(libgnome_shell_la_gir_sources)
Shell_0_1_gir_SCANNERFLAGS = \
--include-uninstalled=$(builddir)/St-1.0.gir \

View File

@ -388,6 +388,7 @@ main (int argc, char **argv)
ctx = meta_get_option_context ();
g_option_context_add_main_entries (ctx, gnome_shell_options, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, g_irepository_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &error))
{
g_printerr ("%s: %s\n", argv[0], error->message);

View File

@ -4,7 +4,6 @@
#include "shell-tray-icon.h"
#include "shell-gtk-embed.h"
#include "shell-window-tracker.h"
#include "tray/na-tray-child.h"
#include <gdk/gdkx.h>
#include <X11/Xatom.h>