[grilo/wip/jtojnar/meson-fixes: 4/4] build: Fix path handling in pkgconfig
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo/wip/jtojnar/meson-fixes: 4/4] build: Fix path handling in pkgconfig
- Date: Mon, 7 Jan 2019 16:02:25 +0000 (UTC)
commit b094e74a8fad0ffb1dd7e68505e8b05a19614b96
Author: Jan Tojnar <jtojnar gmail com>
Date: Mon Jan 7 16:39:04 2019 +0100
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]