summaryrefslogtreecommitdiffstats
path: root/zip-systemlibzip.patch
blob: 85946bc85d49068c2abc98961303bf49f29bca6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
 
 PHP_ARG_WITH(pcre-dir, pcre install prefix,
@@ -71,7 +73,20 @@ yes
     ])
 	CPPFLAGS=$old_CPPFLAGS
 
-	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");
+#else
+	php_info_print_table_row(2, "Libzip version", "0.9.0 bundled");
+#endif
 
 	php_info_print_table_end();
 }