#
# spec file for package zip
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           zip
Version:        3.0
Release:        20.10
%define file_version 30
Summary:        File compression program
License:        BSD-3-Clause
Group:          Productivity/Archiving/Compression
Url:            https://github.com/distropatches/zip/commits/opensuse
Source:         http://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz
Patch2:         zip-3.0-iso8859_2.patch
Patch3:         zip-3.0-add_options_to_help.patch
Patch4:         zip-3.0-nonexec-stack.patch
Patch5:         zip-3.0-optflags.patch
Patch6:         zip-3.0-tempfile.patch
Patch7:         zip-notimestamp.patch
Patch8:         zip-3.0-nomutilation.patch
# PATCH-FIX-UPSTREAM bsc#1068346 kstreitova@suse.com -- fix memory leaks
Patch9:         zip-3.0-fix-memory_leaks.patch
Patch10:        reproducible.patch
Patch11:        zip-3.0-fix-doc.patch
Provides:       crzip = %{version}
Obsoletes:      crzip < %{version}
BuildRequires:  libbz2-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Zip is a compression and file packaging utility. It is compatible with
PKZIP(tm) 2.04g (Phil Katz ZIP) for MS-DOS systems.

%prep
%setup -q -n zip%{file_version}
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10 -p1
%patch11 -p1

%build
make %{?_smp_mflags} -f unix/Makefile prefix=/usr CC="gcc %{optflags} -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc

%install
mkdir -p %{buildroot}%{_prefix}/bin
mkdir -p %{buildroot}%{_mandir}/man1
make install -f unix/Makefile BINDIR=%{buildroot}%{_bindir} MANDIR=%{buildroot}%{_mandir}/man1

%files
%defattr(-,root,root)
%doc BUGS CHANGES INSTALL LICENSE README TODO WHATSNEW WHERE
%doc %{_mandir}/man1/zip.1.gz
%doc %{_mandir}/man1/zipcloak.1.gz
%doc %{_mandir}/man1/zipnote.1.gz
%doc %{_mandir}/man1/zipsplit.1.gz
%{_bindir}/zip
%{_bindir}/zipcloak
%{_bindir}/zipnote
%{_bindir}/zipsplit

%changelog
* Fri May  3 2019 Bernhard Wiedemann <bwiedemann@suse.com>
- Add reproducible.patch to allow to override mtime values
  stored in .zip (boo#1047218)
- Add zip-3.0-fix-doc.patch for the --strip-extra param
* Tue Nov 28 2017 kstreitova@suse.com
- add zip-3.0-fix-memory_leaks.patch to fix memory leaks in zip.c,
  zipfile.c and fileio.c files [bsc#1068346]
* Thu Jun 18 2015 hsk@imb-jena.de
- add libbz2-devel as build requirement
* Thu Apr  3 2014 tbehrens@suse.com
- Fix bnc#785305
  * Add patch zip-3.0-nomutilation.patch
* Fri Apr  5 2013 idonmez@suse.com
- Add Source URL, see http://en.opensuse.org/SourceUrls
- Cleanup spec file
* Fri May 21 2010 pth@suse.de
- Update to Zip 3.0:
  * large-file support (i.e., > 2GB)
  * support for more than 65536 files per archive
  * multi-part archive support
  * bzip2 compression support
  * Unicode (UTF-8) filename and (partial) comment support
  * difference mode (for incremental backups)
  * filesystem-synch mode
  * cross-archive copy mode
  * extended progress info and logging
  * improved archive-fixing support
  * improved streaming and piping
  * improved command-line parser
  * improved Unix FIFO support
  * Unix 32-bit UIDs/GIDs (requires UnZip 6.0 to restore)
* Sat Mar  6 2010 aj@suse.de
- Do not record build time in executable to have reproduceable builds.
* Thu Dec 17 2009 jengelh@medozas.de
- enable parallel building
* Tue Nov 24 2009 crrodriguez@opensuse.org
- refresh patches
* Fri Aug  3 2007 dmueller@suse.de
- update to 2.32:
  * fixed -R operation to match the supplied file patterns
  * handle cases where -x, -R, and -i patterns are mixed
  * added some directory-search speedups
  * fixed bug when encrypting large uncompressible files
  * fixed selection of files to delete by date
  * added -MM option where each input file pattern must
    match at least one file and all input files must be readable
  * added check for when Zip tries to exceed seek limit in output file
  * minor changes to compile with Visual C++ 2005
  * added support for Unix FIFOs (named pipes)
  * other minor fixes
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Dec 15 2005 pth@suse.de
- Compile with (limited) large file support. This will support
  single files exceeding 2 GB as long as the archive stays below
  that theshold.
* Mon Oct 31 2005 dmueller@suse.de
- build with non-executable stack
* Mon Jul 18 2005 rommel@suse.de
- update to version 2.31 (has the crypto stuff previously in zip-2.3.patch,
  obsoletes zip-longpath.patch, a few more fixes)
* Mon Apr 25 2005 meissner@suse.de
- correctly use RPM_OPT_FLAGS.
* Thu Dec  2 2004 rommel@suse.de
- reworked zip-longpath.patch, missing free's after malloc
* Thu Nov 11 2004 rommel@suse.de
- added zip-longpath.patch (Bugzilla #47932)
* Fri Jan  9 2004 adrian@suse.de
- build as user
* Tue Sep 17 2002 ro@suse.de
- removed bogus self-provides
* Thu Jan 24 2002 grimmer@suse.de
- added zip-2.3-iso8859_2.patch to fix coding conversion
  between Microsoft and Linux file names
  (originally from http://www.axis.cz/linux/zip_unzip.php3,
  enhanced to support both ISO8859-1 and ISO8859-2 by Petr Mladek
  <pmladek@suse.cz>)
* Wed Jan 23 2002 okir@suse.de
- Fixed tempfile race
* Mon Jun 18 2001 schwab@suse.de
- Fix cpp directives inside macro call.
* Thu Dec 14 2000 grimmer@suse.de
- added encryption patch
- bzipped sources
- now Provides and Obsoletes crzip
* Wed Mar  1 2000 schwab@suse.de
- /usr/man -> /usr/share/man
* Fri Dec 17 1999 grimmer@suse.de
- Update to 2.3
- Spec file cleanups
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Mon Feb 22 1999 grimmer@suse.de
- New version (2.2)
- specfile updates
- added french PAC-info
* Thu Feb  6 1997 rj@suse.de
- Version 2.01:
- ownerships changed
- some cosmetic changes