Libdirs: once more, with feeling

pull/58/head
jackun 4 years ago
parent 4761078133
commit f99129f9de
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -0,0 +1,21 @@
#!/bin/sh
MANGOHUD_LIB_NAME="libMangoHud.so"
if [ "$MANGOHUD_NODLSYM" = "1" ]; then
MANGOHUD_LIB_NAME="libMangoHud_nodlsym.so"
fi
if [ "$#" -eq 0 ]; then
programname=`basename "$0"`
echo "ERROR: No program supplied"
echo
echo "Usage: $programname <program>"
exit 1
fi
# Execute the program under a clean environment
# pass through the overriden LD_PRELOAD environment variables
LD_PRELOAD="${LD_PRELOAD}:${MANGOHUD_LIB_NAME}"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:@libdir_mangohud@"
exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" LD_PRELOAD="${LD_PRELOAD}" "$@"

@ -109,14 +109,14 @@ configure() {
dependencies
git submodule update --init --depth 50
if [[ ! -f "build/meson64/build.ninja" ]]; then
meson build/meson64 --libdir lib64 --prefix "$PWD/build/release/usr"
meson build/meson64 --libdir lib/mangohud/lib64 --prefix /usr -Dusing_build_sh=true
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 lib32 --prefix "$PWD/build/release/usr"
meson build/meson32 --libdir lib/mangohud/lib32 --prefix /usr -Dmangohud_prefix=lib32- -Dusing_build_sh=true
fi
}
@ -124,30 +124,18 @@ build() {
if [[ ! -f "build/meson64/build.ninja" ]]; then
configure
fi
ninja -C build/meson32 install
ninja -C build/meson64 install
DESTDIR="$PWD/build/release" ninja -C build/meson32 install
DESTDIR="$PWD/build/release" ninja -C build/meson64 install
}
package() {
LIB="build/release/usr/lib64/mangohud/libMangoHud.so"
LIB32="build/release/usr/lib32/mangohud/libMangoHud.so"
LIB="build/release/usr/lib/mangohud/lib64/libMangoHud.so"
LIB32="build/release/usr/lib/mangohud/lib32/libMangoHud.so"
if [[ ! -f "$LIB" || "$LIB" -ot "build/meson64/src/libMangoHud.so" ]]; then
build
fi
mkdir -p "$INSTALL_DIR/usr/bin"
mkdir -p "$INSTALL_DIR/usr/lib/MangoHud"
mkdir -p "$INSTALL_DIR/usr/lib/MangoHud/"{lib32,lib64}
mkdir -p "$INSTALL_DIR/usr/share/vulkan/implicit_layer.d"
mkdir -p "$INSTALL_DIR/etc/ld.so.conf.d"
cp libmangohud.conf "$INSTALL_DIR/etc/ld.so.conf.d/libmangohud.conf"
cp "$LIB" "$INSTALL_DIR/usr/lib/MangoHud/lib64/libMangoHud.so"
cp "$LIB32" "$INSTALL_DIR/usr/lib/MangoHud/lib32/libMangoHud.so"
cp "$LAYER" "$INSTALL_DIR/usr/share/vulkan/implicit_layer.d/"
cp --preserve=mode "build/release/usr/bin/mangohud" "$INSTALL_DIR/usr/bin/mangohud"
tar --numeric-owner --owner=0 --group=0 \
-C build/package -cvf "build/MangoHud-package.tar" .
-C build/release -cvf "build/MangoHud-package.tar" .
}
release() {
@ -179,9 +167,10 @@ clean() {
uninstall() {
[ "$UID" -eq 0 ] || exec sudo bash "$0" uninstall
rm -rfv "/usr/lib/MangoHud"
rm -rfv "/usr/lib/mangohud"
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"
}

@ -0,0 +1 @@
@libdir_mangohud@

@ -30,6 +30,12 @@ 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',
@ -207,6 +213,12 @@ vk_enum_to_str = custom_target(
],
)
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'),
)
util_files = files(
'src/mesa/util/os_socket.c',
'src/mesa/util/os_time.c',

@ -1,2 +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.')

@ -0,0 +1,22 @@
{
"file_format_version" : "1.0.0",
"layer" : {
"name": "MangoHud",
"type": "GLOBAL",
"api_version": "1.1.125",
"library_path": "@libdir_mangohud@/libMangoHud.so",
"implementation_version": "1",
"description": "Vulkan Hud Overlay",
"functions": {
"vkGetInstanceProcAddr": "overlay_GetInstanceProcAddr",
"vkGetDeviceProcAddr": "overlay_GetDeviceProcAddr"
},
"enable_environment": {
"MANGOHUD": "1"
},
"disable_environment": {
"DISABLE_MANGOHUD": "1"
}
}
}

@ -83,10 +83,16 @@ vklayer_mesa_overlay = shared_library(
dep_vulkan],
include_directories : [inc_common, inc_opengl],
link_args : cc.get_supported_link_arguments(['-Wl,-Bsymbolic-functions', '-Wl,-z,relro']),
install_dir : join_paths(get_option('libdir'), 'mangohud'),
install_dir : libdir_mangohud,
install : true
)
#configure_file(input : 'mangohud.json.in',
# output : 'mangohud.json',
# configuration : { 'libdir_mangohud' : libdir_mangohud },
# install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'),
#)
install_data(
files('mangohud.json'),
install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'),

Loading…
Cancel
Save