Skip to content

Commit 372ed72

Browse files
authored
Merge pull request #480 from viest/dev
Feat: static built
2 parents 83b993d + ccdaf76 commit 372ed72

File tree

17 files changed

+162
-45
lines changed

17 files changed

+162
-45
lines changed

.appveyor.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,54 @@ environment:
182182
PHP_VER: 8.0.0
183183
ZLIB_VER: 1.2.11
184184
TS: 1
185+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
186+
ARCH: x64
187+
VC: vs16
188+
PHP_VER: 8.1.9
189+
ZLIB_VER: 1.2.11
190+
TS: 0
191+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
192+
ARCH: x64
193+
VC: vs16
194+
PHP_VER: 8.1.9
195+
ZLIB_VER: 1.2.11
196+
TS: 1
197+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
198+
ARCH: x86
199+
VC: vs16
200+
PHP_VER: 8.1.9
201+
ZLIB_VER: 1.2.11
202+
TS: 0
203+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
204+
ARCH: x86
205+
VC: vs16
206+
PHP_VER: 8.1.9
207+
ZLIB_VER: 1.2.11
208+
TS: 1
209+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
210+
ARCH: x64
211+
VC: vs16
212+
PHP_VER: 8.2.5
213+
ZLIB_VER: 1.2.11
214+
TS: 0
215+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
216+
ARCH: x64
217+
VC: vs16
218+
PHP_VER: 8.2.5
219+
ZLIB_VER: 1.2.11
220+
TS: 1
221+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
222+
ARCH: x86
223+
VC: vs16
224+
PHP_VER: 8.2.5
225+
ZLIB_VER: 1.2.11
226+
TS: 0
227+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
228+
ARCH: x86
229+
VC: vs16
230+
PHP_VER: 8.2.5
231+
ZLIB_VER: 1.2.11
232+
TS: 1
185233

186234
build_script:
187235
ps: |

.github/workflows/main.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
operating-system: [ubuntu-latest]
11-
php-versions: ['8.0', '8.1', '8.2']
12-
include:
13-
- operating-system: 'ubuntu-18.04'
14-
php-versions: '7.0'
15-
- operating-system: 'ubuntu-18.04'
16-
php-versions: '7.1'
17-
- operating-system: 'ubuntu-18.04'
18-
php-versions: '7.2'
19-
- operating-system: 'ubuntu-18.04'
20-
php-versions: '7.3'
21-
- operating-system: 'ubuntu-18.04'
22-
php-versions: '7.4'
11+
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
2312
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
2413
steps:
2514
- name: Checkout

config.m4

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ PHP_ARG_WITH(libxlsxwriter, system libxlsxwriter,
77
PHP_ARG_WITH(libxlsxio, system libxlsxio,
88
[ --with-libxlsxio=DIR Use system libxlsxio], no, no)
99

10+
PHP_ARG_WITH(openssl_md5, openssl MD5,
11+
[ --with-openssl-md5=DIR Use openssl MD5], no, no)
12+
13+
PHP_ARG_WITH(bundled_md5, bundled MD5,
14+
[ --with-bundled-md5 Use bundled MD5], no, no)
15+
1016
PHP_ARG_ENABLE(reader, enable xlsx reader support,
1117
[ --enable-reader Enable xlsx reader?], yes, yes)
1218

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

46+
md5_sources="
47+
library/libxlsxwriter/third_party/md5/md5.c \
48+
"
49+
4050
libxlsxwriter_sources="
4151
library/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c \
42-
library/libxlsxwriter/third_party/md5/md5.c \
4352
library/libxlsxwriter/src/app.c \
4453
library/libxlsxwriter/src/chart.c \
4554
library/libxlsxwriter/src/chartsheet.c \
@@ -78,9 +87,44 @@ if test "$PHP_XLSWRITER" != "no"; then
7887
"
7988

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

83-
for i in $PHP_LIBXLSXWRITER /usr/local /usr; do
91+
if test "$PHP_OPENSSL_MD5" != "no"; then
92+
AC_MSG_RESULT([use the openssl md5 library])
93+
for i in $PHP_OPENSSL_MD5 /usr/local /usr /usr/local/opt; do
94+
if test -r $i/include/openssl/md5.h; then
95+
OPENSSL_DIR=$i
96+
AC_MSG_RESULT([found in $i])
97+
break
98+
fi
99+
done
100+
101+
if test -z "$OPENSSL_DIR"; then
102+
AC_MSG_ERROR([openssl library not found])
103+
else
104+
PHP_ADD_INCLUDE($OPENSSL_DIR/include)
105+
106+
PHP_CHECK_LIBRARY(crypto, MD5_Init,
107+
[
108+
PHP_ADD_LIBRARY_WITH_PATH(crypto, $OPENSSL_DIR/lib, XLSWRITER_SHARED_LIBADD)
109+
],[
110+
AC_MSG_ERROR([Wrong openssl MD5_Init not found])
111+
],[
112+
-L$OPENSSL_DIR/lib -lcrypto
113+
])
114+
115+
AC_DEFINE(USE_OPENSSL_MD5, 1, [ use openssl md5 ])
116+
fi
117+
118+
PHP_BUNDLED_MD5=no
119+
fi
120+
121+
if test "$PHP_BUNDLED_MD5" != "no"; then
122+
AC_MSG_RESULT([use the bundled md5 library])
123+
xls_writer_sources="$xls_writer_sources $md5_sources"
124+
fi
125+
126+
if test "$PHP_LIBXLSXWRITER" != "no"; then
127+
for i in $PHP_LIBXLSXWRITER /usr/local /usr /usr/local/opt; do
84128
if test -r $i/include/xlsxwriter.h; then
85129
XLSXWRITER_DIR=$i
86130
AC_MSG_RESULT([found in $i])
@@ -116,7 +160,7 @@ if test "$PHP_XLSWRITER" != "no"; then
116160
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libxlsxwriter/include])
117161

