]> git.pld-linux.org Git - packages/php.git/blob - system-libzip.patch
- use system libzip in zip extension
[packages/php.git] / system-libzip.patch
1
2 https://bugzilla.redhat.com/show_bug.cgi?id=551513
3 https://bugs.php.net/bug.php?id=39388
4 http://spot.fedorapeople.org/php-5.3.6-libzip.patch
5
6 diff -up php-5.3.6/ext/zip/config.m4.libzip php-5.3.6/ext/zip/config.m4
7 --- php-5.3.6/ext/zip/config.m4.libzip  2008-08-08 05:47:15.000000000 -0400
8 +++ php-5.3.6/ext/zip/config.m4 2011-07-20 15:21:05.759490602 -0400
9 @@ -15,6 +15,9 @@ PHP_ARG_WITH(pcre-dir, pcre install pref
10  
11  if test "$PHP_ZIP" != "no"; then
12  
13 +  PHP_ARG_WITH(libzip, libzip,
14 +  [  --with-libzip[=DIR]     Use libzip], no, no)
15 +
16    if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
17      if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
18        PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
19 @@ -71,7 +74,43 @@ yes
20    ])
21    CPPFLAGS=$old_CPPFLAGS
22  
23 -  PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \
24 +  if test "$PHP_LIBZIP" != "no"; then
25 +    if test -r $PHP_LIBZIP/include/zip.h; then
26 +      LIBZIP_DIR=$PHP_LIBZIP
27 +    else
28 +      AC_MSG_CHECKING(for libzip in default path)
29 +      for i in /usr/local /usr; do
30 +        if test -r $i/include/zip.h; then
31 +          LIBZIP_DIR=$i
32 +          AC_MSG_RESULT(found in $i)
33 +          break
34 +        fi
35 +      done
36 +    fi
37 +
38 +    if test -z "$LIBZIP_DIR"; then
39 +      AC_MSG_RESULT(not found)
40 +      AC_MSG_ERROR(Please reinstall the libzip distribution)
41 +    fi
42 +
43 +    dnl Could not think of a simple way to check libzip for overwrite support
44 +    PHP_CHECK_LIBRARY(zip, zip_open,
45 +    [
46 +      PHP_ADD_INCLUDE($LIBZIP_DIR/include)
47 +      PHP_ADD_LIBRARY_WITH_PATH(zip, $LIBZIP_DIR/$PHP_LIBDIR, LIBZIP_SHARED_LIBADD)
48 +      AC_DEFINE(HAVE_LIBZIP,1,[ ])
49 +    ], [
50 +      AC_MSG_ERROR(could not find usable libzip)
51 +    ], [
52 +      -L$LIBZIP_DIR/$PHP_LIBDIR
53 +    ])
54 +
55 +    AC_DEFINE(HAVE_ZIP,1,[ ])
56 +    PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c, $ext_shared)
57 +    PHP_SUBST(LIBZIP_SHARED_LIBADD)
58 +    PHP_SUBST(ZIP_SHARED_LIBADD)
59 +  else
60 +    PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \
61                           lib/zip_fread.c lib/zip_open.c lib/zip_source_filep.c  \
62                           lib/zip_strerror.c lib/zip_close.c lib/zip_error_get.c \
63                           lib/zip_file_error_get.c lib/zip_free.c lib/zip_rename.c \
64 @@ -91,10 +130,11 @@ yes
65                           lib/zip_unchange_archive.c lib/zip_memdup.c lib/zip_stat_init.c lib/zip_add_dir.c \
66                           lib/zip_error_clear.c lib/zip_file_error_clear.c"
67  
68 -  AC_DEFINE(HAVE_ZIP,1,[ ])
69 -  PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
70 -  PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
71 -  PHP_SUBST(ZIP_SHARED_LIBADD)
72 +    AC_DEFINE(HAVE_ZIP,1,[ ])
73 +    PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
74 +    PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
75 +    PHP_SUBST(ZIP_SHARED_LIBADD)
76 +  fi
77  
78    dnl so we always include the known-good working hack.
79    PHP_ADD_MAKEFILE_FRAGMENT
This page took 0.035287 seconds and 4 git commands to generate.