[template-glib: 1/2] Clean up Meson a bit
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [template-glib: 1/2] Clean up Meson a bit
- Date: Fri, 6 May 2022 21:18:19 +0000 (UTC)
commit ca5383f17ffad02e93026a19103d888c29fe1855
Author: Tristan Partin <tristan partin io>
Date: Thu May 5 22:32:53 2022 -0500
Clean up Meson a bit
This is a little bit of a cleanup around the build. Makes the build a
little bit more modern.
CONTRIBUTING.md | 1 -
doc/meson.build | 3 +--
doc/xml/meson.build | 5 ++---
meson.build | 15 +++++++++++----
meson_options.txt | 12 ++++++------
src/meson.build | 13 +++++++------
tests/meson.build | 2 +-
7 files changed, 28 insertions(+), 23 deletions(-)
---
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9783e80..230167d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -10,4 +10,3 @@ Email, github, bugzilla (in gnome-builder project), etc.
We follow the GLib and Gtk+ coding style, which is roughly GNU C89.
Please don't use the new g_auto() and g_autoptr() since we would like
this to work on other platforms without much effort.
-
diff --git a/doc/meson.build b/doc/meson.build
index 6ccf7d6..db72407 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -25,7 +25,7 @@ private_headers = [
'tmpl-util-private.h',
]
-glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+glib_prefix = dependency('glib-2.0').get_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
@@ -51,4 +51,3 @@ gnome.gtkdoc('template-glib',
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
],
install: true)
-
diff --git a/doc/xml/meson.build b/doc/xml/meson.build
index 0ab9a0a..9317f0e 100644
--- a/doc/xml/meson.build
+++ b/doc/xml/meson.build
@@ -1,11 +1,10 @@
ent_conf = configuration_data()
ent_conf.set('PACKAGE', 'Template-GLib')
-ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=template-glib')
+ent_conf.set('PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/template-glib/-/issues')
ent_conf.set('PACKAGE_NAME', 'Template-GLib')
ent_conf.set('PACKAGE_STRING', 'template-glib')
ent_conf.set('PACKAGE_TARNAME', 'template-glib-' + meson.project_version())
-ent_conf.set('PACKAGE_URL', 'http://wiki.gnome.org/Apps/Builder')
+ent_conf.set('PACKAGE_URL', 'https://gitlab.gnome.org/GNOME/template-glib')
ent_conf.set('PACKAGE_VERSION', meson.project_version())
ent_conf.set('PACKAGE_API_VERSION', apiversion)
configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
-
diff --git a/meson.build b/meson.build
index cc92f42..4d485b3 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
project('template-glib', 'c',
version: '3.35.0',
license: 'LGPLv2.1+',
- meson_version: '>= 0.50.0',
+ meson_version: '>= 0.51.0',
default_options: [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11' ],
)
@@ -104,7 +104,7 @@ test_c_args = [
if get_option('buildtype') != 'plain'
test_c_args += '-fstack-protector-strong'
endif
-if get_option('enable_profiling')
+if get_option('profiling')
test_c_args += '-pg'
endif
@@ -133,10 +133,17 @@ endif
gnome = import('gnome')
i18n = import('i18n')
+gir = find_program('g-ir-scanner', required: get_option('introspection'))
+generate_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
+generate_vapi = generate_gir and get_option('vapi')
+
subdir('src')
-subdir('tests')
subdir('po')
-if get_option('enable_gtk_doc')
+if get_option('tests')
+ subdir('tests')
+endif
+
+if get_option('gtk_doc')
subdir('doc')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 59bd279..c809d72 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,18 +1,18 @@
-
# Performance and debugging related options
-option('enable_tracing', type: 'boolean', value: false)
-option('enable_profiling', type: 'boolean', value: false)
+option('tracing', type: 'boolean', value: false)
+option('profiling', type: 'boolean', value: false)
# Support for multiple languages
-option('with_introspection', type: 'boolean', value: true)
-option('with_vapi', type: 'boolean', value: true)
+option('introspection', type: 'feature', value: 'auto')
+option('vapi', type: 'boolean', value: true)
# For subproject usage
option('package_subdir', type: 'string',
description: 'Private sub-directory used when built as a subproject'
)
-option('enable_gtk_doc',
+option('gtk_doc',
type: 'boolean', value: false,
description: 'Whether to generate the API reference for Template-GLib')
+option('tests', type: 'boolean', value: true)
diff --git a/src/meson.build b/src/meson.build
index ff11e0a..8b9da7c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -6,7 +6,7 @@ version_data.set('TMPL_MAJOR_VERSION', template_glib_version_major)
version_data.set('TMPL_MINOR_VERSION', template_glib_version_minor)
version_data.set('TMPL_MICRO_VERSION', template_glib_version_micro)
version_data.set('TMPL_VERSION', meson.project_version())
-version_data.set10('ENABLE_TRACING', get_option('enable_tracing'))
+version_data.set10('ENABLE_TRACING', get_option('tracing'))
tmpl_version_h = configure_file(
input: 'tmpl-version.h.in',
@@ -69,7 +69,6 @@ libtemplate_glib_deps = [
cc.find_library('m', required: false),
]
-
flex = find_program('flex')
bison = find_program('bison')
sed = find_program('sed')
@@ -97,7 +96,6 @@ tmpl_expr_scanner = custom_target('tmpl-expr-scanner',
command: [flex, '-o', '@OUTPUT@', '@INPUT@']
)
-
libtemplate_glib_sources = [
libtemplate_glib_generated_headers,
libtemplate_glib_public_headers,
@@ -169,7 +167,7 @@ libtemplate_glib_dep = declare_dependency(
include_directories: include_directories('.'),
)
-if get_option('with_introspection')
+if generate_gir
if girdir == '' or typelibdir == ''
error('You must set pkggirdir and pkgtypelidir when using as a subproject')
endif
@@ -191,7 +189,7 @@ if get_option('with_introspection')
],
)
- if get_option('with_vapi')
+ if get_option('vapi')
if vapidir == ''
error('You must set pkgvapidir when using as a subproject')
endif
@@ -210,6 +208,10 @@ install_headers(libtemplate_glib_public_headers,
install_dir: libtemplate_glib_header_dir
)
+if meson.version().version_compare('>=0.57')
+ meson.override_dependency('template-glib-@0@'.format(apiversion), libtemplate_glib_dep)
+endif
+
pkgg = import('pkgconfig')
pkgg.generate(
@@ -222,4 +224,3 @@ pkgg.generate(
requires: 'gio-2.0',
install_dir: join_paths(libdir, 'pkgconfig'),
)
-
diff --git a/tests/meson.build b/tests/meson.build
index 6db580f..108b652 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -26,5 +26,5 @@ foreach test: testsuite_sources
dependencies: [core_lib_dep],
)
- test(test_name, test_exe, suite: 'Template-GLib', env: test_env)
+ test(test_name, test_exe, env: test_env)
endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]