[rhythmbox] build: use realpath to resolve symlinks in prefix before checking



commit 4f82a5925ca2dcf4f2f4ea660ca058859e011884
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Jun 11 20:41:23 2022 +1000

    build: use realpath to resolve symlinks in prefix before checking
    
    meson resolves symlinks for source and build paths, so this makes
    the install prefix check work better.

 shell/meson.build | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/shell/meson.build b/shell/meson.build
index 17a615678..5b57d93ba 100644
--- a/shell/meson.build
+++ b/shell/meson.build
@@ -135,8 +135,18 @@ endif
 # if installing elsewhere, getting the library search path right
 # is the user's responsibility.
 rpath = ''
-if get_option('prefix').startswith(meson.project_source_root())
-  rpath = get_option('prefix') / get_option('libdir')
+
+# try to use realpath(1) to resolve symlinks in the prefix path,
+# since meson.project_source_root() is a resolved path.
+real_prefix = get_option('prefix')
+realpath = find_program('realpath', required: false)
+if realpath.found()
+  realpath_result = run_command([realpath, real_prefix], check: false)
+  real_prefix = realpath_result.stdout().strip()
+endif
+
+if real_prefix.startswith(meson.project_source_root())
+  rpath = real_prefix / get_option('libdir')
 endif
 
 executable('rhythmbox', 'main.c',


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