Skip to content

Commit 1026290

Browse files
committed
support Windows builds
1 parent 820d2a3 commit 1026290

File tree

4 files changed

+62
-6
lines changed

4 files changed

+62
-6
lines changed

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,40 @@ jobs:
4141
run: make
4242
- name: test
4343
run: make test TESTS="--show-diff tests"
44+
windows:
45+
defaults:
46+
run:
47+
shell: cmd
48+
strategy:
49+
matrix:
50+
version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
51+
arch: [x64]
52+
ts: [nts, ts]
53+
runs-on: windows-latest
54+
steps:
55+
- name: Checkout php-bsdiff
56+
uses: actions/checkout@v2
57+
- name: Setup PHP
58+
id: setup-php
59+
uses: cmb69/[email protected]
60+
with:
61+
version: ${{matrix.version}}
62+
arch: ${{matrix.arch}}
63+
ts: ${{matrix.ts}}
64+
- name: Download deps
65+
run: |
66+
curl -LO https://windows.php.net/downloads/php-sdk/deps/vc15/x64/libbzip2-1.0.8-vc15-${{matrix.arch}}.zip
67+
7z x libbzip2-1.0.8-vc15-${{matrix.arch}}.zip -o..\deps
68+
- name: Enable Developer Command Prompt
69+
uses: ilammy/msvc-dev-cmd@v1
70+
with:
71+
arch: ${{matrix.arch}}
72+
toolset: ${{steps.setup-php.outputs.toolset}}
73+
- name: phpize
74+
run: phpize
75+
- name: configure
76+
run: configure --enable-bsdiff --with-bz2=..\deps --with-prefix=${{steps.setup-php.outputs.prefix}}
77+
- name: make
78+
run: nmake
79+
- name: test
80+
run: nmake test TESTS="--show-diff tests"

config.w32

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ARG_WITH("bz2", "BZip2", "no");
2+
3+
if (PHP_BZ2 != "no") {
4+
if (CHECK_LIB("libbz2_a.lib;libbz2.lib", "bsdiff", PHP_BZ2) &&
5+
CHECK_HEADER_ADD_INCLUDE("bzlib.h", "CFLAGS_BSDIFF")) {
6+
AC_DEFINE('HAVE_BZ2', 1, 'Have BZ2 library');
7+
} else {
8+
WARNING("bz2 not enabled; libraries and headers not found");
9+
}
10+
}
11+
12+
ARG_ENABLE('bsdiff', 'Whether to enable bsdiff support', 'no');
13+
14+
if (PHP_BSDIFF != 'no') {
15+
AC_DEFINE('HAVE_BSDIFF', 1, 'bsdiff support enabled');
16+
17+
PHP_INSTALL_HEADERS("ext/bsdiff", "php_bsdiff.h bsdiff.h bspatch.h");
18+
EXTENSION('bsdiff', 'php_bsdiff.c bsdiff.c bspatch.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
19+
}

tests/003_bsdiff_exceptions.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ try {
3535
}
3636
?>
3737
--EXPECTF--
38-
string(%d) "Failed to open the old file "%s/tests/003_old.out""
39-
string(%d) "Failed to open the new file "%s/tests/003_new.out""
40-
string(%d) "Cannot open the diff file "%s/tests/003_diff.out" in write mode"
38+
string(%d) "Failed to open the old file "%s003_old.out""
39+
string(%d) "Failed to open the new file "%s003_new.out""
40+
string(%d) "Cannot open the diff file "%s003_diff.out" in write mode"

tests/004_bspatch_exceptions.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ try {
5454
}
5555
?>
5656
--EXPECTF--
57-
string(%d) "Cannot open diff file "%s/tests/004_diff.out" in read mode"
57+
string(%d) "Cannot open diff file "%s004_diff.out" in read mode"
5858
string(%d) "The diff file is corrupted (missing header information)"
5959
string(%d) "The diff file is corrupted (invalid header information)"
60-
string(%d) "Failed to open the old file "%s/tests/004_old.out""
61-
string(%d) "Failed to create the new file "%s/tests/004_patched.out""
60+
string(%d) "Failed to open the old file "%s004_old.out""
61+
string(%d) "Failed to create the new file "%s004_patched.out""

0 commit comments

Comments
 (0)