File dreamdeck.spec of Package dreamdeck

#
# spec file for package dreamdeck
#
# 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:           dreamdeck
Version:        0.1.git.1750156851.a0698cc
Release:        0
Summary:        Versatile Macroboard for Touchscreens
License:        MIT
URL:            https://github.com/jcronenberg/DreamDeck
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor-ssh.tar.gz
Source2:        vendor-touch.tar.gz
%if 0%{?suse_version}
BuildRequires:  cargo-packaging
%else
BuildRequires:  cargo-rpm-macros >= 24
%endif
BuildRequires:  pkgconfig(openssl)
BuildRequires:  godot >= 4.4
BuildRequires:  godot-runner >= 4.4

%description
A versatile Macroboard software tailored for touchscreen devices,
distinguishing itself from Stream Decks and similar software by leveraging the
entire screen, offering more than just simple button displays.

%prep
%autosetup -a1
%setup -T -D -a2
godot_version=$(godot-runner --version | grep --extended-regexp --only-matching --regexp ^\([0-9]+\\.\)+stable -)
%ifarch %{arm} %{arm64}
template_name=linux_release.arm%{__isa_bits}
%elifarch %{x86_64} %{ix86}
template_name=linux_release.x86_%{__isa_bits}
%else
template_name=linux_release.%{_arch}
%endif
target_dir=$HOME/.local/share/godot/export_templates/$godot_version
target_file_path=$target_dir/$template_name
mkdir -p $target_dir
cp %{_bindir}/godot-runner $target_file_path
%if %{defined fedora}
%cargo_prep
%endif

%build
pushd plugins/touch/rust
%{cargo_build}
%if %{defined fedora}
cp -r target/rpm target/release
%endif
popd
pushd plugins/ssh/rust
%{cargo_build}
%if %{defined fedora}
cp -r target/rpm target/release
%endif
popd
godot --headless -v --import || true
godot --headless -v --export-release "Linux" || true

%install
%make_install PREFIX=/usr

%files
%license LICENSE
%doc README.md
%dir %{_datadir}/icons/hicolor/256x256/apps
%{_bindir}/%{name}
# Godot unfortunately currently only supports ../lib for dynamic library loading
%{_prefix}/lib/lib%{name}_ssh.so
%{_prefix}/lib/lib%{name}_touch.so
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%{_datadir}/applications/%{name}.desktop

%changelog

openSUSE Build Service is sponsored by