Summary: A library for handling different graphics file formats.
Summary(ja): 異なる画像ファイル形式を取り扱うためのライブラリ
Name: netpbm
Version: 10.47.27
Release: 1%{?_dist_release}
License: Artistic License/GPL/MIT
Group: System Environment/Libraries
Source0: netpbm-%{version}.tar.xz
Source3: jpeg-to-pnm.fpi
Source4: pnm-to-ps.fpi
Source5: bmp-to-pnm.fpi
Source6: gif-to-pnm.fpi
Source7: rast-to-pnm.fpi
Source8: tiff-to-pnm.fpi
Source9: png-to-pnm.fpi
#Source10: netpbmdoc-%{version}.tar.bz2
# Patches from fedora core
Patch1: netpbm-time.patch
Patch2: netpbm-message.patch
Patch3: netpbm-security-scripts.patch
Patch4: netpbm-security-code.patch
Patch5: netpbm-nodoc.patch
Patch6: netpbm-gcc4.patch
Patch7: netpbm-bmptopnm.patch
Patch8: netpbm-CAN-2005-2471.patch
Patch9: netpbm-xwdfix.patch
Patch11: netpbm-multilib.patch
Patch12: netpbm-pamscale.patch
Patch13: netpbm-glibc.patch
Patch14: netpbm-svgtopam.patch
Patch15: netpbm-docfix.patch
Patch16: netpbm-ppmfadeusage.patch
Patch17: netpbm-fiasco-overflow.patch
Patch18: netpbm-lz.patch
Patch19: netpbm-pnmmontagefix.patch
Patch20: netpbm-noppmtompeg.patch
Patch21: netpbm-cmuwtopbm.patch
Patch22: netpbm-pamtojpeg2k.patch
Patch23: netpbm-manfix.patch

# bugfix
Patch110: netpbm-10.27-pnmcolormap_segfault.patch

#Security fix


URL: http://netpbm.sourceforge.net/
Buildroot: %{_tmppath}/%{name}-root
BuildRequires: libjpeg-devel, libtiff-devel, zlib-devel, perl
BuildRequires: libpng-devel >= 1.2.5, libX11-devel
BuildRequires: flex
Obsoletes: libgr

Vendor: Project Vine
Distribution: Vine Linux

%description
The netpbm package contains a library of functions which support
programs for handling various graphics file formats, including .pbm
(portable bitmaps), .pgm (portable graymaps), .pnm (portable anymaps),
.ppm (portable pixmaps) and others.

%package devel
Summary: Development tools for programs which will use the netpbm libraries.
Summary(ja): netpbm ライブラリを使うプログラムの開発ツール
Group: Development/Libraries
Requires: netpbm = %{version}-%{release}
Obsoletes: libgr-devel

%description devel
The netpbm-devel package contains the header files and static libraries,
etc., for developing programs which can handle the various graphics file
formats supported by the netpbm libraries.

Install netpbm-devel if you want to develop programs for handling the
graphics file formats supported by the netpbm libraries.  You will also 
need to have the netpbm package installed.

%package progs
Summary: Tools for manipulating graphics files in netpbm supported formats.
Summary(ja): netpbm でサポートするフォーマットの画像ファイルを操作するツール
Group: Applications/Graphics
Requires: netpbm = %{version}-%{release}
Requires: libpng libtiff libjpeg zlib perl bash
Obsoletes: libgr-progs

%description progs
The netpbm-progs package contains a group of scripts for manipulating the
graphics files in formats which are supported by the netpbm libraries.  For
example, netpbm-progs includes the rasttopnm script, which will convert a
Sun rasterfile into a portable anymap.  Netpbm-progs contains many other
scripts for converting from one graphics file format to another.

If you need to use these conversion scripts, you should install
netpbm-progs.  You will also need to install the netpbm package.

%package doc
Summary: Documentation for manipulating graphics files with netpbm-progs formats

Summary(ja): netpbm-progs による画像ファイル操作のドキュメント
Group: Applications/Documentation
Requires: netpbm-progs = %{version}-%{release}

%description doc
The netpbm-doc package contains a documentation in HTML format for utilities
present in netpbm-progs package.

If you need to look into the HTML documentation, you should install
netpbm-doc.  You'll also need to install the netpbm-progs package.

