[gupnp-tools/wip/jtojnar/dirs] build: fix DATA_DIR constant



commit 2845d07b1584789a23a0e691ceff476e5d82ccb7
Author: Jan Tojnar <jtojnar gmail com>
Date:   Fri Dec 14 20:19:50 2018 +0100

    build: fix DATA_DIR constant
    
    On Nix, the datadir option is returning just share, which causes issues when
    the program tries to load the data:
    
    $ result/bin/gupnp-network-light
    ** (gupnp-network-light:29089): CRITICAL **: 20:12:47.920: Unable to load the XML description file: 
Failed to parse share/gupnp-tools/xml/network-light-desc.xml
    
    Let’s fix it to always use absolute paths.

 meson.build | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 67c61f2..70201ef 100644
--- a/meson.build
+++ b/meson.build
@@ -23,21 +23,25 @@ if not gtksourceview.found()
     gtksourceview = dependency('gtksourceview-3.0', version: '>= 3.2.0', required: false)
 endif
 
+prefix = get_option('prefix')
+datadir = join_paths(prefix, get_option('datadir'))
+localedir = join_paths(prefix, get_option('localedir'))
+
 resource_data = join_paths(meson.source_root(), 'data')
 if get_option('uninstalled')
     shareddir = resource_data
 else
-    shareddir = join_paths(get_option('datadir'), meson.project_name())
+    shareddir = join_paths(datadir, meson.project_name())
 endif
 
-desktopdir = join_paths(get_option('datadir'), 'applications')
+desktopdir = join_paths(datadir, 'applications')
 
 conf = configuration_data()
 conf.set('VERSION', '"@0@"'.format(meson.project_version()))
 conf.set('DATA_DIR', '"@0@"'.format(shareddir))
 conf.set('HAVE_GTK_SOURCEVIEW', gtksourceview.found())
 conf.set('GETTEXT_PACKAGE', '"@0@"'.format(meson.project_name()))
-conf.set('LOCALEDIR', '"@0@"'.format(join_paths(get_option('prefix'), get_option('localedir'))))
+conf.set('LOCALEDIR', '"@0@"'.format(localedir))
 
 configure_file(input: 'config.h.meson', output: 'config.h', configuration: conf)
 config_header = declare_dependency(compile_args : '-DHAVE_CONFIG_H=1', include_directories : 
include_directories('.'))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]