Version: 2.7.0

%global GITrev b17f908

%global gapmajorver %(echo %version | sed 's|\\..*||g')
%global gapminorver %(echo %version | sed 's|^%{gapmajorver}\\.||g;s|\\..*||g')
%global gapmicrover %(echo %version | sed 's|^%{gapmajorver}\\.%{gapminorver}\\.||g;s|\\..*||g')
%global gimplibdir %(pkg-config gimp-2.0 --variable=gimplibdir)
%global gimpdatadir %(pkg-config gimp-2.0 --variable=gimpdatadir)

Summary:		The GIMP Animation Package
Name:		gimp-gap
Release:		20%{?GITrev:.GIT%{GITrev}}%{?dist}
Group:		Applications/Multimedia
License:		GPLv2+
URL:			https://github.com/GNOME/gimp-gap
#Source: ftp://ftp.gimp.org/pub/gimp/plug-ins/v2.6/gap/gimp-gap-%%{version}.tar.bz2
# See script in Source1 to reproduce tarball
Source0:		%{name}-%{GITrev}-clean.tar.xz
Source1:		%{name}.get.tarball
# https://bugzilla.redhat.com/show_bug.cgi?id=1299256 -> https://bugzilla.gnome.org/show_bug.cgi?id=760758
Source2:		%{name}.metainfo.xml

BuildRequires:  gcc
BuildRequires:	autoconf >= 2.54, automake >= 1.7, intltool >= 0.17
# glib-gettextize >= 2.2.0
BuildRequires:	pkgconfig(gimp-2.0), gimp-devel-tools >= 2.6.0
BuildRequires:	bzip2-devel, glib2-devel >= 2.2.0, libjpeg-turbo-devel

Requires:		gimp >= 2.6.0

# Unbundle libs. Fedora-specific patch, borrowed from SUSE.
Patch1:		gimp-gap-2.7-unbandle.patch
# Fix format security issues
Patch2:		gimp-gap-2.7-fix-format-security.patch

%description
The GIMP-GAP (GIMP Animation Package) is a collection of Plug-Ins to
extend GIMP with capabilities to edit and create animations as
sequences of single frames.

%prep
%setup -q -n %{name}

%patch1 -p1 -b .unbundle
%patch2 -p1 -b .format-security

# 1 symbol only not in UTF-8. iso8859-1 encoding my guess
iconv -f iso8859-1 -t utf8 ChangeLog > ChangeLog.tmp
touch -r ChangeLog ChangeLog.tmp
mv -f ChangeLog.tmp ChangeLog

# Try make rpmlint happy
find \( -iname '*.c' -or -iname '*.h' \) -exec chmod -x {} \;
find -type d -exec chmod 0755 {} \;

%build
# Disable call ./configure from autogen.sh because we want it with default configured parameters
sed -i 's@$srcdir/configure@#$srcdir/configure@' autogen.sh
./autogen.sh
%configure --disable-libavformat

# Parralel build terminated with error
make LIBS="$LIBS -lm"

%install
%make_install

mkdir -p %{buildroot}/%{_datadir}/appdata/
install -m 644 -D %{SOURCE2} %{buildroot}/%{_datadir}/appdata/

%find_lang gimp20-gap

%files -f gimp20-gap.lang
%doc AUTHORS ChangeLog MAINTAINERS NEWS README
#%{_libdir}/%{name}/
%{gimplibdir}/plug-ins/*
%{gimpdatadir}/scripts/*
%{_datadir}/appdata/%{name}.metainfo.xml

%changelog
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-20.GITb17f908
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Jun  4 2018 Tom Callaway <spot@fedoraproject.org> - 2.7.0-19.GITb17f908
- update to git b17f908
- adjust "get" script to remove legally problematic items and make clean tarball
- use clean tarball

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-18.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-17.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-16.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-15.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-14.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sat Jan 23 2016 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-13.GITe75bd46
- Add appdata metainfo file. Thanks to Jiri Eischmann. bz#1299256

* Mon Dec 07 2015 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-12.GITe75bd46
- Replace patch gimp-gap-2.7-autogen.sh-automake-1.12.patch by universal gimp-gap-automake-auto-version.patch - fix FBFS bz#1239530

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.0-11.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.0-10.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.0-9.GITe75bd46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Nov 4 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-8.GITe75bd46
- Review in progress (bz#954108), for comments thanks to Mario Blättermann.
- Filled bug about incorrect FSF address - https://bugzilla.gnome.org/show_bug.cgi?id=711402
- Encode Changelog into UTF-8.
- Make rpmlint for debuginfo happy by drop executable permissions from source files and chmod directories to 0755.

* Sun Nov 3 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-7.GITe75bd46
- Change BR "gimp-devel >= 2.6.0" on "pkgconfig(gimp-2.0)", remove sed. Thanks to Mario Blättermann (review bz#954108).

* Thu May 2 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-6.GITe75bd46
- Disable call of ./configure script from autogen.sh as excessive and run it manually via macros (Michael Schwendt insist).

* Tue Apr 30 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-5.GITe75bd46
- Remove xvidcore from requires. Thanks to Vasiliy Glazov.

* Mon Apr 29 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-4.GITe75bd46
- Add %%{?dist} tag. Thanks to Vasiliy Glazov.
- Try avoid second reconfigure by passing argument in autoden.sh. Thanks to Antonio Trande.

* Mon Apr 29 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-3.GITe75bd46
- For changes thanks to Antonio Trande and their comments in Fedora review (bz#954108).
- Remove BR xvidcore-devel xvidcore (its is not required and does not present in Fedora).
- Remove %%{_datadir}/locale/*/*/*
- Remade gimp-gap-2.7-autogen.sh-automake-1.12.patch to account automake-1.13 also.
- Add BR libjpeg-turbo-devel

* Sat Apr 20 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-2.GITe75bd46
- Remove BuildRequires: ffmpeg-libs ffmpeg-devel
- Borrow from SUSE Patch1: gimp-gap-2.7-unbandle.patch (rebased)
- Remove bundled libs in prep.
- Add --disable-libavformat configure option.
- As ffmpeg not required anymore and there no legal issues it ready for Fedora now.

* Tue Apr 9 2013 Pavel Alexeev <Pahan@Hubbitus.info> - 2.7.0-1.GITe75bd46
- Import http://forums.fedoraforum.org/attachment.php?attachmentid=20693&d=12975115122C ( http://forums.fedoraforum.org/showthread.php?t=182414 )

* Thu Feb 10 2011 Oliver Mangold <o.mangold@gmail.com>
- updated to version 2.6.0

* Wed Apr 14 2004 Nils Philippsen <nphilipp@redhat.com>
- version 2.0.0
- initial build

