File rustdesk.spec of Package rustdesk
#
# spec file for package rustdesk
#
# Copyright (c) 2022 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 rustflags '-Clink-arg=-Wl,-z,relro,-z,now'
%define _lto_cflags %{nil}
Name: rustdesk
Version: 1.2.0
Release: 0
Summary: The best open source remote desktop client software
License: GPL-3.0-or-later
URL: https://rustdesk.com/
Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.xz
Source2: cargo_config
Source3: https://github.com/microsoft/vcpkg/archive/refs/tags/2021.12.01.tar.gz
Source4: https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so
Source5: %{name}.sh
Patch0: desktop-file.patch
BuildRequires: cargo-packaging
BuildRequires: clang-devel
BuildRequires: nasm
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: pkgconfig
BuildRequires: xdotool-devel
BuildRequires: yasm-devel
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libyuv)
BuildRequires: pkgconfig(opus)
BuildRequires: pkgconfig(vpx)
BuildRequires: pkgconfig(xcb)
BuildRequires: pkgconfig(xfixes)
BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(gstreamer-video-1.0)
Requires: alsa-utils
Requires: arphic-uming-fonts
Requires: gtk3
Requires: libXfixes3
Requires: libXtst6
Requires: libxcb1
Requires: pulseaudio-utils
Requires: python3-evdev
Requires: python3-libevdev
Requires: python3-pynput
Requires: python3-python-xlib
Requires: python3-six
Requires: xdotool
%description
The best open-source remote desktop client software, written in Rust. Works out of the box, no configuration required.
Great alternative to TeamViewer and AnyDesk! You have full control of your data, with no concerns about security.
You can use our rendezvous/relay server, set up your own, or write your own rendezvous/relay server.
%prep
%autosetup -a1 -p1
%setup -q -T -D -a 3
cp %{SOURCE2} .cargo/config
mv vcpkg-2021.12.01 $HOME/vcpkg
rm -rf %{buildroot}/.cargo
ln -s %{_bindir}/vcpkg $HOME/vcpkg/vcpkg
%define vcpkg_target x64-linux
export VCPKG_ROOT=$HOME/vcpkg
mkdir -p $VCPKG_ROOT/installed/%{vcpkg_target}/lib
ln -s %{_libdir}/libvpx.* $VCPKG_ROOT/installed/%{vcpkg_target}/lib/
ln -s %{_libdir}/libyuv.* $VCPKG_ROOT/installed/%{vcpkg_target}/lib/
ln -s %{_libdir}/libopus.* $VCPKG_ROOT/installed/%{vcpkg_target}/lib/
mkdir -p target/release
cp %{SOURCE4} target/release/
%build
export VCPKG_ROOT=$HOME/vcpkg
%{cargo_build}
%install
%{cargo_install} --frozen
install -d %{buildroot}%{_datadir}/%{name}/files/
install -d %{buildroot}%{_libdir}/
install -d %{buildroot}%{_datadir}/applications/
install -d %{buildroot}%{_unitdir}
install %{SOURCE4} %{buildroot}%{_libdir}/libsciter-gtk.so
install res/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install res/128x128.png %{buildroot}%{_datadir}/%{name}/files/rustdesk.png
install res/rustdesk.desktop %{buildroot}%{_datadir}/applications/rustdesk.desktop
install res/rustdesk-link.desktop %{buildroot}%{_datadir}/applications/rustdesk-link.desktop
rm %{buildroot}%{_bindir}/naming
rm %{buildroot}%{_bindir}/%{name}
install -Dpm0755 target/release/%{name} %{buildroot}%{_datadir}/%{name}/files/
cp -R src %{buildroot}%{_datadir}/%{name}/files/
install %{SOURCE5} %{buildroot}%{_bindir}/%{name}
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%license LICENCE
%doc README.md docs/*
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_unitdir}/%{name}.service
%{_libdir}/libsciter-gtk.so
%{_datadir}/applications/rustdesk.desktop
%{_datadir}/applications/rustdesk-link.desktop
%changelog