File mtn.spec of Package mtn
Name: mtn
Version: 3.5.0
Release: 0
Group: Amusements/Toys/Other
Summary: Movie thumbnailer
License: GPL-2.0-or-later
URL: http://gitlab.com/movie_thumbnailer/mtn/
Source0: %{name}-devel.tar.gz
Source1: sample.webm
%if 0%{?suse_version}>=1699
# tumbleweed
%define suse_ff_ver 8
%define avif_enabled 1
%else
%if 0%{?suse_version}>=1600
# leap 16
%define suse_ff_ver 7
%define avif_enabled 1
%else
# leap 15
%define suse_ff_ver 4
%define avif_enabled 0
%define with_avif ENABLE_AVIF=0
%endif
%endif
BuildRequires: gcc
BuildRequires: make
BuildRequires: gettext-runtime
BuildRequires: gd-devel >= 2.0.35
BuildRequires: ffmpeg-%{suse_ff_ver}-libavcodec-devel
BuildRequires: ffmpeg-%{suse_ff_ver}-libavdevice-devel
BuildRequires: ffmpeg-%{suse_ff_ver}-libavformat-devel
BuildRequires: ffmpeg-%{suse_ff_ver}-libswscale-devel
BuildRequires: dejavu-fonts
Requires: gd
Requires: ffmpeg-%{suse_ff_ver}
Requires: dejavu-fonts
Requires: fontconfig
%description
Movie thumbnail generator
%package bash-completion
Summary: Bash completion support for %{name}
BuildArch: noarch
Requires: bash-completion
Requires: fontconfig
%description bash-completion
Bash completion support for the %{name}'s utilities.
%package zsh-completion
Summary: Zsh completion support for %{name}
BuildArch: noarch
Requires: zsh
Requires: fontconfig
%description zsh-completion
Zsh completion support for the %{name}'s utilities.
%lang_package
%prep
tar -xf %SOURCE0
cd %{name}-*
%build
cd %{name}-*/src
%make_build %?with_avif ENABLE_LOCALE=1
strip ../bin/mtn
%check
%{name}-*/bin/mtn -q -O. -T "Text: Open Build Service" -c1 -r1 -o .png %SOURCE1
%{name}-*/bin/mtn -q -O. -T "Text: Open Build Service" -c1 -r1 -o .webp %SOURCE1
%{name}-*/bin/mtn -q -O. -T "Text: Open Build Service" -c1 -r1 -v -N _info.txt -S 2 %SOURCE1
%if %{avif_enabled}
%{name}-*/bin/mtn -q -O. -T "Text: Open Build Service" -c1 -r1 -o .avif %SOURCE1
# GD Warning: AVIF image support has been disabled
%if 0%{?suse_version} != 1600
test -s sample.avif
%endif
%endif
for file in sample_s.jpg sample.png sample.webp sample_info.txt
do
test -s $file
done
grep "Stream 0: Video: vp9" sample_info.txt
grep "Stream 1: Video: vp9" sample_info.txt
%install
cd %{name}-*
install -Dpm 755 bin/%name %{buildroot}%{_bindir}/%{name}
install -Dpm 644 man/%name.1 %{buildroot}%{_mandir}/man1/%name.1
install -Ddpm 644 doc %{buildroot}%{_defaultdocdir}/%name
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions
install -pm644 completions/%{name} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
mkdir -p %{buildroot}%{_datadir}/zsh/site-functions
install -pm644 completions/_%{name} %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
for lng in `find po -name \*.po -exec basename {} .po \;`
do
mkdir -p locale/$lng/LC_MESSAGES
msgfmt po/$lng.po -o locale/$lng/LC_MESSAGES/mtn.mo
done
cp -r locale %{buildroot}/usr/share/
%find_lang %{name}
mv mtn.lang ../
%files
%{_bindir}/mtn
%{_defaultdocdir}/mtn
%{_mandir}/man1/mtn.1*
%license %{name}*/LICENSE
%files bash-completion
%{_datadir}/bash-completion/completions/%{name}
%files zsh-completion
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_%{name}
%files lang -f %{name}.lang
%changelog