When building a project using Meson, the project will be installed
respecting the multi-library path.

In order to get the right path we should do:
- Debian based machines:
  - Use the value of `dpkg-architecture -q DEB_TARGET_MULTIARCH`
- RPM based machines:
  - Use the value of `rpm --eval '%{_lib}'`

Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
---
 guests/playbooks/update/templates/bashrc.j2 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/guests/playbooks/update/templates/bashrc.j2 
b/guests/playbooks/update/templates/bashrc.j2
index 1f39cf2..794398c 100644
--- a/guests/playbooks/update/templates/bashrc.j2
+++ b/guests/playbooks/update/templates/bashrc.j2
@@ -14,6 +14,23 @@ export 
XDG_DATA_DIRS="$VIRT_PREFIX/share:/usr/share:/usr/local/share"
 export GI_TYPELIB_PATH="$VIRT_PREFIX/lib/girepository-1.0"
 export OSINFO_SYSTEM_DIR="$VIRT_PREFIX/share/osinfo"
 
+# Add the multilib path to the LD_LIBRARY_PATH, PKG_CONFIG_PATH, and 
GI_TYPELIB_PATH
+# The multilib path can be discovered either using `dpkg-architecture` (on 
Debian based
+# machines) or by calling `rpm --eval '%{_lib}'` (on rpm based machines).
+
+package_format="{{ package_format }}"
+if test "$package_format" = "deb"; then
+    multilib=$(dpkg-architecture -q DEB_TARGET_MULTIARCH)
+    export LD_LIBRARY_PATH="$VIRT_PREFIX/lib/$multilib:$LD_LIBRARY_PATH"
+    export 
PKG_CONFIG_PATH="$VIRT_PREFIX/lib/$multilib/pkgconfig:$PKG_CONFIG_PATH"
+    export 
GI_TYPELIB_PATH="$VIRT_PREFIX/lib/$multilib/girepository-1.0:$GI_TYPELIB_PATH"
+elif test "$package_format" = "rpm"; then
+    multilib=$(rpm --eval '%{_lib}')
+    export LD_LIBRARY_PATH="$VIRT_PREFIX/$multilib:$LD_LIBRARY_PATH"
+    export PKG_CONFIG_PATH="$VIRT_PREFIX/$multilib/pkgconfig:$PKG_CONFIG_PATH"
+    export 
GI_TYPELIB_PATH="$VIRT_PREFIX/$multilib/girepository-1.0:$GI_TYPELIB_PATH"
+fi
+
 # We need to ask Perl for this information, since it's used to
 # construct installation paths
 plarch=$(perl -e 'use Config; print $Config{archname}')
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to