Add Flatpak (#1683)

* Add Flatpak manifest

* Add x264

* Update x264 module

* Update to llvm16

* Update Flatpak README

* Fix paths for llvm

* Update readme for flatpak

* Update manifest and modules

* Disable LTO on FFMPEG and move manifest to xtask

* Remove nv-codec-headers

* Add Flatpak wiki page
This commit is contained in:
Charlie Le 2023-07-02 23:58:31 -04:00 committed by GitHub
parent b241470a40
commit f5448ff7d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 245 additions and 1 deletions

3
.gitignore vendored
View File

@ -61,3 +61,6 @@ deps
node_modules
# The .gitignore for android is project folder.
# flatpak
.flatpak*

View File

@ -0,0 +1,40 @@
# ALVR Flatpak
This is an experimental Flatpak for ALVR! It is **only** compatible with the Flatpak version of Steam! For all non-Flatpak Steam users, use the AppImage that is already provided.
## Installation
Currently, no precompiled builds are available. However, building from source does not take very long, and just requires the usage of the terminal.
1. Install the Flatpak dependencies
```
flatpak install flathub org.flatpak.Builder org.freedesktop.Sdk//22.08 \
org.freedesktop.Sdk.Extension.llvm16//22.08 \
org.freedesktop.Sdk.Extension.rust-stable//22.08
```
2. Clone and enter this repository
```
git clone https://github.com/alvr-org/ALVR.git
cd ALVR
```
3. Build and install the flatpak
```
flatpak run org.flatpak.Builder --user --install --force-clean .flatpak-build-dir alvr/xtask/flatpak/com.valvesoftware.Steam.Utility.alvr.json
```
## Usage
To launch the ALVR Dashboard, run the following command:
```
flatpak run --command=alvr_dashboard com.valvesoftware.Steam
```
## Caveats
Launching SteamVR from the dashboard will always launch a new instance of Steam. To avoid this, register the ALVR driver with Steam from the dashboard. However, the dashboard will not appear if SteamVR is launched from Steam. If any configuration needs to be made, launch the dashboard like the above. If the visibility of the Steam client does not matter, then simply launch SteamVR from the dashboard. Otherwise, launch SteamVR from inside of Steam after the driver is registered.

View File

@ -0,0 +1,13 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=ALVR
GenericName=Game
Comment=ALVR is an open source remote VR display which allows playing SteamVR games on a standalone headset such as Gear VR or Oculus Go/Quest.
Exec=/usr/bin/flatpak run --command=alvr_dashboard com.valvesoftware.Steam
Icon=alvr
Categories=Game;
StartupNotify=true
PrefersNonDefaultGPU=true
X-KDE-RunOnDiscreteGpu=true
StartupWMClass=ALVR

View File

@ -0,0 +1,63 @@
{
"id": "com.valvesoftware.Steam.Utility.alvr",
"branch": "stable",
"sdk": "org.freedesktop.Sdk//22.08",
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.llvm16",
"org.freedesktop.Sdk.Extension.rust-stable"
],
"runtime": "com.valvesoftware.Steam",
"runtime-version": "stable",
"build-extension": true,
"appstream-compose": false,
"separate-locales": false,
"build-options": {
"prefix": "/app/utils/alvr",
"append-path": "/usr/lib/sdk/llvm16/bin:/usr/lib/sdk/rust-stable/bin:/app/utils/alvr/bin",
"prepend-ld-library-path": "/app/utils/alvr/lib",
"prepend-pkg-config-path": "/app/utils/alvr/lib/pkgconfig",
"strip": true,
"env": {
"PREFIX": "/app/utils/alvr"
},
"build-args": [
"--share=network"
]
},
"cleanup": [
"/lib/*.a",
"/lib/*.la",
"/share/doc",
"/share/man"
],
"modules": [
{
"name": "alvr",
"buildsystem": "simple",
"build-options": {
"env": {
"RUST_BACKTRACE": "full",
"CURL_HOME": "/run/build/alvr",
"CPATH": "/app/utils/alvr/include"
}
},
"build-commands": [
"echo 'insecure' >> .curlrc",
"cargo xtask prepare-deps --platform linux --no-nvidia",
"cargo xtask build-streamer --release",
"cp -r /run/build/alvr/build/alvr_streamer_linux/* /app/utils/alvr"
],
"modules": [
"modules/yasm/yasm.json",
"modules/vulkan-headers/vulkan-headers.json",
"modules/x264/x264.json"
],
"sources": [
{
"type": "dir",
"path": "../../../"
}
]
}
]
}

View File

