Initial ZipArchive import

This commit is contained in:
Hans de Goede 2012-01-23 20:53:30 +01:00
commit 7d9c5a1271
7 changed files with 366 additions and 0 deletions

1
.gitignore vendored
View file

@ -0,0 +1 @@
/ziparchive_src.zip

106
ZipArchive-autotools.patch Normal file
View file

@ -0,0 +1,106 @@
diff -up ZipArchive-4.1.1/ZipArchive/autogen.sh.autotools ZipArchive-4.1.1/ZipArchive/autogen.sh
--- ZipArchive-4.1.1/ZipArchive/autogen.sh.autotools 2011-12-23 11:10:11.000000000 +0100
+++ ZipArchive-4.1.1/ZipArchive/autogen.sh 2011-12-23 11:10:11.000000000 +0100
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+if [ "$USER" = "root" ]; then
+ echo "You cannot do this as "$USER" please use a normal user account"
+ exit
+fi
+
+libtoolize --copy
+aclocal
+autoheader
+automake --add-missing --copy --foreign
+autoconf
diff -up ZipArchive-4.1.1/ZipArchive/configure.ac.autotools ZipArchive-4.1.1/ZipArchive/configure.ac
--- ZipArchive-4.1.1/ZipArchive/configure.ac.autotools 2011-12-23 11:10:11.000000000 +0100
+++ ZipArchive-4.1.1/ZipArchive/configure.ac 2011-12-23 14:50:00.000000000 +0100
@@ -0,0 +1,21 @@
+## Bootstrap autoconf/automake
+AC_PREREQ(2.59)
+AC_INIT([ZipArchive], [4.1.1], [])
+AC_CANONICAL_TARGET
+AC_CONFIG_SRCDIR([configure.ac])
+AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER([config.h])
+
+## Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_CC_STDC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_LIBTOOL
+
+# Produce output
+AC_CONFIG_FILES([Makefile ZipArchive.pc])
+AC_OUTPUT
+
+echo "Type 'make' to compile"
diff -up ZipArchive-4.1.1/ZipArchive/Makefile.am.autotools ZipArchive-4.1.1/ZipArchive/Makefile.am
--- ZipArchive-4.1.1/ZipArchive/Makefile.am.autotools 2011-12-23 11:10:11.000000000 +0100
+++ ZipArchive-4.1.1/ZipArchive/Makefile.am 2011-12-23 11:10:11.000000000 +0100
@@ -0,0 +1,45 @@
+MAINTAINERCLEANFILES = INSTALL \
+ Makefile.in \
+ aclocal.m4 \
+ config.guess \
+ config.h.in \
+ config.h.in~ \
+ stamp-h.in \
+ config.sub \
+ configure \
+ install-sh \
+ missing \
+ mkinstalldirs \
+ ltmain.sh \
+ ltconfig \
+ compile \
+ depcomp
+
+AM_CXXFLAGS = -Wall
+
+lib_LTLIBRARIES = libziparch.la
+
+libziparch_la_LDFLAGS = -release $(VERSION)
+libziparch_la_LIBADD = -lz
+
+libziparch_la_SOURCES = \
+ZipArchive.cpp ZipAutoBuffer.cpp ZipCentralDir.cpp \
+ZipCompressor.cpp BaseLibCompressor.cpp Bzip2Compressor.cpp \
+DeflateCompressor.cpp ZipCompatibility.cpp ZipException.cpp ZipFile_stl.cpp ZipFileHeader.cpp \
+ZipMemFile.cpp ZipPathComponent_lnx.cpp ZipPlatformComm.cpp ZipPlatform_lnx.cpp \
+ZipStorage.cpp ZipString.cpp ZipExtraData.cpp ZipExtraField.cpp \
+DirEnumerator.cpp FileFilter.cpp Wildcard.cpp \
+ZipCryptograph.cpp ZipCrc32Cryptograph.cpp \
+Aes.cpp Hmac.cpp RandomPool.cpp ZipAesCryptograph.cpp Sha1.cpp
+
+libziparchdir = $(includedir)/ZipArchive
+
+libziparch_HEADERS = \
+BitFlag.h DirEnumerator.h _features.h FileFilter.h FileInfo.h _platform.h \
+stdafx.h std_stl.h Wildcard.h ZipAbstractFile.h ZipArchive.h ZipAutoBuffer.h \
+ZipBaseException.h ZipCallback.h ZipCallbackProvider.h ZipCentralDir.h \
+ZipCollections.h ZipCollections_stl.h ZipCompatibility.h ZipCompressor.h \
+ZipCryptograph.h ZipException.h ZipExport.h ZipExtraData.h ZipExtraField.h \
+ZipFile.h ZipFileHeader.h ZipFile_stl.h ZipMemFile.h ZipMutex.h ZipMutex_lnx.h \
+ZipPathComponent.h ZipPlatform.h ZipSplitNamesHandler.h ZipStorage.h \
+ZipString.h ZipString_stl.h ZipStringStoreSettings.h
diff -up ZipArchive-4.1.1/ZipArchive/ZipArchive.pc.in.autotools ZipArchive-4.1.1/ZipArchive/ZipArchive.pc.in
--- ZipArchive-4.1.1/ZipArchive/ZipArchive.pc.in.autotools 2011-12-23 14:49:38.000000000 +0100
+++ ZipArchive-4.1.1/ZipArchive/ZipArchive.pc.in 2011-12-23 14:48:57.000000000 +0100
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/ZipArchive
+
+Name: ZipArchive
+Description: ZipArchive library
+Version: @VERSION@
+
+Requires:
+Libs: -L${libdir} -lziparch
+Cflags: -I${includedir}

