From 252f18e54d8a56ce4420c549fb48963cad3b91c0 Mon Sep 17 00:00:00 2001
From: John Zimmermann <me@johnnynator.dev>
Date: Thu, 28 Sep 2023 18:17:37 +0200
Subject: [PATCH 2/2] meson: allow setting absolute path instead of 'Dynamic
 string tokens'

resolves #601
---
 meson_options.txt |  1 +
 src/meson.build   | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 5f7d11b..0173a54 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -12,3 +12,4 @@ option('mangoapp', type: 'boolean', value : false)
 option('mangohudctl', type: 'boolean', value : false)
 option('mangoapp_layer', type: 'boolean', value : false)
 option('tests', type: 'feature', value: 'auto', description: 'Run tests')
+option('dynamic_string_tokens', type: 'boolean', value: true, description: 'Use dynamic string tokens in LD_PRELOAD')
diff --git a/src/meson.build b/src/meson.build
index 537ce63..034dce2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,12 +1,18 @@
 glslang = find_program('glslang', 'glslangValidator')
 
+if get_option('dynamic_string_tokens')
+  ld_prefix = get_option('prefix') + '/\$LIB/'
+else
+  ld_prefix = join_paths(get_option('prefix') ,get_option('libdir')) + '/'
+endif
+
 # Needs prefix for configure_file()
 if get_option('append_libdir_mangohud')
   libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir'), 'mangohud')
-  ld_libdir_mangohud = get_option('prefix') + '/\$LIB/mangohud/'
+  ld_libdir_mangohud = ld_prefix + 'mangohud/'
 else
   libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir'))
-  ld_libdir_mangohud = get_option('prefix') + '/\$LIB/'
+  ld_libdir_mangohud = ld_prefix
 endif
 
 conf_data = configuration_data()
-- 
2.42.0

