File opentrack.spec of Package opentrack

#
# spec file for package opentrack
#
# Copyright (c) 2023 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/
#
%define _version 2024.1.1
%define _name_archive opentrack-master
%define onnxruntime_version 1.23.2

Name:           opentrack
Version:        2024.1.1+git.20241226
Release:        0
Group:          Amusements/Games/Other
Summary:        opentrack is an application dedicated to tracking user's head movements and relaying the information to games and flight simulation software. Head tracking software for MS Windows, Linux, and Apple OSX
License:        ISC
URL:            https://github.com/opentrack/opentrack
Source:         %{_name_archive}-%{version}.tar.xz
Source2:        https://github.com/microsoft/onnxruntime/releases/download/v%{onnxruntime_version}/onnxruntime-linux-x64-gpu-%{onnxruntime_version}.tgz
Patch1:         cmake-install.patch

BuildRequires:  ImageMagick
BuildRequires:  cmake
BuildRequires:  ninja


BuildRequires:  glibc
BuildRequires:  libstdc++-devel
BuildRequires:  libgcc_s1
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  glibc-devel 
BuildRequires:  cmake-extras
BuildRequires:  eigen3-devel
BuildRequires:  double-conversion-devel
BuildRequires:  opencv-devel
BuildRequires:  cmake(Qt6)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  procps-devel
BuildRequires:  qt6-gui-private-devel
BuildRequires:  libevdev-devel
BuildRequires:  update-desktop-files
BuildRequires:  wine >= 10.0
BuildRequires:  wine-devel >= 10.0
BuildRequires:  fdupes
%ifarch x86_64
BuildRequires:  wine-32bit >= 10.0
BuildRequires:  wine-devel-32bit >= 10.0
BuildRequires:  gcc-32bit
BuildRequires:  gcc-c++-32bit
BuildRequires:  libstdc++-devel-32bit
BuildRequires:  rpm-32bit
BuildRequires:  mozilla-nss-certs-32bit
BuildRequires:  glibc-devel
%endif
Suggests: wine

%description
%{summary}.

%package docs
Summary: Documentation for opentrack
Group: Amusements/Games/Other
BuildArch: noarch

%description docs
The docs of %{name}.

%prep
%setup -q -n %{_name_archive}-%{version}

tar -xf %{SOURCE2}

%build
mkdir -p build
cd build
cmake \
  -GNinja \
  -DUNIX_STRUCTURE=1 \
  -DCMAKE_CXX_STANDARD=17 \
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  -DSDK_WINE=ON \
  -DONNXRuntime_DIR="../onnxruntime-linux-x64-gpu-%{onnxruntime_version}" \
  -DONNXRuntime_INCLUDE_DIR="../onnxruntime-linux-x64-gpu-%{onnxruntime_version}/include" \
  -DONNXRuntime_LIBRARY="../onnxruntime-linux-x64-gpu-%{onnxruntime_version}/lib/libonnxruntime.so" \
  ..
ninja

%install
cd build
DESTDIR=%buildroot ninja install
rm -rf %{buildroot}/usr/share/doc/opentrack/source-code
%fdupes %{buildroot}/usr/share/doc/opentrack
cd ../
magick convert ./contrib/cute-octopus-vector-material_15-1831.jpg ./contrib/%{name}.png
%suse_update_desktop_file -c "opentrack" "Opentrack" "Application dedicated to tracking user's head movements" "/usr/bin/opentrack" "opentrack" "Game" "Simulation"
install -D -m 0644  ./contrib/%{name}.png %{buildroot}/usr/share/pixmaps/%{name}.png

%post
%postun

%files
%license OPENTRACK-LICENSING.txt
%doc WARRANTY.txt README.md AUTHORS.md
%{_bindir}/%{name}
%{_libexecdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%files docs
%{_datadir}/doc/%{name}

%changelog
openSUSE Build Service is sponsored by