%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary: A library of functions for manipulating PNG image format files.
Summary(ja): PNG画像形式ファイル操作用の関数ライブラリ
Name: libpng
Version: 1.6.20
Release: 1%{_dist_release}
License: distributable
Group: System Environment/Libraries
Source: ftp://ftp.simplesystems.org/pub/libpng/png/src/%{name}-%{version}.tar.xz

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: zlib-devel
Requires: zlib
URL: http://www.libpng.org/pub/png/
%define LIBVER 3.%{version}
Epoch: 2

Vendor: Project Vine
Distribution: Vine Linux

%description
The libpng package contains a library of functions for creating and
manipulating PNG (Portable Network Graphics) image format files.  PNG
is a bit-mapped graphics format similar to the GIF format.  PNG was
created to replace the GIF format, since GIF uses a patented data
compression algorithm.

Libpng should be installed if you need to manipulate PNG format image
files.

%description -l ja
libpng パッケージには PNG (Portable Network Graphics) 形式の
画像ファイルを作成/操作する為のライブラリが収められています．
PNG はビットマップの画像形式で，GIF によく似ています．
GIF が 特許保護された LZW データ圧縮アルゴリズムを利用している為，
PNG は GIF の代替画像形式として生まれました．

PNG 形式の画像ファイルを扱う場合は libpng をインストールして下さい．

%package devel
Summary: Development tools for programs to manipulate PNG image format files.
Summary(ja): PNG 形式画像ファイルを扱うプログラム向け開発ツール
Group: Development/Libraries
Requires: libpng = %{epoch}:%{version}-%{release}
Requires: zlib-devel

%description devel
The libpng-devel package contains the header files necessary for 
developing programs using the PNG (Portable Network Graphics) library.

%description devel -l ja
libpng-devel パッケージには，PNG (Portable Network Graphics) ライブラリを
使ったプログラムを開発するのに必要なヘッダファイルが収められています．

%package static
Summary: Static library for %{name}
Summary(ja): %{name} のスタティックライブラリ
Group: Development/Libraries
Requires: libpng-devel = %{epoch}:%{version}-%{release}

%description static
The libpng-static package contains the static library for libpng.

%package tools
Summary: Tools for PNG image format file library
Summary(ja): %{name} 用のツール
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}

%description tools
The libpng-tools package contains tools used by the authors of libpng.

## to build compat32 for x86_64 architecture support
%package -n compat32-%{name}
Summary: A library of functions for manipulating PNG image format files.
Summary(ja): PNG画像形式ファイル操作用の関数ライブラリ
Group: System Environment/Libraries

%description -n compat32-%{name}
The libpng package contains a library of functions for creating and
manipulating PNG (Portable Network Graphics) image format files.  PNG
is a bit-mapped graphics format similar to the GIF format.  PNG was
created to replace the GIF format, since GIF uses a patented data
compression algorithm.

Libpng should be installed if you need to manipulate PNG format image
files.

%package -n compat32-%{name}-devel
Summary: Development tools for programs to manipulate PNG image format files.
Summary(ja): PNG 形式画像ファイルを扱うプログラム向け開発ツール
Group: Development/Libraries
Requires: libpng = %{epoch}:%{version}-%{release}, libpng-devel = %{epoch}:%{version}-%{release}
Requires: zlib-devel

%description -n compat32-%{name}-devel
The libpng-devel package contains the header files and static
libraries necessary for developing programs using the PNG (Portable
Network Graphics) library.

If you want to develop programs which will manipulate PNG image format
files, you should install libpng-devel.  You'll also need to install
the libpng package.

#'
%prep
%setup -q

%build
#./autogen.sh
%configure
%__make %{?_smp_mflags}

%install
[ -n $RPM_BUILD_ROOT -a $RPM_BUILD_ROOT != / ] && rm -rf $RPM_BUILD_ROOT
%makeinstall

# remove unneeded files
%__rm -f %{buildroot}%{_libdir}/libpng*.la

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig

