MangoHud/build.sh

63 lines
1.8 KiB
Bash
Raw Normal View History

2020-01-28 07:20:23 +00:00
#!/bin/bash
DATA_DIR=$HOME/.local/share/MangoHud
LAYER=build/release/usr/share/vulkan/implicit_layer.d/mangohud.json
2020-01-28 07:20:23 +00:00
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/usr
2020-01-28 07:20:23 +00:00
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/usr
2020-01-28 07:20:23 +00:00
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/usr/lib32/libMangoHud.so $DATA_DIR/libMangoHud32.so
cp build/release/usr/lib64/libMangoHud.so $DATA_DIR/libMangoHud.so
2020-01-28 07:20:23 +00:00
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
}
package() {
cd build/release
tar czf ../../MangoHud.tar.gz *
}
2020-01-28 07:20:23 +00:00
clean() {
2020-01-28 10:12:49 +00:00
rm -r build
2020-01-28 07:20:23 +00:00
}
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;;
"package") package;;
2020-01-28 07:20:23 +00:00
"clean") clean;;
"uninstall") uninstall;;
*)
echo "Unrecognized command argument: $1"
echo 'Accepted arguments: "", "build", "install", "package", "clean", "uninstall".'
esac