60
ZipArchive-gcc-4.7.patch Normal file
View file

@ -0,0 +1,60 @@
diff -up ZipArchive-4.1.1/ZipArchive/ZipCollections_stl.h.gcc47 ZipArchive-4.1.1/ZipArchive/ZipCollections_stl.h
--- ZipArchive-4.1.1/ZipArchive/ZipCollections_stl.h.gcc47 2011-06-28 09:45:36.000000000 +0200
+++ ZipArchive-4.1.1/ZipArchive/ZipCollections_stl.h 2012-01-12 22:49:15.092984963 +0100
@@ -88,10 +88,10 @@ public:
TYPE& GetAt(size_t uIndex) {return this->at(uIndex);}
const TYPE& GetAt(size_t uIndex) const {return this->at(uIndex);}
void SetAt(size_t uIndex, TYPE value) {inherited::operator[](uIndex) = value; }
- size_t Add(const TYPE& x) {push_back(x);return GetUpperBound();}
+ size_t Add(const TYPE& x) {this->push_back(x);return GetUpperBound();}
void RemoveAll() {this->clear();}
- void RemoveAt(size_t uIndex) { erase(GetIterFromIndex(uIndex));}
- void InsertAt(size_t uIndex, const TYPE& x){insert(GetIterFromIndex(uIndex), x);}
+ void RemoveAt(size_t uIndex) { this->erase(GetIterFromIndex(uIndex));}
+ void InsertAt(size_t uIndex, const TYPE& x){this->insert(GetIterFromIndex(uIndex), x);}
TYPE& operator[](size_t uIndex)
{
return inherited::operator[](uIndex);
@@ -115,7 +115,7 @@ public:
typedef typename std::list<TYPE>::iterator iterator;
typedef typename std::list<TYPE>::const_iterator const_iterator;
size_t GetCount() const {return this->size();}
- void AddTail(const TYPE& x){push_back(x);}
+ void AddTail(const TYPE& x){this->push_back(x);}
void AddHead(const TYPE& x){push_front(x);}
void RemoveHead() {this->pop_front();}
void RemoveTail() {this->pop_back();}
@@ -132,7 +132,7 @@ public:
TYPE& GetPrev(iterator& pos) { return *pos--;}
TYPE GetPrev(iterator& pos) const{ return *pos--;}
iterator Find(TYPE& x) { return std::find(this->begin(), this->end(), x);}
- void RemoveAt(iterator& pos) { erase(pos);}
+ void RemoveAt(iterator& pos) { this->erase(pos);}
bool IteratorValid(const_iterator &iter) const
{
return iter != this->end();
@@ -168,11 +168,11 @@ public:
typedef typename std::map<KEY,VALUE, std::less<KEY>, std::allocator<std::pair<const KEY, VALUE> > >::value_type v_type;
void SetAt( KEY key, VALUE newValue)
{
- insert(v_type(key, newValue));
+ this->insert(v_type(key, newValue));
}
ZBOOL RemoveKey( KEY key )
{
- return erase(key) != 0;
+ return this->erase(key) != 0;
}
ZBOOL Lookup( KEY key, VALUE& rValue ) const
{
diff -up ZipArchive-4.1.1/ZipArchive/ZipPlatform.h.gcc47 ZipArchive-4.1.1/ZipArchive/ZipPlatform.h
--- ZipArchive-4.1.1/ZipArchive/ZipPlatform.h.gcc47 2012-01-12 22:49:43.750984616 +0100
+++ ZipArchive-4.1.1/ZipArchive/ZipPlatform.h 2012-01-12 22:49:59.620984395 +0100
@@ -29,6 +29,7 @@ class CZipAutoBuffer;
#include "ZipString.h"
#include "ZipPathComponent.h"
+#include <stdint.h>
#include <sys/types.h>
#include "ZipExport.h"

View file

@ -0,0 +1,11 @@
--- ZipArchive-4.1.1.orig/ZipArchive/_platform.h 2011-06-28 09:45:36.000000000 +0200
+++ ZipArchive-4.1.1/ZipArchive/_platform.h 2011-12-11 22:10:53.000000000 +0100
@@ -29,7 +29,7 @@
/************************************ BLOCK START ***********************************/
//#define _ZIP_IMPL_MFC
-//#define _ZIP_SYSTEM_LINUX
+#define _ZIP_SYSTEM_LINUX
// simplified endianess detection
#ifdef __APPLE__

View file

@ -0,0 +1,83 @@
diff -up ZipArchive-4.1.1/ZipArchive/DeflateCompressor.cpp.system-zlib ZipArchive-4.1.1/ZipArchive/DeflateCompressor.cpp
--- ZipArchive-4.1.1/ZipArchive/DeflateCompressor.cpp.system-zlib 2011-06-28 09:45:36.000000000 +0200
+++ ZipArchive-4.1.1/ZipArchive/DeflateCompressor.cpp 2011-12-23 11:07:14.000000000 +0100
@@ -14,7 +14,7 @@
#include "stdafx.h"
#include "DeflateCompressor.h"
-#include "zlib/deflate.h"
+#include <zlib.h>
namespace ZipArchiveLib
{
diff -up ZipArchive-4.1.1/ZipArchive/DeflateCompressor.h.system-zlib ZipArchive-4.1.1/ZipArchive/DeflateCompressor.h
--- ZipArchive-4.1.1/ZipArchive/DeflateCompressor.h.system-zlib 2011-06-28 09:45:36.000000000 +0200
+++ ZipArchive-4.1.1/ZipArchive/DeflateCompressor.h 2011-12-23 11:07:14.000000000 +0100
@@ -28,7 +28,7 @@
#include "ZipExport.h"
#include "BaseLibCompressor.h"
#include "ZipException.h"
-#include "zlib/zlib.h"
+#include <zlib.h>
namespace ZipArchiveLib
{
diff -up ZipArchive-4.1.1/ZipArchive/_platform.h.system-zlib ZipArchive-4.1.1/ZipArchive/_platform.h
--- ZipArchive-4.1.1/ZipArchive/_platform.h.system-zlib 2011-12-23 11:07:14.000000000 +0100
+++ ZipArchive-4.1.1/ZipArchive/_platform.h 2011-12-23 11:07:14.000000000 +0100
@@ -63,4 +63,19 @@
#error Using MFC under a non-Windows platform is not supported
#endif
+// revert symbol names back to system zlib
+#define zarch_alloc_func alloc_func
+#define zarch_free_func free_func
+#define zarch_uInt uInt
+#define zarch_Bytef Bytef
+#define zarch_z_stream z_stream
+#define zarch_crc32 crc32
+#define zarch_deflateInit2_ deflateInit2_
+#define zarch_deflate deflate
+#define zarch_deflateEnd deflateEnd
+#define zarch_inflateInit2_ inflateInit2_
+#define zarch_inflate inflate
+#define zarch_inflateEnd inflateEnd
+#define zarch_get_crc_table get_crc_table
+
#endif // !defined(ZIPARCHIVE_PLATFORM_DOT_H)
diff -up ZipArchive-4.1.1/ZipArchive/ZipCrc32Cryptograph.h.system-zlib ZipArchive-4.1.1/ZipArchive/ZipCrc32Cryptograph.h
--- ZipArchive-4.1.1/ZipArchive/ZipCrc32Cryptograph.h.system-zlib 2011-06-28 09:45:36.000000000 +0200
+++ ZipArchive-4.1.1/ZipArchive/ZipCrc32Cryptograph.h 2011-12-23 11:07:14.000000000 +0100
@@ -25,7 +25,7 @@
#pragma once
#endif
-#include "zlib/zlib.h"
+#include <zlib.h>
#include "ZipCryptograph.h"
#include "ZipFileHeader.h"
diff -up ZipArchive-4.1.1/ZipArchive/ZipException.cpp.system-zlib ZipArchive-4.1.1/ZipArchive/ZipException.cpp
--- ZipArchive-4.1.1/ZipArchive/ZipException.cpp.system-zlib 2011-06-28 09:45:36.000000000 +0200
+++ ZipArchive-4.1.1/ZipArchive/ZipException.cpp 2011-12-23 11:07:14.000000000 +0100
@@ -14,7 +14,7 @@
#include "stdafx.h"
#include "ZipException.h"
-#include "zlib/zlib.h"
+#include <zlib.h>
#include <errno.h>
//////////////////////////////////////////////////////////////////////
diff -up ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp.system-zlib ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp
--- ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp.system-zlib 2011-12-23 11:07:58.000000000 +0100
+++ ZipArchive-4.1.1/ZipArchive/ZipFileHeader.cpp 2011-12-23 11:08:07.000000000 +0100
@@ -22,7 +22,7 @@
#include "ZipCrc32Cryptograph.h"
#include "BytesWriter.h"
-#include "zlib/zlib.h"
+#include <zlib.h>
#define FILEHEADERSIZE 46
#define LOCALFILEHEADERSIZE 30

104
ZipArchive.spec Normal file
View file

@ -0,0 +1,104 @@
Name: ZipArchive
Version: 4.1.1
Release: 5%{?dist}
Summary: Library for accessing zip files
Group: System Environment/Libraries
License: GPLv2+
URL: http://www.artpol-software.com/ZipArchive/
Source0: http://www.artpol-software.com/Downloads/ziparchive_src.zip
# switch to Linux version
Patch0: %{name}-linux-enable.patch
# add autotooled build system
Patch1: %{name}-autotools.patch
# use system zlib
Patch2: %{name}-system-zlib.patch
# Fix building with gcc-4.7
Patch3: %{name}-gcc-4.7.patch
BuildRequires: libtool
BuildRequires: zlib-devel
%description
The ZipArchive library.
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q -c
%patch0 -p1 -b .linux-enable
%patch1 -p1 -b .autotools
%patch2 -p1 -b .system-zlib
%patch3 -p1 -b .gcc47
for i in ZipArchive/*.txt; do
sed -i.old 's/\r//' "$i"
touch -r "$i.old" "$i"
done
cd ZipArchive
rm -rf zlib bzip2
sh ./autogen.sh
%build
cd ZipArchive
%configure --disable-static
make %{?_smp_mflags}
%install
cd ZipArchive
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
install -p -m 644 %{name}.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc ZipArchive/License.txt
%{_libdir}/libziparch-%{version}.so
%files devel
%doc ZipArchive/{Appnote.txt,_readme.txt}
%{_includedir}/ZipArchive/
%{_libdir}/libziparch.so
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Thu Jan 19 2012 Hans de Goede <hdegoede@redhat.com> - 4.1.1-5
- Drop custom cmake module, cmake using apps can use the .pc file
- Fix the .pc file to properly return -lziparch for --libs
* Thu Jan 12 2012 Hans de Goede <hdegoede@redhat.com> - 4.1.1-4
- Make -devel package Requires on main package include isa
- Drop buildroot and defattr boilerplate (no longer needed with recent rpm)
- Fix building with gcc-4.7
- Fix various rpmlint warnings
* Fri Dec 23 2011 Dan Horák <dan[at]danny.cz> - 4.1.1-3
- use system zlib
* Tue Dec 13 2011 Dan Horák <dan[at]danny.cz> - 4.1.1-2
- add missing *_lnx.cpp files to the library
* Tue Dec 13 2011 Dan Horák <dan[at]danny.cz> - 4.1.1-1
- initial Fedora version

View file

@ -0,0 +1 @@
3d2ec49638cfbc5d57cc43b0a894573d ziparchive_src.zip