%define src_ver 5.52
%define src_file unzip552

Summary: A utility for unpacking zip files.
Summary(ja): zip ファイルを展開するユーティリティ
Name: unzip
Version: %{src_ver}
Release: 3%{?_dist_release}
License: BSD
Group: Applications/Archiving
Source: ftp://ftp.info-zip.org/pub/infozip/src/%{src_file}.tar.gz
Patch0: unzip542-rpmoptflags.patch

Patch1: unzip-5.52-near-4GB.patch
Patch2: unzip-5.52-near-4GB2.patch
# Patch3: unzip-5.51-near-4GB3.patch
Patch10: unzip-5.51-link-segv.patch
Patch11: unzip-5.51-link-segv2.patch
# Patch12: unzip-5.51-link-segv3.patch
Patch13: unzip-5.52-open.patch

Patch100: unzip-5.52_CVE-2005-4667.patch
Patch110: unzip-5.52-deb-CVE-2008-0888.patch

# http://www.coara.or.jp/~sudakyo/dasworksrpms.html#unzip 
Patch200: unzip-5.52-nls.patch

URL: http://www.info-zip.org/pub/infozip/UnZip.html
BuildRoot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux

%description
The unzip utility is used to list, test, or extract files from a zip
archive.  Zip archives are commonly found on MS-DOS systems.  The zip
utility, included in the zip package, creates zip archives.  Zip and
unzip are both compatible with archives created by PKWARE(R)'s PKZIP
for MS-DOS, but the programs' options and default behaviors do differ
in some respects.

Install the unzip package if you need to list, test or extract files from
a zip archive.

%description -l ja
unzip ユーティリティは,zip アーカイブ内のファイルを一覧表示したり,
テスト/展開する為に使うユーティリティです.zip アーカイブは MS-DOS
システムで一般的に使われます.
zip パッケージに含まれる zip プログラムは zip アーカイブを
作成するのに使います.
zip と unzip は PKWARE(R) の MS-DOS 用 PKZIP で作成された zip アーカイブに
対応していますが,デフォルトの動作やプログラムオプション等一部が
異なります.


%prep
%setup -q 
%patch0 -p1 -b .rpmo
%patch1 -p1 -b .4GB
%patch2 -p1 -b .4GB2
# %patch3 -p1 -b .4GB3

%patch10 -p1 -b .link-segv
%patch11 -p1 -b .morn
# %patch12 -p1 -b .morn2
%patch13 -p1 -b .open

%patch100 -p1 -b .CVE-2005-4667
%patch110 -p0 -b .CVE-2008-0888

%patch200 -p1 -b .nls

ln -s unix/Makefile Makefile

%build
make LOCAL_UNZIP="-DNLS" CFLAGS="-D_LARGEFILE64_SOURCE" linux_noasm LF2=""


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

make prefix=$RPM_BUILD_ROOT%{_prefix} MANDIR=$RPM_BUILD_ROOT/%{_mandir}/man1 install LF2=""


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


%files
%defattr(-,root,root)
%doc README BUGS LICENSE INSTALL
%{_bindir}/*
%{_mandir}/*/*


%changelog
* Tue Apr  5 2011 IWAI, Masaharu <iwai@alib.jp> 5.52-3vl6
- build on current VineSeed

* Wed Apr 15 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 5.52-2
- spec in utf-8
- add NLS patch

* Wed Apr 09 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 5.52-1
- new upstream release
- add patch13 from fc8
- update patches to fit new release & drop old patches
- with new versioning polity

* Wed Apr 09 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 5.51-11vl4
- fix changelog typo

* Wed Apr 09 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 5.51-10vl4
- update patch100 to fix ppc issue (it was patch5, from rhel4)
- renumber patchs
- add patch 2,3 to support big archive (from rhel4)
- with new versioning polity

* Fri Mar 21 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 5.51-9vl1.1
- add patch5 for fix CVE-2005-4667
- add patch6 for fix CVE-2008-0888 
- add Vendor/Distribution tag

* Tue May 10 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.51-9vl1
- new upstream release
- based on 5.51-9 Fedora development
  * Thu Feb 10 2005 Ivana Varekova <varekova@redhat.com> 5.51-9
  - fix the other problem with unpacking zipfiles containing symlinks
    (bug #134073)
  * Thu Feb 03 2005 Ivana Varekova <varekova@redhat.com> 5.51-8
  - fix segfault with unpacking of zipfiles containing dangling symlinks
    (bug #134073)
  * Thu Dec 02 2004 Lon Hohberger <lhh@redhat.com> 5.51-5
  - Fix segfault on extraction of symlinks
  * Mon Jun 21 2004 Lon Hohberger <lhh@redhat.com> 5.51-4
  - Extend max file/archive size to 2^32-8193 (4294959103) bytes
  * Tue Jun 08 2004 Lon Hohberger <lhh@redhat.com> 5.51-1.1
  - Update to 5.51; remove dotdot patch.

* Tue Sep 23 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.50-5vl2
- merged patch1 from Vine Linux 2.6 updates
  - Thu Aug 28 2003 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.50-4vl3
  - replace patch1 from RedHat (RHSA-2003:199-02).

  - Fri Jul 18 2003 Kunio Murasawa <murasawa@fa2.so-net.ne.jp> 5.50-4vl2
  - added patch1 from Redhat (RHSA-2003:199-01)


* Sun Dec  1 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 5.50-5vl1
- modified changelog section :-P (merge rawhidee changelogs)

  - Sun Dec  1 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.50-4vl2
  - rebuild with new toolchains

  - Sun May 26 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.50-4vl1
  - based on 5.50-4 from Rawhide 
  - previous Vine version was 5.41-3vl1:

  - Tue Dec 26 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
  - 5.41-3vl1
  - based on 5.41-3 from Rawhide
  - added Japanese summary and description
  - use better macros

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Thu Apr 25 2002 Trond Eivind Glomsr︰ <teg@redhat.com> 5.50-3
- Rebuild

* Tue Apr  2 2002 Trond Eivind Glomsr︰ <teg@redhat.com> 5.50-2
- Make it not strip

* Wed Mar 13 2002 Trond Eivind Glomsr︰ <teg@redhat.com> 5.50-1
- 5.50

* Thu Feb 21 2002 Trond Eivind Glomsr︰ <teg@redhat.com> 5.42-3
- Rebuild

* Wed Jan 09 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Mon May 21 2001 Trond Eivind Glomsr︰ <teg@redhat.com>
- 5.42
- Don't strip binaries explicitly
- build without assembly, it doesn't seem to increase performance 
- make it respect RPM_OPT_FLAGS, define _GNU_SOURCE
- use %%{_tmppath}
- "License:" replaces "Copyright:"
- Update URL
- include zipgrep
- COPYING doesn't exist anymore, include LICENSE instead

* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sun Jun 11 2000 BIll Nottingham <notting@redhat.com>
- rebuild in new env.; FHS fixes.

* Tue Apr 18 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 4.51 (an acceptable license at last...)

* Thu Feb  3 2000 Bill Nottingham <notting@redhat.com>
- handle compressed man pages

* Fri Jul 30 1999 Bill Nottingham <notting@redhat.com>
- update to 5.40

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

* Thu Dec 17 1998 Michael Maher <mike@redhat.com>
- built for 6.0

* Tue Aug 11 1998 Jeff Johnson <jbj@redhat.com>
- build root

* Mon Apr 27 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Tue Oct 21 1997 Erik Troan <ewt@redhat.com>
- builds on non i386 platforms

* Mon Oct 20 1997 Otto Hammersmith <otto@redhat.com>
- updated the version

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