[gjs/wip/hadess/fix-destdir-install] build: Fix installation with DESTDIR set



commit 4a7c705a8c181eda6bb4e03a5674aab393331a04
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 29 17:50:48 2019 +0100

    build: Fix installation with DESTDIR set
    
    os.path.join() doesn't simply concatenate paths as:
    If a component is an absolute path, all previous components are
    thrown away and joining continues from the absolute path component.
    
    Strip the leading '/' from the configured prefix if needed to prevent
    that.
    
    Closes: https://gitlab.gnome.org/GNOME/gjs/issues/291

 build/symlink-gjs.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/build/symlink-gjs.py b/build/symlink-gjs.py
index 365a3211..2c6f0a57 100644
--- a/build/symlink-gjs.py
+++ b/build/symlink-gjs.py
@@ -12,7 +12,11 @@ destdir = os.environ.get('DESTDIR')
 install_prefix = os.environ.get('MESON_INSTALL_PREFIX')
 bindir = sys.argv[1]
 if destdir is not None:
-    installed_bin_dir = os.path.join(destdir, install_prefix, bindir)
+    # os.path.join() doesn't concat paths if one of them is absolute
+    if install_prefix[0] == '/' and os.name is not 'nt':
+        installed_bin_dir = os.path.join(destdir, install_prefix[1:], bindir)
+    else:
+        installed_bin_dir = os.path.join(destdir, install_prefix, bindir)
 else:
     installed_bin_dir = os.path.join(install_prefix, bindir)
 


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