[glib: 1/3] build: Rework path construction to reliably add prefix
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/3] build: Rework path construction to reliably add prefix
- Date: Mon, 17 Feb 2020 19:47:20 +0000 (UTC)
commit 65be80c3edbcf3f10ae63f529a53ba95dddf6186
Author: Philip Withnall <withnall endlessm com>
Date: Fri Feb 7 16:34:13 2020 +0000
build: Rework path construction to reliably add prefix
There were a couple of custom paths which could end up being relative,
rather than absolute, due to not properly prefixing them with
`get_option('prefix')`.
The use of `join_paths()` here correctly drops all path components
before the final absolute path in the list of arguments. So if someone
configures GLib with an absolute path for `gio_module_dir`, that will be
used unprefixed; but if someone configures with a relative path, it will
be prefixed by `get_option('prefix)`.
Signed-off-by: Philip Withnall <withnall endlessm com>
Fixes: #1919
gio/gdbus-2.0/codegen/meson.build | 2 +-
gio/meson.build | 9 +++++----
glib/gnulib/meson.build | 2 +-
glib/libcharset/meson.build | 7 +------
meson.build | 13 ++++++++++---
5 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build
index ff5edb977..c0caf0e50 100644
--- a/gio/gdbus-2.0/codegen/meson.build
+++ b/gio/gdbus-2.0/codegen/meson.build
@@ -24,7 +24,7 @@ gdbus_codegen = configure_file(input : 'gdbus-codegen.in',
# Provide tools for others when we're a subproject and they use the Meson GNOME module
meson.override_find_program('gdbus-codegen', gdbus_codegen)
-codegen_dir = join_paths(get_option('datadir'), 'glib-2.0/codegen')
+codegen_dir = join_paths(glib_datadir, 'glib-2.0', 'codegen')
gdbus_codegen_built_files = []
gdbus_codegen_built_files += configure_file(input : 'config.py.in',
diff --git a/gio/meson.build b/gio/meson.build
index d0018673e..66f9e3236 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -811,9 +811,10 @@ libgio = library('gio-2.0',
link_args : [noseh_link_args, glib_link_flags],
)
-giomodulesdir = get_option('gio_module_dir')
-if giomodulesdir == ''
- giomodulesdir = join_paths('${libdir}', 'gio', 'modules')
+if get_option('gio_module_dir') != ''
+ pkgconfig_giomodulesdir = join_paths('${prefix}', get_option('gio_module_dir'))
+else
+ pkgconfig_giomodulesdir = join_paths('${libdir}', 'gio', 'modules')
endif
schemas_subdir = join_paths('glib-2.0', 'schemas')
@@ -824,7 +825,7 @@ pkg.generate(libgio,
variables : ['datadir=' + join_paths('${prefix}', get_option('datadir')),
'schemasdir=' + join_paths('${datadir}', schemas_subdir),
'bindir=' + join_paths('${prefix}', get_option('bindir')),
- 'giomoduledir=' + giomodulesdir,
+ 'giomoduledir=' + pkgconfig_giomodulesdir,
'gio=' + join_paths('${bindir}', 'gio'),
'gio_querymodules=' + join_paths('${bindir}', 'gio-querymodules'),
'glib_compile_schemas=' + join_paths('${bindir}', 'glib-compile-schemas'),
diff --git a/glib/gnulib/meson.build b/glib/gnulib/meson.build
index 6ad55d07a..e45e8c2f4 100644
--- a/glib/gnulib/meson.build
+++ b/glib/gnulib/meson.build
@@ -338,6 +338,6 @@ gnulib_lib = static_library('gnulib', gnulib_sources,
dependencies : [libm],
include_directories : [configinc, glibinc, include_directories ('.')],
pic : true,
- c_args : ['-DGCC_LINT=1', '-DLIBDIR="@0@"'.format(get_option('libdir')), '-DGLIB_COMPILATION',
'-DG_LOG_DOMAIN="GLib"' ] + glib_hidden_visibility_args + extra_gnulib_args)
+ c_args : ['-DGCC_LINT=1', '-DLIBDIR="@0@"'.format(glib_libdir), '-DGLIB_COMPILATION',
'-DG_LOG_DOMAIN="GLib"' ] + glib_hidden_visibility_args + extra_gnulib_args)
gnulib_libm_dependency = [libm]
diff --git a/glib/libcharset/meson.build b/glib/libcharset/meson.build
index be4a79023..5a02666df 100644
--- a/glib/libcharset/meson.build
+++ b/glib/libcharset/meson.build
@@ -1,9 +1,4 @@
-charsetalias_dir = get_option('charsetalias_dir')
-if charsetalias_dir == ''
- charsetalias_dir = get_option('libdir')
-endif
-
charset_lib = static_library('charset', 'localcharset.c',
include_directories : configinc,
pic : true,
- c_args : [ '-DGLIB_CHARSETALIAS_DIR="@0@"'.format(charsetalias_dir) ] + glib_hidden_visibility_args)
+ c_args : [ '-DGLIB_CHARSETALIAS_DIR="@0@"'.format(glib_charsetaliasdir) ] + glib_hidden_visibility_args)
diff --git a/meson.build b/meson.build
index 6868dd2b2..0ce279a8c 100644
--- a/meson.build
+++ b/meson.build
@@ -63,13 +63,20 @@ glib_libexecdir = join_paths(glib_prefix, get_option('libexecdir'))
glib_datadir = join_paths(glib_prefix, get_option('datadir'))
glib_pkgdatadir = join_paths(glib_datadir, 'glib-2.0')
glib_includedir = join_paths(glib_prefix, get_option('includedir'))
-glib_giomodulesdir = get_option('gio_module_dir')
-if glib_giomodulesdir == ''
+if get_option('gio_module_dir') != ''
+ glib_giomodulesdir = join_paths(glib_prefix, get_option('gio_module_dir'))
+else
glib_giomodulesdir = join_paths(glib_libdir, 'gio', 'modules')
endif
glib_pkgconfigreldir = join_paths(glib_libdir, 'pkgconfig')
+if get_option('charsetalias_dir') != ''
+ glib_charsetaliasdir = join_paths(glib_prefix, get_option('charsetalias_dir'))
+else
+ glib_charsetaliasdir = glib_libdir
+endif
+
installed_tests_metadir = join_paths(glib_datadir, 'installed-tests', meson.project_name())
installed_tests_execdir = join_paths(glib_libexecdir, 'installed-tests', meson.project_name())
installed_tests_enabled = get_option('installed_tests')
@@ -2216,7 +2223,7 @@ if get_option('man')
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
]
- man1_dir = get_option('mandir') + '/man1'
+ man1_dir = join_paths(glib_prefix, get_option('mandir'), 'man1')
endif
gnome = import('gnome')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]