[gnome-builder] build: make libgnome-builder.la install to private directory



commit 7a4d422c4624dce3754d29eda5cb6d17d1ada15c
Author: Christian Hergert <christian hergert me>
Date:   Sun Aug 23 17:02:06 2015 -0700

    build: make libgnome-builder.la install to private directory
    
    In preparation for allowing plugins to get access to introspection data
    for the Builder process, we want to make libgnome-builder.la an installable
    (but private) shared library. We'll place it in the same place as our
    other private libraries ($libdir/gnome-builder).
    
    This also makes libegg and librg available as a shared library so we can
    more easily link against it from various libraries.

 contrib/egg/Makefile.am            |   12 ++++++---
 contrib/rg/Makefile.am             |    5 ++-
 libide/Makefile.am                 |    2 +-
 src/Makefile.am                    |   11 ++++++-
 src/util/gb-plugins.c              |   15 +++++++++-
 tests/Makefile.am                  |   48 +++++++++++++++++++++---------------
 tests/test-ide-back-forward-list.c |    5 ++-
 tests/test-ide-buffer-manager.c    |   11 +++----
 tests/test-ide-buffer.c            |    8 ++---
 tests/test-ide-context.c           |   17 ++++++------
 tests/test-ide-indenter.c          |    5 ++-
 tests/test-ide-source-view.c       |    9 +++---
 tests/test-vim.c                   |    4 +-
 tools/Makefile.am                  |    2 +-
 14 files changed, 91 insertions(+), 63 deletions(-)
---
diff --git a/contrib/egg/Makefile.am b/contrib/egg/Makefile.am
index 7edcb68..ac8968b 100644
--- a/contrib/egg/Makefile.am
+++ b/contrib/egg/Makefile.am
@@ -1,6 +1,7 @@
-noinst_LTLIBRARIES = libegg.la
+pkglibdir = $(libdir)/gnome-builder
+pkglib_LTLIBRARIES = libegg-private.la
 
-libegg_la_SOURCES = \
+libegg_private_la_SOURCES = \
        egg-binding-group.c \
        egg-binding-group.h \
        egg-counter.c \
@@ -23,8 +24,11 @@ libegg_la_SOURCES = \
        egg-task-cache.h \
        $(NULL)
 
-libegg_la_CFLAGS = $(EGG_CFLAGS)
-libegg_la_LIBADD = \
+libegg_private_la_CFLAGS = \
+       $(EGG_CFLAGS) \
+       $(NULL)
+
+libegg_private_la_LIBADD = \
        $(EGG_LIBS) \
        $(SHM_LIB) \
        $(NULL)
diff --git a/contrib/rg/Makefile.am b/contrib/rg/Makefile.am
index 7f754ee..a0013a3 100644
--- a/contrib/rg/Makefile.am
+++ b/contrib/rg/Makefile.am
@@ -1,4 +1,5 @@
-noinst_LTLIBRARIES = librg.la
+pkglibdir = $(libdir)/gnome-builder
+pkglib_LTLIBRARIES = librg.la
 
 librg_la_SOURCES = \
        realtime-graphs.h \
@@ -30,7 +31,7 @@ librg_la_CFLAGS = \
 
 librg_la_LIBADD = \
        $(RG_LIBS) \
-       $(top_builddir)/contrib/egg/libegg.la \
+       $(top_builddir)/contrib/egg/libegg-private.la \
        $(NULL)
 
 librg_la_LDFLAGS = \
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 4a25409..c648435 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -300,7 +300,7 @@ libide_1_0_la_LIBADD = \
        $(LIBIDE_LIBS) \
        $(SHM_LIB) \
        -lm \
-       $(top_builddir)/contrib/egg/libegg.la \
+       $(top_builddir)/contrib/egg/libegg-private.la \
        $(top_builddir)/contrib/libeditorconfig/libeditorconfig.la \
        $(top_builddir)/contrib/search/libsearch.la \
        $(top_builddir)/contrib/xml/libxml.la \
diff --git a/src/Makefile.am b/src/Makefile.am
index 784a1ec..ce9dcd6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,8 @@ EXTRA_DIST =
 
 bin_PROGRAMS = gnome-builder
 
