alvr: build from source
Co-authored-by: Justinas Stankevicius <justinas@justinas.org>
This commit is contained in:
parent
9908000d50
commit
7c2572e5cf
7328
pkgs/by-name/al/alvr/Cargo.lock
generated
Normal file
7328
pkgs/by-name/al/alvr/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
45
pkgs/by-name/al/alvr/fix-finding-libs.patch
Normal file
45
pkgs/by-name/al/alvr/fix-finding-libs.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 1e792a4e7356f070856e4bf5775a07b18c3cc5ee Mon Sep 17 00:00:00 2001
|
||||
From: jopejoe1 <johannes@joens.email>
|
||||
Date: Sat, 7 Sep 2024 23:28:25 +0200
|
||||
Subject: [PATCH] fix finding libs
|
||||
|
||||
---
|
||||
alvr/server_openvr/build.rs | 18 +++---------------
|
||||
alvr/session/build.rs | 4 +---
|
||||
2 files changed, 4 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/alvr/server_openvr/build.rs b/alvr/server_openvr/build.rs
|
||||
index b9bc4bd8..0581de0d 100644
|
||||
--- a/alvr/server_openvr/build.rs
|
||||
+++ b/alvr/server_openvr/build.rs
|
||||
@@ -1,24 +1,12 @@
|
||||
-use std::{env, path::PathBuf};
|
||||
+use std::{env, path::{Path, PathBuf}};
|
||||
|
||||
fn get_ffmpeg_path() -> PathBuf {
|
||||
- let ffmpeg_path = alvr_filesystem::deps_dir()
|
||||
- .join(if cfg!(target_os = "linux") {
|
||||
- "linux"
|
||||
- } else {
|
||||
- "windows"
|
||||
- })
|
||||
- .join("ffmpeg");
|
||||
-
|
||||
- if cfg!(target_os = "linux") {
|
||||
- ffmpeg_path.join("alvr_build")
|
||||
- } else {
|
||||
- ffmpeg_path
|
||||
- }
|
||||
+ Path::new("@ffmpeg@").to_owned()
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "linux", feature = "gpl"))]
|
||||
fn get_linux_x264_path() -> PathBuf {
|
||||
- alvr_filesystem::deps_dir().join("linux/x264/alvr_build")
|
||||
+ Path::new("@x264@").to_owned()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
--
|
||||
2.46.0
|
||||
|
@ -1,34 +1,154 @@
|
||||
{ lib,
|
||||
appimageTools,
|
||||
fetchurl,
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
substituteAll,
|
||||
nix-update-script,
|
||||
pkg-config,
|
||||
autoAddDriverRunpath,
|
||||
alsa-lib,
|
||||
brotli,
|
||||
bzip2,
|
||||
celt,
|
||||
ffmpeg,
|
||||
jack2,
|
||||
lame,
|
||||
libX11,
|
||||
libXi,
|
||||
libXrandr,
|
||||
libXcursor,
|
||||
libdrm,
|
||||
libglvnd,
|
||||
libogg,
|
||||
libpng,
|
||||
libtheora,
|
||||
libunwind,
|
||||
libva,
|
||||
libvdpau,
|
||||
libxkbcommon,
|
||||
openssl,
|
||||
openvr,
|
||||
pipewire,
|
||||
rust-cbindgen,
|
||||
soxr,
|
||||
vulkan-headers,
|
||||
vulkan-loader,
|
||||
wayland,
|
||||
x264,
|
||||
xvidcore,
|
||||
}:
|
||||
let
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "alvr";
|
||||
version = "20.6.1";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/alvr-org/ALVR/releases/download/v${version}/ALVR-x86_64.AppImage";
|
||||
hash = "sha256-IYw3D18xUGWiFu74c4d8d4tohZztAD6mmZCYsDNxR+A=";
|
||||
version = "20.11.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "alvr-org";
|
||||
repo = "ALVR";
|
||||
rev = "refs/tags/v${version}";
|
||||
fetchSubmodules = true; #TODO devendor openvr
|
||||
hash = "sha256-zqeh9U0A/KHlRieq9Lf+7f04K3JG/vpE2gZ916ReXLc=";
|
||||
};
|
||||
|
||||
appimageContents = appimageTools.extractType2 { inherit pname version src; };
|
||||
in
|
||||
appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
"openxr-0.19.0" = "sha256-bnMSjJh+zjLw4Pdxr7LLm6qYAJOK7hz5xORKZ2pVcGw=";
|
||||
"settings-schema-0.2.0" = "sha256-luEdAKDTq76dMeo5kA+QDTHpRMFUg3n0qvyQ7DkId0k=";
|
||||
};
|
||||
};
|
||||
|
||||
extraInstallCommands = ''
|
||||
install -Dm444 ${appimageContents}/alvr.desktop -t $out/share/applications
|
||||
substituteInPlace $out/share/applications/alvr.desktop \
|
||||
--replace-fail 'Exec=alvr_dashboard' 'Exec=alvr'
|
||||
cp -r ${appimageContents}/usr/share/icons $out/share
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./fix-finding-libs.patch;
|
||||
ffmpeg = lib.getDev ffmpeg;
|
||||
x264 = lib.getDev x264;
|
||||
})
|
||||
];
|
||||
|
||||
env = {
|
||||
NIX_CFLAGS_COMPILE = toString [
|
||||
"-lbrotlicommon"
|
||||
"-lbrotlidec"
|
||||
"-lcrypto"
|
||||
"-lpng"
|
||||
"-lssl"
|
||||
];
|
||||
};
|
||||
|
||||
RUSTFLAGS = map (a: "-C link-arg=${a}") [
|
||||
"-Wl,--push-state,--no-as-needed"
|
||||
"-lEGL"
|
||||
"-lwayland-client"
|
||||
"-lxkbcommon"
|
||||
"-Wl,--pop-state"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
rust-cbindgen
|
||||
pkg-config
|
||||
rustPlatform.bindgenHook
|
||||
autoAddDriverRunpath
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
alsa-lib
|
||||
brotli
|
||||
bzip2
|
||||
celt
|
||||
ffmpeg
|
||||
jack2
|
||||
lame
|
||||
libX11
|
||||
libXcursor
|
||||
libXi
|
||||
libXrandr
|
||||
libdrm
|
||||
libglvnd
|
||||
libogg
|
||||
libpng
|
||||
libtheora
|
||||
libunwind
|
||||
libva
|
||||
libvdpau
|
||||
libxkbcommon
|
||||
openssl
|
||||
openvr
|
||||
pipewire
|
||||
soxr
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
wayland
|
||||
x264
|
||||
xvidcore
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
# Build SteamVR driver ("streamer")
|
||||
cargo xtask build-streamer --release
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -Dm755 ${src}/alvr/xtask/resources/alvr.desktop $out/share/applications/alvr.desktop
|
||||
install -Dm644 ${src}/resources/alvr.png $out/share/icons/hicolor/256x256/apps/alvr.png
|
||||
|
||||
# Install SteamVR driver
|
||||
mkdir -p $out/{libexec,lib/alvr,share}
|
||||
cp -r ./build/alvr_streamer_linux/lib64/. $out/lib
|
||||
cp -r ./build/alvr_streamer_linux/libexec/. $out/libexec
|
||||
cp -r ./build/alvr_streamer_linux/share/. $out/share
|
||||
ln -s $out/lib $out/lib64
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = with lib; {
|
||||
description = "Stream VR games from your PC to your headset via Wi-Fi";
|
||||
homepage = "https://github.com/alvr-org/ALVR/";
|
||||
changelog = "https://github.com/alvr-org/ALVR/releases/tag/v${version}";
|
||||
license = licenses.mit;
|
||||
mainProgram = "alvr";
|
||||
mainProgram = "alvr_dashboard";
|
||||
maintainers = with maintainers; [ passivelemon ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user