118162
dnl see library/CMakeLists.txt
119-
LIBOPT="-DNOCRYPT -DNOUNCRYPT"
163+
LIBOPT="$LIBOPT -DNOCRYPT -DNOUNCRYPT"
120164
fi
121165

122166
if test "$PHP_READER" = "yes"; then

include/chart.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef PHP_EXT_EXCEL_EXPORT_CHART_H
1414
#define PHP_EXT_EXCEL_EXPORT_CHART_H
1515

16+
#include "common.h"
17+
1618
extern zend_class_entry *vtiful_chart_ce;
1719

1820
VTIFUL_STARTUP_FUNCTION(chart);

include/common.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| XlsWriter Extension |
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) 2017-2018 The Viest |
6+
+----------------------------------------------------------------------+
7+
| http://www.viest.me |
8+
+----------------------------------------------------------------------+
9+
| Author: viest <[email protected]> |
10+
+----------------------------------------------------------------------+
11+
*/
12+
13+
#ifndef PHP_EXT_XLS_WRITER_COMMON_H
14+
#define PHP_EXT_XLS_WRITER_COMMON_H
15+
16+
#ifdef PHP_WIN32
17+
# define PHP_VTIFUL_API __declspec(dllexport)
18+
#elif defined(__GNUC__) && __GNUC__ >= 4
19+
# define PHP_VTIFUL_API __attribute__ ((visibility("default")))
20+
#else
21+
# define PHP_VTIFUL_API
22+
#endif
23+
24+
#ifdef ZTS
25+
#include "TSRM.h"
26+
#endif
27+
28+
#if PHP_VERSION_ID >= 80000
29+
#define TSRMLS_D void
30+
#define TSRMLS_DC
31+
#define TSRMLS_C
32+
#define TSRMLS_CC
33+
#endif
34+
35+
#define VTIFUL_RESOURCE_NAME "xlsx"
36+
37+
#define VTIFUL_STARTUP_MODULE(module) ZEND_MODULE_STARTUP_N(xlsxwriter_##module)(INIT_FUNC_ARGS_PASSTHRU)
38+
#define VTIFUL_STARTUP_FUNCTION(module) ZEND_MINIT_FUNCTION(xlsxwriter_##module)
39+
40+
#if defined(ZTS) && defined(COMPILE_DL_VTIFUL)
41+
ZEND_TSRMLS_CACHE_EXTERN();
42+
#endif
43+
44+
#endif

include/csv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef PHP_EXT_XLS_WRITER_CSV_H
1414
#define PHP_EXT_XLS_WRITER_CSV_H
1515

16+
#include "common.h"
17+
1618
unsigned int xlsx_to_csv(
1719
zval *stream_resource,
1820
const char *delimiter_str, int delimiter_str_len,

include/excel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef VTIFUL_XLS_H
1414
#define VTIFUL_XLS_H
1515

16+
#include "common.h"
17+
1618
#define V_XLS_HANDLE "handle"
1719
#define V_XLS_FIL "fileName"
1820
#define V_XLS_COF "config"

include/exception.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef VTIFUL_XLS_EXCEPTION_H
1414
#define VTIFUL_XLS_EXCEPTION_H
1515

16+
#include "common.h"
17+
1618
extern zend_class_entry *vtiful_exception_ce;
1719

1820
VTIFUL_STARTUP_FUNCTION(exception);

include/format.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef PHP_EXT_XLS_EXPORT_FORMAT_H
1414
#define PHP_EXT_XLS_EXPORT_FORMAT_H
1515

16+
#include "common.h"
17+
1618
extern zend_class_entry *vtiful_format_ce;
1719

1820
VTIFUL_STARTUP_FUNCTION(format);

include/help.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef PHP_EXT_XLS_EXPORT_HELP_H
1414
#define PHP_EXT_XLS_EXPORT_HELP_H
1515

16+
#include "common.h"
17+
1618
unsigned int file_exists(const char *path);
1719
unsigned int directory_exists(const char *path);
1820
zend_long date_double_to_timestamp(double value);

0 commit comments

Comments
 (0)