From bbdd7d9b15d9f6738dc133b43f6bd922133fcfc5 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 8 Oct 2008 10:11:57 +0100 Subject: [PATCH] Build metacity as library so that plugins can link against it. Renamed original main() to meta_main(); added wrapper main() into metacity.c. --- src/Makefile.am | 24 +++++++++++--------- src/compositor/clutter-plugins/Makefile.am | 2 ++ src/core/main.c | 2 +- src/core/metacity.c | 26 ++++++++++++++++++++++ src/include/main.h | 2 ++ 5 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 src/core/metacity.c diff --git a/src/Makefile.am b/src/Makefile.am index 1544f1482..eee586ce5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -lib_LTLIBRARIES = libmetacity-private.la +lib_LTLIBRARIES = libmetacity-private.la libmetacity.la SUBDIRS=wm-tester tools themes @@ -8,7 +8,10 @@ endif INCLUDES=@METACITY_CFLAGS@ -I $(srcdir)/include -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMETACITY_PKGDATADIR=\"$(pkgdatadir)\" -DMETACITY_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"metacity\" -DSN_API_NOT_YET_FROZEN=1 -DMETACITY_MAJOR_VERSION=$(METACITY_MAJOR_VERSION) -DMETACITY_MINOR_VERSION=$(METACITY_MINOR_VERSION) -DMETACITY_MICRO_VERSION=$(METACITY_MICRO_VERSION) -DMETACITY_CLUTTER_PLUGIN_API_VERSION=$(METACITY_CLUTTER_PLUGIN_API_VERSION) -DMETACITY_PKGLIBDIR=\"$(pkglibdir)\" -metacity_SOURCES= \ +metacity_SOURCES= \ + core/metacity.c + +libmetacity_la_SOURCES= \ core/async-getprop.c \ core/async-getprop.h \ core/atomnames.h \ @@ -103,7 +106,8 @@ metacity_SOURCES= \ ui/ui.c if WITH_CLUTTER -metacity_SOURCES += compositor/compositor-clutter.c \ +libmetacity_la_SOURCES += \ + compositor/compositor-clutter.c \ compositor/compositor-clutter.h \ compositor/tidy-texture-frame.c \ compositor/tidy-texture-frame.h \ @@ -156,19 +160,19 @@ bin_PROGRAMS=metacity metacity-theme-viewer libexec_PROGRAMS=metacity-dialog EFENCE= -metacity_LDADD=@METACITY_LIBS@ $(EFENCE) +metacity_LDADD=@METACITY_LIBS@ libmetacity.la $(EFENCE) metacity_theme_viewer_LDADD= @METACITY_LIBS@ libmetacity-private.la metacity_dialog_LDADD=@METACITY_LIBS@ -testboxes_SOURCES=include/util.h core/util.c include/boxes.h core/boxes.c core/testboxes.c -testgradient_SOURCES=ui/gradient.h ui/gradient.c ui/testgradient.c -testasyncgetprop_SOURCES=core/async-getprop.h core/async-getprop.c core/testasyncgetprop.c +testboxes_SOURCES=core/testboxes.c +testgradient_SOURCES=ui/testgradient.c +testasyncgetprop_SOURCES=core/testasyncgetprop.c noinst_PROGRAMS=testboxes testgradient testasyncgetprop -testboxes_LDADD= @METACITY_LIBS@ -testgradient_LDADD= @METACITY_LIBS@ -testasyncgetprop_LDADD= @METACITY_LIBS@ +testboxes_LDADD= @METACITY_LIBS@ libmetacity.la +testgradient_LDADD= @METACITY_LIBS@ libmetacity.la +testasyncgetprop_LDADD= @METACITY_LIBS@ libmetacity.la @INTLTOOL_DESKTOP_RULE@ diff --git a/src/compositor/clutter-plugins/Makefile.am b/src/compositor/clutter-plugins/Makefile.am index 05fad571d..8a8de4acc 100644 --- a/src/compositor/clutter-plugins/Makefile.am +++ b/src/compositor/clutter-plugins/Makefile.am @@ -5,6 +5,8 @@ if WITH_CLUTTER INCLUDES=@METACITY_CFLAGS@ -I $(top_srcdir)/src/include -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMETACITY_PKGDATADIR=\"$(pkgdatadir)\" -DMETACITY_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"metacity\" -DSN_API_NOT_YET_FROZEN=1 -DMETACITY_MAJOR_VERSION=$(METACITY_MAJOR_VERSION) -DMETACITY_MINOR_VERSION=$(METACITY_MINOR_VERSION) -DMETACITY_MICRO_VERSION=$(METACITY_MICRO_VERSION) -DMETACITY_CLUTTER_PLUGIN_API_VERSION=$(METACITY_CLUTTER_PLUGIN_API_VERSION) -DMETACITY_PKGLIBDIR=\"$(pkglibdir)\" +LDADD = $(top_builddir)/src/libmetacity.la + default_la_CFLAGS = -fPIC default_la_SOURCES = default.c default_la_LDFLAGS = -module -avoid-version -no-undefined diff --git a/src/core/main.c b/src/core/main.c index 96c8580cc..f9a1fd890 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -386,7 +386,7 @@ void meta_select_display (gchar *display_name) * functions. */ int -main (int argc, char **argv) +meta_main (int argc, char **argv) { struct sigaction act; sigset_t empty_mask; diff --git a/src/core/metacity.c b/src/core/metacity.c new file mode 100644 index 000000000..df0313500 --- /dev/null +++ b/src/core/metacity.c @@ -0,0 +1,26 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (C) 2008 Intel Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +int +main (int argc, char **argv) +{ + return meta_main (argc, argv); +} diff --git a/src/include/main.h b/src/include/main.h index d06e2c5bc..d85408de7 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -40,4 +40,6 @@ void meta_quit (MetaExitCode code); void meta_restart (void); +int meta_main (int argc, char **argv); + #endif