File looking-glass.spec of Package looking-glass
#
# spec file for package looking-glass
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: looking-glass
Version: B7
Release: 0
Summary: An extremely low latency KVMFR (KVM FrameRelay)
License: GPL-2.0
URL: https://looking-glass.io/
Source0: https://github.com/gnif/LookingGlass/archive/refs/tags/LookingGlass-B7.tar.gz
BuildRequires: clang
BuildRequires: cmake
BuildRequires: make
BuildRequires: gcc13
BuildRequires: gcc13-c++
BuildRequires: Mesa-libEGL-devel
BuildRequires: Mesa-libGL-devel
BuildRequires: Mesa-libGLESv2-devel
BuildRequires: Mesa-libGLESv3-devel
BuildRequires: sdl2-compat-devel
BuildRequires: libSDL2_ttf-2_0-0
BuildRequires: nerd-dejavu-sansmono-fonts
BuildRequires: fontconfig-devel
BuildRequires: libdecor-0-0
BuildRequires: libXss-devel
BuildRequires: libvulkan1
BuildRequires: libwayland-egl1
BuildRequires: libXrandr-devel
BuildRequires: zlib-devel-static
BuildRequires: libglvnd-devel
BuildRequires: spice-protocol-devel
BuildRequires: obs-studio-devel
BuildRequires: libavutil57
BuildRequires: libnettle-devel
BuildRequires: vulkan-devel
BuildRequires: wayland-devel
BuildRequires: glibc-locale-base
BuildRequires: binutils-devel
BuildRequires: libX11-devel
BuildRequires: libXi-devel
BuildRequires: libconfig-devel
BuildRequires: pkgconf-pkg-config
BuildRequires: wayland-protocols-devel
BuildRequires: pkgconfig(libpipewire-0.3)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(samplerate)
BuildRequires: pkgconfig(xcursor)
BuildRequires: pkgconfig(xinerama)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(xpresent)
BuildRequires: libzstd-devel
BuildRequires: zstd
BuildRequires: libctf0
BuildRequires: binutils-devel
Epoch: 2
ExclusiveArch: x86_64 aarch64
%description
An extremely low latency KVMFR (KVM FrameRelay) implementation for guests with VGA PCI Passthrough.
%prep
%autosetup -p1 -n LookingGlass-%{version}
sed -i '1 i\#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"' host/platform/Linux/capture/pipewire/src/portal.c
sed -i '/find_library(BFD_LIBRARIES NAMES bfd)/a\
find_library(BFD_CTF_LIBRARY NAMES ctf)\
find_library(BFD_ZSTD_LIBRARY NAMES zstd)\
list(APPEND BFD_LIBRARIES ${BFD_CTF_LIBRARY} ${BFD_ZSTD_LIBRARY})' common/cmake/FindBFD.cmake
%build
export CC="gcc-13"
export CXX="g++-13"
export CFLAGS="%{optflags} -fPIC"
export CXXFLAGS="%{optflags} -fPIC"
export LDFLAGS="-pie"
mkdir -p client/build host/build obs/build
pushd client/build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DENABLE_BACKTRACE=0 \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release ..
make
popd
pushd host/build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DENABLE_BACKTRACE=0 \
-DCMAKE_BUILD_TYPE=Release ..
make
popd
pushd obs/build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON ..
make
popd
%install
pushd client/build
make DESTDIR=%{buildroot} install
popd
pushd host/build
make DESTDIR=%{buildroot} install
popd
pushd obs/build
install -Dm644 %{_builddir}/LookingGlass-%{version}/obs/build/liblooking-glass-obs.so %{buildroot}/%_libdir/obs-plugins/liblooking-glass-obs.so
popd
install -Dm644 resources/looking-glass-client.desktop.in %{_builddir}/%_datadir/applications/looking-glass-client.desktop
install -Dm644 resources/lg-logo.svg %{_builddir}/%_datadir/icons/hicolor/scalable/apps/looking-glass.svg
find %{buildroot} -type f -executable -exec strip --strip-unneeded '{}' + || true
%check
%package client
Summary: A client application for accessing the LookingGlass
Group: System/Emulators/PC
Requires: Mesa-libGL1
Requires: looking-glass-kmp-default
%description client
A client application for accessing the LookingGlass IVSHMEM device of a VM.
%files client
%license LICENSE
%doc README.md
%{_bindir}/looking-glass-client
%_datadir/applications/looking-glass-client.desktop
%_datadir/icons/hicolor/scalable/apps/looking-glass.svg
%package host
Summary: Application for pushing frame data to the LookingGlass IVSHMEM device
Group: System/Emulators/PC
%description host
Linux host application for pushing frame data to the LookingGlass IVSHMEM device.
%files host
%{_bindir}/looking-glass-host
%package obs-plugin
Summary: Plugin for OBS Studio to stream directly from Looking Glass
Group: System/Emulators/PC
Requires: obs-studio
%description obs-plugin
Plugin for OBS Studio to stream directly from Looking Glass without having to record the Looking Glass client.
%files obs-plugin
%dir %{_libdir}/obs-plugins
%{_libdir}/obs-plugins/liblooking-glass-obs.so
%changelog