XR packaging for Fedora Atomic
1# SPDX-License-Identifier: AGPL-3.0-only
2# Copyright (c) 2025 Shiloh Fen <shiloh@shilohfen.com>
3class WlxOverlayS < Formula
4 desc "Access your Wayland desktop from Monado/WiVRn"
5 homepage "https://github.com/galister/wlx-overlay-s"
6 url "https://github.com/galister/wlx-overlay-s/archive/refs/tags/v25.4.2.tar.gz"
7 sha256 "c2be093a815fa69fee65235bad573be8c1ac7959b5bad197f9e4201cc15da5ba"
8 license "GPL-3.0-only"
9
10 depends_on "alsa-lib" => :build
11 depends_on "dbus" => :build
12 depends_on "gcc" => :build
13 depends_on "libpipewire" => :build
14 depends_on "libxkbcommon" => :build
15 depends_on "nushell" => :build
16 depends_on "rust" => :build
17 depends_on "shaderc" => :build
18 depends_on "fontconfig"
19 depends_on :linux
20 depends_on "mesa"
21 depends_on "openxr-generated"
22 depends_on "wayland"
23
24 def install
25 ENV["SHADERC_LIB_DIR"] = Formula["shaderc"].opt_lib.to_s
26
27 # HACK: temporarily disable fixincludes for pthread.h, see https://github.com/orgs/Homebrew/discussions/6193
28 # Maybe building with LLVM clang would be a better idea?
29 system "nu", "-c", <<~EOF
30 try {
31 ls /home/linuxbrew/.linuxbrew/Cellar/gcc/*/lib/gcc/current/gcc/x86_64-pc-linux-gnu/*/include-fixed/pthread.h
32 | each {|file| mv $file.name $'($file.name).bak'};
33 print 'GCC Fixincludes disabled for `pthread.h`'
34 } catch {
35 print 'WARNING: Failed to disable pthread.h fixincludes from GCC.'
36 }
37 EOF
38
39 system "cargo", "install",
40 "--no-default-features",
41 "--features", "openxr,wayland,pipewire,osc,wayvr",
42 *std_cargo_args
43
44 # HACK: re-enable pthread.h fixincludes
45 system "nu", "-c", <<~EOF
46 try {
47 ls /home/linuxbrew/.linuxbrew/Cellar/gcc/*/lib/gcc/current/gcc/x86_64-pc-linux-gnu/*/include-fixed/pthread.h.bak
48 | each {|file| mv $file.name ($file.name | str substring 0..-5)};
49 print 'GCC Fixincludes re-enabled for `pthread.h`'
50 } catch {
51 print 'WARNING: Failed to re-enable pthread.h fixincludes from GCC.'
52 }
53 EOF
54 end
55
56 def caveats
57 "AtomicXR's WlxOverlay-S formula does not currently support X11 & OpenVR."
58 end
59
60 test do
61 # TODO: improve test
62 system bin/"wlx-overlay-s", "--version"
63 end
64end