File: meson_vapi_link.py-Improve-calculation-of-vapidir.patch

package info (click to toggle)
libgit2-glib 0.99.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,692 kB
  • sloc: ansic: 17,155; python: 1,989; makefile: 21; sh: 7
file content (51 lines) | stat: -rw-r--r-- 1,876 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Sun, 1 Mar 2020 17:33:12 +0000
Subject: meson_vapi_link.py: Improve calculation of vapidir

The script gets the *absolute* datadir passed as its argument. This
means os.path.join will throw away the MESON_INSTALL_DESTDIR_PREFIX,
breaking the symlinking when DESTDIR is set.

Also handle the case where the datadir is not inside the prefix by
prepending the destdir ourselves. We make the datadir relative to the
root by stripping the drive letter (if any) and the initial separator.

Origin: upstream, 0.99.1, commit:170e1c31dad2208e3ce659628efdbf0623ebbda7
---
 meson.build        | 2 +-
 meson_vapi_link.py | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 990ce23..a36b606 100644
--- a/meson.build
+++ b/meson.build
@@ -135,7 +135,7 @@ 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', get_option('datadir'))
+  meson.add_install_script('meson_vapi_link.py', libgit2_glib_datadir)
 endif
 
 # Check for libgit2 ssh support
diff --git a/meson_vapi_link.py b/meson_vapi_link.py
index 58e0f6b..d7fc729 100644
--- a/meson_vapi_link.py
+++ b/meson_vapi_link.py
@@ -4,7 +4,14 @@ import os
 import subprocess
 import sys
 
-vapidir = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], sys.argv[1], 'vala', 'vapi')
+datadir = sys.argv[1]
+
+destdir = os.environ.get('DESTDIR')
+if destdir:
+    datadir = os.path.splitdrive(datadir)[1].lstrip(os.path.sep)
+    datadir = os.path.join(destdir, datadir)
+
+vapidir = os.path.join(datadir, 'vala', 'vapi')
 os.chdir(vapidir)
 
 # FIXME: meson will not track the creation of these files