alvr/main.sh

85 lines
3.1 KiB
Bash
Raw Normal View History

2023-08-05 19:08:32 +02:00
#! /bin/bash
2023-08-05 20:33:42 +02:00
set -e
2024-07-28 17:49:17 +02:00
VERSION=20.9.1
2023-08-05 19:08:32 +02:00
2024-07-28 17:49:17 +02:00
source ./pika-build-config.sh
echo "$PIKA_BUILD_ARCH" > pika-build-arch
2024-07-28 18:12:51 +02:00
export PATH=$PATH:/root/.cargo/bin
2023-08-05 19:08:32 +02:00
# Get build deps
apt-get build-dep ./ -y
2024-07-28 17:49:17 +02:00
apt-get install curl -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | CARGO_HOME=/root/.cargo sh -s -- -y
2023-08-05 19:36:32 +02:00
# Build ALVR
2024-07-28 17:49:17 +02:00
git clone https://github.com/alvr-org/ALVR --recursive -b v"$VERSION"
2023-08-05 19:36:32 +02:00
cd ./ALVR
export CARGO_PROFILE_RELEASE_LTO=true
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
sed -i 's:../../../lib64/libalvr_vulkan_layer.so:libalvr_vulkan_layer.so:' alvr/vulkan_layer/layer/alvr_x86_64.json
cargo fetch --locked --target "x86_64-unknown-linux-gnu"
export ALVR_ROOT_DIR=/usr
2023-10-04 20:43:12 +02:00
export ALVR_LIBRARIES_DIR="$ALVR_ROOT_DIR/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
2023-08-05 19:36:32 +02:00
export ALVR_OPENVR_DRIVER_ROOT_DIR="$ALVR_LIBRARIES_DIR/steamvr/alvr/"
export ALVR_VRCOMPOSITOR_WRAPPER_DIR="$ALVR_LIBRARIES_DIR/alvr/"
export FIREWALL_SCRIPT_DIR="$ALVR_ROOT_DIR/share/alvr/"
cargo run --release --frozen -p alvr_xtask -- prepare-deps --platform linux
cargo build \
--frozen \
--release \
-p alvr_server \
-p alvr_dashboard \
-p alvr_vulkan_layer \
-p alvr_vrcompositor_wrapper
for res in 16x16 32x32 48x48 64x64 128x128 256x256; do
mkdir -p "icons/hicolor/${res}/apps/"
convert 'alvr/dashboard/resources/dashboard.ico' -thumbnail "${res}" -alpha on -background none -flatten "./icons/hicolor/${res}/apps/alvr.png"
done
mkdir -p ../alvr
cp -rvf ../debian ../alvr/
# Make ALVR Dir
2024-07-28 17:55:59 +02:00
install -Dm644 LICENSE -t "../alvr/usr/share/licenses/alvr/"
2023-08-05 19:36:32 +02:00
install -Dm755 target/release/alvr_dashboard -t "../alvr/usr/bin/"
# vrcompositor wrapper
2024-07-28 17:55:59 +02:00
install -Dm755 target/release/alvr_vrcompositor_wrapper "../alvr/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/alvr/vrcompositor-wrapper"
2023-08-05 19:36:32 +02:00
# OpenVR Driver
2024-07-28 17:55:59 +02:00
install -Dm644 target/release/libalvr_server.so "../alvr/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/steamvr/alvr/bin/linux64/driver_alvr_server.so"
install -Dm644 alvr/xtask/resources/driver.vrdrivermanifest -t "../alvr/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/steamvr/alvr/"
2023-08-05 19:36:32 +02:00
# Vulkan Layer
2024-07-28 17:55:59 +02:00
install -Dm644 target/release/libalvr_vulkan_layer.so -t "../alvr/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/"
2023-08-05 19:36:32 +02:00
install -Dm644 alvr/vulkan_layer/layer/alvr_x86_64.json -t "../alvr/usr/share/vulkan/explicit_layer.d/"
# Desktop
2024-07-28 17:55:59 +02:00
install -Dm644 alvr/xtask/resources/alvr.desktop -t "../alvr/usr/share/applications"
2023-08-05 19:36:32 +02:00
# Icons
install -d ../alvr/usr/share/icons/hicolor/{16x16,32x32,48x48,64x64,128x128,256x256}/apps/
cp -ar icons/* ../alvr/usr/share/icons/
# Firewall
2024-07-28 17:55:59 +02:00
install -Dm644 "alvr/xtask/firewall/alvr-firewalld.xml" "../alvr/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/firewalld/services/alvr.xml"
install -Dm644 "alvr/xtask/firewall/ufw-alvr" -t "../alvr/etc/ufw/applications.d/"
2023-08-05 19:36:32 +02:00
2024-07-28 17:55:59 +02:00
install -Dm755 "alvr/xtask/firewall/alvr_fw_config.sh" -t "../alvr/usr/share/alvr/"
2023-08-05 19:36:32 +02:00
cd ../alvr
2023-08-05 19:08:32 +02:00
# Build package
2024-07-28 17:49:17 +02:00
LOGNAME=root dh_make --createorig -y -l -p alvr_"$VERSION" || echo "dh-make: Ignoring Last Error"
2023-08-05 19:08:32 +02:00
dpkg-buildpackage --no-sign
# Move the debs to output
cd ../
mkdir -p ./output
mv ./*.deb ./output/