[libgit2-glib] meson: Create a symlink with the old VAPI name



commit 2dd507dd92f4af0c15aa49744df1a1e4556de663
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Sun Jan 28 20:26:18 2018 +0100

    meson: Create a symlink with the old VAPI name
    
    The VAPI file has been renamed following the VAPI naming guidelines.
    
    This patch creates a symlink with the old VAPI name pointing to the
    new file which adds backwards compatibility.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787198

 meson.build                                      |    4 ++-
 meson_post_install.py => meson_python_compile.py |    0
 meson_vapi_link.py                               |   25 ++++++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/meson.build b/meson.build
index e4567ff..3f492a5 100644
--- a/meson.build
+++ b/meson.build
@@ -131,6 +131,8 @@ enable_vapi = get_option('vapi')
 if enable_vapi
   assert(enable_gir, 'vapi support was requested, but introspection support is mandatory.')
   assert(add_languages('vala', required: false), 'vapi support was requested, but vala not found.')
+
+  meson.add_install_script('meson_vapi_link.py', libgit2_glib_datadir)
 endif
 
 # Check for libgit2 ssh support
@@ -159,7 +161,7 @@ if enable_python
   dependency('pygobject-3.0', version: '>= 3.0.0')
   assert(python.language_version().version_compare('>= ' + python_req), 'python support was requested, but 
version >= ' + python_req + ' not found.')
 
-  meson.add_install_script('meson_post_install.py', libgit2_glib_libdir)
+  meson.add_install_script('meson_python_compile.py', libgit2_glib_libdir)
 endif
 
 gnome = import('gnome')
diff --git a/meson_post_install.py b/meson_python_compile.py
similarity index 100%
rename from meson_post_install.py
rename to meson_python_compile.py
diff --git a/meson_vapi_link.py b/meson_vapi_link.py
new file mode 100644
index 0000000..435cd95
--- /dev/null
+++ b/meson_vapi_link.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+vapidir = os.path.join(sys.argv[1], 'vala', 'vapi')
+
+destdir = os.environ.get('DESTDIR', '')
+dest_vapidir = os.path.normpath(destdir + os.sep + vapidir)
+
+# FIXME: meson will not track the creation of these files
+#        https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
+old = 'ggit-1.0'
+new = 'libgit2-glib-1.0'
+
+wd = os.getcwd()
+os.chdir(dest_vapidir)
+
+for ext in ['vapi', 'deps']:
+  src = os.path.join('{}.{}'.format(new, ext))
+  dest = os.path.join('{}.{}'.format(old, ext))
+  subprocess.call(['ln', '-s', '-f', src, dest])
+
+os.chdir(wd)


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