-noinst_LTLIBRARIES = libgnome-builder.la
+pkglibdir = $(libdir)/gnome-builder
+pkglib_LTLIBRARIES = libgnome-builder.la
 
 libgnome_builder_la_SOURCES = \
        $(gnome_builder_built_sources) \
@@ -173,17 +174,23 @@ libgnome_builder_la_LIBADD = \
        $(OPTIMIZE_LDFLAGS) \
        $(top_builddir)/data/icons/hicolor/libicons.la \
        $(top_builddir)/libide/libide-1.0.la \
-       $(top_builddir)/contrib/egg/libegg.la \
+       $(top_builddir)/contrib/egg/libegg-private.la \
        $(top_builddir)/contrib/gd/libgd.la \
        $(top_builddir)/contrib/gedit/libgedit.la \
        $(top_builddir)/contrib/nautilus/libnautilus.la \
        $(top_builddir)/contrib/rg/librg.la \
        -lm
 
+libgnome_builder_la_LDFLAGS = \
+       -export-symbols-regex '^gb_.*' \
+       -export-dynamic \
+       $(NULL)
+
 libgnome_builder_la_CFLAGS = \
        -DPACKAGE_DATADIR="\"${datadir}\"" \
        -DPACKAGE_LOCALE_DIR=\""${datadir}/locale"\" \
        -DPACKAGE_LIBDIR=\""${libdir}"\" \
+       -DBUILDDIR=\""${abs_top_builddir}"\" \
        $(BUILDER_CFLAGS) \
        $(DEBUG_CFLAGS) \
        $(OPTIMIZE_CFLAGS) \
diff --git a/src/util/gb-plugins.c b/src/util/gb-plugins.c
index 9188d22..8313490 100644
--- a/src/util/gb-plugins.c
+++ b/src/util/gb-plugins.c
@@ -23,12 +23,16 @@
 #endif
 
 #include <libpeas/peas.h>
+#include <girepository.h>
 
 #include "gb-application.h"
 #include "gb-document.h"
 #include "gb-plugins.h"
+#include "gb-tree.h"
 #include "gb-tree-builder.h"
+#include "gb-tree-node.h"
 #include "gb-view.h"
+#include "gb-view-grid.h"
 #include "gb-workbench.h"
 #include "gb-workspace.h"
 
@@ -45,8 +49,11 @@ gb_plugins_init (void)
    */
   g_type_ensure (GB_TYPE_APPLICATION);
   g_type_ensure (GB_TYPE_DOCUMENT);
+  g_type_ensure (GB_TYPE_TREE);
   g_type_ensure (GB_TYPE_TREE_BUILDER);
+  g_type_ensure (GB_TYPE_TREE_NODE);
   g_type_ensure (GB_TYPE_VIEW);
+  g_type_ensure (GB_TYPE_VIEW_GRID);
   g_type_ensure (GB_TYPE_WORKBENCH);
   g_type_ensure (GB_TYPE_WORKSPACE);
 
