From 7d10079f2d40fcc43d36857fa427d0372925e4c4 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 9 Sep 2020 16:59:43 +0100
Subject: [PATCH] Link pressure-vessel-wrap to libsteam-runtime-tools
 statically

This avoids needing to mess about with RPATHs to make the link (and
the containers test) work, and in future will allow access to
non-API-stable parts of the library.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/build-relocatable-install.py |  4 ----
 pressure-vessel/meson.build                  |  2 +-
 steam-runtime-tools/meson.build              | 15 +++++++++++++--
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/pressure-vessel/build-relocatable-install.py b/pressure-vessel/build-relocatable-install.py
index b6b44cd95..79b08c6f3 100755
--- a/pressure-vessel/build-relocatable-install.py
+++ b/pressure-vessel/build-relocatable-install.py
@@ -386,10 +386,6 @@ def main():
                     'soname:libjson-glib-1.0.so.0',
                     'soname:libpcre.so.3',
                     'soname:libselinux.so.1',
-                    'path:{}/lib/{}/libsteam-runtime-tools-0.so.0'.format(
-                        args.prefix,
-                        arch.multiarch,
-                    ),
                 ])
 
             for so in glob.glob(
diff --git a/pressure-vessel/meson.build b/pressure-vessel/meson.build
index f1f23a968..3cf43bad9 100644
--- a/pressure-vessel/meson.build
+++ b/pressure-vessel/meson.build
@@ -201,7 +201,7 @@ executable(
   ] + enums,
   c_args : pv_c_args,
   dependencies : [
-    libsteamrt_dep,
+    libsteamrt_static_dep,
     gio_unix,
     xau,
     libglnx.get_variable('libglnx_dep'),
diff --git a/steam-runtime-tools/meson.build b/steam-runtime-tools/meson.build
index 665ce5b9b..76babbc8c 100644
--- a/steam-runtime-tools/meson.build
+++ b/steam-runtime-tools/meson.build
@@ -71,8 +71,8 @@ install_headers(
   subdir : join_paths('steam-runtime-tools-' + api_major, 'steam-runtime-tools'),
 )
 
-libsteamrt = library(
-  'steam-runtime-tools-' + api_major,
+libsteamrt_static = static_library(
+  'steam-runtime-tools-internal',
   libsteamrt_sources + libsteamrt_public_headers + enums,
   c_args : [
     '-DG_LOG_DOMAIN="' + meson.project_name() + '"',
@@ -83,6 +83,12 @@ libsteamrt = library(
   ],
   include_directories : project_include_dirs,
   dependencies : [libdl, threads, libelf, gio_unix, glib, gobject, json_glib],
+  install : false,
+)
+libsteamrt = library(
+  'steam-runtime-tools-' + api_major,
+  dependencies : [libdl, threads, libelf, gio_unix, glib, gobject, json_glib],
+  objects : [libsteamrt_static.extract_all_objects()],
   soversion : abi_major,
   version : abi_major + '.' + abi_minor,
   install : true,
@@ -100,6 +106,11 @@ libsteamrt_dep = declare_dependency(
   link_with : libsteamrt,
   sources : libsteamrt_public_headers + [enums[1]],
 )
+libsteamrt_static_dep = declare_dependency(
+  include_directories : project_include_dirs,
+  link_with : libsteamrt_static,
+  sources : libsteamrt_public_headers + [enums[1]],
+)
 
 if get_option('introspection')
   gnome.generate_gir(
-- 
GitLab