Name:          optipng
Version:       0.6.5
Release:       1%{?_dist_release}
Summary:       PNG optimizer and converter
Summary(ja):   PNG オプティマイザ と コンバータ

Group:         Applications/Graphics
License:       zlib
URL:           http://optipng.sourceforge.net/
Source0:       http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Patch0:        fix_builderror.patch

BuildRoot:     %{_tmppath}/%{name}-%{version}-root

BuildRequires:  zlib-devel libpng-devel

%description
OptiPNG is a PNG optimizer that recompresses image files to a smaller size,
without losing any information. This program also converts external formats
(BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks
and corrections.

%description -l ja
OptiPNG は、PNG 形式の画像ファイルを何ら情報を失うことなく
より小さなサイズへと再圧縮するオプティマイザです。
このプログラムは、外部フォーマット (BMP、GIF、PNM および TIFF)から
最適化された PNG 形式へと変換し、PNG 形式の整合性チェックと訂正を行います。

%prep
%setup -q
%patch0 -p1

# Ensure system libs and headers are used; as of 0.6.1 pngxtern will use
# the bundled headers if present even with -with-system-*, causing failures.
rm -rf lib/libpng lib/zlib

%define makefile gcc.mak

%build
./configure -with-system-zlib -with-system-libpng
cd src/
make -f scripts/%{makefile} %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"\
                                            LDFLAGS="$RPM_OPT_FLAGS"


%install
rm -rf $RPM_BUILD_ROOT
cd src/
make -f scripts/%{makefile} install DESTDIR="$RPM_BUILD_ROOT"\
                                    prefix="%{_prefix}" \
                                    man1dir="%{_mandir}/man1"

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc README.txt LICENSE.txt doc/*
%{_bindir}/optipng
%{_mandir}/man1/optipng.1*


%changelog
* Sun Feb 6 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.6.5-1
- new upstream release
- added Patch0 to fix build error

* Thu Apr 15 2010 Shu KONNO <owa@bg.wakwak.com> - 0.6.4-1
- new upstream release

* Wed Jul 29 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.6.3-1
- initial build for VineSeed

* Wed Nov 12 2008 Till Maas <opensource@till.name> - 0.6.2-1
- Update to new release to fix buffer overflow
- Red Hat Bugzilla #471206

* Thu Aug 28 2008 Ville Skyttä <ville.skytta at iki.fi> - 0.6.1-1
- 0.6.1.

* Thu Feb 14 2008 Ville Skyttä <ville.skytta at iki.fi> - 0.5.5-4
- Apply sf.net patch #1790969 to fix crash with -log.
- Cosmetic specfile changes.

* Thu Aug 02 2007 Till Maas <opensource till name> - 0.5.5-3
- update License: Tag according to new Guidelines

* Wed Feb 14 2007 Till Maas <opensource till name> - 0.5.5-2
- rebuild because of new libpng

* Tue Feb 06 2007 Till Maas <opensource till name> - 0.5.5-1
- Version bump

* Wed Nov 29 2006 Till Maas <opensource till name> - 0.5.4-4
- splitting makefile patches
- make LDFLAGS=$RPM_OPT_FLAGS
- Use own makefile define
- Fixing 216784 with upstream patch

* Wed Oct 11 2006 Till Maas <opensource till name> - 0.5.4-3
- bumping release because of errors while importing to extras

* Tue Oct 10 2006 Till Maas <opensource till name> - 0.5.4-2
- shortening Summary

* Thu Sep 14 2006 Till Maas <opensource till name> - 0.5.4-1
- version bump
- use system zlib and libpng
- link without "-s" flag for non-empty debuginfo
- use DESTDIR

* Fri Jul 28 2006 Till Maas <opensource till name> - 0.5.3-1
- version bump
- Changed license tag back to zlib/libpng (#198616 rpmlint) 
- use $RPM_OPT_FLAGS instead of %%{optflags}

* Thu Jul 06 2006 Till Maas <opensource till name> - 0.5.2-2
- Changed license tag from zlib/libpng to zlib

* Tue Jul 04 2006 Till Maas <opensource till name> - 0.5.2-1
- Created from scratch for fedora extras
