[eog: 10/21] build: Do not use prefix on directory variables



commit 4ee870fad9630a3004d9757f1af12faa19737809
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Jun 27 23:45:43 2019 +0200

    build: Do not use prefix on directory variables
    
    Although usually directory variables are set by using the `prefix`
    directory, this might cause issues due to parameters that need
    relative directories.
    
    In order to ease the transition `prefix` directory has been stripped
    from directory variables and only has been appended when necessary.

 meson.build           |  8 ++++----
 meson_post_install.py |  6 ++++--
 src/meson.build       | 13 +++++++------
 tests/meson.build     |  2 +-
 4 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/meson.build b/meson.build
index 02497e6a..3f7a143d 100644
--- a/meson.build
+++ b/meson.build
@@ -17,13 +17,13 @@ eog_gir_ns = 'Eog'
 eog_gir_version = '1.0'
 
 eog_prefix = get_option('prefix')
-eog_datadir = eog_prefix / get_option('datadir')
-eog_libdir = eog_prefix / get_option('libdir')
-eog_localedir = eog_prefix / get_option('localedir')
+eog_datadir = get_option('datadir')
+eog_libdir = get_option('libdir')
+eog_localedir = get_option('localedir')
 
 eog_pkgdatadir = eog_datadir / meson.project_name()
 eog_pkglibdir = eog_libdir / meson.project_name()
-eog_pkglibexecdir = eog_prefix / get_option('libexecdir') / meson.project_name()
+eog_pkglibexecdir = get_option('libexecdir') / meson.project_name()
 
 eog_pluginsdir = eog_pkglibdir / 'plugins'
 eog_schemadir = eog_datadir / 'glib-2.0/schemas'
diff --git a/meson_post_install.py b/meson_post_install.py
index 0df46924..46d7d58c 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -5,10 +5,12 @@ import subprocess
 import sys
 
 if not os.environ.get('DESTDIR'):
-  icondir = os.path.join(sys.argv[1], 'icons', 'hicolor')
+  prefix = os.environ['MESON_INSTALL_PREFIX']
+
+  icondir = os.path.join(prefix, sys.argv[1], 'icons', 'hicolor')
   print('Update icon cache...')
   subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
 
-  schemadir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
+  schemadir = os.path.join(prefix, sys.argv[1], 'glib-2.0', 'schemas')
   print('Compiling gsettings schemas...')
   subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/src/meson.build b/src/meson.build
index beb5e420..a0b05a05 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -134,9 +134,9 @@ deps = common_deps + [
 
 cflags = [
   '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name().to_upper()),
-  '-DEOG_DATA_DIR="@0@"'.format(eog_pkgdatadir),
-  '-DEOG_PLUGIN_DIR="@0@"'.format(eog_pluginsdir),
-  '-DLIBDIR="@0@"'.format(eog_libdir),
+  '-DEOG_DATA_DIR="@0@"'.format(eog_prefix / eog_pkgdatadir),
+  '-DEOG_PLUGIN_DIR="@0@"'.format(eog_prefix / eog_pluginsdir),
+  '-DLIBDIR="@0@"'.format(eog_prefix / eog_libdir),
 ]
 
 symbol_map = meson.current_source_dir() / 'symbol.map'
@@ -182,7 +182,8 @@ pkg.generate(
   requires: 'gtk+-3.0',
   variables: [
     'exec_prefix=${prefix}',
-    'pluginsdir=' + eog_pluginsdir,
+    # the equivalent of eog_pluginsdir but using ${libdir} fro variable replacement
+    'pluginsdir=' + ('${libdir}' / meson.project_name() / 'plugins'),
   ],
 )
 
@@ -190,7 +191,7 @@ deps = [libeog_dep]
 
 cflags = [
   '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name().to_upper()),
-  '-DEOG_LOCALE_DIR="@0@"'.format(eog_localedir),
+  '-DEOG_LOCALE_DIR="@0@"'.format(eog_prefix / eog_localedir),
 ]
 
 if enable_introspection
@@ -204,7 +205,7 @@ eog = executable(
   dependencies: deps,
   c_args: cflags,
   install: true,
-  install_rpath: eog_pkglibdir,
+  install_rpath: eog_prefix / eog_pkglibdir,
 )
 
 if enable_introspection
diff --git a/tests/meson.build b/tests/meson.build
index 875fdcd3..fe99c6ba 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,4 +1,4 @@
-tests_execdir = eog_pkglibexecdir / 'installed-tests'
+tests_execdir = eog_prefix / eog_pkglibexecdir / 'installed-tests'
 tests_metadir = eog_datadir / 'installed-tests' / meson.project_name()
 
 tests_data = files(


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