Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main static built #479

Merged
merged 9 commits into from
May 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,54 @@ environment:
PHP_VER: 8.0.0
ZLIB_VER: 1.2.11
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.1.9
ZLIB_VER: 1.2.11
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.1.9
ZLIB_VER: 1.2.11
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.1.9
ZLIB_VER: 1.2.11
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.1.9
ZLIB_VER: 1.2.11
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.2.5
ZLIB_VER: 1.2.11
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x64
VC: vs16
PHP_VER: 8.2.5
ZLIB_VER: 1.2.11
TS: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.2.5
ZLIB_VER: 1.2.11
TS: 0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ARCH: x86
VC: vs16
PHP_VER: 8.2.5
ZLIB_VER: 1.2.11
TS: 1

build_script:
ps: |
Expand Down
52 changes: 48 additions & 4 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ PHP_ARG_WITH(libxlsxwriter, system libxlsxwriter,
PHP_ARG_WITH(libxlsxio, system libxlsxio,
[ --with-libxlsxio=DIR Use system libxlsxio], no, no)

PHP_ARG_WITH(openssl_md5, openssl MD5,
[ --with-openssl-md5=DIR Use openssl MD5], no, no)

PHP_ARG_WITH(bundled_md5, bundled MD5,
[ --with-bundled-md5 Use bundled MD5], no, no)

PHP_ARG_ENABLE(reader, enable xlsx reader support,
[ --enable-reader Enable xlsx reader?], yes, yes)

Expand Down Expand Up @@ -37,9 +43,12 @@ if test "$PHP_XLSWRITER" != "no"; then
library/libxlsxwriter/third_party/minizip/zip.c \
"

md5_sources="
library/libxlsxwriter/third_party/md5/md5.c \
"

libxlsxwriter_sources="
library/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c \
library/libxlsxwriter/third_party/md5/md5.c \
library/libxlsxwriter/src/app.c \
library/libxlsxwriter/src/chart.c \
library/libxlsxwriter/src/chartsheet.c \
Expand Down Expand Up @@ -78,9 +87,44 @@ if test "$PHP_XLSWRITER" != "no"; then
"

AC_MSG_CHECKING([Check libxlsxwriter library])
if test "$PHP_LIBXLSXWRITER" != "no"; then

for i in $PHP_LIBXLSXWRITER /usr/local /usr; do
if test "$PHP_OPENSSL_MD5" != "no"; then
AC_MSG_RESULT([use the openssl md5 library])
for i in $PHP_OPENSSL_MD5 /usr/local /usr /usr/local/opt; do
if test -r $i/include/openssl/md5.h; then
OPENSSL_DIR=$i
AC_MSG_RESULT([found in $i])
break
fi
done

if test -z "$OPENSSL_DIR"; then
AC_MSG_ERROR([openssl library not found])
else
PHP_ADD_INCLUDE($OPENSSL_DIR/include)

PHP_CHECK_LIBRARY(crypto, MD5_Init,
[
PHP_ADD_LIBRARY_WITH_PATH(crypto, $OPENSSL_DIR/lib, XLSWRITER_SHARED_LIBADD)
],[
AC_MSG_ERROR([Wrong openssl MD5_Init not found])
],[
-L$OPENSSL_DIR/lib -lcrypto
])

AC_DEFINE(USE_OPENSSL_MD5, 1, [ use openssl md5 ])
fi

PHP_BUNDLED_MD5=no
fi

if test "$PHP_BUNDLED_MD5" != "no"; then
AC_MSG_RESULT([use the bundled md5 library])
xls_writer_sources="$xls_writer_sources $md5_sources"
fi

if test "$PHP_LIBXLSXWRITER" != "no"; then
for i in $PHP_LIBXLSXWRITER /usr/local /usr /usr/local/opt; do
if test -r $i/include/xlsxwriter.h; then
XLSXWRITER_DIR=$i
AC_MSG_RESULT([found in $i])
Expand Down Expand Up @@ -116,7 +160,7 @@ if test "$PHP_XLSWRITER" != "no"; then
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libxlsxwriter/include])

dnl see library/CMakeLists.txt
LIBOPT="-DNOCRYPT -DNOUNCRYPT"
LIBOPT="$LIBOPT -DNOCRYPT -DNOUNCRYPT"
fi

if test "$PHP_READER" = "yes"; then
Expand Down
2 changes: 2 additions & 0 deletions include/chart.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef PHP_EXT_EXCEL_EXPORT_CHART_H
#define PHP_EXT_EXCEL_EXPORT_CHART_H

#include "common.h"

extern zend_class_entry *vtiful_chart_ce;

VTIFUL_STARTUP_FUNCTION(chart);
Expand Down
44 changes: 44 additions & 0 deletions include/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
+----------------------------------------------------------------------+
| XlsWriter Extension |
+----------------------------------------------------------------------+
| Copyright (c) 2017-2018 The Viest |
+----------------------------------------------------------------------+
| http://www.viest.me |
+----------------------------------------------------------------------+
| Author: viest <dev@service.viest.me> |
+----------------------------------------------------------------------+
*/

#ifndef PHP_EXT_XLS_WRITER_COMMON_H
#define PHP_EXT_XLS_WRITER_COMMON_H

#ifdef PHP_WIN32
# define PHP_VTIFUL_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_VTIFUL_API __attribute__ ((visibility("default")))
#else
# define PHP_VTIFUL_API
#endif

#ifdef ZTS
#include "TSRM.h"
#endif

#if PHP_VERSION_ID >= 80000
#define TSRMLS_D void
#define TSRMLS_DC
#define TSRMLS_C
#define TSRMLS_CC
#endif

#define VTIFUL_RESOURCE_NAME "xlsx"

