ARG_ENABLE("phar", "enable phar support", "no");
if (PHP_PHAR != "no") {
- EXTENSION("phar", "tar.c zip.c stream.c dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c");
+ EXTENSION("phar", "dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c zip.c");
if (PHP_PHAR_SHARED) {
ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_PHAR ");
}
- if (HAVE_ZIP) {
- AC_DEFINE('HAVE_PHAR_ZIP', 1);
+ if (PHP_ZIP_SHARED) {
+ if (PHP_PHAR_SHARED) {
+ ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_ZIP ");
+ } else {
+ ERROR("Phar cannot be built statically with shared Zip extension");
+ }
+ }
+ if (PHP_ZIP != "no") {
ADD_EXTENSION_DEP('phar', 'zip', true);
+ AC_DEFINE('HAVE_PHAR_ZIP', 1);
}
- ADD_EXTENSION_DEP('phar', 'zlib', true);
ADD_EXTENSION_DEP('phar', 'bz2', true);
ADD_EXTENSION_DEP('phar', 'spl', true);
+ ADD_EXTENSION_DEP('phar', 'zlib', true);
}
/* zip functions in zip.c */
int phar_open_zipfile(char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error TSRMLS_DC);
int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
+#if HAVE_PHAR_ZIP
int phar_zip_flush(phar_archive_data *archive, char *user_stub, long len, char **error TSRMLS_DC);
+#endif
#ifdef PHAR_MAIN
static int phar_open_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
phar_archive_data phar = {0};
long offset = 0;
char *error, *opened_path = NULL;
- int fd, ziperror;
/* set whole-archive compression from parameter */
phar.flags = flags;
case 2 :
phar.is_zip = 1;
#if HAVE_PHAR_ZIP
+ int fd, ziperror;
+
if (!((fd = php_open_temporary_fd(NULL, "pharzip", &opened_path TSRMLS_CC)) >= 0)) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
"Cannot convert phar archive \"%s\", unable to open temporary zip archive", source->fname);