# Build features %bcond_with x264 %global forgeurl https://github.com/Meumeu/WiVRn #%%global forgeurl https://github.com/damaestro/WiVRn %global commit 604089048fe9e261f33c922c29fabbdc41901c7c %global date 20240510 %global branch dev %forgemeta Name: wivrn Version: 0.14.1 Release: %autorelease Summary: OpenXR to HMD streaming application License: GPL-3.0-or-later URL: %{forgeurl} Source0: %{forgesource} # FIXME: split out to upstream sources vs the build-deps tar Source1: %{forgeurl}/releases/download/v%{version}/server-build-deps.tar.xz BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: git BuildRequires: glslc BuildRequires: ninja-build BuildRequires: pkgconfig(avahi-client) BuildRequires: pkgconfig(bluez) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(eigen3) BuildRequires: pkgconfig(glslang) BuildRequires: pkgconfig(gstreamer-1.0) BuildRequires: pkgconfig(gstreamer-app-1.0) BuildRequires: pkgconfig(gstreamer-video-1.0) BuildRequires: pkgconfig(hidapi-libusb) BuildRequires: pkgconfig(libavcodec) BuildRequires: pkgconfig(libavfilter) BuildRequires: pkgconfig(libavutil) BuildRequires: pkgconfig(libbsd) BuildRequires: pkgconfig(libcjson) BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libonnxruntime) BuildRequires: pkgconfig(libpipewire-0.3) BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(libusb-1.0) BuildRequires: pkgconfig(libuvc) BuildRequires: pkgconfig(libswscale) BuildRequires: pkgconfig(libva) BuildRequires: pkgconfig(nlohmann_json) BuildRequires: pkgconfig(opencv) BuildRequires: pkgconfig(openhmd) BuildRequires: pkgconfig(openvr) BuildRequires: pkgconfig(openxr) BuildRequires: pkgconfig(realsense2) BuildRequires: pkgconfig(sdl2) BuildRequires: pkgconfig(vulkan) BuildRequires: pkgconfig(wayland-client) BuildRequires: pkgconfig(wayland-eglstream) BuildRequires: pkgconfig(wayland-protocols) BuildRequires: pkgconfig(wayland-scanner) %if %{with x264} BuildRequires: pkgconfig(x264) %endif BuildRequires: pkgconfig(xrandr) BuildRequires: systemd-rpm-macros # FIXME: Add bundled() for server-build-deps # APK HACK BuildRequires: librsvg2-tools BuildRequires: wget # /APK HACK Suggests: libva-nvidia-driver Suggests: mesa-va-drivers-freeworld Suggests: intel-media-driver %description WiVRn lets you run OpenXR applications on a computer and display them on a standalone headset. %package clients Summary: WiVRn android clients Requires: android-tools BuildArch: noarch %description clients WiVRn android clients to be installed on HMDs. %prep %forgeautosetup -p1 %build # W: no-soname /usr/lib64/libopenxr_wivrn.so # W: no-manual-page-for-binary wivrn-server %cmake -GNinja \ -DCMAKE_PROJECT_VERSION=%{version} \ -DWIVRN_BUILD_CLIENT=OFF \ -DWIVRN_BUILD_SERVER=ON \ -DWIVRN_USE_VAAPI=ON \ %if %{with x264} -DWIVRN_USE_X264=ON \ %else -DWIVRN_USE_X264=OFF \ %endif -DWIVRN_USE_NVENC=ON \ -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ -DWIVRN_USE_ANDROID_VALIDATION_LAYER=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ %cmake_build # APK HACK # Gross, for now -- will need to package or pull in SDK differently set -eo pipefail VERSION=9477386 ANDROID_HOME=${ANDROID_HOME:-android-sdk} ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-32} ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-32.0.0} mkdir -p "$ANDROID_HOME" FN=commandlinetools-linux-${VERSION}_latest.zip wget https://dl.google.com/android/repository/$FN unzip $FN -d "$ANDROID_HOME/extract" mkdir -p "$ANDROID_HOME/cmdline-tools" mv "$ANDROID_HOME/extract/cmdline-tools/" "$ANDROID_HOME/cmdline-tools/latest/" mv "$ANDROID_HOME/extract/" "$ANDROID_HOME/cmdline-tools/" SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager echo "Installing the Android compile SDK platform android-${ANDROID_COMPILE_SDK}" echo y | $SDKMANAGER "platforms;android-${ANDROID_COMPILE_SDK}" >> /dev/null echo "Installing the Android platform tools" echo y | $SDKMANAGER "platform-tools" >> /dev/null echo "Installing the Android build tools ${ANDROID_BUILD_TOOLS}" echo y | $SDKMANAGER "build-tools;${ANDROID_BUILD_TOOLS}" >> /dev/null set +o pipefail yes | $SDKMANAGER --licenses set -o pipefail ANDROID_HOME=$ANDROID_HOME ./gradlew assembleStandard assembleStandardDebug assembleStandardDebugWithValidationLayer # /APK HACK %install %cmake_install # APK HACK install -m 0755 -vd %{buildroot}%{_datadir}/wivrn install -m 0644 -t %{buildroot}%{_datadir}/wivrn build/outputs/apk/standard/*/*.apk # /APK HACK %files %license COPYING %doc README.md %{_bindir}/wivrn-server %{_libdir}/libopenxr_wivrn.so %{_datarootdir}/openxr/1/openxr_wivrn.json %{_userunitdir}/wivrn.service %{_prefix}/lib/firewalld/services/wivrn.xml %files clients %license COPYING %doc README.md %{_datadir}/wivrn/* %changelog %autochangelog