Commit b3c883e2 authored by Patrick Griffis's avatar Patrick Griffis 💬 Committed by Christian Hergert
Browse files

build: Add support for Meson

This adds support for the Meson build system for Builder. Autotools is still
our default build system for 3.24, but we would like distributors to give meson
a try as we intend to switch to meson as the default for 3.26.
parent 727d431c
......@@ -45,4 +45,7 @@ indent_style = space
[*.json]
indent_size = 4
tab_size = 4
[meson.build]
indent_size = 2
indent_style = space
#!/usr/bin/env python3
import os
import subprocess
prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = os.path.join(prefix, 'share')
# Packaging tools define DESTDIR and this isn't needed for them
if 'DESTDIR' not in os.environ:
print('Compiling gsettings schemas...')
subprocess.call(['glib-compile-schemas',
os.path.join(datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
subprocess.call(['gtk-update-icon-cache', '-qtf',
os.path.join(datadir, 'icons', 'hicolor')])
print('Updating desktop database...')
subprocess.call(['update-desktop-database', '-q',
os.path.join(datadir, 'applications')])
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#mesondefine ENABLE_NLS
/* GETTEXT package name */
#mesondefine GETTEXT_PACKAGE
/* Define if the GNU gettext() function is already present or preinstalled. */
#mesondefine HAVE_GETTEXT
/* Define to 1 if you have the `sched_getcpu' function. */
#mesondefine HAVE_SCHED_GETCPU
/* Name of package */
#mesondefine PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#mesondefine PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#mesondefine PACKAGE_NAME
/* Define to the full name and version of this package. */
#mesondefine PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#mesondefine PACKAGE_TARNAME
/* Define to the home page for this package. */
#mesondefine PACKAGE_URL
/* Define to the version of this package. */
#mesondefine PACKAGE_VERSION
#mesondefine PACKAGE_DATADIR
#mesondefine PACKAGE_LIBDIR
#mesondefine PACKAGE_LIBEXECDIR
#mesondefine PACKAGE_LOCALE_DIR
/* Version number of package */
#mesondefine VERSION
#mesondefine SRCDIR
#mesondefine BUILDDIR
libegg_headers = [
'egg-animation.h',
'egg-binding-group.h',
'egg-box.h',
'egg-centering-bin.h',
'egg-column-layout.h',
'egg-counter.h',
'egg-date-time.h',
'egg-empty-state.h',
'egg-entry-box.h',
'egg-file-chooser-entry.h',
'egg-frame-source.h',
'egg-heap.h',
'egg-list-box.h',
'egg-menu-manager.h',
'egg-pill-box.h',
'egg-priority-box.h',
'egg-private.h',
'egg-radio-box.h',
'egg-scrolled-window.h',
'egg-search-bar.h',
'egg-settings-flag-action.h',
'egg-settings-sandwich.h',
'egg-signal-group.h',
'egg-simple-label.h',
'egg-simple-popover.h',
'egg-slider.h',
'egg-state-machine-buildable.h',
'egg-state-machine.h',
'egg-task-cache.h',
'egg-three-grid.h',
'egg-widget-action-group.h',
]
install_headers(libegg_headers,
subdir: 'gnome-builder-' + meson.project_version() + '/egg'
)
libegg_resources = gnome.compile_resources('egg-resources', 'egg.gresource.xml',
c_name: 'egg',
)
libegg_sources = [
'egg-animation.c',
'egg-binding-group.c',
'egg-box.c',
'egg-centering-bin.c',
'egg-column-layout.c',
'egg-counter.c',
'egg-date-time.c',
'egg-empty-state.c',
'egg-entry-box.c',
'egg-file-chooser-entry.c',
'egg-frame-source.c',
'egg-heap.c',
'egg-list-box.c',
'egg-menu-manager.c',
'egg-pill-box.c',
'egg-priority-box.c',
'egg-radio-box.c',
'egg-scrolled-window.c',
'egg-search-bar.c',
'egg-settings-flag-action.c',
'egg-settings-sandwich.c',
'egg-signal-group.c',
'egg-simple-label.c',
'egg-simple-popover.c',
'egg-slider.c',
'egg-state-machine-buildable.c',
'egg-state-machine.c',
'egg-task-cache.c',
'egg-three-grid.c',
'egg-widget-action-group.c',
]
libegg_deps = [
libgio_dep,
libgtk_dep,
libm_dep,
dependency('gmodule-2.0'),
]
libegg_args = []
if get_option('enable_rdtscp')
libegg_args += '-DEGG_HAVE_RDTSCP'
endif
shm_dep = cc.find_library('rt', required: false)
libegg = shared_library('egg-private', libegg_sources + [libegg_resources[0], libegg_resources[1]],
dependencies: libegg_deps + [shm_dep],
c_args: libegg_args,
version: '0.0.0',
install: true,
install_dir: pkglibdir,
)
libegg_dep = declare_dependency(
link_with: libegg,
dependencies: libegg_deps,
include_directories: include_directories('.'),
)
if get_option('with_introspection')
libegg_gir = gnome.generate_gir(libegg,
sources: libegg_sources + libegg_headers,
nsversion: '1.0',
namespace: 'Egg',
symbol_prefix: 'egg',
identifier_prefix: 'Egg',
includes: ['Gdk-3.0', 'Gio-2.0', 'Gtk-3.0'],
install: true,
install_dir_gir: pkggirdir,
install_dir_typelib: pkgtypelibdir,
extra_args: [
'--c-include=egg-private.h',
]
)
if get_option('with_vapi')
libegg_vapi = gnome.generate_vapi('egg-private',
sources: libegg_gir[0],
packages: ['gio-2.0', 'gtk+-3.0'],
install: true,
install_dir: pkgvapidir,
)
endif
endif
libgd_resources = gnome.compile_resources('gd-resources',
'gd-tagged-entry.gresource.xml',
c_name: 'gd',
)
libgd_sources = [
'gd-tagged-entry.c',
libgd_resources,
]
libgd_deps = [
libgio_dep,
libgtk_dep,
]
libgd = static_library('gd', libgd_sources,
dependencies: libgd_deps,
pic: true,
)
libgd_dep = declare_dependency(
link_with: libgd,
include_directories: include_directories('.'),
)
{
global:
gstyle_*;
local:
*;
};
libgstyle_headers = [
'gstyle-animation.h',
'gstyle-cielab.h',
'gstyle-color.h',
'gstyle-color-component.h',
'gstyle-color-convert.h',
'gstyle-color-filter.h',
'gstyle-color-item.h',
'gstyle-color-panel.h',
'gstyle-color-panel-private.h',
'gstyle-color-panel-actions.h',
'gstyle-color-plane.h',
'gstyle-color-predefined.h',
'gstyle-color-scale.h',
'gstyle-color-widget.h',
'gstyle-color-widget-actions.h',
'gstyle-colorlexer.h',
'gstyle-css-provider.h',
'gstyle-eyedropper.h',
'gstyle-hsv.h',
'gstyle-palette.h',
'gstyle-palette-widget.h',
'gstyle-private.h',
'gstyle-rename-popover.h',
'gstyle-revealer.h',
'gstyle-slidein.h',
'gstyle-types.h',
'gstyle-utils.h',
'gstyle-xyz.h',
]
libgstyle_header_dir = join_paths(get_option('includedir'),
'gnome-builder-' + meson.project_version(), 'gstyle')
install_headers(libgstyle_headers,
install_dir: libgstyle_header_dir,
)
libgstyle_resources = gnome.compile_resources('gstyle-resources',
'gstyle.gresource.xml',
c_name: 'gstyle',
)
libgstyle_sources = [
'gstyle-animation.c',
'gstyle-cielab.c',
'gstyle-color.c',
'gstyle-color-component.c',
'gstyle-color-convert.c',
'gstyle-color-filter.c',
'gstyle-color-item.c',
'gstyle-color-panel.c',
'gstyle-color-panel-actions.c',
'gstyle-color-plane.c',
'gstyle-color-scale.c',
'gstyle-color-widget.c',
'gstyle-color-widget-actions.c',
'gstyle-colorlexer.c',
'gstyle-css-provider.c',
'gstyle-eyedropper.c',
'gstyle-hsv.c',
'gstyle-palette.c',
'gstyle-palette-widget.c',
'gstyle-rename-popover.c',
'gstyle-revealer.c',
'gstyle-slidein.c',
'gstyle-utils.c',
'gstyle-xyz.c',
libgstyle_resources[0],
]
libgstyle_deps = [
libgtk_dep,
libsearch_dep,
libxml_dep,
libm_dep,
]
libgstyle_link_args = '-Wl,--version-script=' + join_paths(meson.current_source_dir(), 'gstyle.map')
libgstyle = shared_library('gstyle-private', libgstyle_sources,
dependencies: libgstyle_deps,
link_args: libgstyle_link_args,
link_depends: 'gstyle.map',
version: '0.0.0',
install: true,
install_dir: pkglibdir,
)
libgstyle_dep = declare_dependency(
link_with: libgstyle,
dependencies: libgstyle_deps,
include_directories: include_directories('.'),
)
if get_option('with_introspection')
libgstyle_introspection_sources = [
'gstyle-cielab.h',
'gstyle-cielab.c',
'gstyle-color.h',
'gstyle-color.c',
'gstyle-color-component.h',
'gstyle-color-component.c',
'gstyle-color-convert.h',
'gstyle-color-convert.c',
'gstyle-color-filter.h',
'gstyle-color-filter.c',
'gstyle-color-item.h',
'gstyle-color-item.c',
'gstyle-color-panel.h',
'gstyle-color-panel.c',
'gstyle-color-plane.h',
'gstyle-color-plane.c',
'gstyle-color-scale.h',
'gstyle-color-scale.c',
'gstyle-color-widget.h',
'gstyle-color-widget.c',
'gstyle-eyedropper.h',
'gstyle-eyedropper.c',
'gstyle-hsv.h',
'gstyle-hsv.c',
'gstyle-palette.h',
'gstyle-palette.c',
'gstyle-palette-widget.h',
'gstyle-palette-widget.c',
'gstyle-slidein.h',
'gstyle-slidein.c',
'gstyle-xyz.h',
'gstyle-xyz.c',
]
libgstyle_gir = gnome.generate_gir(libgstyle,
sources: libgstyle_introspection_sources,
nsversion: '1.0',
namespace: 'Gstyle',
symbol_prefix: 'gstyle',
identifier_prefix: 'Gstyle',
includes: ['Gdk-3.0', 'Gio-2.0', 'Gtk-3.0', 'GtkSource-3.0'],
install: true,
install_dir_gir: pkggirdir,
install_dir_typelib: pkgtypelibdir,
extra_args: [
'--c-include=gstyle-private.h',
],
)
if get_option('with_vapi')
libgstyle_vapi = gnome.generate_vapi('gstyle-private',
sources: libgstyle_gir[0],
packages: ['gio-2.0', 'gtk+-3.0', 'GtkSource-3.0'],
install: true,
install_dir: pkgvapidir,
)
endif
endif
subdir('tests')
......@@ -4,7 +4,7 @@ gstyle_cflags = \
$(DEBUG_CFLAGS) \
$(GSTYLE_CFLAGS) \
-I$(top_srcdir)/contrib/gstyle \
-DTEST_DATA_DIR="\"$(abs_builddir)/data\"" \
-DTEST_DATA_DIR="\"$(abs_srcdir)/data\"" \
$(NULL)
gstyle_libs = \
......
gstyle_test_env = [
'GB_IN_TREE_PLUGINS=1',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'G_DEBUG=gc-friendly',
'GSETTINGS_BACKEND=memory',
'MALLOC_CHECK_=2',
# 'MALLOC_PERTURB_=$((${RANDOM:-256} % 256))',
]
gstyle_test_cflags = [
'-DTEST_DATA_DIR="@0@/data"'.format(meson.current_source_dir()),
]
gstyle_color = executable('test-gstyle-color',
'test-gstyle-color.c',
dependencies: libgstyle_dep,
)
test('test-gstyle-color', gstyle_color,
env: gstyle_test_env
)
gstyle_color_panel = executable('test-gstyle-color-panel',
'test-gstyle-color-panel.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
test('test-gstyle-color-panel', gstyle_color_panel,
env: gstyle_test_env
)
gstyle_color_plane = executable('test-gstyle-color-plane',
'test-gstyle-color-plane.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
#test('test-gstyle-color-plane', gstyle_color_plane,
# env: gstyle_test_env
#)
gstyle_color_scale = executable('test-gstyle-color-scale',
'test-gstyle-color-scale.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
#test('test-gstyle-color-scale', gstyle_color_scale,
# env: gstyle_test_env
#)
gstyle_color_widget = executable('test-gstyle-color-widget',
'test-gstyle-color-widget.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
#test('test-gstyle-color-widget', gstyle_color_widget,
# env: gstyle_test_env
#)
gstyle_filter = executable('test-gstyle-filter',
'test-gstyle-filter.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
#test('test-gstyle-filter', gstyle_filter,
# env: gstyle_test_env
#)
gstyle_palette = executable('test-gstyle-palette',
'test-gstyle-palette.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
test('test-gstyle-palette', gstyle_palette,
env: gstyle_test_env
)
gstyle_palette_widget = executable('test-gstyle-palette-widget',
'test-gstyle-palette-widget.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
test('test-gstyle-color-palette-widget', gstyle_palette_widget,
env: gstyle_test_env
)
gstyle_parse = executable('test-gstyle-color-parse',
'test-gstyle-parse.c',
c_args: gstyle_test_cflags,
dependencies: libgstyle_dep,
)
test('test-gstyle-parse', gstyle_parse,
env: gstyle_test_env
)
libjsonrpc_public_sources = [
'jsonrpc-client.c',
'jsonrpc-client.h',
'jsonrpc-input-stream.c',
'jsonrpc-input-stream.h',
'jsonrpc-output-stream.c',
'jsonrpc-output-stream.h',
'jsonrpc-server.c',
'jsonrpc-server.h',
]
libjsonrpc_api_version = '1.0'
jsonrpc_conf = configuration_data()
# TODO: This is just based on gnome-builders version
jsonrpc_conf.set('VERSION', meson.project_version())
jsonrpc_conf.set('MAJOR_VERSION', MAJOR_VERSION)
jsonrpc_conf.set('MINOR_VERSION', MINOR_VERSION)
jsonrpc_conf.set('MICRO_VERSION', MICRO_VERSION)
configure_file(
input: 'jsonrpc-version.h.in',
output: 'jsonrpc-version.h',
configuration: jsonrpc_conf,
)
libjsonrpc_private_sources = [
'jcon.c',
]
libjsonrpc_deps = [
libjson_glib_dep,
]
libjsonrpc = shared_library('jsonrpc-glib-' + libjsonrpc_api_version,
libjsonrpc_private_sources + libjsonrpc_public_sources,
dependencies: libjsonrpc_deps,
version: '0.0.0',
c_args: ['-DJSONRPC_GLIB_COMPILATION'],
install: true,
install_dir: pkglibdir,
)
libjsonrpc_dep = declare_dependency(
link_with: libjsonrpc,
include_directories: include_directories('.'),
)
if get_option('with_introspection')
libjsonrpc_gir = gnome.generate_gir(libjsonrpc,
sources: libjsonrpc_public_sources,
nsversion: libjsonrpc_api_version,
namespace: 'Jsonrpc',
symbol_prefix: 'jsonrpc',
identifier_prefix: 'Jsonrpc',
includes: ['Gio-2.0', 'Json-1.0'],
install: true,
install_dir_gir: pkggirdir,
install_dir_typelib: pkgtypelibdir,
extra_args: [
'-DTMPL_GLIB_COMPILATION',
'--c-include=jsonrpc-glib.h',
]
)
if get_option('with_vapi')
libjsonrpc_vapi = gnome.generate_vapi('jsonrpc-glib-' + libjsonrpc_api_version,
sources: libjsonrpc_gir[0],
packages: ['gio-2.0', 'json-glib-1.0'],
install: true,
install_dir: pkgvapidir,
)
endif
endif
if get_option('with_editorconfig')
libeditorconfig_sources = [
'ec_glob.c',
'ec_glob.h',
'editorconfig.c',
'editorconfig.h',
'editorconfig/editorconfig.h',
'editorconfig/editorconfig_handle.h',
'editorconfig_handle.c',
'editorconfig_handle.h',
'global.h',
'ini.c',
'ini.h',
'misc.c',
'misc.h',
'utarray.h',
]
libeditorconfig_deps = [
dependency('libpcre')
]
# 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',
]
libeditorconfig = static_library('editorconfig',
libeditorconfig_sources,
dependencies: libeditorconfig_deps,
c_args: libeditorconfig_args,
pic: true,
)
libeditorconfig_dep = declare_dependency(
link_with: libeditorconfig,
include_directories: include_directories('.'),
)
endif
libnautilus_sources = [
'nautilus-floating-bar.c',
]
libnautilus_deps = [