[gnome-documents] build: DESTDIR support for link creation



commit a5862c23f28f6be95b35123d7309f722a7207510
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Dec 26 16:40:01 2017 +0100

    build: DESTDIR support for link creation
    
    The link to scripts in bindir were created only when DESTDIR
    variable was not set.
    
    This patch are created in the bindir directory, which can be
    located under DESTDIR, if it's set.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787013

 meson_post_install.py |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/meson_post_install.py b/meson_post_install.py
index 2767a94..844888f 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -6,34 +6,39 @@ import re
 import subprocess
 import sys
 
+datadir = sys.argv[1]
+
+destdir = os.environ.get('DESTDIR', '')
+bindir = os.path.normpath(destdir + os.sep + sys.argv[2])
+
+# FIXME: meson will not track the creation of these files
+#        https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
+apps = [
+  ['org.gnome.Books', 'gnome-books'],
+  ['org.gnome.Documents', 'gnome-documents']
+]
+
+if not os.path.exists(bindir):
+  os.makedirs(bindir)
+
+for app in apps:
+  src = os.path.join(datadir, 'gnome-documents', app[0])
+  dest = os.path.join(bindir, app[1])
+  subprocess.call(['ln', '-s', '-f', src, dest])
+
 if not os.environ.get('DESTDIR'):
-  # FIXME: meson will not track the creation of these files
-  #        https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
-  apps = [
-    ['org.gnome.Books', 'gnome-books'],
-    ['org.gnome.Documents', 'gnome-documents']
-  ]
-
-  bindir = sys.argv[2]
-  if not os.path.exists(bindir):
-    os.makedirs(bindir)
-
-  for app in apps:
-    src = os.path.join(sys.argv[1], 'gnome-documents', app[0])
-    dest = os.path.join(bindir, app[1])
-    subprocess.call(['ln', '-s', '-f', src, dest])
-
-  icondir = os.path.join(sys.argv[1], 'icons', 'hicolor')
+  icondir = os.path.join(datadir, '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(datadir, 'glib-2.0', 'schemas')
   print('Compiling gsettings schemas...')
   subprocess.call(['glib-compile-schemas', schemadir])
 
   search_pattern = '/*.desktop'
 
-  desktopdir = os.path.join(sys.argv[1], 'applications')
+  desktopdir = os.path.join(datadir, 'applications')
   print('Validate desktop files...')
   [subprocess.call(['desktop-file-validate', file])
    for file in glob.glob(desktopdir + search_pattern, recursive=False)]


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