%prep
%setup -q
%patch1 -p1 -b .time
%patch2 -p1 -b .message
%patch3 -p1 -b .security-scripts
%patch4 -p1 -b .security-code
%patch5 -p1 -b .nodoc
%patch6 -p1 -b .gcc4
%patch7 -p1 -b .bmptopnm
%patch8 -p1 -b .CAN-2005-2471
%patch9 -p1 -b .xwdfix
%patch11 -p1 -b .multilib
%patch12 -p1 -b .pamscale
%patch13 -p1 -b .glibc
%patch14 -p1 -b .svgtopam
%patch15 -p1
%patch16 -p1 -b .ppmfadeusage
%patch17 -p1 -b .fiasco-overflow
%patch18 -p1 -b .lz
%patch19 -p1 -b .pnmmmontagefix
%patch20 -p1 -b .noppmtompeg
%patch21 -p1 -b .cmuwtopbmfix
%patch22 -p1 -b .pamtojpeg2kfix
%patch23 -p1 -b .manfix

##%patch110 -p0 -b .pnmcolor_segfault


%build
[ ! -f "/tmp/netpbm" ] && rm -rf /tmp/netpbm

./configure <<EOF
















%ifnarch %{ix86}

%endif
EOF

TOP=`pwd`
make \
	CC=%{__cc} \
	CFLAGS="$RPM_OPT_FLAGS -fPIC -flax-vector-conversions -fno-strict-aliasing" \
	LDFLAGS="-L$TOP/pbm -L$TOP/pgm -L$TOP/pnm -L$TOP/ppm" \
	LADD="-lm" \
	JPEGINC_DIR=%{_includedir} \
	PNGINC_DIR=%{_includedir} \
	TIFFINC_DIR=%{_includedir} \
	JPEGLIB_DIR=%{_libdir} \
	PNGLIB_DIR=%{_libdir} \
	TIFFLIB_DIR=%{_libdir} \
	LINUXSVGALIB=NONE \
	X11LIB=%{_libdir}/libX11.so

# prepare man files
cd userguide
for i in *.html ; do
  ../buildtools/makeman ${i}
done
for i in 1 3 5 ; do
  mkdir -p man/man${i}
  mv *.${i} man/man${i}
done

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT
make package pkgdir=$RPM_BUILD_ROOT/usr LINUXSVGALIB=NONE

# Ugly hack to have libs in correct dir on 64bit archs.
mkdir -p $RPM_BUILD_ROOT%{_libdir}
if [ "%{_libdir}" != "/usr/lib" ]; then
  mv $RPM_BUILD_ROOT/usr/lib/lib* $RPM_BUILD_ROOT%{_libdir}
fi

cp -af lib/libnetpbm.a $RPM_BUILD_ROOT%{_libdir}/libnetpbm.a
ln -sf libnetpbm.so.10 $RPM_BUILD_ROOT%{_libdir}/libnetpbm.so

#mkdir -p $RPM_BUILD_ROOT%{_mandir}
#tar jxvf %{SOURCE10} -C $RPM_BUILD_ROOT%{_mandir}

mkdir -p $RPM_BUILD_ROOT%{_datadir}
mv userguide/man $RPM_BUILD_ROOT%{_mandir}

# Get rid of the useless non-ascii character in pgmminkowski.1
sed -i 's/\xa0//' $RPM_BUILD_ROOT%{_mandir}/man1/pgmminkowski.1

# Don't ship man pages for non-existent binaries and bogus ones
for i in hpcdtoppm \
         ppmsvgalib vidtoppm picttoppm \
         directory error extendedopacity \
         pam pbm pgm pnm ppm index libnetpbm_dir \
         liberror ppmtotga; do
        rm -f $RPM_BUILD_ROOT%{_mandir}/man1/${i}.1
done

