From f3bedf3bce23773dc6894121f4bfdd3015b2bacb Mon Sep 17 00:00:00 2001 From: telans Date: Tue, 28 Jan 2020 20:20:23 +1300 Subject: [PATCH] add build script "build.sh" --- build.sh | 56 +++++++++++++++++++++++++++++++++++++++++++ src/meson.build | 5 ---- src/setup_mangohud.sh | 46 ----------------------------------- 3 files changed, 56 insertions(+), 51 deletions(-) create mode 100755 build.sh delete mode 100755 src/setup_mangohud.sh diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..915d013b --- /dev/null +++ b/build.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +DATA_DIR=$HOME/.local/share/MangoHud +LAYER=build/release/share/vulkan/implicit_layer.d/mangohud.json +IMPLICIT_LAYER_DIR=$HOME/.local/share/vulkan/implicit_layer.d + +configure() { + if [[ ! -d build/meson64 ]]; then + meson build/meson64 --libdir lib64 --prefix $PWD/build/release + + export CC="gcc -m32" + export CXX="g++ -m32" + export PKG_CONFIG_PATH="/usr/lib32/pkgconfig" + export LLVM_CONFIG="/usr/bin/llvm-config32" + meson build/meson32 --libdir lib32 --prefix $PWD/build/release + fi +} + +build() { + ninja -C build/meson32 install + ninja -C build/meson64 install +} + +install() { + mkdir -p $IMPLICIT_LAYER_DIR + mkdir -p $DATA_DIR + + cp build/release/lib32/libMangoHud.so $DATA_DIR/libMangoHud32.so + cp build/release/lib64/libMangoHud.so $DATA_DIR/libMangoHud.so + cp $LAYER $IMPLICIT_LAYER_DIR/mangohud64.json + cp $LAYER $IMPLICIT_LAYER_DIR/mangohud32.json + + sed -i "s|libMangoHud.so|$HOME/.local/share/MangoHud/libMangoHud32.so|g" $IMPLICIT_LAYER_DIR/mangohud32.json + sed -i "s|libMangoHud.so|$HOME/.local/share/MangoHud/libMangoHud.so|g" $IMPLICIT_LAYER_DIR/mangohud64.json + sed -i "s|64bit|32bit|g" $IMPLICIT_LAYER_DIR/mangohud32.json +} + +clean() { + rm -r make +} + +uninstall() { + rm -r $HOME/.local/share/MangoHud + rm $IMPLICIT_LAYER_DIR/{mangohud64,mangohud32}.json +} + +case $1 in + "") configure; build;; + "build") configure; build;; + "install") configure; build; install;; + "clean") clean;; + "uninstall") uninstall;; + *) + echo "Unrecognized command argument: $1" + echo 'Accepted arguments: "", "build", "install", "package", "clean", "uninstall".' +esac diff --git a/src/meson.build b/src/meson.build index 6add76c8..43ad0f0b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -70,11 +70,6 @@ install_data( install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), ) -install_data( - files('setup_mangohud.sh'), - install_dir: get_option('bindir'), -) - configure_file( input : files('mesa-overlay-control.py'), output : '@PLAINNAME@', diff --git a/src/setup_mangohud.sh b/src/setup_mangohud.sh deleted file mode 100755 index 9faaa17f..00000000 --- a/src/setup_mangohud.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -MANGOHUD_DIR=$HOME/.local/share/MangoHud/ -LIB64=$HOME/.local/share/MangoHud/libMangoHud64.so -LIB32=$HOME/.local/share/MangoHud/libMangoHud32.so -IMPLICIT_LAYER_DIR=$HOME/.local/share/vulkan/implicit_layer.d -EXPLICIT_LAYER_DIR=$HOME/.local/share/vulkan/explicit_layer.d - -install() { - mkdir -p $IMPLICIT_LAYER_DIR - mkdir -p $EXPLICIT_LAYER_DIR - mkdir -p $MANGOHUD_DIR - cp -v x32/libMangoHud32.so $MANGOHUD_DIR - cp -v x64/libMangoHud64.so $MANGOHUD_DIR - cp -v implicit_layer.d/mangohud32.json $IMPLICIT_LAYER_DIR - cp -v implicit_layer.d/mangohud64.json $IMPLICIT_LAYER_DIR - cp -v explicit_layer.d/mangohud32.json $EXPLICIT_LAYER_DIR - cp -v explicit_layer.d/mangohud64.json $EXPLICIT_LAYER_DIR - sed -i "s|libMangoHud.so|$LIB32|g" $IMPLICIT_LAYER_DIR/mangohud32.json - sed -i "s|libMangoHud.so|$LIB64|g" $IMPLICIT_LAYER_DIR/mangohud64.json - sed -i "s|64bit|32bit|g" $IMPLICIT_LAYER_DIR/mangohud32.json - sed -i "s|libMangoHud.so|$LIB32|g" $EXPLICIT_LAYER_DIR/mangohud32.json - sed -i "s|libMangoHud.so|$LIB64|g" $EXPLICIT_LAYER_DIR/mangohud64.json - sed -i "s|64bit|32bit|g" $EXPLICIT_LAYER_DIR/mangohud32.json - sed -i "s|mangohud|mangohud32|g" $EXPLICIT_LAYER_DIR/mangohud32.json -} - -uninstall() { - rm -v $MANGOHUD_DIR/libMangoHud32.so - rm -v $MANGOHUD_DIR/libMangoHud64.so - rm -v $IMPLICIT_LAYER_DIR/mangohud32.json - rm -v $IMPLICIT_LAYER_DIR/mangohud64.json -} - -case $1 in - "install") - install - ;; - "uninstall") - uninstall - ;; - *) - echo "Unrecognized action: $1" - echo "Usage: $0 [install|uninstall]" - exit 1 - ;; -esac \ No newline at end of file