diff options
-rw-r--r-- | 165.patch | 137 | ||||
-rw-r--r-- | PHPINFO | 2 | ||||
-rw-r--r-- | php-pecl-xlswriter.spec | 23 |
3 files changed, 154 insertions, 8 deletions
diff --git a/165.patch b/165.patch new file mode 100644 index 0000000..49f98da --- /dev/null +++ b/165.patch @@ -0,0 +1,137 @@ +From 8139123b63f5a7885466e5450aba502f77a9a592 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 16 Sep 2019 12:04:08 +0200 +Subject: [PATCH 1/2] allow to build with system libxlsxio + +--- + config.m4 | 61 ++++++++++++++++++++++++++++++++++++++++++------------- + 1 file changed, 47 insertions(+), 14 deletions(-) + +diff --git a/config.m4 b/config.m4 +index 2c5f9be..f3fb280 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -1,8 +1,11 @@ + PHP_ARG_WITH(xlswriter, xlswriter support, +-[ --with-xlswriter Include xlswriter support], yes) ++[ --with-xlswriter Include xlswriter support], yes) + +-PHP_ARG_WITH(libxlsxwriter, system libxlsswriter, +-[ --with-libxlsxwriter=DIR Use system library], no, no) ++PHP_ARG_WITH(libxlsxwriter, system libxlsxwriter, ++[ --with-libxlsxwriter=DIR Use system libxlsxwriter], no, no) ++ ++PHP_ARG_WITH(libxlsxio, system libxlsxio, ++[ --with-libxlsxio=DIR Use system libxlsxio], no, no) + + PHP_ARG_ENABLE(reader, enable xlsx reader support, + [ --enable-reader Enable xlsx reader?], no, no) +@@ -135,22 +138,52 @@ if test "$PHP_XLSWRITER" != "no"; then + fi + + if test "$PHP_READER" = "yes"; then +- xls_writer_sources="$xls_writer_sources $xls_read_sources" ++ AC_MSG_CHECKING([Check libxlsxwriter library]) ++ if test "$PHP_LIBXLSXIO" != "no"; then ++ ++ for i in $PHP_LIBXLSXIO /usr/local /usr; do ++ if test -r $i/include/xlsxio_read.h; then ++ XLSXIO_DIR=$i ++ AC_MSG_RESULT([found in $i]) ++ break ++ fi ++ done ++ ++ if test -z "$XLSXIO_DIR"; then ++ AC_MSG_ERROR([libxlsxio library not found]) ++ else ++ PHP_ADD_INCLUDE($XLSXIO_DIR/include) ++ PHP_CHECK_LIBRARY(xlsxio_read, xlsxioread_sheet_open, ++ [ ++ PHP_ADD_LIBRARY_WITH_PATH(xlsxio_read, $i/$PHP_LIBDIR, XLSWRITER_SHARED_LIBADD) ++ ],[ ++ AC_MSG_ERROR([Wrong libxlsxio version or library not found]) ++ ],[ ++ -L$XLSXWRITER_DIR/$PHP_LIBDIR -lm ++ ]) ++ fi + +- AC_DEFINE(ENABLE_READER, 1, [enable reader]) ++ AC_DEFINE(HAVE_LIBXLSXIO, 1, [ use system libxlsxwriter ]) ++ else ++ AC_MSG_RESULT([use the bundled library]) + +- xls_writer_sources="$xls_writer_sources $libexpat" +- PHP_ADD_INCLUDE([$srcdir/library/libexpat/expat/lib]) +- PHP_ADD_BUILD_DIR([$abs_builddir/library/libexpat/expat/lib]) +- LIBOPT="$LIBOPT -DXML_POOR_ENTROPY" ++ xls_writer_sources="$xls_writer_sources $libexpat" ++ PHP_ADD_INCLUDE([$srcdir/library/libexpat/expat/lib]) ++ PHP_ADD_BUILD_DIR([$abs_builddir/library/libexpat/expat/lib]) ++ LIBOPT="$LIBOPT -DXML_POOR_ENTROPY" + +- xls_writer_sources="$xls_writer_sources $libxlsxio" +- PHP_ADD_INCLUDE([$srcdir/library/libxlsxio/include]) +- PHP_ADD_BUILD_DIR([$abs_builddir/library/libxlsxio/lib]) +- LIBOPT="$LIBOPT -DUSE_MINIZIP" ++ xls_writer_sources="$xls_writer_sources $libxlsxio" ++ PHP_ADD_INCLUDE([$srcdir/library/libxlsxio/include]) ++ PHP_ADD_BUILD_DIR([$abs_builddir/library/libxlsxio/lib]) ++ LIBOPT="$LIBOPT -DUSE_MINIZIP" ++ ++ fi ++ ++ xls_writer_sources="$xls_writer_sources $xls_read_sources" ++ AC_DEFINE(ENABLE_READER, 1, [enable reader]) + fi + +- if test "$PHP_READER" = "yes" || test "$PHP_LIBXLSXWRITER" = "no"; then ++ if test "$PHP_LIBXLSXIO" = "no" || test "$PHP_LIBXLSXWRITER" = "no"; then + xls_writer_sources="$xls_writer_sources $minizip_sources" + fi + + +From feb5b1a4c963d06ee70ab3eb74401160ccc201e1 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 16 Sep 2019 12:04:21 +0200 +Subject: [PATCH 2/2] report libxlsxio in phpinfo + +--- + xlswriter.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/xlswriter.c b/xlswriter.c +index 8faa7f6..7b223c3 100644 +--- a/xlswriter.c ++++ b/xlswriter.c +@@ -18,6 +18,11 @@ + #include "ext/standard/info.h" + #include "xlswriter.h" + ++#if ENABLE_READER ++#include <xlsxio_version.h> ++#include <xlsxio_read.h> ++#endif ++ + int le_xls_writer; + + /* {{{ PHP_MINIT_FUNCTION +@@ -85,6 +90,18 @@ PHP_MINFO_FUNCTION(xlswriter) + php_info_print_table_row(2, "bundled libxlsxwriter version", LXW_VERSION); + #endif + #endif ++ ++#if ENABLE_READER ++#if HAVE_LIBXLSXIO ++ /* Build time */ ++ php_info_print_table_row(2, "libxlsxio headers version", XLSXIO_VERSION_STRING); ++ /* Run time */ ++ php_info_print_table_row(2, "libxlsxio library version", xlsxioread_get_version_string()); ++#else ++ php_info_print_table_row(2, "bundled libxlsxio version", XLSXIO_VERSION_STRING); ++#endif ++#endif ++ + php_info_print_table_end(); + } + /* }}} */ @@ -5,3 +5,5 @@ xlswriter support => enabled Version => 1.2.8 libxlsxwriter headers version => 0.8.7 libxlsxwriter library version => 0.8.7 +libxlsxio headers version => 0.2.21 +libxlsxio library version => 0.2.21 diff --git a/php-pecl-xlswriter.spec b/php-pecl-xlswriter.spec index e80f41e..3fb09cc 100644 --- a/php-pecl-xlswriter.spec +++ b/php-pecl-xlswriter.spec @@ -25,19 +25,23 @@ # No soname, so manage dependency on available version %global libxlsxwriter_version 0.8.7 +%global libxlsxio_version 0.2.21 Summary: An efficient and fast xlsx file export extension Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.2.8 -Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: https://patch-diff.githubusercontent.com/raw/viest/php-ext-excel-export/pull/165.patch + BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7 BuildRequires: %{?scl_prefix}php-pear BuildRequires: libxlsxwriter-devel >= %{libxlsxwriter_version} +BuildRequires: libxlsxio-devel >= %{libxlsxio_version} BuildRequires: zlib-devel Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} @@ -45,6 +49,7 @@ Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-json%{?_isa} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Requires: libxlsxwriter%{?_isa} >= %{libxlsxwriter_version} +Requires: libxlsxio%{?_isa} >= %{libxlsxio_version} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -104,8 +109,9 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -# we use the system library -rm -r library/libxlsxwriter/src +# we use the system libraries +rm -r library +%patch0 -p1 # Sanity check, really often broken extver=$(sed -n '/#define PHP_XLSWRITER_VERSION/{s/.* "//;s/".*$//;p}' php_xlswriter.h) @@ -134,11 +140,8 @@ peclbuild() { %configure \ --with-xlswriter \ --with-libxlsxwriter=%{_prefix} \ -%if 0%{?rhel} == 6 - --disable-reader \ -%else + --with-libxlsxio=%{_prefix} \ --enable-reader \ -%endif --with-php-config=$1 make %{?_smp_mflags} @@ -252,7 +255,11 @@ cd .. %changelog -* Sat Sep 14 2019 Remi Collet <remi@remirepo.net> - 1.2.8-2 +* Mon Sep 16 2019 Remi Collet <remi@remirepo.net> - 1.2.8-4 +- build with system libxlsxio using patch from + https://github.com/viest/php-ext-excel-export/pull/165 + +* Sat Sep 14 2019 Remi Collet <remi@remirepo.net> - 1.2.8-3 - update to 1.2.8 (new tarball) - drop missing source added upstream |