From ad64bf345d7bf32521a0bb46820101daec9fe7b6 Mon Sep 17 00:00:00 2001 From: jackun Date: Sat, 14 Mar 2020 12:59:20 +0200 Subject: [PATCH 1/3] Update build scripts, again Install to $prefix$libdir/mangohud by default. --- meson.build | 13 ------------- meson_options.txt | 2 +- src/meson.build | 46 +++++++++++++++++++++++++++++----------------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/meson.build b/meson.build index 35a5ff2..9e39d26 100644 --- a/meson.build +++ b/meson.build @@ -30,12 +30,6 @@ cpp = meson.get_compiler('cpp') prog_python = import('python').find_installation('python3') null_dep = dependency('', required : false) -# Needs prefix for configure_file() -libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir'), 'mangohud') -if get_option('using_build_sh') - libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir')) -endif - pre_args = [ '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', @@ -212,13 +206,6 @@ vk_enum_to_str = custom_target( '--outdir', meson.current_build_dir() ], ) -if get_option('using_build_sh') - configure_file(input : 'libmangohud.conf.in', - output : get_option('mangohud_prefix') + 'libmangohud.conf', - configuration : { 'libdir_mangohud' : libdir_mangohud }, - install_dir : join_paths(get_option('sysconfdir'), 'ld.so.conf.d'), - ) -endif util_files = files( 'src/mesa/util/os_socket.c', diff --git a/meson_options.txt b/meson_options.txt index a2e30de..cfcc675 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ option('glibcxx_asserts', type : 'boolean', value : false) option('use_system_vulkan', type : 'feature', value : 'disabled', description: 'Use system vulkan headers instead of the provided ones') option('mangohud_prefix', type : 'string', value : '', description: 'Add prefix to cross-compiled library, like "lib32-".') -option('using_build_sh', type : 'boolean', value : false, description: 'Add "mangohud" suffix to libdir or not.') +option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.') diff --git a/src/meson.build b/src/meson.build index c269be8..55524c0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -20,6 +20,13 @@ glslang = find_program('glslangValidator') +# Needs prefix for configure_file() +if get_option('append_libdir_mangohud') + libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir'), 'mangohud') +else + libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir')) +endif + overlay_shaders = [ 'overlay.frag', 'overlay.vert', @@ -87,31 +94,36 @@ vklayer_mesa_overlay = shared_library( install : true ) -if get_option('using_build_sh') +if get_option('append_libdir_mangohud') configure_file(input : 'mangohud.json.in', - output : '@0@.json'.format(meson.project_name()), - configuration : {'PROJECT_NAME' : meson.project_name(), - 'libdir_mangohud' : '', - 'LAYER_SUFFIX' : ''}, - install : true, - install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), + output : '@0@.@1@.json'.format(meson.project_name(), target_machine.cpu_family()), + configuration : {'libdir_mangohud' : libdir_mangohud + '/', + 'PROJECT_NAME' : meson.project_name() + ' ', + 'LAYER_SUFFIX' : target_machine.cpu_family()}, + install : true, + install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), ) else configure_file(input : 'mangohud.json.in', - output : '@0@.@1@.json'.format(meson.project_name(), target_machine.cpu_family()), - configuration : {'libdir_mangohud' : join_paths(get_option('prefix'), get_option('libdir'), 'mangohud') + '/', - 'PROJECT_NAME' : meson.project_name() + ' ', - 'LAYER_SUFFIX' : target_machine.cpu_family()}, - install : true, - install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), + output : '@0@.json'.format(meson.project_name()), + configuration : {'PROJECT_NAME' : meson.project_name(), + 'libdir_mangohud' : '', + 'LAYER_SUFFIX' : ''}, + install : true, + install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), ) endif -install_data( - files('../bin/run-mangohud-gl-pkg.sh'), +if target_machine.cpu_family() == 'x86_64' + mangohud_cpu_family = '' +else + mangohud_cpu_family = '.@0@'.format(target_machine.cpu_family()) +endif + +configure_file(input : '../bin/mangohud.in', + output : 'mangohud@0@'.format(mangohud_cpu_family), + configuration : {'libdir_mangohud' : libdir_mangohud}, install_dir : get_option('bindir'), - install_mode: 'rwxr-xr-x', - rename : ['mangohud'] ) install_data( From deaccb7dd8b6daea6de126c3e99e21af66140cc5 Mon Sep 17 00:00:00 2001 From: jackun Date: Sat, 14 Mar 2020 13:09:35 +0200 Subject: [PATCH 2/3] Update build.sh --- build.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index f313762..2d8d520 100755 --- a/build.sh +++ b/build.sh @@ -109,14 +109,14 @@ configure() { dependencies git submodule update --init --depth 50 if [[ ! -f "build/meson64/build.ninja" ]]; then - meson build/meson64 --libdir lib/mangohud/lib64 --prefix /usr -Dusing_build_sh=true + meson build/meson64 --libdir lib/mangohud/lib64 --prefix /usr -Dappend_libdir_mangohud=false fi if [[ ! -f "build/meson32/build.ninja" ]]; then export CC="gcc -m32" export CXX="g++ -m32" export PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig:${PKG_CONFIG_PATH_32}" export LLVM_CONFIG="/usr/bin/llvm-config32" - meson build/meson32 --libdir lib/mangohud/lib32 --prefix /usr -Dmangohud_prefix=lib32- -Dusing_build_sh=true + meson build/meson32 --libdir lib/mangohud/lib32 --prefix /usr -Dappend_libdir_mangohud=false fi } @@ -171,9 +171,8 @@ uninstall() { rm -rfv "/usr/share/doc/mangohud" rm -fv "/usr/share/vulkan/implicit_layer.d/mangohud.json" rm -fv "/usr/share/vulkan/implicit_layer.d/MangoHud.json" - rm -fv "/etc/ld.so.conf.d/libmangohud.conf" - rm -fv "/etc/ld.so.conf.d/lib32-libmangohud.conf" rm -fv "/usr/bin/mangohud" + rm -fv "/usr/bin/mangohud.x86" } for a in $@; do From fa41e6f882d19eed5d80e3ba8e4012cabc184a80 Mon Sep 17 00:00:00 2001 From: jackun Date: Sat, 14 Mar 2020 13:22:17 +0200 Subject: [PATCH 3/3] Always configure vulkan json --- build.sh | 2 ++ src/meson.build | 27 ++++++++------------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/build.sh b/build.sh index 2d8d520..411a09a 100755 --- a/build.sh +++ b/build.sh @@ -171,6 +171,8 @@ uninstall() { rm -rfv "/usr/share/doc/mangohud" rm -fv "/usr/share/vulkan/implicit_layer.d/mangohud.json" rm -fv "/usr/share/vulkan/implicit_layer.d/MangoHud.json" + rm -fv "/usr/share/vulkan/implicit_layer.d/MangoHud.x86.json" + rm -fv "/usr/share/vulkan/implicit_layer.d/MangoHud.x86_64.json" rm -fv "/usr/bin/mangohud" rm -fv "/usr/bin/mangohud.x86" } diff --git a/src/meson.build b/src/meson.build index 55524c0..3c187d6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -94,25 +94,14 @@ vklayer_mesa_overlay = shared_library( install : true ) -if get_option('append_libdir_mangohud') - configure_file(input : 'mangohud.json.in', - output : '@0@.@1@.json'.format(meson.project_name(), target_machine.cpu_family()), - configuration : {'libdir_mangohud' : libdir_mangohud + '/', - 'PROJECT_NAME' : meson.project_name() + ' ', - 'LAYER_SUFFIX' : target_machine.cpu_family()}, - install : true, - install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), - ) -else - configure_file(input : 'mangohud.json.in', - output : '@0@.json'.format(meson.project_name()), - configuration : {'PROJECT_NAME' : meson.project_name(), - 'libdir_mangohud' : '', - 'LAYER_SUFFIX' : ''}, - install : true, - install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), - ) -endif +configure_file(input : 'mangohud.json.in', + output : '@0@.@1@.json'.format(meson.project_name(), target_machine.cpu_family()), + configuration : {'libdir_mangohud' : libdir_mangohud + '/', + 'PROJECT_NAME' : meson.project_name() + ' ', + 'LAYER_SUFFIX' : target_machine.cpu_family()}, + install : true, + install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), +) if target_machine.cpu_family() == 'x86_64' mangohud_cpu_family = ''