diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 831ad1b6..2ac57b0f 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -54,9 +54,9 @@ jobs: # For easier packaging, build dependencies are made available as a separate archive run: (cd build/_deps/ ; tar --create --xz *-src) > server-build-deps.tar.xz - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + # - name: Build + # # Build your program with the given configuration + # run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - name: Publish build dependencies uses: actions/upload-artifact@v4 @@ -73,6 +73,35 @@ jobs: draft: true files: server-build-deps.tar.xz + + build-server-flatpak: + name: Linux server (flatpak) + needs: build-server + runs-on: ubuntu-latest + container: + image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08 + options: --privileged + + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + name: Download server build dependencies + with: + name: server-build-deps + path: . + + - name: Extract server build dependencies + run: | + mkdir -p deps + tar --file server-build-deps.tar.xz --directory=deps --extract + + - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + manifest-path: flatpak/org.meumeu.wivrn-server.yml + bundle: wivrn-server.flatpak + + build-test-client: name: Linux client runs-on: ubuntu-22.04 diff --git a/flatpak/opencomposite-0001-Add-install-target.patch b/flatpak/opencomposite-0001-Add-install-target.patch new file mode 100644 index 00000000..d4f5d7b0 --- /dev/null +++ b/flatpak/opencomposite-0001-Add-install-target.patch @@ -0,0 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5956a67..3f0fda1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -528,3 +528,11 @@ set_target_properties(OCOVR PROPERTIES + get_target_property(output_dir OCOVR LIBRARY_OUTPUT_DIRECTORY) + add_custom_command(TARGET OCOVR + PRE_LINK COMMAND ${CMAKE_COMMAND} -E make_directory ${output_dir}) ++ ++# Installation ++include(GNUInstallDirs) ++install(TARGETS OCOVR ++ LIBRARY ++ DESTINATION "${PROJECT_NAME}/${VRCLIENT_DIR}" ++ COMPONENT Runtime ++) +-- +2.45.2 + diff --git a/flatpak/org.meumeu.wivrn-server.appdata.xml b/flatpak/org.meumeu.wivrn-server.appdata.xml new file mode 100644 index 00000000..291dd1ff --- /dev/null +++ b/flatpak/org.meumeu.wivrn-server.appdata.xml @@ -0,0 +1,16 @@ + + + org.meumeu.wivrn-server + WiVRn server + FSFAP + GPL-3.0+ + The WiVRn server +

The WiVRn server, long description TBD

