File shotcut.spec of Package shotcut

# spec file for package shotcut
# 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

# Find qt version used to build
%define qt5version %(pkg-config --modversion Qt5Core)

%if 0%{?BUILD_ORIG}
%bcond_without lame
%bcond_without libvpx
%bcond_without ffmpeg
%bcond_without x264
%if !%{with ffmpeg}
%if 0%{?suse_version} > 1320 || (0%{?suse_version} >= 1315 && 0%{?is_opensuse})
%bcond_without ffmpeg
%bcond_without libvpx
Name:           shotcut
Version:        17.05
Release:        0
# This package creates a build time version from the current date and uses it to check
# for updates. See patch1 and prep/build section.
%define _vstring %(echo %{version} |tr -d ".")
Summary:        A video editor
License:        GPL-3.0+
Group:          Productivity/Multimedia/Video/Editors and Convertors
# PATCH-FIX-OPENSUSE shotcut-desktopfile.patch -- Fix icon path
Patch0:         shotcut-desktopfile.patch
# PATCH-FIX-OPENSUSE shotcut-noupdatecheck.patch -- Disable automatic update check
Patch1:         shotcut-noupdatecheck.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libqt5-qtdeclarative-private-headers-devel
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5Core) >= 5.5.0
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Multimedia)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5PrintSupport)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  pkgconfig(Qt5UiTools)
BuildRequires:  pkgconfig(Qt5WebKitWidgets)
BuildRequires:  pkgconfig(Qt5WebSockets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  pkgconfig(mlt++)
BuildRequires:  pkgconfig(mlt-framework)
# frei0r-plugins prior to 1.4-7.1 are built against qt4 and cause a segfault on startup.
Requires:       frei0r-plugins >= 1.4-7.1
Requires:       ladspa
Requires:       libmlt6-modules
Requires:       melt
%if %{with lame}
Requires:       lame
%if %{with libvpx}
BuildRequires:  pkgconfig(vpx)
Requires:       %(rpm -qf $(readlink -qne %{_libdir}/ --qf '%{NAME} >= %{VERSION}')
%if %{with ffmpeg}
Requires:       ffmpeg >= 2.7
%if %{with x264}
BuildRequires:  pkgconfig(x264)
Requires:       %(rpm -qf $(readlink -qne %{_libdir}/ --qf '%{NAME} >= %{VERSION}')
# needed on runtime for the timeline to work see
Requires:       libqt5-qtgraphicaleffects >= %{qt5version}
Requires:       libqt5-qtquickcontrols >= %{qt5version}

Shotcut is a video editor. It supports many audio and video and image
formats, as well as image sequences. It's compatible with JACK Audio
and Melted Server, and offers an experimental GPU Processing feature.
Shotcut can test MLT XML files, too.


%setup -q
echo "Qt5Core = %{qt5version}"

# Search for executable files
find . \
\( -name \*.html -o -name \*.js \) -type f -executable -exec chmod a-x {} + || :

# Create version.json from current version
echo "{" > version.json
echo " \"version_number\": %{_vstring}02," >> version.json
echo " \"version_string\": \"%{version}.02\"," >> version.json
echo " \"url\": \"{_vstring}/\"" >> version.json
echo "}" >> version.json
echo "" >> version.json

export _VSTRING="%{version}.02"
%qmake5 \
	_VSTRING="%{version}.02" \
        PREFIX="%{_prefix}" -Wall -recursive

make %{_smp_mflags} VERBOSE=1


install -D icons/%{name}-logo-64.png %{buildroot}/%{_datadir}/pixmaps/%{name}.png

# Install language files
basedir=$(basename "$langdir")
pushd $basedir
	for ts in *.ts; do
		[ -e "$ts" ] || continue
		lupdate-qt5 "$ts" && lrelease-qt5 "$ts"
	for qm in *.qm; do
		[ -e "$qm" ] || continue
		if ! grep -wqs "%dir\ $langdir" "$langlist"; then
			echo "%dir $langdir" >>"$langlist"
		install -Dm0644 "$qm" "%{buildroot}/$langdir/$qm"
		echo "%lang($lang) $langdir/$qm" >>"$langlist"
cp -v version.json %{buildroot}%{_datadir}/%{name}
%suse_update_desktop_file -i %{name}
%fdupes -s %{buildroot}/%{_datadir}



%exclude %{_datadir}/%{name}/translations

%files lang -f %{name}.lang