Commit e2f8a08d authored by Christian Hergert's avatar Christian Hergert

build: add libgnome-builder-plugins for embedding plugins

This creates a new library that contains many plugins inside of it.  The idea
here is that the gnome-builder executable will link against this library
allowing us to drastically reduce the number of files that are checked/loaded
when starting a gnome-builder process.
parent 8d5f31ff
......@@ -229,24 +229,6 @@ subdir('src')
subdir('po')
subdir('doc')
exe_link_args = [ '-pie' ]
exe_c_args = [ '-fPIE' ]
gnome_builder_sources = [
'src/main.c',
'src/bug-buddy.c',
'src/bug-buddy.h',
]
executable('gnome-builder', gnome_builder_sources,
gui_app: true,
install: true,
c_args: exe_c_args,
link_args: exe_link_args,
install_rpath: pkglibdir_abs,
dependencies: libide_deps + [libide_dep],
)
meson.add_install_script('build-aux/meson/post_install.py')
message('\n '.join(status))
......@@ -23,26 +23,27 @@ libeditorconfig_deps = [
# FIXME: Actually test these
libeditorconfig_args = [
'-DHAVE_STRCASECMP',
'-DHAVE_STRICMP',
'-DHAVE_STRDUP',
'-DHAVE_STRNDUP',
'-DUNIX',
'-Deditorconfig_VERSION_MAJOR=0',
'-Deditorconfig_VERSION_MINOR=0',
'-Deditorconfig_VERSION_PATCH=0',
'-Deditorconfig_VERSION_SUFFIX=0',
'-DHAVE_STRCASECMP',
'-DHAVE_STRICMP',
'-DHAVE_STRDUP',
'-DHAVE_STRNDUP',
'-DUNIX',
'-Deditorconfig_VERSION_MAJOR=0',
'-Deditorconfig_VERSION_MINOR=0',
'-Deditorconfig_VERSION_PATCH=0',
'-Deditorconfig_VERSION_SUFFIX=0',
]
libeditorconfig = static_library('editorconfig',
libeditorconfig_sources,
dependencies: libeditorconfig_deps,
c_args: libeditorconfig_args,
pic: true,
c_args: libeditorconfig_args,
pic: true,
)
libeditorconfig_dep = declare_dependency(
link_with: libeditorconfig,
link_with: libeditorconfig,
include_directories: include_directories('.'),
)
endif
libide_header_subdir = join_paths('gnome-builder', 'libide')
libide_api_version = '1.0'
libide_enum_headers = []
libide_generated_headers = []
libide_public_headers = []
......@@ -32,21 +34,6 @@ libide_build_ident_h = vcs_tag(
)
libide_generated_headers += [libide_build_ident_h]
libide_deps = [
libdazzle_dep,
libgd_dep,
libgio_dep,
libgiounix_dep,
libgtk_dep,
libgtksource_dep,
libjson_glib_dep,
libjsonrpc_glib_dep,
libpangoft2_dep,
libpeas_dep,
libtemplate_glib_dep,
libxml2_dep,
]
libide_public_headers += [
'ide.h',
'ide-context.h',
......@@ -164,20 +151,15 @@ contrib_dir = join_paths(meson.source_root(), 'contrib/')
if get_option('with_webkit')
libide_sources += ['webkit/ide-webkit.c']
libide_deps += [dependency('webkit2gtk-4.0', version: '>=2.12.0')]
endif
if get_option('with_editorconfig')
libide_args += '-DENABLE_EDITORCONFIG'
libide_deps += libeditorconfig_dep
libide_sources += [
'editorconfig/editorconfig-glib.c',
'editorconfig/ide-editorconfig-file-settings.c',
]
endif
libide_api_version = '1.0'
# We want to find the subdirectory to install our override into:
python3 = find_program('python3')
......@@ -216,6 +198,30 @@ if ld_supports_version_script
libide_link_args += [ '-Wl,--version-script,' + join_paths(meson.current_source_dir(), 'ide.map') ]
endif
libide_deps = [
libdazzle_dep,
libgd_dep,
libgio_dep,
libgiounix_dep,
libgtk_dep,
libgtksource_dep,
libjson_glib_dep,
libjsonrpc_glib_dep,
libpangoft2_dep,
libpeas_dep,
libtemplate_glib_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
libide = shared_library('ide-' + libide_api_version,
libide_resources + libide_icons_resources + libide_sources,
dependencies: libide_deps,
......
......@@ -25,6 +25,9 @@
#include "bug-buddy.h"
/* Keep in sync with gnome-builder-plugins.c */
extern void gnome_builder_plugins_init (void);
static IdeApplicationMode early_mode;
static gboolean
......@@ -102,11 +105,21 @@ main (int argc,
IdeApplication *app;
int ret;
/* Setup our gdb fork()/exec() helper */
bug_buddy_init ();
/* Early init of logging so that we get messages in a consistent
* format. If we deferred this to GApplication, we'd get them in
* multiple formats.
*/
ide_log_init (TRUE, NULL);
/* Extract options like -vvvv and --type=worker only */
early_params_check (&argc, &argv);
/* We might need to prime SSL environment and other bits before
* the application has had a chance to setup caches/etc.
*/
early_ssl_check ();
g_message ("Initializing with Gtk+ version %d.%d.%d.",
......@@ -129,11 +142,26 @@ main (int argc,
*/
g_type_ensure (G_TYPE_ZLIB_DECOMPRESSOR);
/* Setup the application instance */
app = ide_application_new ();
_ide_application_set_mode (app, early_mode);
/* 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 ();
/* Block until the application exits */
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 */
ide_log_shutdown ();
return ret;
......
......@@ -3,3 +3,21 @@ subdir('gstyle')
subdir('libide')
subdir('plugins')
subdir('tests')
exe_link_args = [ '-pie' ]
exe_c_args = [ '-fPIE' ]
gnome_builder_sources = [
'main.c',
'bug-buddy.c',
'bug-buddy.h',
]
executable('gnome-builder', gnome_builder_sources,
gui_app: true,
install: true,
c_args: exe_c_args,
link_args: exe_link_args,
install_rpath: pkglibdir_abs,
dependencies: gnome_builder_plugins_deps + [libide_dep, gnome_builder_plugins_dep],
)
AC_ARG_ENABLE([autotools-templates],
[AS_HELP_STRING([--enable-autotools-templates=@<:@yes/no@:>@],
[Build with support for creating autotools projects.])],
[enable_autotools_templates=$enableval],
[enable_autotools_templates=yes])
# for if ENABLE_AUTOTOOLS_TEMPLATE_PLUGIN in Makefile.am
AM_CONDITIONAL(ENABLE_AUTOTOOLS_TEMPLATES, [test "x$enable_autotools_templates" = "xyes"])
# Ensure our makefile is generated by autoconf
AC_CONFIG_FILES([plugins/autotools-templates/Makefile])
......@@ -25,7 +25,7 @@
#include "ide-autotools-project-miner.h"
void
peas_register_types (PeasObjectModule *module)
ide_autotools_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module, IDE_TYPE_APPLICATION_ADDIN, IDE_TYPE_AUTOTOOLS_APPLICATION_ADDIN);
peas_object_module_register_extension_type (module, IDE_TYPE_BUILD_PIPELINE_ADDIN, IDE_TYPE_AUTOTOOLS_PIPELINE_ADDIN);
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins">
<file>autotools.plugin</file>
</gresource>
</gresources>
......@@ -5,6 +5,6 @@ Description=Provides integration with the Autotools build system
Authors=Christian Hergert <christian@hergert.me>
Copyright=Copyright © 2015 Christian Hergert
Builtin=true
Hidden=true
Embedded=ide_autotools_register_types
X-Project-File-Filter-Pattern=configure.ac,configure.in
X-Project-File-Filter-Name=Autotools Project (configure.ac)
if get_option('with_autotools')
autotools_resources = gnome.compile_resources(
'ide-autotools-resources',
'autotools.gresource.xml',
c_name: 'ide_autotools',
)
autotools_sources = [
'autotools-plugin.c',
'ide-autotools-application-addin.c',
......@@ -24,26 +30,7 @@ autotools_sources = [
'ide-makecache-target.h',
]
make_exe_name = 'make'
if find_program('gmake', required: false).found()
make_exe_name = 'gmake'
endif
shared_module('autotools-plugin', autotools_sources,
dependencies: plugin_deps,
c_args: ['-DGNU_MAKE_NAME="@0@"'.format(make_exe_name)],
link_args: plugin_link_args,
link_depends: plugin_link_deps,
install: true,
install_dir: plugindir,
)
configure_file(
input: 'autotools.plugin',
output: 'autotools.plugin',
configuration: configuration_data(),
install: true,
install_dir: plugindir,
)
gnome_builder_plugins_sources += files(autotools_sources)
gnome_builder_plugins_sources += autotools_resources[0]
endif
......@@ -6,3 +6,4 @@ Authors=Sébastien Lafargue <slafargue@gnome.org>
Copyright=Copyright © 2016 Sébastien Lafargue
Depends=editor
Builtin=true
Embedded=gb_beautifier_register_types
......@@ -22,7 +22,7 @@
#include "gb-beautifier-editor-addin.h"
void
peas_register_types (PeasObjectModule *module)
gb_beautifier_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
IDE_TYPE_EDITOR_ADDIN,
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins/beautifier_plugin">
<file>beautifier.plugin</file>
<file>gtk/menus.ui</file>
</gresource>
</gresources>
......@@ -7,7 +7,6 @@ beautifier_resources = gnome.compile_resources(
)
beautifier_sources = [
beautifier_resources,
'gb-beautifier-config.c',
'gb-beautifier-config.h',
'gb-beautifier-helper.c',
......@@ -20,24 +19,11 @@ beautifier_sources = [
'gb-beautifier-editor-addin.h',
]
beautifier_datadir = join_paths(get_option('prefix'), plugindatadir, 'beautifier_plugin')
shared_module('beautifier_plugin', beautifier_sources,
dependencies: plugin_deps,
link_args: plugin_link_args,
link_depends: plugin_link_deps,
install: true,
install_dir: plugindir,
)
gnome_builder_plugins_sources += files(beautifier_sources)
gnome_builder_plugins_sources += beautifier_resources[0]
beautifier_datadir = join_paths(get_option('prefix'), plugindatadir, 'beautifier_plugin')
install_subdir('beautifier_plugin/data', install_dir: beautifier_datadir)
install_subdir('beautifier_plugin/internal', install_dir: beautifier_datadir)
configure_file(
input: 'beautifier.plugin',
output: 'beautifier.plugin',
configuration: configuration_data(),
install: true,
install_dir: plugindir,
)
endif
......@@ -25,7 +25,7 @@ void _ide_c_indenter_register_type (GTypeModule *module);
void _ide_c_format_provider_register_type (GTypeModule *module);
void
peas_register_types (PeasObjectModule *module)
ide_c_pack_register_types (PeasObjectModule *module)
{
_ide_c_indenter_register_type (G_TYPE_MODULE (module));
_ide_c_format_provider_register_type (G_TYPE_MODULE (module));
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins">
<file>c-pack.plugin</file>
</gresource>
</gresources>
......@@ -9,3 +9,4 @@ X-Indenter-Languages=c,chdr
X-Indenter-Languages-Priority=0
X-Completion-Provider-Languages=c,chdr
X-Completion-Provider-Languages-Priority=0
Embedded=ide_c_pack_register_types
if get_option('with_c_pack')
c_pack_resources = gnome.compile_resources(
'c-pack-resources',
'c-pack.gresource.xml',
c_name: 'ide_c',
)
c_pack_sources = [
'c-pack-plugin.c',
'c-parse-helper.c',
......@@ -10,20 +16,7 @@ c_pack_sources = [
'ide-c-format-provider.h',
]
shared_module('c-pack-plugin', c_pack_sources,
dependencies: plugin_deps,
link_args: plugin_link_args,
link_depends: plugin_link_deps,
install: true,
install_dir: plugindir,
)
configure_file(
input: 'c-pack.plugin',
output: 'c-pack.plugin',
configuration: configuration_data(),
install: true,
install_dir: plugindir,
)
gnome_builder_plugins_sources += files(c_pack_sources)
gnome_builder_plugins_sources += c_pack_resources[0]
endif
......@@ -33,7 +33,7 @@
#include "ide-clang-translation-unit.h"
void
peas_register_types (PeasObjectModule *module)
ide_clang_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
IDE_TYPE_CODE_INDEXER,
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins">
<file>clang.plugin</file>
</gresource>
</gresources>
......@@ -5,6 +5,7 @@ Description=Provides integration with Clang
Authors=Christian Hergert <christian@hergert.me>
Copyright=Copyright © 2015 Christian Hergert
Builtin=true
Embedded=ide_clang_register_types
X-Completion-Provider-Languages=c,chdr,cpp,cpphdr
X-Highlighter-Languages=c,chdr,cpp
X-Highlighter-Languages-Priority=100
......
if get_option('with_clang')
clang_resources = gnome.compile_resources(
'ide-clang-resources',
'clang.gresource.xml',
c_name: 'ide_clang',
)
clang_sources = [
'ide-clang-code-index-entries.c',
'ide-clang-code-index-entries.h',
......@@ -58,24 +64,12 @@ if not cc.has_header('clang-c/Index.h', args: '-I' + clang_include)
endif
clang_dep = declare_dependency(
dependencies: cc.find_library('libclang', dirs: clang_libdir),
dependencies: cc.find_library('libclang', dirs: clang_libdir),
include_directories: include_directories(clang_include),
)
shared_module('clang-plugin', clang_sources,
dependencies: plugin_deps + [clang_dep],
link_args: plugin_link_args,
link_depends: plugin_link_deps,
install: true,
install_dir: plugindir,
)
configure_file(
input: 'clang.plugin',
output: 'clang.plugin',
configuration: configuration_data(),
install: true,
install_dir: plugindir,
)
gnome_builder_plugins_deps += [clang_dep]
gnome_builder_plugins_sources += files(clang_sources)
gnome_builder_plugins_sources += clang_resources[0]
endif
......@@ -24,7 +24,7 @@
#include "ide-code-index-symbol-resolver.h"
void
peas_register_types (PeasObjectModule *module)
ide_code_index_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
IDE_TYPE_SERVICE,
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins">
<file>code-index.plugin</file>
</gresource>
</gresources>
......@@ -5,5 +5,6 @@ Description=Manages Code Index and does Global Search and Jump to Definition usi
Authors=Anoop Chandu <anoopchandu96@gmail.com>
Copyright=Copyright © 2017 Anoop Chandu
Builtin=true
Embedded=ide_code_index_register_types
X-Symbol-Resolver-Languages=c,chdr,cpp
X-Symbol-Resolver-Languages-Priority=200
if get_option('with_code_index')
code_index_resources = gnome.compile_resources(
'ide-code-index-resources',
'code-index.gresource.xml',
c_name: 'ide_code_index',
)
code_index_sources = [
'code-index-plugin.c',
'ide-code-index-builder.c',
......@@ -20,20 +26,7 @@ code_index_sources = [
'ide-persistent-map.h',
]
shared_module('code-index-plugin', code_index_sources,
dependencies: plugin_deps,
link_args: plugin_link_args,
link_depends: plugin_link_deps,
install: true,
install_dir: plugindir,
)
configure_file(
input: 'code-index.plugin',
output: 'code-index.plugin',
configuration: configuration_data(),
install: true,
install_dir: plugindir,
)
gnome_builder_plugins_sources += files(code_index_sources)
gnome_builder_plugins_sources += code_index_resources[0]
endif
......@@ -6,3 +6,4 @@ Authors=Sébastien Lafargue <slafargue@gnome.org>
Copyright=Copyright © 2016 Sébastien Lafargue
Depends=editor
Builtin=true
Embedded=gb_color_picker_register_types
......@@ -23,7 +23,7 @@
#include "gb-color-picker-editor-view-addin.h"
void
peas_register_types (PeasObjectModule *module)
gb_color_picker_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
IDE_TYPE_EDITOR_ADDIN,
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins">
<file>color-picker.plugin</file>
</gresource>
<gresource prefix="/org/gnome/builder/plugins/color-picker-plugin">
<file>themes/Adwaita.css</file>
<file>themes/Adwaita-dark.css</file>
......
......@@ -25,32 +25,14 @@ color_picker_sources = [
'gb-color-picker-prefs-palette-row.c',
'gb-color-picker-prefs-palette-row.h',
'gb-color-picker-private.h',
color_picker_resources[0],
]
color_picker_deps = plugin_deps + [
libgstyle_dep,
]
shared_module('color-picker-plugin', color_picker_sources,
dependencies: color_picker_deps,
link_args: plugin_link_args,
link_depends: plugin_link_deps,
install: true,
install_dir: plugindir,
install_rpath: pkglibdir_abs,
)
gnome_builder_plugins_deps += [libgstyle_dep]
gnome_builder_plugins_sources += files(color_picker_sources)
gnome_builder_plugins_sources += color_picker_resources[0]
install_data('gsettings/org.gnome.builder.plugins.color_picker_plugin.gschema.xml',
install_dir: schema_dir,
)
configure_file(
input: 'color-picker.plugin',
output: 'color-picker.plugin',
configuration: configuration_data(),
install: true,
install_dir: plugindir,
)
endif