@ -0,0 +1,11 @@
{
"name": "vulkan-headers",
"buildsystem": "cmake",
"sources": [
{
"type": "git",
"url": "https://github.com/KhronosGroup/Vulkan-Headers.git",
"tag": "v1.3.249"
}
]
}

View File

@ -0,0 +1,16 @@
{
"name": "x264",
"config-opts": [
"--prefix=/app/utils/alvr",
"--enable-pic",
"--enable-shared",
"--disable-cli"
],
"sources": [
{
"type": "git",
"url": "https://code.videolan.org/videolan/x264.git",
"commit": "baee400fa9ced6f5481a728138fed6e867b0ff7f"
}
]
}

View File

@ -0,0 +1,13 @@
{
"name": "yasm",
"sources": [
{
"type": "archive",
"url": "https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz",
"sha256": "3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f"
}
],
"cleanup": [
"*"
]
}

View File

@ -125,7 +125,6 @@ pub fn build_ffmpeg_linux(nvenc_flag: bool) {
"--disable-swscale",
"--disable-postproc",
"--disable-network",
"--enable-lto",
"--disable-everything",
"--enable-encoder=h264_vaapi",
"--enable-encoder=hevc_vaapi",

86
wiki/Flatpak.md Normal file
View File

@ -0,0 +1,86 @@
## Installing ALVR and using SteamVR on Linux through Flatpak
## Disclaimer
1. This is not a fully-featured version of ALVR! It lacks Nvidia support, a desktop file, and has bugs related to Flatpak sandboxing
2. Nvidia GPUs are currently not supported
3. Native Linux SteamVR utility applications such as OpenVRAS are not supported nor tested, use at your own risk
4. Firewall configuration does not work
5. Any scripts that affect the host will run within the sandbox
6. Sometimes, a new instance of Steam will launch when launching the dashboard. To fix this, close both ALVR and Steam then launch Steam. As soon as Steam is opens to the storefront, launch the ALVR dashboard.
7. The ALVR Dashboard is not available in the Applications menu. To run the dashboard, run the following command to run `alvr_dashboard` in the Steam Flatpak environment:
```
flatpak run --command=alvr_dashboard com.valvesoftware.Steam
```
## Dependencies
First, flatpak must be installed from your distro's repositories. Refer to [this page](https://flatpak.org/setup/) to find the instructions for your distro.
Once Flatpak is installed, the flatpak dependencies must also be installed. They are:
* Flatpak Builder
* Rust
* LLVM
* Freedesktop SDK
* Steam
These can be installed like so:
```
flatpak install flathub org.flatpak.Builder \
org.freedesktop.Sdk//22.08 \
org.freedesktop.Sdk.Extension.llvm16//22.08 \
org.freedesktop.Sdk.Extension.rust-stable//22.08 \
com.valvesoftware.Steam
```
AMD users may need to install the appropriate Mesa codec extensions as well:
```
flatpak install flathub org.freedesktop.Platform.GL.default//22.08-extra \
org.freedesktop.Platform.GL32.default//22.08-extra
```
## Build and Install
Once the dependencies are fulfilled, clone and enter the repository.
```
git clone https://github.com/alvr-org/ALVR.git
cd ALVR
```
Once inside the repository, simply run the following command to build and install the Flatpak.
```
flatpak run org.flatpak.Builder --user --install --force-clean .flatpak-build-dir alvr/xtask/flatpak/com.valvesoftware.Steam.Utility.alvr.json
```
## Notes
### Running the dashboard
To run the ALVR Dashboard, run the following command:
```
flatpak run --command=alvr_dashboard com.valvesoftware.Steam
```
A desktop file named `com.valvesoftware.Steam.Utility.alvr.desktop` is supplied within the `alvr/xtask/flatpak` directory. Move this to where other desktop files are located on your system in order to run the dashboard without the terminal.
### Other Applications
The support for other applications that are not launched via Steam is non-existent due to the Flatpak sandbox.
Various SteamVR utilities such as [WlxOverlay](https://github.com/galister/WlxOverlay) and [OpenVR-AdvancedSettings](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings) cannot run within the Flatpak sandbox due to their usage of AppImage. However, unpacking the supplied AppImage or building the utilities from source and running their binaries from within the sandbox similiarly to `alvr_dashboard` could work, but there is no guarantee that they will work properly.
Some applications such as [Godot](https://godotengine.org) support OpenXR. However, unless they are launched within the Steam Flatpak sandbox, they will not work with the Steam Flatpak. See [here](https://github.com/flathub/com.valvesoftware.Steam/issues/1010) for more details.