File gyroflow.spec of Package gyroflow

#
# spec file for package python-wakeonlan
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/

%global rustflags '-Clink-arg=-Wl,-z,relro,-z,now'

Name:           gyroflow
Version:        1.5.5~pre
Release:        0
License:        GPL-3.0-or-later
Summary:        Gyro-assisted video stabilization for cinematography, drone videography
Group:          Development/Languages/Python
Url:            https://gyroflow.xyz
Source:         gyroflow-%{version}.tar.xz
Source1:        vendor.tar.xz
Source2:        cargo_config
Source3:        mdk-sdk-linux.tar.xz
Source4:        gyroflow.desktop
Patch1: fix.patch
Patch2: fix-vendor.patch
BuildRequires:  cargo-packaging
BuildRequires:  ffmpeg-7-libavformat-devel
BuildRequires:  ffmpeg-7-libavfilter-devel
BuildRequires:  ffmpeg-7-libavutil-devel
BuildRequires:  qt6-quickcontrols2-devel
BuildRequires:  qt6-quickcontrols2-private-devel
BuildRequires:  qt6-gui-devel
BuildRequires:  qt6-gui-private-devel
BuildRequires:  qt6-declarative-devel
BuildRequires:  qt6-declarative-private-devel
BuildRequires:  qt6-base-common-devel
BuildRequires:  alsa-devel
BuildRequires:  llvm-devel
BuildRequires:  clang-devel
BuildRequires:  opencv-devel
BuildRequires:  libpulse-devel
BuildRequires:  zlib-devel
BuildRequires:  zlib-devel-static
BuildRequires:  ocl-icd-devel
BuildRequires:  cmake
BuildRequires:  gcc13-c++
# ensure to have at least one or gyroflow crashes
Requires:       Mesa-libOpenCL
Requires:       gyroflow-lens_profiles

Requires:       libQt6Svg6

# limited by vendored modules in first place
ExclusiveArch:  x86_64 aarch64

%description
Advanced open-source gyro-assisted video stabilization for cinematography, drone videography.

Note: this package is mostly useless without the ffmpeg packages from packman project!

%prep
%setup -qa1
%patch1 -p1
%patch2 -p0
cp %{SOURCE2} .cargo/config

%build
export RUST_BACKTRACE=full
export RUST_UPDATE_CHECKING=0

export PATH="$PATH:%_libdir/qt6/bin/"
export OPENCV_LINK_PATHS=%_libdir
export OPENCV_INCLUDE_PATHS=/usr/include/
export OPENCV_LINK_LIBS="opencv_core,opencv_calib3d,opencv_features2d,opencv_imgproc,opencv_video,opencv_flann,opencv_imgcodecs,opencv_objdetect"
export FFMPEG_DIR=/usr

export RUSTFLAGS=%{rustflags} 

export CC=/usr/bin/gcc-13
export CXX=/usr/bin/g++-13

cargo build --release %{?jobs:-j%jobs} 

%install
# manual install
mkdir -p %buildroot/%_bindir
mkdir -p %buildroot/%_libdir/gyroflow
mkdir -p %buildroot/%_prefix/share/applications
mkdir -p %buildroot/%_prefix/share/pixmaps
mkdir -p %buildroot/%_prefix/share/Gyroflow

# desktop entry
install -m 0644 %{S:4} %buildroot/%_prefix/share/applications/
install -m 0644 resources/icon.png %buildroot/%_prefix/share/pixmaps/gyroflow.png

install -m 0755 target/release/gyroflow %buildroot/%_libdir/gyroflow/
install -m 0644 target/release/libmdk.so.* %buildroot/%_libdir/gyroflow/
cp -a resources %buildroot/%_libdir/gyroflow/
ln -sf ../../..%_libdir/gyroflow/resources/icons/svg %buildroot/%_prefix/share/Gyroflow/pics

cat > %buildroot/%_bindir/%name <<EOF
#!/bin/sh
export LD_LIBRARY_PATH=%_libdir/gyroflow/
%_libdir/gyroflow/gyroflow \$@
EOF
chmod 0755 %buildroot/%_bindir/%name

%files
%license LICENSE
%_bindir/*
%_libdir/%name
%_prefix/share/applications
%_prefix/share/pixmaps/*
%_prefix/share/Gyroflow


openSUSE Build Service is sponsored by