File handbrake.spec of Package handbrake

#
# spec file for package handbrake
#
# Copyright (c) 2012 Pascal Bleser <pascal.bleser@opensuse.org>
# Copyright (c) 2014 B1 Systems GmbH, Vobhurg, 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/
#


Name:           handbrake
Summary:        Multithreaded Video Transcoder
Version:        1.2.2
Release:        0
Url:            http://handbrake.fr/
Source0:        https://download.handbrake.fr/releases/%{version}/HandBrake-%{version}-source.tar.bz2
Source1:        https://github.com/HandBrake/HandBrake/releases/download/%{version}/HandBrake-%{version}-source.tar.bz2.sig
Patch0:         HandBrake-no-builddate.patch
Patch1:         HandBrake-build-shared.patch
License:        GPL-2.0+
Group:          Productivity/Multimedia/Video/Editors and Convertors
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  cmake
BuildRequires:  curl
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  make
BuildRequires:  nasm
BuildRequires:  python > 2.7.3
BuildRequires:  subversion
BuildRequires:  update-desktop-files
BuildRequires:  wget
BuildRequires:  yasm
BuildRequires:  glibc-devel
BuildRequires:  libmp3lame-devel
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(dvdnav)
BuildRequires:  pkgconfig(dvdread)
BuildRequires:  pkgconfig(ffnvcodec)
BuildRequires:  pkgconfig(gstreamer-1.0)
BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.10
BuildRequires:  pkgconfig(gudev-1.0)
BuildRequires:  pkgconfig(libass)
BuildRequires:  pkgconfig(libavcodec) >= 58
BuildRequires:  pkgconfig(libavfilter) >= 7
BuildRequires:  pkgconfig(libavformat) >= 58
BuildRequires:  pkgconfig(libavresample) >= 4
BuildRequires:  pkgconfig(libavutil) >= 56
BuildRequires:  pkgconfig(libbluray) >= 1.0.2
BuildRequires:  pkgconfig(libswscale) >= 5
BuildRequires:  pkgconfig(libnotify)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(samplerate)
BuildRequires:  pkgconfig(speex)
BuildRequires:  pkgconfig(theora)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(vpx) >= 1.4
BuildRequires:  pkgconfig(x264)
BuildRequires:  pkgconfig(x265)
BuildRequires:  pkgconfig(jansson)
%ifarch armv6l || armv6hl
BuildRequires:  Mesa-libEGL1
BuildRequires:  Mesa-libEGL-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video
transcoder.

%package cli
Summary:        Multithreaded Video Transcoder
Group:          Productivity/Multimedia/Video/Editors and Convertors

%description cli
HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video
transcoder.

This package contains a command-line interface for Handbrake.

%package gtk
Summary:        Multithreaded Video Transcoder
Group:          Productivity/Multimedia/Video/Editors and Convertors
Recommends:     handbrake-gtk-lang = %{version}-%{release}

%description gtk
HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video
transcoder.

This package contains a GTK+ graphical user interface for Handbrake.

%lang_package -n handbrake-gtk

%prep
%setup -q -n HandBrake-%{version}
%patch0 -p0
%patch1 -p0

%build
export CFLAGS="%{optflags} -fno-strict-aliasing -Wno-unused -I%{_includedir}/ffmpeg"
export CXXFLAGS="$CFLAGS -Wno-reorder"
export PATH="%{_builddir}/HandBrake-%{version}/build/contrib/bin:$PATH"

# try to remove build date from binaries... -- seife+obs@b1-systems.com
PKGDATE=$(date -r %{_sourcedir}/handbrake.changes +%Y%m%d)
sed -i -e "s/@BUILD@/$PKGDATE/" make/configure.py

%__mkdir build
./configure \
    --force \
    --build="$PWD/build" \
    --prefix=%{_prefix} \
    --strip="/bin/true" \
    --optimize=speed \
    --disable-fdk-aac \
    --debug=max

pushd build
%__make libhb/project.h
%__make %{?_smp_mflags}
popd

%install
%makeinstall -C build

%__ln_s ghb %{buildroot}%{_bindir}/HandBrakeGUI

%suse_update_desktop_file -r fr.handbrake.ghb AudioVideo AudioVideoEditing

# -f because it might not be there if built without gtk...
%__rm -f "%{buildroot}%{_datadir}/icons"/*/*.cache

%find_lang ghb

%fdupes %{buildroot}

%files cli
%defattr(-,root,root)
%doc COPYING NEWS.markdown THANKS.markdown
%{_bindir}/HandBrakeCLI

%files gtk
%defattr(-,root,root)
%doc COPYING NEWS.markdown THANKS.markdown
%{_bindir}/HandBrakeGUI
%{_bindir}/ghb
%{_datadir}/applications/fr.handbrake.ghb.desktop
%{_datadir}/icons/*/*/apps/hb-icon.*
%{_datadir}/icons/hicolor/scalable/apps/fr.handbrake.ghb.svg
%{_datadir}/metainfo/fr.handbrake.ghb.appdata.xml

%files -n handbrake-gtk-lang -f ghb.lang

%changelog