+ + + + + launch-wivrn-server + + +
diff --git a/flatpak/org.meumeu.wivrn-server.desktop b/flatpak/org.meumeu.wivrn-server.desktop new file mode 100644 index 00000000..91c17305 --- /dev/null +++ b/flatpak/org.meumeu.wivrn-server.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=WiVRn server +Comment=TBD +GenericName=TBD +Exec=launch-wivrn-server +Icon=org.meumeu.wivrn +Type=Application +Categories=ConsoleOnly +Keywords=wivrn; diff --git a/flatpak/org.meumeu.wivrn-server.yml b/flatpak/org.meumeu.wivrn-server.yml new file mode 100644 index 00000000..92cc5f66 --- /dev/null +++ b/flatpak/org.meumeu.wivrn-server.yml @@ -0,0 +1,201 @@ +id: org.meumeu.wivrn-server +runtime: org.freedesktop.Platform +runtime-version: '23.08' +sdk: org.freedesktop.Sdk +command: launch-wivrn-server + +add-extensions: + org.freedesktop.Platform.VAAPI.Intel: + version: '23.08' + directory: lib/dri + add-ld-path: lib + subdirectories: true + no-autodownload: true + autodelete: true +cleanup-commands: + - mkdir -p ${FLATPAK_DEST}/lib/dri + +modules: + - name: libavahi-client + buildsystem: autotools + config-opts: + - --disable-mono + - --enable-compat-libdns_sd + - --with-autoipd-group=avahi + - --with-autoipd-user=avahi + - --with-avahi-priv-access-group=network + - --disable-libdaemon + - --with-distro=none + - --disable-libevent + - --disable-qt4 + - --disable-qt5 + - --disable-gtk + - --disable-gtk3 + - --disable-python + - --disable-manpages + - --disable-static + sources: + - type: git + url: https://github.com/avahi/avahi.git + tag: v0.8 + cleanup: + - /share/locale + - /share/runtime/locale + - /bin/avahi-* + + - name: x264 + buildsystem: autotools + config-opts: + - --enable-shared + sources: + - type: git + url: https://code.videolan.org/videolan/x264.git + tag: 31e19f92f00c7003fa115047ce50978bc98c3a0d + cleanup: + - /bin/x264 + + - name: ffmpeg-libdrm + config-opts: + - --optflags="${CFLAGS}" + - --extra-ldflags="${LDFLAGS}" + - --disable-stripping + - --disable-debug + - --disable-doc + - --disable-static + - --disable-everything + - --enable-shared + - --enable-libdrm + - --enable-vaapi + - --enable-pthreads + - --enable-encoder=hevc_vaapi,h264_vaapi,av1_vaapi + build-commands: + - make install + cleanup: + - /share/ffmpeg + + sources: + - type: git + url: https://gitlab.com/freedesktop-sdk/mirrors/ffmpeg/ffmpeg.git + tag: n7.0.1 + + - name: eigen3 + buildsystem: cmake-ninja + config-opts: + - -DBUILD_TESTING=OFF + builddir: true + sources: + - type: git + url: https://gitlab.com/libeigen/eigen.git + tag: 3.4.0 + cleanup: + - '*' + + - name: nlohmann_json + buildsystem: cmake-ninja + config-opts: + - -DJSON_BuildTests=OFF + sources: + - type: git + url: https://github.com/nlohmann/json.git + tag: v3.11.3 + + - name: cli11 + buildsystem: cmake-ninja + config-opts: + - -DCMAKE_BUILD_TYPE=RelWithDebInfo + - -DBUILD_TESTING=OFF + - -DCLI11_BUILD_TESTS=OFF + - -DCLI11_BUILD_EXAMPLES=OFF + sources: + - type: git + url: https://github.com/CLIUtils/CLI11 + tag: v2.4.2 + cleanup: + - '*' + + - name: wivrn + buildsystem: cmake-ninja + config-opts: + - -DCMAKE_BUILD_TYPE=RelWithDebInfo + - -DWIVRN_BUILD_CLIENT=OFF + - -DWIVRN_USE_VAAPI=ON + - -DWIVRN_USE_X264=ON + - -DWIVRN_USE_NVENC=ON + - -DWIVRN_USE_PULSEAUDIO=OFF + - -DFETCHCONTENT_FULLY_DISCONNECTED=ON + - -DFETCHCONTENT_BASE_DIR=deps + - -DXRT_IPC_MSG_SOCK_FILENAME=wivrn/comp_ipc + - -Wno-dev + sources: + - type: dir + path: .. + # This assumes server-build-deps.tar.xz from the CI is extracted in the deps subdirectory + + - name: opencomposite + buildsystem: cmake-ninja + config-opts: + - -DUSE_SYSTEM_OPENXR=OFF + - -DUSE_SYSTEM_GLM=OFF + sources: + - type: git + url: https://gitlab.com/znixian/OpenOVR.git + tag: 632e5cc50b913e93194ca2970e6f13021182579f + - type: patch + paths: + - opencomposite-0001-Add-install-target.patch + + - name: launcher + buildsystem: simple + build-commands: + - install -Dm755 launch-wivrn-server.sh ${FLATPAK_DEST}/bin/launch-wivrn-server + sources: + - type: script + dest-filename: launch-wivrn-server.sh + commands: + - rm -f $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath + - sed -ne 's#app-path=\(.*\)#{"runtime":["\1/OpenComposite"],"version":1}#p' /.flatpak-info > $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath + - chmod -w $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath + - wivrn-server + + - name: appdata + buildsystem: simple + build-commands: + - install -Dm644 org.meumeu.wivrn-server.appdata.xml -t ${FLATPAK_DEST}/share/appdata + sources: + - type: file + path: org.meumeu.wivrn-server.appdata.xml + +cleanup: + - /lib/pkgconfig + - /share/pkgconfig + - /include + - /share/man + - /share/cmake + - /share/gir-1.0 + - /lib/girepository-1.0 + - /lib/systemd + - '*.a' + - '*.la' + +finish-args: + # X11 + XShm access + - --share=ipc + - --socket=fallback-x11 + # Wayland access + - --socket=wayland + # GPU acceleration if needed + - --device=dri + # Needs to talk to the network + - --share=network + # Announce WiVRn via avahi + # - --system-talk-name=org.freedesktop.Avahi + # Allow getting the pretty hostname + # - --system-talk-name=org.freedesktop.hostname1 + - --socket=system-bus # workaround bug between sd-bus (https://github.com/systemd/systemd/issues/16610) and xdg-dbus-proxy (https://github.com/flatpak/xdg-dbus-proxy/issues/21) + # Pipewire + - --filesystem=xdg-run/pipewire-0 + # Set the active OpenXR / OpenVR runtime + - --filesystem=xdg-config/openxr:create + - --filesystem=xdg-config/openvr:create + # Let outside application access the WiVRn socket + - --filesystem=xdg-run/wivrn:create