From ca38c7a9452f9a4351ebd5d0a35bff4a05377d7d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 8 Aug 2013 14:15:30 +0200 Subject: php-pecl-zip: revival / new package, version 0.12.1 (use libzip 0.11) --- Makefile | 2 +- package.xml | 687 ------------------------------------------------- php-pecl-zip.spec | 240 ++++++++--------- zip-systemlibzip.patch | 233 ++++++++++++----- 4 files changed, 287 insertions(+), 875 deletions(-) delete mode 100644 package.xml diff --git a/Makefile b/Makefile index 1e65467..13af741 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ SRCDIR := $(shell pwd) NAME := $(shell basename $(SRCDIR)) -include ../common/Makefile +include ../../../common/Makefile diff --git a/package.xml b/package.xml deleted file mode 100644 index 53523ef..0000000 --- a/package.xml +++ /dev/null @@ -1,687 +0,0 @@ - - - zip - pecl.php.net - A zip management extension - Zip is an extension to create, modify and read zip files. - - Pierre-Alain Joye - pajoye - pajoye@php.net - yes - - 2009-08-11 - - - 1.10.2 - 2.0.0 - - - stable - stable - - PHP License - -- #49072, feof never returns true for damaged file in zip -- Fix possible crash when zip stream are used, the file entry stream was desroyed after the archive. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4.3.0 - - - 1.7.0 - - - - zip - - - - 2009-07-20 - - 1.10.1 - 2.0.0 - - - stable - stable - - PHP License - -- #48763, ZipArchive produces corrupted archive (dani dot church at gmail dot com) -- Fixed regression in the overwrite mode -- Fixed binary mode with FCGI on Windows - - - - 2008-12-24 - - 1.10.0 - 2.0.0 - - - stable - stable - - PHP License - -- #12965, archive files with many root entries cannot be opened -- #12414, extracting files from damaged archives -- fix test for OOo stream test -- Sync Code with 0.8.x (and port our php zip fixes) - - - - 2007-01-18 - - 1.9.1 - 2.0.0 - - - alpha - alpha - - PHP License - -- #40228, extractTo does not create recursive empty path (empty1/empty2/) - - - - 2007-01-18 - - 1.9.0 - 2.0.0 - - - alpha - alpha - - PHP License - -- fix some memleaks and double-free()s on error conditions (Nuno Lopes) -- Add experimental support for addGlob and addPattern. They use respectively -glob or regexp patterns to add entries. They also accept options like remove_path -, add_path or remove_all_path. See the examples addglob and addpattern.php -- requires pcre - - - - 2006-12-17 - - 1.8.4 - 2.0.0 - - - stable - stable - - PHP License - -- Use phplibdir in config.m4 (for lib64 or other custom location) -- Add path length sanity checks (Ilia, Tony) -- Update year, happy new year - - - - 2006-12-17 - - 1.8.3 - 2.0.0 - - - stable - stable - - PHP License - -- Fixed threadsafe issue with localtime function, it uses now the - php php_localtime_r (Ron Korving, Ilia) - - - - 2006-12-02 - - 1.8.2 - 2.0.0 - - - stable - stable - - PHP License - -- restore compatibility with php 5.1.0 to 5.1.2 (other versions are not affected) - - - - 2006-11-28 - - 1.8.1 - 2.0.0 - - - stable - stable - - PHP License - -- PECL #9278, Binary access issues on Windows in any SAPI but CGI, CLI and embed -(windows API does not respect "b" mode given to fopen) -- Fixed a possible leak in the entries managements (Nuno Lopes) -- createEmptyDir returns true one success -- Use static for each internal functions when possible (Nuno Lopes) -- Update protos in the sources - - - - 2006-11-01 - - 1.8.0 - 2.0.0 - - - stable - stable - - PHP License - -- Fixed a possible leak in statName and statIndex -- Added zipArchive::adEmptyDir() method, creates an empty directory -- Fixed setComment when used with a freshly added entry -- setComment now returns the expected value (boolean) (Hannes) - - - - 2006-10-25 - - 1.7.5 - 2.0.0 - - - stable - stable - - PHP License - -- PECL Bug #9082, wrong entry name like "a/b//file.txt" cannot be extracted on windows - A "bug" in php mkdir was the cause, a work around has been introduced for php versions before 5.2.0 - - - - - 1.7.4 - 2.0.0 - - - stable - stable - - PHP License - -- PHP Bug #38943, properties in extended class cannot be set -- PHP Bug #38944, freshly created archive has no comment or cdir - - - - 2006-09-16 - - 1.7.3 - 2.0.0 - - - stable - stable - - PHP License - -- PECL Bug #8700, zipArchive::getFromIndex fails -- PECL Bug #8676, zipArchive::addFile was not updated and still used VCWD_REALPATH, it now uses expand_filename -- Fixed wrong internal types for comment lenghts, does not affect userland script (Nuno Lopes) - - - - 2006-09-06 - - 2.0.0 - 2.0.0 - - - stable - stable - - PHP License - -- Fix wrong internal types for comment lenghts, does not affect userland script (Nuno Lopes) - - - - 2006-08-24 - - 1.7.2 - 1.7.0 - - - beta - beta - - PHP License - -- Previous release was broken in non threaded environment. -This release works smoothly in threaded and non threaded. -Thanks to "FamilleCollet dot com" (Fedora-Extra maintainer for the -head up) - - - - 2006-08-24 - - 1.7.1 - 1.7.0 - - - beta - beta - - -- Fix issues with relative path in threaded environment, -VCWD_REALPATH is used in ZipArchive::open() and ::addFile - - - - 2006-07-14 - - 1.7.0 - 1.7.0 - - - beta - beta - - PHP License - -- Add ZIPARCHIVE::OVERWRITE mode for ::open(), creates a new -archive and write over an existing file -- locateName do not change anymore the state, it can now be used to test an entry -- fix possilbe crashes when two entries with the same name have been added -- Enhanced safemode support -- fix builds against php 6.0 (HEAD) -- fix compiler warning (Ilia, Tony) -- cleanup phpinfo() output (Ilia) - - - - 2006-07-14 - - 1.6.0 - 1.6.0 - - - beta - alpha - - PHP License - -- Rename Class Zip to ZipArchive, required to be bundled -in php 5.2.0 (Zip being a ZipCode in US), making the role of -this class more obvious *Gah* - - - - 2006-07-14 - - 1.5.0 - 1.5.0 - - - alpha - alpha - - PHP License - -- bring consistency to the method names: - - rename zip::delete() to deleteIndex() - - add zip::deleteName() - - rename zip::statPath to zip::statName() - - rename zip::rename to zip::renameIndex() - - add zip::renameName(); -- add zip::locateName(), returns the index of an entry, allows case insensitive - or directory free lookup (ZIP::FL_NOCASE, ZIP::FL_NODIR) -- add zip::unchangeName(), ::unchangeIndex(), unchangeAll() and unchangeArchive() - revert changes to an entry, to all entries or the archive -- add zip::getNameIndex(), get the name of the entry at the given position -- Bug #7658, Modify zip archives causes corruption if the data descriptor is used - (bit 3 of the general flags) -- fix a bug when in the delete and rename methods when the index is lower than 1 -- zip::addFile() must return true on success -- zip::open() returns now the error code on error and true on success - - - - 2006-06-28 - - 1.4.1 - 1.4.0 - - - alpha - alpha - - PHP License - -- Add missing files in the package release - - - - 2006-06-28 - - 1.4.0 - 1.4.0 - - - alpha - alpha - - PHP License - -- Add write mode to the archive comment (zip::comment property) -- Add zip::setCommentName and ::setCommentIndex, add or remove entrie comment -- Add zip::getCommentName and ::getCommentIndex, get an entrie comment -- Add zip::setArchiveComment -- Full sync with zip-0.7.1 -- #8009, modify archives on windows cannot be closed - - - 2006-04-26 - - 1.3.1 - 1.3.0 - - - alpha - alpha - - PHP License - - #7500, Fix build with php 5.1.0, 5.1.1 and 5.1.2 - - - - 2006-04-26 - - 1.3.0 - 1.3.0 - - - alpha - alpha - - -- Fix possible leak with __set/__get in classes extending the Zip -intern object (tony2001[at]php.net) -- Added getFromName(), return the contents of an entry using its name -- Added getFromIndex(), return the contents of an entry using its index - - - - 2006-03-30 - - 1.2.3 - 1.2.1 - - - alpha - alpha - - PHP License - -- #7214, use binary safe string as return value, 0x00 was considered as -the end of the content, affected only the procedural API - - - - 2006-03-22 - - - 1.2.2 - 1.2.1 - - - alpha - alpha - - PHP License - -- fix a bug in internal zip_close, new archives were not written -- ::open returns now false on error -- update the "create.php" example, status and returned codes are now checked -- fix a leak when the ::open method is called twice or more with the same -object - - - - 2006-03-19 - - - 1.2.1 - 1.2.1 - - - alpha - alpha - - PHP License - -- fixed a possible build problem (mkstemp missing) -- fix a bug where extending the Zip class does allow -to write to a property, see php bugs #36743 (array) - - - - 2006-03-12 - - - 1.2.0 - 1.2.0 - - - alpha - alpha - - PHP License - -- enable stream by default, - * use uri like zip:///path/to/my.zip#entryname.dat - (the URI format may change in future version) -- add support for print_r/var_dump (Zip object) -- add tests for the OO (still need more) -- add more example, like using xmlreader and zip - stream to parse OpenDocument meta info - - - - 2006-03-05 - - - 1.1.2 - 1.1.0 - - - alpha - alpha - - PHP License - -- do not create empty file when a zip entry is only -a directory (empty or not) - - - - 2006-03-02 - - - 1.1.1 - 1.1.0 - - - alpha - alpha - - PHP License - -- Fix PHP 5.1 detection at compiletie -- fix possible build errors with gcc other than 4.0.x -- add better zlib detection -- "--with-zlib-dir=[DIR]" added - - - - 2006-03-01 - - - 1.1.0 - 1.1.0 - - - alpha - alpha - - PHP License - -- replace the old zip extensions - * 100% compatible with the old API - * added zip creation support (write mode) - * added OO interface - * Stream support, getStream method - returns a file handler -- bundled libzip and drop zzlib usage - (see http://www.nih.at/libzip/) - - - - diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec index 203fbd5..2573c3e 100644 --- a/php-pecl-zip.spec +++ b/php-pecl-zip.spec @@ -1,37 +1,51 @@ -%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} -%{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}} - -%global pecl_name zip - - -Summary: A zip management extension +# spec file for php-pecl-zip +# +# Copyright (c) 2013 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/3.0/ +# +# Please, preserve the changelog entries +# +%global pecl_name zip +%global with_libzip 1 +%global with_zts 0%{?__ztsphp:1} + +Summary: A ZIP archive management extension Summary(fr): Une extension de gestion des ZIP Name: php-pecl-zip -Version: 1.10.2 +Version: 1.12.1 Release: 1%{?dist} License: PHP Group: Development/Languages URL: http://pecl.php.net/package/zip Source: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz -# http://svn.php.net/viewvc/pecl/zip/trunk/tests/bug38943.inc?view=co -# http://pecl.php.net/bugs/22604 - missing file -Source1: bug38943.inc -Source2: xml2changelog +# use system libzip 0.11 instead of bundled copy Patch0: zip-systemlibzip.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: php-devel, zlib-devel -BuildRequires: php-pear(PEAR) >= 1.7.0 -BuildRequires: libzip2-devel +BuildRequires: php-devel +%if %{with_libzip} +BuildRequires: libzip-devel >= 0.11.1 +%else +BuildRequires: zlib-devel +%endif +BuildRequires: php-pear -Requires(post): %{__pecl} -Requires(postun): %{__pecl} +Requires(post): %{_bindir}/pecl +Requires(postun): %{_bindir}/pecl Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} -Provides: php-pecl(%{pecl_name}) = %{version}, php-pecl(%{pecl_name})%{?_isa} = %{version} -Provides: php-%{pecl_name} = %{version}-%{release}, php-%{pecl_name}%{?_isa} = %{version}-%{release} + +Provides: php-pecl(%{pecl_name}) = %{version} +Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} +Provides: php-%{pecl_name} = %{version}-%{release} +Provides: php-%{pecl_name}%{?_isa} = %{version}-%{release} + +# Filter private shared +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} + %description Zip is an extension to create and read zip files. @@ -43,54 +57,97 @@ Zip est une extension pour créer et lire les archives au format ZIP. %prep %setup -c -q -%{_bindir}/php -n %{SOURCE2} package.xml | tee CHANGELOG | head -n 10 -%{__cp} %{SOURCE1} %{pecl_name}-%{version}/tests/bug38943.inc - cd %{pecl_name}-%{version} + +%if %{with_libzip} %patch0 -p1 -b .systemlibzip +rm -rf lib +%endif + +cd .. +: Create the configuration file +cat >%{pecl_name}.ini << 'EOF' +; Enable ZIP extension module +extension=%{pecl_name}.so +EOF + +%if %{with_zts} +: Duplicate sources tree for ZTS build +cp -pr %{pecl_name}-%{version} %{pecl_name}-zts +%endif %build +export PHP_RPATH=no + cd %{pecl_name}-%{version} -phpize -%configure --with-libzip-dir=%{_prefix} -%{__make} %{?_smp_mflags} +%{_bindir}/phpize +%configure \ + --with-php-config=%{_bindir}/php-config \ +%if %{with_libzip} + --with-libzip +%endif +make %{?_smp_mflags} -%install -cd %{pecl_name}-%{version} -%{__rm} -rf %{buildroot} -%{__make} install INSTALL_ROOT=%{buildroot} +%if %{with_zts} +cd ../%{pecl_name}-zts +%{_bindir}/zts-phpize +%configure \ + --with-php-config=%{_bindir}/zts-php-config \ +%if %{with_libzip} + --with-libzip +%endif + +make %{?_smp_mflags} +%endif -# Drop in the bit of configuration -%{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d -%{__cat} > %{buildroot}%{_sysconfdir}/php.d/%{pecl_name}.ini << 'EOF' -; Enable ZIP extension module -extension=%{pecl_name}.so -EOF + +%install +make -C %{pecl_name}-%{version} install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini # Install XML package description -%{__mkdir_p} %{buildroot}%{pecl_xmldir} -%{__install} -m 644 ../package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +%if %{with_zts} +make -C %{pecl_name}-zts install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini +%endif %check cd %{pecl_name}-%{version} -php --no-php-ini \ +: minimal load test of NTS extension +%{_bindir}/php --no-php-ini \ --define extension_dir=modules \ --define extension=%{pecl_name}.so \ --modules | grep %{pecl_name} +: upstream test suite for NTS extension TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ - REPORT_EXIT_STATUS=1 \ - NO_INTERACTION=1 \ - TEST_PHP_EXECUTABLE=%{_bindir}/php \ - %{_bindir}/php \ +REPORT_EXIT_STATUS=1 \ +NO_INTERACTION=1 \ +TEST_PHP_EXECUTABLE=%{_bindir}/php \ +%{_bindir}/php \ run-tests.php +%if %{with_zts} +cd ../%{pecl_name}-zts +: minimal load test of NTS extension +%{_bindir}/zts-php --no-php-ini \ + --define extension_dir=modules \ + --define extension=%{pecl_name}.so \ + --modules | grep %{pecl_name} -%clean -%{__rm} -rf %{buildroot} +: upstream test suite for NTS extension +TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ +REPORT_EXIT_STATUS=1 \ +NO_INTERACTION=1 \ +TEST_PHP_EXECUTABLE=%{_bindir}/zts-php \ +%{_bindir}/php \ + run-tests.php +%endif %post @@ -104,93 +161,18 @@ fi %files -%defattr(-, root, root, -) -# http://pecl.php.net/bugs/22603 - License file -%doc CHANGELOG %doc %{pecl_name}-%{version}/CREDITS %doc %{pecl_name}-%{version}/examples -%config(noreplace) %{_sysconfdir}/php.d/%{pecl_name}.ini -%{php_extdir}/%{pecl_name}.so %{pecl_xmldir}/%{name}.xml +%config(noreplace) %{php_inidir}/%{pecl_name}.ini +%{php_extdir}/%{pecl_name}.so +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini +%{php_ztsextdir}/%{pecl_name}.so +%endif -%changelog -* Sun Mar 20 2011 Remi Collet 1.10.2-1 -- Version 1.10.2 (stable) - API 2.0.0 (stable) -- mostly rewriten for latest PHP Guidelines - -* Thu Jun 07 2007 Remi Collet 1.8.10-1 -- update to 1.8.10 - -* Sun Mar 25 2007 Remi Collet 1.8.8-1 -- update to 1.8.8 - -* Mon Feb 26 2007 Remi Collet 1.8.6-1 -- update to 1.8.6 - -* Sat Feb 24 2007 Remi Collet 1.8.5-1 -- update to 1.8.5 -- requires php(zend-abi) and php(api) when available - -* Sat Dec 02 2006 Remi Collet 1.8.2-1 -- update to 1.8.2 - -* Thu Nov 02 2006 Remi Collet 1.8.0-1 -- update to 1.8.0 - -* Tue Oct 24 2006 Remi Collet 1.7.5-1 -- update to 1.7.5 - -* Wed Sep 27 2006 Remi Collet 1.7.4-1 -- update to 1.7.4 - -* Sun Sep 17 2006 Remi Collet 1.7.3-1 -- update to 1.7.3 -- remove PECL from sumnary -- change to %%setup -c -q -- add generated CHANGELOG to %%doc - -* Mon Aug 28 2006 Remi Collet 1.7.2-2 -- rebuild for FE6 - -* Sun Aug 27 2006 Remi Collet 1.7.2-1 -- update to 1.7.2 - -* Sat Aug 26 2006 Remi Collet 1.7.1-2 -- use php_zip.c version 1.73 from CVS -- see http://pecl.php.net/bugs/bug.php?id=8564 - -* Fri Aug 25 2006 Remi Collet 1.7.1-1 -- update to 1.7.1 -- change macros to conform to PHP Guidelines - -* Sun Aug 20 2006 Remi Collet 1.7.0-1 -- update to 1.7.0 - -* Sun Jul 30 2006 Remi Collet 1.6.0-1 -- update to 1.6.0 (Big change : Rename Class Zip to ZipArchive) - -* Sun Jul 16 2006 Remi Collet 1.5.0-1 -- update to 1.5.0 -- Requires: php-api - -* Thu Jun 29 2006 Remi Collet 1.4.1-1 -- update to 1.4.1 -- bundle the v3.01 PHP LICENSE file -- Suppr. Requires zip, Add Provides php-pecl(zip) and php-zip -- change defattr - -* Fri Apr 28 2006 Remi Collet 1.3.1-2 -- Add zlib(devel) to Requires - -* Thu Apr 27 2006 Remi Collet 1.3.1-1 -- update to 1.3.1 - -* Wed Apr 26 2006 Remi Collet 1.2.3-1 -- initial RPM for extras -- add french summary & description -- add examples to doc. - -* Tue Apr 11 2006 Remi Collet 1.2.3-1 -- initial RPM +%changelog +* Thu Aug 08 2013 Remi Collet 1.12.1-1 +- New spec for version 1.12.1 diff --git a/zip-systemlibzip.patch b/zip-systemlibzip.patch index 85946bc..b6d76b1 100644 --- a/zip-systemlibzip.patch +++ b/zip-systemlibzip.patch @@ -1,64 +1,181 @@ -diff -up zip-1.10.2/config.m4.orig zip-1.10.2/config.m4 ---- zip-1.10.2/config.m4.orig 2011-03-20 13:05:28.661443158 +0100 -+++ zip-1.10.2/config.m4 2011-03-20 13:16:37.676577789 +0100 -@@ -8,6 +8,8 @@ PHP_ARG_ENABLE(zip, for zip archive read - if test -z "$PHP_ZLIB_DIR"; then - PHP_ARG_WITH(zlib-dir, for the location of libz, - [ --with-zlib-dir[=DIR] ZIP: Set the path to libz install prefix], no, no) -+ PHP_ARG_WITH(libzip-dir, for the location of libzip, -+ [ --with-libzip-dir[=DIR] ZIP: Set the path to libzip install prefix], no, no) - fi - +diff -up zip-1.12.1/config.m4.old zip-1.12.1/config.m4 +--- zip-1.12.1/config.m4.old 2013-04-29 11:18:17.000000000 +0200 ++++ zip-1.12.1/config.m4 2013-08-08 13:09:18.000000000 +0200 +@@ -13,8 +13,60 @@ fi PHP_ARG_WITH(pcre-dir, pcre install prefix, -@@ -71,7 +73,20 @@ yes - ]) - CPPFLAGS=$old_CPPFLAGS + [ --with-pcre-dir ZIP: pcre install prefix], no, no) + ++PHP_ARG_WITH(libzip, libzip, ++[ --with-libzip[=DIR] ZIP: use libzip], no, no) ++ + if test "$PHP_ZIP" != "no"; then + ++ if test "$PHP_LIBZIP" != "no"; then ++ ++ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) ++ ++ dnl system libzip, depends on libzip ++ AC_MSG_CHECKING(for libzip) ++ if test -r $PHP_LIBZIP/include/zip.h; then ++ LIBZIP_CFLAGS="-I$PHP_LIBZIP/include" ++ LIBZIP_LIBDIR="$PHP_LIBZIP/$PHP_LIBDIR" ++ AC_MSG_RESULT(from option: found in $PHP_LIBZIP) ++ ++ elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libzip; then ++ LIBZIP_CFLAGS=`$PKG_CONFIG libzip --cflags` ++ LIBZIP_LIBDIR=`$PKG_CONFIG libzip --variable=libdir` ++ AC_MSG_RESULT(from pkgconfig: found in $LIBZIP_LIBDIR) ++ ++ else ++ for i in /usr/local /usr; do ++ if test -r $i/include/zip.h; then ++ LIBZIP_CFLAGS="-I$i/include" ++ LIBZIP_LIBDIR="$i/$PHP_LIBDIR" ++ AC_MSG_RESULT(in default path: found in $i) ++ break ++ fi ++ done ++ fi ++ ++ if test -z "$LIBZIP_LIBDIR"; then ++ AC_MSG_RESULT(not found) ++ AC_MSG_ERROR(Please reinstall the libzip distribution) ++ fi ++ ++ dnl Could not think of a simple way to check libzip for overwrite support ++ PHP_CHECK_LIBRARY(zip, zip_open, ++ [ ++ PHP_ADD_LIBRARY_WITH_PATH(zip, $LIBZIP_LIBDIR, ZIP_SHARED_LIBADD) ++ AC_DEFINE(HAVE_LIBZIP,1,[ ]) ++ ], [ ++ AC_MSG_ERROR(could not find usable libzip) ++ ], [ ++ -L$LIBZIP_LIBDIR ++ ]) ++ ++ AC_DEFINE(HAVE_ZIP,1,[ ]) ++ PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c, $ext_shared,, $LIBZIP_CFLAGS) ++ PHP_SUBST(ZIP_SHARED_LIBADD) ++ else ++ ++ dnl bundled libzip, depends on zlib + if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then + if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then + PHP_ZLIB_DIR="$PHP_ZLIB_DIR" +@@ -94,6 +146,7 @@ yes + PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared) + PHP_ADD_BUILD_DIR($ext_builddir/lib, 1) + PHP_SUBST(ZIP_SHARED_LIBADD) ++fi -- PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \ -+ if test "$PHP_LIBZIP_DIR" != "no" && test "$PHP_LIBZIP_DIR" != "yes"; then -+ if test -f "$PHP_LIBZIP_DIR/include/zip.h"; then -+ PHP_LIBZIP_DIR="$PHP_LIBZIP_DIR" -+ PHP_LIBZIP_INCDIR="$PHP_LIBZIP_DIR/include" -+ else -+ AC_MSG_ERROR([Can not find libzip headers under "$PHP_ZLIB_DIR"]) -+ fi -+ fi -+ -+ dnl # libzip -+ AC_MSG_CHECKING([for the location of libzip]) -+ if test "$PHP_LIBZIP_DIR" = "no"; then -+ AC_MSG_RESULT([bundled]) -+ PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \ - lib/zip_fread.c lib/zip_open.c lib/zip_source_filep.c \ - lib/zip_strerror.c lib/zip_close.c lib/zip_error_get.c \ - lib/zip_file_error_get.c lib/zip_free.c lib/zip_rename.c \ -@@ -90,6 +105,13 @@ yes - lib/zip_set_archive_comment.c lib/zip_set_file_comment.c \ - lib/zip_unchange_archive.c lib/zip_memdup.c lib/zip_stat_init.c lib/zip_add_dir.c \ - lib/zip_error_clear.c lib/zip_file_error_clear.c" -+ AC_DEFINE(HAVE_LIBZIP,0,[ ]) -+ else -+ AC_MSG_RESULT([$PHP_LIBZIP_DIR]) -+ PHP_ADD_LIBRARY_WITH_PATH(zip, $PHP_LIBZIP_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD) -+ PHP_ADD_INCLUDE($PHP_LIBZIP_INCDIR) -+ AC_DEFINE(HAVE_LIBZIP,1,[ ]) -+ fi - AC_DEFINE(HAVE_ZIP,1,[ ]) - PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared) -diff -up zip-1.10.2/php_zip.c.orig zip-1.10.2/php_zip.c ---- zip-1.10.2/php_zip.c.orig 2011-03-20 13:17:48.724908789 +0100 -+++ zip-1.10.2/php_zip.c 2011-03-20 13:18:29.019963522 +0100 -@@ -2672,7 +2672,11 @@ static PHP_MINFO_FUNCTION(zip) - php_info_print_table_row(2, "Zip", "enabled"); - php_info_print_table_row(2, "Extension Version","$Id: php_zip.c 284448 2009-07-20 15:26:54Z pajoye $"); - php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING); -- php_info_print_table_row(2, "Libzip version", "0.9.0"); -+#if HAVE_LIBZIP -+ php_info_print_table_row(2, "Libzip version", "system"); + AC_CHECK_TYPES([int8_t]) +diff -up zip-1.12.1/libzip-missing.h.old zip-1.12.1/libzip-missing.h +--- zip-1.12.1/libzip-missing.h.old 2013-08-08 13:31:19.000000000 +0200 ++++ zip-1.12.1/libzip-missing.h 2013-08-08 13:29:24.000000000 +0200 +@@ -0,0 +1,60 @@ ++/*** Private API copied from lib/zipint.h ***/ ++ ++/* error information */ ++ ++struct zip_error { ++ int zip_err; /* libzip error code (ZIP_ER_*) */ ++ int sys_err; /* copy of errno (E*) or zlib error code */ ++ char *str; /* string representation or NULL */ ++}; ++ ++ ++/* zip archive, part of API */ ++ ++struct zip { ++ char *zn; /* file name */ ++ FILE *zp; /* file */ ++ unsigned int open_flags; /* flags passed to zip_open */ ++ struct zip_error error; /* error information */ ++ ++ unsigned int flags; /* archive global flags */ ++ unsigned int ch_flags; /* changed archive global flags */ ++ ++ char *default_password; /* password used when no other supplied */ ++ ++ struct zip_string *comment_orig; /* archive comment */ ++ struct zip_string *comment_changes; /* changed archive comment */ ++ int comment_changed; /* whether archive comment was changed */ ++ ++ zip_uint64_t nentry; /* number of entries */ ++ zip_uint64_t nentry_alloc; /* number of entries allocated */ ++ struct zip_entry *entry; /* entries */ ++ ++ unsigned int nfile; /* number of opened files within archive */ ++ unsigned int nfile_alloc; /* number of files allocated */ ++ struct zip_file **file; /* opened files within archive */ ++ ++ char *tempdir; /* custom temp dir (needed e.g. for OS X sandboxing) */ ++}; ++ ++/* file in zip archive, part of API */ ++ ++struct zip_file { ++ struct zip *za; /* zip archive containing this file */ ++ struct zip_error error; /* error information */ ++ int eof; ++ struct zip_source *src; /* data source */ ++}; ++ ++/*** Private API copied from lib/zip_error.c ***/ ++ ++void ++_zip_error_clear(struct zip_error *err) ++{ ++ if (err == NULL) ++ return; ++ ++ err->zip_err = ZIP_ER_OK; ++ err->sys_err = 0; ++} ++ +diff -up zip-1.12.1/php_zip.c.old zip-1.12.1/php_zip.c +--- zip-1.12.1/php_zip.c.old 2013-08-08 13:24:00.000000000 +0200 ++++ zip-1.12.1/php_zip.c 2013-08-08 13:26:43.000000000 +0200 +@@ -29,8 +29,14 @@ + #include "ext/standard/php_string.h" + #include "ext/pcre/php_pcre.h" + #include "php_zip.h" ++ ++#if defined(HAVE_LIBZIP) ++#include ++#include "libzip-missing.h" ++#else + #include "lib/zip.h" + #include "lib/zipint.h" ++#endif + + /* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */ + static PHP_NAMED_FUNCTION(zif_zip_open); +diff -up zip-1.12.1/php_zip.h.old zip-1.12.1/php_zip.h +--- zip-1.12.1/php_zip.h.old 2013-08-08 13:33:03.000000000 +0200 ++++ zip-1.12.1/php_zip.h 2013-08-08 13:33:34.000000000 +0200 +@@ -28,7 +28,11 @@ extern zend_module_entry zip_module_entr + #include "TSRM.h" + #endif + ++#if defined(HAVE_LIBZIP) ++#include +#else -+ php_info_print_table_row(2, "Libzip version", "0.9.0 bundled"); + #include "lib/zip.h" +#endif - php_info_print_table_end(); - } + #define PHP_ZIP_VERSION_STRING "1.12.1" + +diff -up zip-1.12.1/zip_stream.c.old zip-1.12.1/zip_stream.c +--- zip-1.12.1/zip_stream.c.old 2013-08-08 13:35:24.000000000 +0200 ++++ zip-1.12.1/zip_stream.c 2013-08-08 13:35:39.000000000 +0200 +@@ -6,8 +6,6 @@ + #if HAVE_ZIP + #ifdef ZEND_ENGINE_2 + +-#include "lib/zip.h" +- + #include "php_streams.h" + #include "ext/standard/file.h" + #include "ext/standard/php_string.h" -- cgit