%clean
[ -n $RPM_BUILD_ROOT -a $RPM_BUILD_ROOT != / ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc *.txt example.c README TODO CHANGES
%{_libdir}/libpng*.so.*
%{_mandir}/man5/*

%files devel
%defattr(-,root,root)
%{_bindir}/libpng-config
%{_bindir}/libpng16-config
%{_includedir}/*
%{_libdir}/libpng*.so
%{_libdir}/pkgconfig/*
%{_mandir}/man3/*

%files static
%defattr(-,root,root)
%{_libdir}/libpng*.a

%files tools
%defattr(-,root,root)
%{_bindir}/pngfix
%{_bindir}/png-fix-itxt


## to build compat32 for x86_64 architecture support
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_libdir}/libpng*.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/libpng*.a
%{_libdir}/libpng*.so
%{_libdir}/pkgconfig/*
%endif

%changelog
* Sun Jan 17 2016 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.6.20-1
- update to 1.6.20

* Sat Nov 21 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2:1.6.19-2
- fix typo

* Sat Nov 21 2015 Toshiharu Kudoh <toshi.kd2@gmail.com> 2:1.6.19-1
- update to 1.6.19

* Sat Jun 21 2014 Daisuke SUZUKI <daisuke@vinelinux.org> 2:1.6.12-1
- update to 1.6.12
- add tools subpackage

* Fri Oct 19 2012 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.50-1
- new upstream release
- drop old patches (are included in new release)

* Sat Apr 28 2012 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.46-3vl6
- add patch110 for fix CVE-2011-3045 
- add patch120 for fix CVE-2011-3048 (png_set_text2())

* Sat Feb 18 2012 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.46-2
- add patch100 for fix CVE-2011-3026

* Wed Jul 13 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.46-1
- new upstream release with security fix (VU#819894)
- add Vendor/Distri tags

* Tue Sep 21 2010 IWAI, Masaharu <iwai@alib.jp> 2:1.2.44-3
- build with rpm-4.8.1-1 for pkg-config file

* Sun Jul 18 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2:1.2.44-2
- sync with Vine Linux 5 updates release
  * Tue Jun 29 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.44-1
  - new upstream release with security fix (CVE-2010-1205)

* Thu Apr 22 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2:1.2.43-2
- sync with Vine Linux 5 updates release
  * Sun Mar  7 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.43-1
  - new upstream release with security fix (CVE-2010-0205)

* Wed Jan 20 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2:1.2.42-1
- new upstream release with security fix

* Tue Jun  9 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.37-1
- new upstream release with security fix

* Fri Mar 27 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2:1.2.35-2
- split static library to libpng-static
  - needed by tuxonice-userui

* Wed Feb 25 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.35-1
- new upstream release with security fix (CVE-2009-0040)

* Mon Nov 03 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.33-1
- new upstream release

* Fri Oct 10 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.32-2
- spec file in UTF-8

* Fri Oct 10 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.32-1
- new upstream release with security fix (CVE-2008-3964)

* Sat May 03 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2:1.2.28-1
- new upstream release with security fix (CVE-2008-1382)
- added running autogen.sh before configure
- new versioning policy

* Sun Feb 24 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2:1.2.25-0vl1
- new upstream release

* Thu Jan 24 2008 NAKAMURA Kenta <kenta@vinelinux.org> 2:1.2.24-0vl2
- removed %%if !%%{build_compat32} case condition

* Mon Jan 21 2008 Kazutaka HARADA <Kazutaka@dc4.so-net.ne.jp> 2:1.2.24-0vl1
- new upstream release

* Wed Oct 10 2007 Shu KONNO <owa@bg.wakwak.com> 2:1.2.21-0vl1
- new upstream release

* Fri May 18 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2:1.2.18-0vl1
- new upstream release (CVE-2007-2445)

* Sun Dec 17 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2:1.2.14-0vl1
- new upstream release
- drop obsolete patch100

* Fri Nov 24 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.2.12-0vl1.1
- add Patch100 for fix CVE-2006-5793.patch

* Sat Jul 08 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.2.12-0vl1
- [SECURITY] new upstream release
  - potential buffer overrun in chunk error processing (CVE-2006-3334)
- use %%configure, %%makeinstall
- drop unneeded patch10

* Sun Jun 18 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.8-0vl7
- rebuilt with glibc-2.3.3-3vl14

* Tue Feb 28 2006 Shu KONNO <owa@bg.wakwak.com> 1.2.8-0vl6
- fixed libdir path in libpng.pc

* Sun Feb 12 2006 Shu KONNO <owa@bg.wakwak.com> 1.2.8-0vl5
- fixed %postun (missing to build as scriptlet by invalid comment)

* Thu Feb 09 2006 Shu KONNO <owa@bg.wakwak.com> 1.2.8-0vl4
- added compat32-* packages for x86_64 architecture support
- added CC='gcc -m32' to make when build_compat32
- added LIBPATH=%{_libdir} to make

* Thu Feb 02 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.2.8-0vl3
- rebuild

* Wed Dec 15 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.8-0vl2
- rebuild for VineSeed

* Wed Dec 15 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.8-0vl1
- new upstream release (bug fix)

* Mon Sep 27 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.7-0vl1
- new upstream release

* Tue Aug 10 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.6-0vl0.rc3
- update to 1.2.6rc3
- add Requires: zlib-devel to libpng-devel.

* Tue Aug 10 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.6-0vl0.rc2
- update to 1.2.6rc2

* Sun Aug 01 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.6-0vl0.rc1
- update to 1.2.6rc1
- add patch10 to correct directory name in libpng.pc
- clean spec file

* Tue Jul  6 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.5-0vl4
- added Patch4 from Redhat WS updates
  * Mon Jun 14 2004 Matthias Clasen <mclasen@redhat.com> 1.2.2-23
  - Reinstate and improve the transfix patch which got lost sometime ago,
    but is still needed for CAN-2002-1363 (#125934)

* Sun Dec 21 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.5-0vl3
- rebuild with new toolchain
- use License tag
- change URL

* Tue Apr 15 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.5-0vl2
- added Obsoletes: libpng12-devel for libpng-devel

* Mon Apr 14 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.5-0vl1
- change package name from libpng12 to libpng
- revised install and files section
- remove all patches
- define LIBVER 3.%{version}
- add Obsoletes: libpng12

* Sat Mar  1 2003 Kazuhisa TAKEI <takei@vinelinux.org> 1.2.25-0vl5
- new upstream version
- change package name to libpng12
- conflicts libpng-devel(1.0.5) and libpng12-devel

* Sat Dec 14 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.15-0vl3
- added Patch200 for linking libz shared lib
- include libpng*-config

* Sat Dec 14 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.15-0vl2
- added missing libraries in the file list

* Tue Nov 12 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.15-0vl1
- update to 1.0.15
- now, security patch were merged source.

* Wed Aug 07 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.12-0vl3
- added another security patch to preserve libpng from processing too wide
  image files (a patch itself extracted from DSA 140-2)

* Fri Aug 02 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.12-0vl2
- added a patch to fix buffer overflow (Patch100)

* Fri Jul 05 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com>
- 1.0.12-0vl1
- updated 1.0.12

* Tue Jan 09 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.0.7-0vl3
- use better macros
- added Japanese summary and description

* Tue Jul 18 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.0.7-0vl2
- oops, spec was in Shift-JIS... Fixed it.

* Mon Jul  3 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- update to 1.0.7

* Tue Mar 21 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 1.0.6

* Mon Mar 13 2000 Nalin Dahyabhai <nalin@redhat.com>
- change serial to Epoch to get dependencies working correctly

* Fri Feb 11 2000 Nalin Dahyabhai <nalin@redhat.com>
- move buildroot and add URL

* Sat Feb  5 2000 Bernhard Rosenkr舅zer <bero@redhat.com>
- strip library
- rebuild to compress man pages

* Sun Nov 21 1999 Bernhard Rosenkr舅zer <bero@redhat.com>
- 1.0.5
- some tweaks to spec file to make updating easier
- handle RPM_OPT_FLAGS

* Mon Sep 20 1999 Matt Wilson <msw@redhat.com>
- changed requires in libpng-devel to include serial
- corrected typo

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Sun Feb 07 1999 Michael Johnson <johnsonm@redhat.com>
- rev to 1.0.3

* Thu Dec 17 1998 Cristian Gafton <gafton@redhat.com>
- build for 6.0

* Wed Sep 23 1998 Cristian Gafton <gafton@redhat.com>
- we are Serial: 1 now because we are reverting the 1.0.2 version from 5.2
  beta to this prior one
- install man pages; set defattr defaults

* Thu May 07 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Thu Apr 30 1998 Cristian Gafton <gafton@redhat.com>
- devel subpackage moved to Development/Libraries

* Wed Apr 08 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to 1.0.1
- added buildroot

* Tue Oct 14 1997 Donnie Barnes <djb@redhat.com>
- updated to new version
- spec file cleanups

* Thu Jul 10 1997 Erik Troan <ewt@redhat.com>
- built against glibc