@@ -58,7 +65,11 @@ gb_plugins_init (void)
     {
       GDir *dir;
 
-      if ((dir = g_dir_open ("plugins", 0, NULL)))
+      g_irepository_require_private (g_irepository_get_default (),
+                                     BUILDDIR"/libide",
+                                     "Ide", "1.0", 0, NULL);
+
+      if ((dir = g_dir_open (BUILDDIR"/plugins", 0, NULL)))
         {
           const gchar *name;
 
@@ -66,7 +77,7 @@ gb_plugins_init (void)
             {
               gchar *path;
 
-              path = g_build_filename ("plugins", name, NULL);
+              path = g_build_filename (BUILDDIR, "plugins", name, NULL);
               peas_engine_prepend_search_path (engine, path, path);
               g_free (path);
             }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2a4bc29..1d0de47 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,12 +3,11 @@ egg_cflags = \
        $(LIBIDE_CFLAGS) \
        -I$(top_srcdir)/contrib/egg \
        -DTEST_DATA_DIR="\"$(srcdir)/data\"" \
-       -DBUILDDIR="\"$(builddir)\"" \
        $(NULL)
 
 egg_libs = \
        $(LIBIDE_LIBS) \
-       $(top_builddir)/contrib/egg/libegg.la \
+       $(top_builddir)/contrib/egg/libegg-private.la \
        $(NULL)
 
 rg_cflags = \
@@ -19,7 +18,7 @@ rg_cflags = \
        $(NULL)
 
 rg_libs = \
-       $(top_builddir)/contrib/egg/libegg.la \
+       $(top_builddir)/contrib/egg/libegg-private.la \
        $(top_builddir)/contrib/rg/librg.la \
        $(RG_LIBS) \
        $(NULL)
@@ -39,29 +38,36 @@ search_libs = \
 
 tests_cflags = \
        $(egg_cflags) \
+       $(LIBIDE_CFLAGS) \
        -I$(top_srcdir)/libide \
        -I$(top_builddir)/libide \
-       -I$(top_srcdir)/src \
+       -I$(top_srcdir)/src/app \
+       -I$(top_srcdir)/src/css \
+       -I$(top_srcdir)/src/dialogs \
+       -I$(top_srcdir)/src/documents \
+       -I$(top_srcdir)/src/editor \
+       -I$(top_srcdir)/src/greeter \
+       -I$(top_srcdir)/src/html \
+       -I$(top_srcdir)/src/keybindings \
+       -I$(top_srcdir)/src/preferences \
+       -I$(top_srcdir)/src/project-tree \
+       -I$(top_srcdir)/src/resources \
+       -I$(top_srcdir)/src/scrolledwindow \
+       -I$(top_srcdir)/src/search \
+       -I$(top_srcdir)/src/support \
+       -I$(top_srcdir)/src/tree \
+       -I$(top_srcdir)/src/util \
+       -I$(top_srcdir)/src/views \
+       -I$(top_srcdir)/src/workbench \
        -I$(top_srcdir)/src/workspace \
        $(NULL)
 
 tests_libs = \
-       $(egg_libs) \
-       $(top_builddir)/libide/libide-1.0.la \
-       $(NULL)
-
-tests_ide_context_cflags = \
-       $(egg_cflags) \
-       -I$(top_srcdir)/libide \
-       -I$(top_builddir)/libide \
-       -I$(top_srcdir)/src \
-       -I$(top_srcdir)/plugins/autotools \
+       $(top_builddir)/src/libgnome-builder.la \
        $(NULL)
 
-tests_ide_context_libs = \
-       $(egg_libs) \
-       $(top_builddir)/libide/libide-1.0.la \
-       $(top_builddir)/plugins/autotools/libautotools-plugin.la \
+tests_ldflags = \
+       -export-dynamic \
        $(NULL)
 
 misc_programs =
@@ -71,6 +77,7 @@ TESTS_ENVIRONMENT= \
         G_TEST_SRCDIR="$(abs_srcdir)"          \
         G_TEST_BUILDDIR="$(abs_builddir)"      \
         G_DEBUG=gc-friendly                    \
+        GB_IN_TREE_PLUGINS=1                    \
         MALLOC_CHECK_=2                        \
         MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
 
@@ -78,8 +85,9 @@ LOG_COMPILER = $(top_srcdir)/build/autotools/tap-test
 
 TESTS = test-ide-context
 test_ide_context_SOURCES = test-ide-context.c
-test_ide_context_CFLAGS = $(tests_ide_context_cflags)
-test_ide_context_LDADD = $(tests_ide_context_libs)
+test_ide_context_CFLAGS = $(tests_cflags)
+test_ide_context_LDADD = $(tests_libs)
+test_ide_context_LDFLAGS = $(tests_ldflags)
 
 
 TESTS += test-ide-back-forward-list
diff --git a/tests/test-ide-back-forward-list.c b/tests/test-ide-back-forward-list.c
index d5bfb9e..5100b67 100644
--- a/tests/test-ide-back-forward-list.c
+++ b/tests/test-ide-back-forward-list.c
@@ -16,10 +16,11 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <girepository.h>
 #include <glib.h>
 #include <ide.h>
 
+#include "gb-plugins.h"
+
 typedef struct
 {
   GMainLoop    *main_loop;
@@ -171,9 +172,9 @@ gint
 main (gint   argc,
       gchar *argv[])
 {
-  g_irepository_prepend_search_path (BUILDDIR"/../libide");
   gtk_init (&argc, &argv);
   g_test_init (&argc, &argv, NULL);
   g_test_add_func ("/Ide/BackForwardList/basic", test_basic);
+  gb_plugins_init ();
   return g_test_run ();
 }
diff --git a/tests/test-ide-buffer-manager.c b/tests/test-ide-buffer-manager.c
index a5ac32f..535668a 100644
--- a/tests/test-ide-buffer-manager.c
+++ b/tests/test-ide-buffer-manager.c
@@ -18,9 +18,10 @@
 
 #include <glib.h>
 #include <glib/gstdio.h>
-#include <girepository.h>
 #include <ide.h>
 
+#include "gb-plugins.h"
+
 typedef struct
 {
   GMainLoop    *main_loop;
@@ -157,8 +158,9 @@ test_buffer_manager_basic (void)
   IdeBufferManager *buffer_manager;
   GFile *project_file;
   g_autofree gchar *path = NULL;
+  const gchar *builddir = g_getenv ("G_TEST_BUILDDIR");
 
-  path = g_build_filename (g_get_current_dir (), TEST_DATA_DIR, "project1", "configure.ac", NULL);
+  path = g_build_filename (builddir, "data", "project1", "configure.ac", NULL);
   project_file = g_file_new_for_path (path);
 
   state.main_loop = g_main_loop_new (NULL, FALSE);
@@ -192,12 +194,9 @@ gint
 main (gint   argc,
       gchar *argv[])
 {
-  g_irepository_prepend_search_path (BUILDDIR"/../libide");
   gtk_init (&argc, &argv);
   g_test_init (&argc, &argv, NULL);
-  g_irepository_require_private (g_irepository_get_default (),
-                                 BUILDDIR,
-                                 "Ide", "1.0", 0, NULL);
   g_test_add_func ("/Ide/BufferManager/basic", test_buffer_manager_basic);
+  gb_plugins_init ();
   return g_test_run ();
 }
diff --git a/tests/test-ide-buffer.c b/tests/test-ide-buffer.c
index cfc2ece..cacd8e6 100644
--- a/tests/test-ide-buffer.c
+++ b/tests/test-ide-buffer.c
@@ -18,9 +18,10 @@
 
 #include <glib.h>
 #include <glib/gstdio.h>
-#include <girepository.h>
 #include <ide.h>
 
+#include "gb-plugins.h"
+
 typedef struct
 {
   GMainLoop    *main_loop;
@@ -140,12 +141,9 @@ gint
 main (gint   argc,
       gchar *argv[])
 {
-  g_irepository_prepend_search_path (BUILDDIR"/../libide");
   gtk_init (&argc, &argv);
   g_test_init (&argc, &argv, NULL);
-  g_irepository_require_private (g_irepository_get_default (),
-                                 BUILDDIR,
-                                 "Ide", "1.0", 0, NULL);
   g_test_add_func ("/Ide/Buffer/basic", test_buffer_basic);
+  gb_plugins_init ();
   return g_test_run ();
 }
diff --git a/tests/test-ide-context.c b/tests/test-ide-context.c
index a3e40ef..98f38c5 100644
--- a/tests/test-ide-context.c
+++ b/tests/test-ide-context.c
@@ -16,11 +16,10 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "ide-autotools-build-system.h"
-
-#include <girepository.h>
 #include <ide.h>
 
+#include "gb-plugins.h"
+
 typedef struct
 {
   GMainLoop    *main_loop;
@@ -47,9 +46,12 @@ test_new_async (void)
   IdeVcs *vcs;
   GFile *project_file;
   const gchar *root_build_dir;
+  const gchar *builddir;
   g_autofree gchar *path = NULL;
 
-  path = g_build_filename (g_get_current_dir (), TEST_DATA_DIR, "project1", "configure.ac", NULL);
+  builddir = g_getenv ("G_TEST_BUILDDIR");
+
+  path = g_build_filename (builddir, "data", "project1", "configure.ac", NULL);
   project_file = g_file_new_for_path (path);
 
   state.main_loop = g_main_loop_new (NULL, FALSE);
@@ -64,7 +66,7 @@ test_new_async (void)
   g_assert (state.context);
 
   bs = ide_context_get_build_system (state.context);
-  g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (bs));
+  g_assert_cmpstr (G_OBJECT_TYPE_NAME (bs), ==, "IdeAutotoolsBuildSystem");
 
   vcs = ide_context_get_vcs (state.context);
   g_assert (IDE_IS_GIT_VCS (vcs));
@@ -83,12 +85,9 @@ gint
 main (gint   argc,
       gchar *argv[])
 {
-  g_irepository_prepend_search_path (BUILDDIR"/../libide");
   gtk_init (&argc, &argv);
   g_test_init (&argc, &argv, NULL);
-  g_irepository_require_private (g_irepository_get_default (),
-                                 BUILDDIR,
-                                 "Ide", "1.0", 0, NULL);
   g_test_add_func ("/Ide/Context/new_async", test_new_async);
+  gb_plugins_init ();
   return g_test_run ();
 }
diff --git a/tests/test-ide-indenter.c b/tests/test-ide-indenter.c
index 0ac1fc1..8bc169e 100644
--- a/tests/test-ide-indenter.c
+++ b/tests/test-ide-indenter.c
@@ -17,10 +17,11 @@
  */
 
 #include <libpeas/peas.h>
-#include <girepository.h>
 #include <ide.h>
 #include <string.h>
 
+#include "gb-plugins.h"
+
 typedef void (*IndentTestFunc) (IdeContext *context,
                                 GtkWidget  *widget);
 
@@ -296,9 +297,9 @@ gint
 main (gint argc,
       gchar *argv[])
 {
-  g_irepository_prepend_search_path (BUILDDIR"/../libide");
   gtk_init (&argc, &argv);
   g_test_init (&argc, &argv, NULL);
   g_test_add_func ("/Ide/CIndenter/basic", test_cindenter_basic);
+  gb_plugins_init ();
   return g_test_run ();
 }
diff --git a/tests/test-ide-source-view.c b/tests/test-ide-source-view.c
index 1997a02..1f3cc76 100644
--- a/tests/test-ide-source-view.c
+++ b/tests/test-ide-source-view.c
@@ -24,7 +24,8 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <stdlib.h>
-#include <girepository.h>
+
+#include "gb-plugins.h"
 
 #define ADD_CLASS(widget,name) \
   gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(widget)), name)
@@ -727,10 +728,6 @@ main (int argc,
     { NULL }
   };
 
-  g_irepository_require_private (g_irepository_get_default (),
-                                 BUILDDIR,
-                                 "Ide", "1.0", 0, NULL);
-
   ide_set_program_name ("gnome-builder");
   ide_log_init (TRUE, NULL);
 
@@ -756,6 +753,8 @@ main (int argc,
 
   project_dir = g_file_new_for_path (".");
 
+  gb_plugins_init ();
+
   ide_context_new_async (project_dir,
                          NULL,
                          idedit__context_new_cb,
diff --git a/tests/test-vim.c b/tests/test-vim.c
index 5429026..9704d2a 100644
--- a/tests/test-vim.c
+++ b/tests/test-vim.c
@@ -18,8 +18,8 @@
 
 #include <ide.h>
 #include <string.h>
-#include <girepository.h>
 
+#include "gb-plugins.h"
 #include "gb-resources.h"
 
 typedef void (*VimTestFunc) (IdeContext *context,
@@ -277,10 +277,10 @@ gint
 main (gint argc,
       gchar *argv[])
 {
-  g_irepository_prepend_search_path (BUILDDIR"/../libide");
   gtk_init (&argc, &argv);
   load_vim_css ();
   g_test_init (&argc, &argv, NULL);
   g_test_add_func ("/Ide/Vim/basic", test_vim_basic);
+  gb_plugins_init ();
   return g_test_run ();
 }
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 01fb180..5a72c74 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -62,7 +62,7 @@ ide_list_counters_CFLAGS = \
        $(NULL)
 ide_list_counters_LDADD = \
        $(EGG_LIBS) \
-       $(top_builddir)/contrib/egg/libegg.la \
+       $(top_builddir)/contrib/egg/libegg-private.la \
        $(SHM_LIB) \
        $(NULL)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]