From 335bc779ceb29afa70c1c22c14e5700d09ba7bcf Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 7 Jan 2019 16:36:23 +0100 Subject: [PATCH 1/2] build: Make meson options more idiomatic The vala option is renamed to vapi to make it compatible with recent Meson. --- doc/meson.build | 2 +- meson.build | 12 ++++++------ meson_options.txt | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/meson.build b/doc/meson.build index 6872d8c..00ffb4a 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -7,6 +7,6 @@ subdir('man') -if get_option('enable-gtk-doc') +if get_option('gtk_doc') subdir('grilo') endif diff --git a/meson.build b/meson.build index 7f237c6..295939c 100644 --- a/meson.build +++ b/meson.build @@ -46,27 +46,27 @@ gmodule_dep = dependency('gmodule-2.0', version: glib2_required_info, required: gobject_dep = dependency('gobject-2.0', version: glib2_required_info, required: true) libxml_dep = dependency('libxml-2.0', required: true) -enable_grlnet = get_option('enable-grl-net') +enable_grlnet = get_option('grl_net') if enable_grlnet libsoup_dep = dependency('libsoup-2.4', version: '>= 2.41.3', required: true) endif -enable_grlpls = get_option('enable-grl-pls') +enable_grlpls = get_option('grl_pls') if enable_grlpls totem_plparser_dep = dependency('totem-plparser', version: '>= 3.4.1', required: true) endif -enable_gir = get_option('enable-introspection') or get_option('enable-vala') +enable_gir = get_option('introspection') or get_option('vapi') if enable_gir - find_program('g-ir-scanner', required: true) + find_program('g-ir-scanner', required: true) endif -enable_vala = get_option('enable-vala') +enable_vala = get_option('vapi') if enable_vala vapigen = find_program('vapigen', required: true) endif -enable_testui = get_option('enable-test-ui') +enable_testui = get_option('test_ui') if enable_testui gtk_dep = dependency('gtk+-3.0', version: '>= 3.14', required: true) oauth_dep = dependency('oauth', required: false) diff --git a/meson_options.txt b/meson_options.txt index 5f396a1..d4800f1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,6 @@ -option('enable-grl-net', type: 'boolean', value: true, description: 'Enable Grilo Net library') -option('enable-grl-pls', type: 'boolean', value: true, description: 'Enable Grilo Pls library') -option('enable-gtk-doc', type: 'boolean', value: false, description: 'Enable generating the API reference') -option('enable-introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection') -option('enable-test-ui', type: 'boolean', value: true, description: 'Build Test UI') -option('enable-vala', type: 'boolean', value: true, description: 'Enable Vala (enables GObject Introspection)') +option('grl_net', type: 'boolean', value: true, description: 'Enable Grilo Net library') +option('grl_pls', type: 'boolean', value: true, description: 'Enable Grilo Pls library') +option('gtk_doc', type: 'boolean', value: false, description: 'Enable generating the API reference') +option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection') +option('test_ui', type: 'boolean', value: true, description: 'Build Test UI') +option('vapi', type: 'boolean', value: true, description: 'Enable Vala (enables GObject Introspection)') -- GitLab From 6eafdbb205128140e5ddba5a871f86ab008fb361 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 7 Jan 2019 16:39:04 +0100 Subject: [PATCH 2/2] build: Fix path handling in pkgconfig On Nix, headers, introspection files and vapi files are installed to different prefix than the library. This makes sure that the correct paths are used, thus making the build more portable. --- bindings/vala/meson.build | 10 ++-------- meson.build | 28 +++++++++++++++++++++++----- src/meson.build | 2 ++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build index 3190f00..9c2d9c0 100644 --- a/bindings/vala/meson.build +++ b/bindings/vala/meson.build @@ -5,13 +5,6 @@ # # Copyright (C) 2016 Igalia S.L. All rights reserved. -vapidir = join_paths([ - prefix, - get_option('datadir'), - 'vala', - 'vapi', -]) - vala_sources = [ # LIBRARY, GIR, DEPS ['grilo-@0@'.format(grl_majorminor), grl_gir[0], ['gmodule-2.0', 'gio-2.0']], ['grilo-net-@0@'.format(grl_majorminor), grlnet_gir[0], ['gio-2.0']], @@ -26,6 +19,7 @@ foreach s: vala_sources gnome.generate_vapi(lib, sources: [custom_vala, gir], packages: deps, - install: true) + install: true, + install_dir: vapidir) endforeach diff --git a/meson.build b/meson.build index 295939c..4a1c660 100644 --- a/meson.build +++ b/meson.build @@ -63,7 +63,7 @@ endif enable_vala = get_option('vapi') if enable_vala - vapigen = find_program('vapigen', required: true) + find_program('vapigen', required: true) endif enable_testui = get_option('test_ui') @@ -73,9 +73,27 @@ if enable_testui endif prefix = get_option('prefix') +includedir = join_paths(prefix, get_option('includedir')) libdir = join_paths(prefix, get_option('libdir')) plugins_dir = join_paths(libdir, grl_name) localedir = join_paths(prefix, get_option('localedir')) +datadir = join_paths(prefix, get_option('datadir')) + +gobject_introspection = dependency('gobject-introspection-1.0', required: false) +if gobject_introspection.found() + girdir = gobject_introspection.get_pkgconfig_variable('girdir', define_variable: ['datadir', datadir]) + typelibdir = gobject_introspection.get_pkgconfig_variable('typelibdir', define_variable: ['libdir', libdir]) +else + girdir = join_paths(datadir, 'gir-1.0') + typelibdir = join_paths(libdir, 'girepository-1.0') +endif + +vapigen = dependency('vapigen', required: false) +if vapigen.found() + vapidir = vapigen.get_pkgconfig_variable('vapidir', define_variable: ['datadir', datadir]) +else + vapidir = join_paths(datadir, 'vala', 'vapi') +endif cdata = configuration_data() cdata.set_quoted('VERSION', grilo_version) @@ -99,11 +117,11 @@ pkgconf = configuration_data() pkgconf.set('prefix', prefix) pkgconf.set('exec_prefix', '${prefix}') pkgconf.set('libdir', libdir) -pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir'))) +pkgconf.set('includedir', join_paths('${prefix}', includedir)) pkgconf.set('GRL_NAME', grl_name) pkgconf.set('GRL_PLUGINS_DIR', plugins_dir) -pkgconf.set('INTROSPECTION_GIRDIR', '${datarootdir}/gir-1.0') -pkgconf.set('INTROSPECTION_TYPELIBDIR', '${libdir}/girepository-1.0'.format(get_option('libdir'))) +pkgconf.set('INTROSPECTION_GIRDIR', join_paths('${prefix}', girdir)) +pkgconf.set('INTROSPECTION_TYPELIBDIR', join_paths('${prefix}', typelibdir)) pkgconf.set('VERSION', grilo_version) pkgconf.set('GRLNET_VERSION', grlnet_version) pkgconf.set('GRLPLS_VERSION', grlpls_version) @@ -114,7 +132,7 @@ foreach p: pkgconfig_files configure_file(input: infile, output: outfile, configuration: pkgconf, - install_dir: '@0@/pkgconfig'.format(get_option('libdir'))) + install_dir: join_paths(libdir, 'pkgconfig')) endforeach gnome = import('gnome') diff --git a/src/meson.build b/src/meson.build index 36c34b3..2eb46f6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -120,5 +120,7 @@ if enable_gir dependencies: [ gobject_dep, gmodule_dep, gio_dep ], includes: [ 'GObject-2.0', 'GModule-2.0', 'Gio-2.0' ], install: true, + install_dir_gir: girdir, + install_dir_typelib: typelibdir, extra_args: gir_extra_args) endif -- GitLab