File openterface.spec of Package openterface

#
# spec file for package openterface
#
# 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/
#

%global rules_file 60-openterface.rules

Name:           openterface
Version:        0.3.19
Release:        0
Summary:        QT GUI for the open source KVM (keyboard, video, mouse) Openterface.
License:        AGPL-3.0-only
Group:          Hardware/Other
URL:            https://github.com/TechxArtisanStudio/Openterface_QT
Source0:        %{name}-%{version}.tar.gz
Source1:        %rules_file
Source2:        %{name}.desktop
Patch0:         fix-return-warning.patch
Packager:       Holden R. Fried
%if 0%{?suse_version}
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  libudev-devel
BuildRequires:  libusb-1_0-devel
BuildRequires:  qt6-concurrent-devel
BuildRequires:  qt6-core-devel
BuildRequires:  qt6-dbus-devel
BuildRequires:  qt6-gui-devel
BuildRequires:  qt6-multimedia-devel
BuildRequires:  qt6-multimediawidgets-devel
BuildRequires:  qt6-network-devel
BuildRequires:  qt6-serialport-devel
BuildRequires:  qt6-svg-devel
Requires:       %{name}-udev-rules = %{version}

#Requires:       libQt6MultimediaWidgets6
%endif
%if 0%{?fedora}
BuildRequires:  cmake-fedora
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  glibc-all-langpacks
BuildRequires:  glibc-langpack-en
BuildRequires:  libusb1-devel
BuildRequires:  oneVPL-devel
BuildRequires:  qt6-qtbase-devel
BuildRequires:  qt6-qtmultimedia-devel
BuildRequires:  qt6-qtserialport-devel
BuildRequires:  qt6-qtsvg-devel
BuildRequires:  qt6-qttools-devel
#Requires:       qt6-qtmultimedia
%endif
%if 0%{?debian} || 0%{?ubuntu}
BuildRequires:  build-essential
BuildRequires:  qmake6
BuildRequires:  qt6-base-dev
BuildRequires:  qt6-multimedia-dev
BuildRequires:  qt6-serialport-dev
BuildRequires:  qt6-svg-dev
BuildRequires:  libavcodec-extra
#BuildRequires:  libavcodec59
BuildRequires:  libavformat-extra
BuildRequires:  libusb-1.0-0-dev
#BuildRequires:  libavformat59 
#BuildRequires:  obs-service-tar 
#BuildRequires:  obs-service-recompress
#BuildRequires:   osc 
%endif

%description
This is the front-end Qt6 graphical interface for the Openterface 
mini-KVM device. It allows you to use your own laptop to display 
and control headless devices directly through a USB and HDMI 
connection. This KVM-over-USB solution captures video via 
HDMI and simulates keyboard and mouse inputs.

%package udev-rules
BuildArch:      noarch
Summary:        openterface udev rules
Conflicts:      openterface-udev-rules


%description udev-rules
This package contains the udev rules for openterface.

%prep
%autosetup -p1

%build
#mkdir build
#cd build
%if 0%{?fedora}
%{_qt6_qmake} %{?_qt6_qmake_flags}
%make_build
%else
%{qmake6}
#qmake6 ..
# % make_build -j$(nproc)
%{qmake6_build} %{?_smp_mflags}
%{__strip} %{name}QT
%endif

%install
#%%qmake6_install
#mv %%{buildroot}%%{_bindir}/openterfaceQT %%{buildroot}%%{_bindir}/openterface
#cd build
%{__install} -Dm 755 %{name}QT %{buildroot}%{_bindir}/%{name}
%{__install} -Dm 644 -t %{buildroot}%{_udevrulesdir} %{SOURCE1}
%{__install} -Dm 644 -t %{buildroot}%{_datadir}/applications %{SOURCE2}

for size in 32 64 128 256; do
    dir="%{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps"
    %{__install} -Dm 644 "images/icon_$size.png" "$dir/%{name}.png"
done
%{__install} -Dm 644 images/icon_256.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%post udev-rules
%udev_rules_update

%postun udev-rules
%udev_rules_update

%files
%license LICENSE
%{_bindir}/%{name}
%{_datadir}/applications/openterface.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%doc README.md

%files udev-rules
%{_udevrulesdir}/%{rules_file}

%changelog
openSUSE Build Service is sponsored by