mv $RPM_BUILD_ROOT/usr/misc/*.map $RPM_BUILD_ROOT%{_libdir}
rm -rf $RPM_BUILD_ROOT/usr/README
rm -rf $RPM_BUILD_ROOT/usr/VERSION
rm -rf $RPM_BUILD_ROOT/usr/link
rm -rf $RPM_BUILD_ROOT/usr/misc
rm -rf $RPM_BUILD_ROOT/usr/man
rm -rf $RPM_BUILD_ROOT/usr/pkginfo
rm -rf $RPM_BUILD_ROOT/usr/config_template

mkdir -p $RPM_BUILD_ROOT%{_libdir}/rhs/rhs-printfilters
for filter in $RPM_SOURCE_DIR/*.fpi ; do
    install -m755 $filter \
	$RPM_BUILD_ROOT%{_libdir}/rhs/rhs-printfilters
done

rm -f $RPM_BUILD_ROOT%{_mandir}/man5/extendedopacity.5

mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
install lib/rgb.txt $RPM_BUILD_ROOT%{_datadir}/%{name}/rgb.txt

# Don't ship the static library
rm -f $RPM_BUILD_ROOT/%{_libdir}/lib*.a

# remove/symlink/substitute obsolete utilities
pushd $RPM_BUILD_ROOT%{_bindir}
rm -f pgmtopbm pnmcomp
ln -s pamcomp pnmcomp
echo -e '#!/bin/sh\npamditherbw $@ | pamtopnm\n' > pgmtopbm
chmod 0755 pgmtopbm
popd

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
# clean builddir
[ ! -f "/tmp/netpbm" ] && rm -rf /tmp/netpbm

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README doc/COPYRIGHT.PATENT doc/GPL_LICENSE.txt doc/HISTORY doc/USERDOC
%{_libdir}/lib*.so.*

%files devel
%defattr(-,root,root)
%dir %{_includedir}/netpbm
%{_includedir}/netpbm/*.h
%{_libdir}/lib*.so
%{_mandir}/man3/*

%files progs
%defattr(-,root,root)
%{_bindir}/*
#%{_libdir}/rhs/rhs-printfilters/jpeg-to-pnm.fpi
#%{_libdir}/rhs/rhs-printfilters/pnm-to-ps.fpi
#%{_libdir}/rhs/rhs-printfilters/bmp-to-pnm.fpi
#%{_libdir}/rhs/rhs-printfilters/gif-to-pnm.fpi
#%{_libdir}/rhs/rhs-printfilters/rast-to-pnm.fpi
#%{_libdir}/rhs/rhs-printfilters/tiff-to-pnm.fpi
#%{_libdir}/rhs/rhs-printfilters/png-to-pnm.fpi
%{_libdir}/*.map
%{_datadir}/%{name}/rgb.txt
%{_mandir}/man1/*
%{_mandir}/man5/*

%files doc
%defattr(-,root,root)
%doc userguide/*

%changelog
* Mon Apr 18 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.47.27-1
- new upstream release.
- shipped all patches from Fedora development.
- added a subpackage "netpbm-doc".
- rebuilt with recent environment.

* Sun Jul 27 2008 Shu KONNO <owa@bg.wakwak.com> 10.27-1vl5
- applied new versioning policy and spec in utf-8

* Sat Jul 28 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.27-0vl6
- changed progs package Group to Applications/Graphics

* Sun Jan 07 2007 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 10.27-0vl5
- make with LINUXSVGALIB=NONE not to depend on svgalib

* Wed Dec 27 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.27-0vl4
- rebuilt for VineSeed

* Thu Dec 21 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 10.27-0vl3.2
- add Vender/Distribution tag

* Wed Dec 13 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 10.27-0vl3.1
- add patch200 for fix CVE-2005-2471
- add patch210 for fix CVE-2005-2978
- add patch220 for fix CVE-2005-3662

* Wed Dec 13 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 10.27-0vl3.0.1
- add patch110 for fix pnmcolormap segfault

* Fri Aug 18 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 10.27-0vl3
- add BuildPrereq: flex
- fix build on x86_64

* Mon Apr 25 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 10.27-0vl2
- add Patch100 to use own rgb.txt as secondary rgb database.
- add rgb.txt again, and move it to %%{_datadir}/netpbm/
- remove dependancy to XOrg-libs
- remove unneeded printconf filters

* Sun Apr 24 2005 Satoshi MACHINO <machino@vinelinux.org> 10.27-0vl1
- new upstream release
	-- added some patches from fedora
- removed rgb.txt because it is included XOrg-libs
- added XOrg-libs, libpng, libtiff, libjpeg, perl and bash to Requires of progs

* Mon May 10 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 10.18.12-0vl1
- new upstream release
- build without svgalib

* Thu Jan 08 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 10.18.4-0vl2
- modified build section for non-ix86 archtectures
  (svgalib is exclusive package for ix86 arch)

* Sun Dec 28 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.18.4-0vl1
- update to 10.18.4
- rebuild with new toolchains

* Tue Oct 14 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.11.15-0vl1
- update to 10.11.15

* Sun Jul 13 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.11.10-0vl1
- update to 10.11.10
- s/Copyright/License/
- fixed License to Artistic License/GPL/MIT
  (http://sourceforge.net/projects/netpbm/)
- added URL

* Thu May  1 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 10.11.6-0vl2
- rebuild with libpng-1.2.5 (BuildPrereq: libpng-devel >= 1.2.5)

* Fri Mar 14 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.11.6-0vl1
- update to 10.11.6

* Thu Dec 12 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.11.2-0vl1
- update to 10.11.2

* Sun Jun 09 2002 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 9.24-4vl1
- merged with rawhide

* Mon Feb 19 2001 Jun Nishii <jun@vinelinux.org>
- 9.9-3vl1
- added Summary(ja)

* Wed Jan 24 2001 Philipp Knirsch <pknirsch@redhat.de>
- Fixed bugzilla bug #21644 where few manpages had a small error.

* Tue Dec 19 2000 Philipp Knirsch <pknirsch@redhat.de>
- Fixed bugzilla bug #19487 where asciitopgm dumped core on Alpha. Actually
  dumped core everywhere

* Tue Dec 19 2000 Philipp Knirsch <pknirsch@redhat.de>
- update to 9.9
- Due to patent infringement problems removed the jbig support from the tarball
  (pnm/jbig + Makefile changes) and created a new tarball

* Wed Oct 25 2000 Nalin Dahyabhai <nalin@redhat.com>
- include shared libraries missing from previous build

* Tue Oct 24 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 9.8
- make sure shhopt.h is included in the -devel package (#19672)
- rename shhopt.h to pbmshhopt.h because it's not the same as the normal
  shhopt.h that other things (like util-linux) expect

* Wed Aug  9 2000 Crutcher Dunnavant <crutcher@redhat.com>
- added a png-to-pnm.fpi filter

* Wed Aug  2 2000 Matt Wilson <msw@redhat.com>
- rebuilt against new libpng

* Mon Jul 17 2000 Nalin Dahyabhai <nalin@redhat.com>
- move netpbm-progs to the Applications/Multimedia group
- reintroduce patches from the old libgr package

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sat Jul  1 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 9.5

* Tue Jun 27 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 9.4

* Sat Jun  3 2000 Nalin Dahyabhai <nalin@redhat.com>
- switch back to the netpbm tree, which is maintained again

* Mon Feb 14 2000 Nalin Dahyabhai <nalin@redhat.com>
- make sure all man pages are included (#9328)
- fix pstopnm bomb when xres == yres (#9329)
- add libjpeg and libz because libtiff now needs them

* Wed Feb 02 2000 Nalin Dahyabhai <nalin@redhat.com>
- added/updated TIFF compression patch from jik@kamens.brookline.ma.us (#8826)

* Mon Dec 06 1999 Michael K. Johnson <johnsonm@redhat.com>
- added TIFF resolution patch from jik@kamens.brookline.ma.us (#7589)

* Mon Sep 20 1999 Michael K. Johnson <johnsonm@redhat.com>
- added section 5 man pages

* Fri Jul 30 1999 Bill Nottingham <notting@redhat.com>
- fix tiff-to-pnm.fpi (#4267)

* Thu Jul 29 1999 Bill Nottingham <notting@redhat.com>
- add a pile of foo-to-bar.fpi filters (#4251)

* Mon Mar 23 1999 Michael Johnson <johnsonm@redhat.com>
- removed old png.h header file that was causing png utils to die
- build png in build instead of install section...

* Mon Mar 22 1999 Bill Nottingham <notting@redhat.com>
- patch for 24-bit .BMP files (from sam@campbellsci.co.uk)

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

* Wed Jan 06 1999 Cristian Gafton <gafton@redhat.com>
- clean up the spec file
- build for glibc 2.1
- patch to fix pktopbm

* Wed Jun 10 1998 Prospector System <bugs@redhat.com>
- translations modified for de

* Wed Jun 10 1998 Jeff Johnson <jbj@redhat.com>
- glibc2 defines random in <stdlib.h> (pbm/pbmplus.h problem #693)

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

* Thu May 07 1998 Cristian Gafton <gafton@redhat.com>
- cleaned up the spec file a little bit
- validated mike's changes :-)

* Wed May 6 1998 Michael Maher <mike@redhat.com>
- added pnm-to-ps.fpi that was missing from previous packages

* Thu Apr 30 1998 Cristian Gafton <gafton@redhat.com>
- altered %install so that the package installs now even if a previous
  version was not installed on the system 

* Thu Apr 16 1998 Erik Troan <ewt@redhat.com>
- built against libpng 1.0

* Thu Nov 06 1997 Donnie Barnes <djb@redhat.com>
- changed copyright from "distributable" to "freeware"
- added some missing scripts that existed in netpbm
- added some binaries that weren't getting built
- added patch to build tiff manipulation progs (requires libtiff)

* Wed Oct 15 1997 Donnie Barnes <djb@redhat.com>
- obsoletes netpbm now

* Tue Oct 14 1997 Erik Troan <ewt@redhat.com>
- mucked config.guess and Make.Rules to build on Alpha/Linux

* Tue Oct 07 1997 Donnie Barnes <djb@redhat.com>
- updated to 2.0.13
- dropped libjpeg and libtiff (those should come from home sources)
- removed glibc patch (new version appears to have it!)
- added i686 as a valid arch type to config.guess

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