#define VTIFUL_STARTUP_MODULE(module) ZEND_MODULE_STARTUP_N(xlsxwriter_##module)(INIT_FUNC_ARGS_PASSTHRU)
#define VTIFUL_STARTUP_FUNCTION(module) ZEND_MINIT_FUNCTION(xlsxwriter_##module)

#if defined(ZTS) && defined(COMPILE_DL_VTIFUL)
ZEND_TSRMLS_CACHE_EXTERN();
#endif

#endif
2 changes: 2 additions & 0 deletions include/csv.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef PHP_EXT_XLS_WRITER_CSV_H
#define PHP_EXT_XLS_WRITER_CSV_H

#include "common.h"

unsigned int xlsx_to_csv(
zval *stream_resource,
const char *delimiter_str, int delimiter_str_len,
Expand Down
2 changes: 2 additions & 0 deletions include/excel.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef VTIFUL_XLS_H
#define VTIFUL_XLS_H

#include "common.h"

#define V_XLS_HANDLE "handle"
#define V_XLS_FIL "fileName"
#define V_XLS_COF "config"
Expand Down
2 changes: 2 additions & 0 deletions include/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef VTIFUL_XLS_EXCEPTION_H
#define VTIFUL_XLS_EXCEPTION_H

#include "common.h"

extern zend_class_entry *vtiful_exception_ce;

VTIFUL_STARTUP_FUNCTION(exception);
Expand Down
2 changes: 2 additions & 0 deletions include/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef PHP_EXT_XLS_EXPORT_FORMAT_H
#define PHP_EXT_XLS_EXPORT_FORMAT_H

#include "common.h"

extern zend_class_entry *vtiful_format_ce;

VTIFUL_STARTUP_FUNCTION(format);
Expand Down
2 changes: 2 additions & 0 deletions include/help.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef PHP_EXT_XLS_EXPORT_HELP_H
#define PHP_EXT_XLS_EXPORT_HELP_H

#include "common.h"

unsigned int file_exists(const char *path);
unsigned int directory_exists(const char *path);
zend_long date_double_to_timestamp(double value);
Expand Down
2 changes: 2 additions & 0 deletions include/read.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef PHP_READ_INCLUDE_H
#define PHP_READ_INCLUDE_H

#include "common.h"

#define READ_SKIP_ROW 0
#define READ_ROW 0x01
#define SKIP_EMPTY_VALUE 0x100
Expand Down
2 changes: 2 additions & 0 deletions include/rich_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef PHP_EXT_XLS_EXPORT_RICH_STRING_H
#define PHP_EXT_XLS_EXPORT_RICH_STRING_H

#include "common.h"

extern zend_class_entry *vtiful_rich_string_ce;

VTIFUL_STARTUP_FUNCTION(rich_string);
Expand Down
2 changes: 2 additions & 0 deletions include/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef PHP_EXT_XLS_WRITER_VALIDATION_H
#define PHP_EXT_XLS_WRITER_VALIDATION_H

#include "common.h"

extern zend_class_entry *vtiful_validation_ce;

VTIFUL_STARTUP_FUNCTION(validation);
Expand Down
1 change: 1 addition & 0 deletions include/xlswriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "xlsxwriter/packager.h"
#include "xlsxwriter/format.h"

#include "common.h"
#include "php_xlswriter.h"
#include "excel.h"
#include "validation.h"
Expand Down
2 changes: 1 addition & 1 deletion kernel/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ workbook_file(xls_resource_write_t *self)

void _php_vtiful_xls_close(zend_resource *rsrc TSRMLS_DC)
{

//
}

/*
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<contents>
<dir name="/">
<file md5sum="1cf796971bf051dce46bb715ab550289" name="include/chart.h" role="src" />
<file md5sum="" name="include/common.h" role="src" />
<file md5sum="7e182a4b3e7d46e2a075b4500c62441a" name="include/csv.h" role="src" />
<file md5sum="230bb9471b8c6f884c35e6279ec52df9" name="include/excel.h" role="src" />
<file md5sum="07719d1125f1db8889ffceffa37feea6" name="include/exception.h" role="src" />
Expand Down
28 changes: 0 additions & 28 deletions php_xlswriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,10 @@ extern zend_module_entry xlswriter_module_entry;
#define PHP_XLSWRITER_VERSION "1.5.4"
#define PHP_XLSWRITER_AUTHOR "Jiexing.Wang (wjx@php.net)"

#ifdef PHP_WIN32
# define PHP_VTIFUL_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_VTIFUL_API __attribute__ ((visibility("default")))
#else
# define PHP_VTIFUL_API
#endif

#ifdef ZTS
#include "TSRM.h"
#endif

#if PHP_VERSION_ID >= 80000
#define TSRMLS_D void
#define TSRMLS_DC
#define TSRMLS_C
#define TSRMLS_CC
#endif

#define VTIFUL_RESOURCE_NAME "xlsx"

extern int le_xls_writer;

#define VTIFUL_STARTUP_MODULE(module) ZEND_MODULE_STARTUP_N(xlsxwriter_##module)(INIT_FUNC_ARGS_PASSTHRU)
#define VTIFUL_STARTUP_FUNCTION(module) ZEND_MINIT_FUNCTION(xlsxwriter_##module)

void _php_vtiful_xls_close(zend_resource *rsrc TSRMLS_DC);

#if defined(ZTS) && defined(COMPILE_DL_VTIFUL)
ZEND_TSRMLS_CACHE_EXTERN();
#endif

PHP_MINIT_FUNCTION(xlswriter);
PHP_MSHUTDOWN_FUNCTION(xlswriter);
PHP_RINIT_FUNCTION(xlswriter);
Expand Down