[gnome-builder: 34/139] build: setup toplevel directory for libide static libs
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder: 34/139] build: setup toplevel directory for libide static libs
- Date: Thu, 10 Jan 2019 04:20:10 +0000 (UTC)
commit 72f645eaae992f7e7c2307bdb30ef4c01fbc8584
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 9 16:04:18 2019 -0800
build: setup toplevel directory for libide static libs
This also sets up the gnome-builder main() hook to get things started
using the new libide APIs.
src/{libide/libide-1.0.deps => libide.deps} | 5 +-
src/libide/Ide-1.0.metadata | 2 -
src/libide/libide.gresource.xml | 143 -------------
src/libide/meson.build | 300 ++--------------------------
src/libide/object-modules.h | 42 ----
src/main.c | 95 +++++----
src/meson.build | 123 ++++++++++--
7 files changed, 185 insertions(+), 525 deletions(-)
---
diff --git a/src/libide/libide-1.0.deps b/src/libide.deps
similarity index 91%
rename from src/libide/libide-1.0.deps
rename to src/libide.deps
index 06925de6a..cdbe37f99 100644
--- a/src/libide/libide-1.0.deps
+++ b/src/libide.deps
@@ -1,7 +1,8 @@
gio-2.0
gtk+-3.0
gtksourceview-4
-libpeas-1.0
-template-glib-1.0
json-glib-1.0
libdazzle-1.0
+libpeas-1.0
+template-glib-1.0
+vte-2.91
diff --git a/src/libide/meson.build b/src/libide/meson.build
index 249623891..3412c50c9 100644
--- a/src/libide/meson.build
+++ b/src/libide/meson.build
@@ -1,167 +1,26 @@
-libide_header_dir = join_paths(get_option('includedir'), 'gnome-builder', 'libide')
-libide_header_subdir = join_paths('gnome-builder', 'libide')
+libide_header_subdir = join_paths('gnome-builder-@0@.@1@'.format(MAJOR_VERSION, MINOR_VERSION), 'libide')
+libide_header_dir = join_paths(get_option('includedir'), libide_header_subdir)
+libide_include_directories = []
-libide_enum_headers = []
-libide_generated_headers = []
-libide_public_headers = []
-libide_public_sources = []
-libide_private_sources = []
-
-version_data = configuration_data()
-version_data.set('MAJOR_VERSION', MAJOR_VERSION)
-version_data.set('MINOR_VERSION', MINOR_VERSION)
-version_data.set('MICRO_VERSION', MICRO_VERSION)
-version_data.set('VERSION', meson.project_version())
-version_data.set_quoted('BUILD_CHANNEL', get_option('with_channel'))
-version_data.set_quoted('BUILD_TYPE', get_option('buildtype'))
-
-libide_version_h = configure_file(
- input: 'ide-version.h.in',
- output: 'ide-version.h',
- install_dir: libide_header_dir,
- install: true,
- configuration: version_data)
-libide_generated_headers += [libide_version_h]
-
-libide_build_ident_h = vcs_tag(
- fallback: meson.project_version(),
- input: 'ide-build-ident.h.in',
- output: 'ide-build-ident.h',
-)
-libide_generated_headers += [libide_build_ident_h]
-
-libide_public_headers += [
- 'ide.h',
- 'ide-context.h',
- 'ide-global.h',
- 'ide-object.h',
- 'ide-pausable.h',
- 'ide-service.h',
- 'ide-types.h',
- 'ide-version-macros.h',
-]
-
-libide_public_sources += [
- 'ide.c',
- 'ide-context.c',
- 'ide-object.c',
- 'ide-pausable.c',
- 'ide-service.c',
-]
-
-subdir('application')
-subdir('buildconfig')
-subdir('buildui')
-subdir('buildsystem')
-subdir('buffers')
-subdir('completion')
-subdir('config')
-subdir('debugger')
-subdir('devices')
-subdir('diagnostics')
-subdir('doap')
-subdir('directory')
-subdir('editor')
-subdir('files')
-subdir('formatting')
-subdir('genesis')
-subdir('greeter')
-subdir('gsettings')
-subdir('highlighting')
-subdir('hover')
-subdir('keybindings')
-subdir('langserv')
-subdir('layout')
-subdir('local')
-subdir('logging')
-subdir('modelines')
+subdir('core')
subdir('plugins')
-subdir('preferences')
+subdir('threading')
+subdir('io')
+subdir('code')
+subdir('vcs')
subdir('projects')
-subdir('rename')
-subdir('runner')
-subdir('runtimes')
subdir('search')
-subdir('session')
-subdir('snippets')
-subdir('sourceview')
-subdir('storage')
-subdir('subprocess')
-subdir('symbols')
-subdir('template')
+subdir('foundry')
+subdir('debugger')
+subdir('themes')
+subdir('gui')
subdir('terminal')
-subdir('testing')
-subdir('threading')
-subdir('toolchain')
-subdir('transfers')
-subdir('util')
-subdir('vcs')
-subdir('workbench')
-subdir('workers')
-
-libide_enums = gnome.mkenums('ide-enums',
- h_template: 'ide-enums.h.in',
- c_template: 'ide-enums.c.in',
- sources: libide_enum_headers,
- install_header: true,
- install_dir: libide_header_dir,
-)
-libide_public_sources += [libide_enums[0]]
-libide_generated_headers += [libide_enums[1]]
-
-libide_conf = configuration_data()
-libide_conf.set10('ENABLE_TRACING', get_option('enable_tracing'))
-libide_conf.set('BUGREPORT_URL', 'https://gitlab.gnome.org/GNOME/gnome-builder/issues')
-libide_debug_h = configure_file(
- input: 'ide-debug.h.in',
- output: 'ide-debug.h',
- configuration: libide_conf,
- install: true,
- install_dir: libide_header_dir,
-)
-libide_generated_headers += [libide_debug_h]
-
-install_headers([
- 'ide.h',
- 'ide-context.h',
- 'ide-global.h',
- 'ide-object.h',
- 'ide-pausable.h',
- 'ide-service.h',
- 'ide-types.h',
- 'ide-version-macros.h',
-], subdir: libide_header_subdir)
-
-libide_resources = gnome.compile_resources('ide-resources',
- 'libide.gresource.xml',
- c_name: 'ide',
-)
-libide_generated_headers += [libide_resources[1]]
-
-libide_icons_resources = gnome.compile_resources('ide-icons-resources',
- join_paths(meson.source_root(), 'data/icons/hicolor/icons.gresource.xml'),
- source_dir: join_paths(meson.source_root(), 'data/icons/hicolor'),
- c_name: 'ide_icons',
-)
-libide_generated_headers += [libide_icons_resources[1]]
-
-libide_sources = ['gconstructor.h']
-libide_sources += libide_private_sources
-libide_sources += libide_generated_headers
-libide_sources += libide_public_sources
-
-contrib_dir = join_paths(meson.source_root(), 'contrib/')
-
-if get_option('with_webkit')
- libide_sources += ['webkit/ide-webkit.c']
-endif
-
-if get_option('with_editorconfig')
- libide_sources += [
- 'editorconfig/editorconfig-glib.c',
- 'editorconfig/ide-editorconfig-file-settings.c',
- ]
-endif
+subdir('sourceview')
+subdir('lsp')
+subdir('editor')
+subdir('greeter')
+subdir('webkit')
+subdir('tree')
# We want to find the subdirectory to install our override into:
python_libprefix = get_option('python_libprefix')
@@ -187,11 +46,14 @@ except ImportError:
if overridedir.startswith(libdir):
overridedir = overridedir[len(libdir) + 1:]
+elif overridedir.startswith('@0@'):
+ # Do nothing if its in our same prefix
+ pass
else:
overridedir = overridedir[len('/usr/lib') + 1:]
print(overridedir)
-'''
+'''.format(get_option('prefix'))
ret = run_command([python3, '-c', get_overridedir])
if ret.returncode() != 0
@@ -202,121 +64,3 @@ endif
endif
install_data('Ide.py', install_dir: pygobject_override_dir)
-
-libide_deps = [
- libdazzle_dep,
- libgio_dep,
- libgiounix_dep,
- libgtk_dep,
- libgtksource_dep,
- libjson_glib_dep,
- libjsonrpc_glib_dep,
- libm_dep,
- libpangoft2_dep,
- libpeas_dep,
- libtemplate_glib_dep,
- libvte_dep,
- libxml2_dep,
-]
-
-if get_option('with_webkit')
- libide_deps += [dependency('webkit2gtk-4.0', version: '>=2.12.0')]
-endif
-
-if get_option('with_editorconfig')
- libide_args += '-DENABLE_EDITORCONFIG'
- libide_deps += libeditorconfig_dep
-endif
-
-# Limit visibility to public API
-libide_args += hidden_visibility_args
-
-libide = shared_library('ide-' + libide_api_version,
- libide_resources + libide_icons_resources + libide_sources,
- dependencies: libide_deps,
- c_args: libide_args + release_args,
- install: true,
- install_dir: pkglibdir_abs,
- install_rpath: pkglibdir_abs,
-)
-
-libide_dep = declare_dependency(
- sources: libide_generated_headers,
- dependencies: [ libdazzle_dep,
- libgio_dep,
- libgtk_dep,
- libgtksource_dep,
- libpeas_dep,
- libjson_glib_dep,
- libtemplate_glib_dep,
- libjsonrpc_glib_dep,
- libvte_dep ],
- link_with: libide,
- include_directories: include_directories('.'),
-)
-
-# Doesn't link to libide
-# TODO: I think we can remove most of the links here and just setup includes
-libide_plugin_dep = declare_dependency(
- sources: libide_generated_headers,
- include_directories: include_directories('.'),
- dependencies: [ libdazzle_dep,
- libgio_dep,
- libgtk_dep,
- libgtksource_dep,
- libtemplate_glib_dep,
- libjson_glib_dep,
- libjsonrpc_glib_dep,
- libvte_dep ],
-)
-
-pkgg = import('pkgconfig')
-
-pkgg.generate(
- libraries: [libide],
- subdirs: [ 'gnome-builder/libide' ],
- version: meson.project_version(),
- name: 'Libide',
- filebase: 'libide-1.0',
- description: 'Libide contains the components used to build the GNOME Builder IDE.',
- requires: [ 'gtk+-3.0', 'gtksourceview-4', 'libdazzle-1.0', 'template-glib-1.0', 'jsonrpc-glib-1.0',
'libpeas-1.0', 'vte-2.91' ],
- install_dir: join_paths(pkglibdir, 'pkgconfig'),
-)
-
-libide_gir = gnome.generate_gir(libide,
- sources: libide_generated_headers + libide_public_headers + libide_public_sources,
- nsversion: libide_api_version,
- namespace: 'Ide',
- symbol_prefix: 'ide',
- identifier_prefix: 'Ide',
- includes: [ 'Gio-2.0', 'GtkSource-4', 'Peas-1.0', 'Dazzle-1.0', 'Json-1.0', 'Template-1.0',
'Vte-2.91' ],
- install: true,
- install_dir_gir: pkggirdir,
- install_dir_typelib: pkgtypelibdir,
- extra_args: [ '--c-include=ide.h', '--pkg-export=libide-1.0' ]
-)
-
-if get_option('with_vapi')
-
-configure_file(
- input: 'libide-' + libide_api_version + '.deps',
- output: 'libide-' + libide_api_version + '.deps',
- copy: true,
- install: true,
- install_dir: pkgvapidir,
-)
-
-libide_vapi = gnome.generate_vapi('libide-' + libide_api_version,
- sources: libide_gir[0],
- install: true,
- install_dir: pkgvapidir,
- packages: [ 'gio-2.0',
- 'gtk+-3.0',
- 'gtksourceview-4',
- 'json-glib-1.0',
- 'libdazzle-1.0',
- 'libpeas-1.0',
- 'template-glib-1.0' ],
-)
-
-endif
diff --git a/src/main.c b/src/main.c
index adc115a52..ade1bf4c4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * Copyright 2014-2019 Christian Hergert <christian hergert me>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
* 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
@@ -18,19 +18,25 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "builder"
+#define G_LOG_DOMAIN "main"
-#include <ide.h>
+#include "config.h"
+
+#include <girepository.h>
#include <glib/gi18n.h>
-#include <gtksourceview/gtksource.h>
-#include <stdlib.h>
+#include <libide-core.h>
+#include <libide-code.h>
+#include <libide-editor.h>
+#include <libide-greeter.h>
+#include <libide-gui.h>
+#include <libide-threading.h>
-#include "plugins/gnome-builder-plugins.h"
+#include "ide-application-private.h"
+#include "ide-thread-private.h"
+#include "ide-terminal-private.h"
#include "bug-buddy.h"
-static IdeApplicationMode early_mode;
-
static gboolean
verbose_cb (const gchar *option_name,
const gchar *value,
@@ -42,35 +48,44 @@ verbose_cb (const gchar *option_name,
}
static void
-early_params_check (gint *argc,
- gchar ***argv)
+early_params_check (gint *argc,
+ gchar ***argv,
+ gboolean *standalone,
+ gchar **type,
+ gchar **plugin,
+ gchar **dbus_address)
{
- g_autofree gchar *type = NULL;
g_autoptr(GOptionContext) context = NULL;
+ g_autoptr(GOptionGroup) gir_group = NULL;
GOptionEntry entries[] = {
+ { "standalone", 's', 0, G_OPTION_ARG_NONE, standalone, N_("Run a new instance of Builder") },
{ "verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, verbose_cb },
- { "type", 0, 0, G_OPTION_ARG_STRING, &type },
+ { "plugin", 0, 0, G_OPTION_ARG_STRING, plugin },
+ { "type", 0, 0, G_OPTION_ARG_STRING, type },
+ { "dbus-address", 0, 0, G_OPTION_ARG_STRING, dbus_address },
{ NULL }
};
+ gir_group = g_irepository_get_option_group ();
+
context = g_option_context_new (NULL);
g_option_context_set_ignore_unknown_options (context, TRUE);
g_option_context_set_help_enabled (context, FALSE);
g_option_context_add_main_entries (context, entries, NULL);
+ g_option_context_add_group (context, gir_group);
g_option_context_parse (context, argc, argv, NULL);
-
- if (g_strcmp0 (type, "worker") == 0)
- early_mode = IDE_APPLICATION_MODE_WORKER;
- else if (g_strcmp0 (type, "cli") == 0)
- early_mode = IDE_APPLICATION_MODE_TOOL;
}
-int
-main (int argc,
- char *argv[])
+gint
+main (gint argc,
+ gchar *argv[])
{
+ g_autofree gchar *plugin = NULL;
+ g_autofree gchar *type = NULL;
+ g_autofree gchar *dbus_address = NULL;
IdeApplication *app;
const gchar *desktop;
+ gboolean standalone = FALSE;
int ret;
/* Setup our gdb fork()/exec() helper */
@@ -79,15 +94,16 @@ main (int argc,
/* Always ignore SIGPIPE */
signal (SIGPIPE, SIG_IGN);
- /*
- * We require a desktop session that provides a properly working
- * DBus environment. Bail if for some reason that is not the case.
- */
- if (g_getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
- {
- g_printerr (_("GNOME Builder requires a desktop session with D-Bus. Please set
DBUS_SESSION_BUS_ADDRESS."));
- return EXIT_FAILURE;
- }
+ /* Setup various application name/id defaults. */
+ g_set_prgname (ide_get_program_name ());
+ g_set_application_name (_("Builder"));
+
+#if 0
+ /* TODO: allow support for parallel nightly install */
+#ifdef DEVELOPMENT_BUILD
+ ide_set_application_id ("org.gnome.Builder-Devel");
+#endif
+#endif
/* Early init of logging so that we get messages in a consistent
* format. If we deferred this to GApplication, we'd get them in
@@ -95,8 +111,8 @@ main (int argc,
*/
ide_log_init (TRUE, NULL);
- /* Extract options like -vvvv and --type=worker only */
- early_params_check (&argc, &argv);
+ /* Extract options like -vvvv */
+ early_params_check (&argc, &argv, &standalone, &type, &plugin, &dbus_address);
/* Log what desktop is being used to simplify tracking down
* quirks in the future.
@@ -111,25 +127,22 @@ main (int argc,
gtk_get_minor_version (),
gtk_get_micro_version ());
- /* Setup the application instance */
- app = ide_application_new (early_mode);
+ /* Initialize thread pools */
+ _ide_thread_pool_init (FALSE);
- /* Ensure that our static plugins init routine is called.
- * This is necessary to ensure that -Wl,--as-needed does not
- * drop our link to this shared library.
- */
- gnome_builder_plugins_init ();
+ /* Guess the user shell early */
+ _ide_guess_shell ();
- /* Block until the application exits */
+ app = _ide_application_new (standalone, type, plugin, dbus_address);
+ g_application_add_option_group (G_APPLICATION (app), g_irepository_get_option_group ());
ret = g_application_run (G_APPLICATION (app), argc, argv);
-
/* Force disposal of the application (to help catch cleanup
* issues at shutdown) and then (hopefully) finalize the app.
*/
g_object_run_dispose (G_OBJECT (app));
g_clear_object (&app);
- /* Cleanup logging and flush anything that still needs it */
+ /* Flush any outstanding logs */
ide_log_shutdown ();
return ret;
diff --git a/src/meson.build b/src/meson.build
index 6be920151..2f2f758b7 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,26 +1,52 @@
-exe_link_args = [ '-pie' ]
+# These are updated by subdir() meson.build files so that we
+# can generate gir files and what not appropriate for the
+# final binary (which statically links their .a libraries)
+gnome_builder_include_subdirs = []
+gnome_builder_public_sources = []
+gnome_builder_public_headers = []
+gnome_builder_private_sources = []
+gnome_builder_private_headers = []
+gnome_builder_generated_sources = []
+gnome_builder_generated_headers = []
+gnome_builder_gir_extra_args = ['--pkg-export=gnome-builder-1.0']
+# To allow all resources to be initialized with static constructors
+# inside the final executable, we delay compiling them until the
+# final binary (otherwise they are silenty dropped when linking).
+
+exe_link_args = [ '-pie', '-export-dynamic' ]
exe_c_args = [ '-fPIE' ]
-subdir('libeditorconfig')
subdir('gstyle')
subdir('libide')
-subdir('plugins')
subdir('tests')
+subdir('plugins')
-gnome_builder_sources = [
- 'main.c',
- 'bug-buddy.c',
- 'bug-buddy.h',
-]
+gnome_builder_deps = [
+ libgio_dep,
+ libgiounix_dep,
+ libdazzle_dep,
+ libgtk_dep,
-executable('gnome-builder', gnome_builder_sources,
- gui_app: true,
- install: true,
- c_args: exe_c_args + release_args,
- link_args: exe_link_args,
- install_rpath: pkglibdir_abs,
- dependencies: gnome_builder_plugins_deps + [libide_dep, gnome_builder_plugins_dep],
-)
+ libide_code_dep,
+ libide_core_dep,
+ libide_debugger_dep,
+ libide_editor_dep,
+ libide_foundry_dep,
+ libide_greeter_dep,
+ libide_gui_dep,
+ libide_io_dep,
+ libide_lsp_dep,
+ libide_plugins_dep,
+ libide_projects_dep,
+ libide_search_dep,
+ libide_sourceview_dep,
+ libide_terminal_dep,
+ libide_themes_dep,
+ libide_threading_dep,
+ libide_vcs_dep,
+ libide_webkit_dep,
+ libide_tree_dep,
+]
if get_option('fusermount_wrapper')
@@ -31,7 +57,70 @@ if get_option('fusermount_wrapper')
c_args: exe_c_args + release_args,
link_args: exe_link_args,
install_rpath: pkglibdir_abs,
- dependencies: [libide_deps, libide_dep],
+ dependencies: [libide_core_deps, libide_io_dep, libide_threading_dep],
)
endif
+
+gnome_builder = executable('gnome-builder', 'main.c', 'bug-buddy.c',
+ gui_app: true,
+ install: true,
+ c_args: libide_args + exe_c_args + release_args,
+ link_args: exe_link_args,
+ link_whole: plugins,
+ install_rpath: pkglibdir_abs,
+ dependencies: gnome_builder_deps,
+)
+
+# We use requires: instead of libraries: so that our link args of
+# things like -Wl,--require-defined= do not leak into the .pc file.
+pkgconfig.generate(
+ subdirs: gnome_builder_include_subdirs,
+ version: meson.project_version(),
+ name: 'gnome-builder-@0@.@1@'.format(MAJOR_VERSION, MINOR_VERSION),
+ filebase: 'gnome-builder-@0@.@1@'.format(MAJOR_VERSION, MINOR_VERSION),
+ description: 'Contains the plugin container for Builder.',
+ install_dir: join_paths(pkglibdir, 'pkgconfig'),
+ requires: [ 'gio-2.0', 'gio-unix-2.0', 'gtk+-3.0', 'libdazzle-1.0' ],
+)
+
+libide_gir = gnome.generate_gir(gnome_builder,
+ sources: gnome_builder_generated_headers +
+ gnome_builder_generated_sources +
+ gnome_builder_public_headers +
+ gnome_builder_public_sources,
+ nsversion: libide_api_version,
+ namespace: 'Ide',
+ symbol_prefix: 'ide',
+ identifier_prefix: 'Ide',
+ includes: [ 'Gio-2.0', 'Gtk-3.0', 'Dazzle-1.0', 'Peas-1.0', 'Vte-2.91', 'GtkSource-4',
'Template-1.0' ],
+ install: true,
+ install_dir_gir: pkggirdir,
+ install_dir_typelib: pkgtypelibdir,
+ extra_args: gnome_builder_gir_extra_args,
+)
+
+configure_file(
+ input: 'libide.deps',
+ output: 'libide-' + libide_api_version + '.deps',
+ copy: true,
+ install: true,
+ install_dir: pkgvapidir,
+)
+
+libide_vapi = gnome.generate_vapi('libide-' + libide_api_version,
+ sources: libide_gir[0],
+ install: true,
+ install_dir: pkgvapidir,
+ packages: [ 'gio-2.0',
+ 'gtk+-3.0',
+ 'gtksourceview-4',
+ 'json-glib-1.0',
+ 'libdazzle-1.0',
+ 'libpeas-1.0',
+ 'template-glib-1.0',
+ 'vte-2.91' ],
+)
+
+# Must be after vapi generation
+subdir('plugins/vala-pack')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]