mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Compare commits
512 Commits
2.7.4
...
revert-115
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca3daad350 | ||
|
|
eb97711347 | ||
|
|
5c8ec7a56d | ||
|
|
e85cd55dba | ||
|
|
f9f4ca9a01 | ||
|
|
fd882ce03e | ||
|
|
99a512c4a4 | ||
|
|
8d038f435d | ||
|
|
134186c94f | ||
|
|
ef95e4f857 | ||
|
|
fd4f70d526 | ||
|
|
c7738749e2 | ||
|
|
44f9cb1ffd | ||
|
|
970343b143 | ||
|
|
e21bb528c0 | ||
|
|
5b5861c366 | ||
|
|
7a71a40824 | ||
|
|
a9e1327a80 | ||
|
|
93a227bc6d | ||
|
|
4eaeeb8230 | ||
|
|
0588401ee3 | ||
|
|
abfdae256a | ||
|
|
450e0e1ecb | ||
|
|
a373df2444 | ||
|
|
95a4b4d738 | ||
|
|
4e9edf6c9d | ||
|
|
14fc3f8d87 | ||
|
|
f52e8ad449 | ||
|
|
4318ef8fa3 | ||
|
|
8630fd57e2 | ||
|
|
0a3c56ba49 | ||
|
|
b1a77b01e2 | ||
|
|
f39d77dde0 | ||
|
|
cc7a22922c | ||
|
|
1a395a2b0f | ||
|
|
bfe4a012b8 | ||
|
|
ab17fbe288 | ||
|
|
7a65135c68 | ||
|
|
f57986ccbf | ||
|
|
9bcb809117 | ||
|
|
2073652744 | ||
|
|
1440f104bb | ||
|
|
834cc4d16e | ||
|
|
a9c16b74d7 | ||
|
|
c532b9e893 | ||
|
|
73dd885342 | ||
|
|
be24fd9467 | ||
|
|
bf1f54a091 | ||
|
|
1c3dc91845 | ||
|
|
565ff27b71 | ||
|
|
f48961c72d | ||
|
|
a0c2fefd24 | ||
|
|
f585cc446a | ||
|
|
f43e915341 | ||
|
|
93f68b209f | ||
|
|
3fb68f3989 | ||
|
|
4f27d2d9d1 | ||
|
|
562fbf2a9c | ||
|
|
cbf1ed7662 | ||
|
|
4bba584e88 | ||
|
|
0ed1bbc74a | ||
|
|
1272acd07e | ||
|
|
6e354b4c6a | ||
|
|
864fa9d0eb | ||
|
|
a27f5cc8be | ||
|
|
26a14bccbe | ||
|
|
cf48d131b3 | ||
|
|
544fd15c0b | ||
|
|
b04b079267 | ||
|
|
da49c056c9 | ||
|
|
7fc5dd428d | ||
|
|
6b62255091 | ||
|
|
9d777ca650 | ||
|
|
20f95efcba | ||
|
|
fb7730989c | ||
|
|
4d2036f20e | ||
|
|
105f0328e6 | ||
|
|
d411fac9a1 | ||
|
|
ddb9e3e7e4 | ||
|
|
fef361225a | ||
|
|
0b2b1d51e1 | ||
|
|
820d77b8b2 | ||
|
|
cd3eb3d41d | ||
|
|
fb8f8d4ef8 | ||
|
|
1a476d0e80 | ||
|
|
e5ad72214c | ||
|
|
c339b900f8 | ||
|
|
3ded9881e1 | ||
|
|
08a6bf38a4 | ||
|
|
cae668a947 | ||
|
|
e592488d7a | ||
|
|
a7184d0411 | ||
|
|
d535e4f102 | ||
|
|
5a5f54bdcd | ||
|
|
8f7897e13b | ||
|
|
daae5f2a7c | ||
|
|
766f7fa34f | ||
|
|
ecf712b2b7 | ||
|
|
d35cbd7bf8 | ||
|
|
d076df6b04 | ||
|
|
a99b6bebae | ||
|
|
864678ab46 | ||
|
|
c03508a84b | ||
|
|
963e2a084a | ||
|
|
4c6b7a3d55 | ||
|
|
5404926a14 | ||
|
|
295df19484 | ||
|
|
b970bf8e3a | ||
|
|
54915028d7 | ||
|
|
823fe96942 | ||
|
|
f2fa29809a | ||
|
|
463ec546fa | ||
|
|
60b2aea09e | ||
|
|
4625c6a885 | ||
|
|
85b0cd8b4b | ||
|
|
1fcb74ad9b | ||
|
|
1049a3ce66 | ||
|
|
1b8b53d47f | ||
|
|
a232f578a4 | ||
|
|
70285cb53b | ||
|
|
a335d050cf | ||
|
|
ef4b2997a7 | ||
|
|
901da8fa41 | ||
|
|
e49a5d7a50 | ||
|
|
281b958075 | ||
|
|
e31f64864e | ||
|
|
92f5b56c74 | ||
|
|
2350d2d5ca | ||
|
|
086c855a43 | ||
|
|
4fa5292913 | ||
|
|
9634b8bcda | ||
|
|
5d5a50a33c | ||
|
|
1edf14e642 | ||
|
|
2277390a1a | ||
|
|
f93ad27c17 | ||
|
|
b690566b39 | ||
|
|
16e772e1a8 | ||
|
|
ad356b4a23 | ||
|
|
8c4e3d58a3 | ||
|
|
8a51d64685 | ||
|
|
055bc7bc3c | ||
|
|
7d7902e0e9 | ||
|
|
2a8fa7d155 | ||
|
|
67ef8f6608 | ||
|
|
d83a597689 | ||
|
|
5623fed37f | ||
|
|
38140d115f | ||
|
|
98117c3a04 | ||
|
|
b01d3ce12c | ||
|
|
608c915e14 | ||
|
|
c680299654 | ||
|
|
794ab16b32 | ||
|
|
661723c99a | ||
|
|
d9834d05c6 | ||
|
|
9a53ef3498 | ||
|
|
f680731f9d | ||
|
|
0fe1442f7e | ||
|
|
1e4780397b | ||
|
|
6b67cb90fc | ||
|
|
b89ff3c083 | ||
|
|
0cfa2036f0 | ||
|
|
c5882c1f8e | ||
|
|
4531c9fe57 | ||
|
|
223dd10ac6 | ||
|
|
1c28f0f455 | ||
|
|
b3c450291a | ||
|
|
372760e469 | ||
|
|
6cf4c40cd2 | ||
|
|
af75ffaf24 | ||
|
|
ae0217b3a1 | ||
|
|
1e2b4017ac | ||
|
|
19f941797e | ||
|
|
0b863cbc70 | ||
|
|
b09337de09 | ||
|
|
d902e70b4d | ||
|
|
cd2dc5bce4 | ||
|
|
34910d18e9 | ||
|
|
3a17cec521 | ||
|
|
94644d374f | ||
|
|
f8b0c2c980 | ||
|
|
6bbb3c969c | ||
|
|
76025b95c1 | ||
|
|
1be353fd13 | ||
|
|
54001ab868 | ||
|
|
890ff475f1 | ||
|
|
559a2909a9 | ||
|
|
fff2484529 | ||
|
|
d1b194999d | ||
|
|
64f7a3553e | ||
|
|
a06cc32491 | ||
|
|
022fdb2fc5 | ||
|
|
7688a55656 | ||
|
|
08388c0b15 | ||
|
|
e7a88f1df7 | ||
|
|
2f3122627e | ||
|
|
93a35908de | ||
|
|
5ef4623051 | ||
|
|
e952f1c76a | ||
|
|
09b89a30f9 | ||
|
|
9a681a9fa6 | ||
|
|
8650ce4f8f | ||
|
|
f7ca621efe | ||
|
|
6b5200002e | ||
|
|
53f7cdefe0 | ||
|
|
e1a14bbb9f | ||
|
|
9e051c8c80 | ||
|
|
e677be74d7 | ||
|
|
037d224fd7 | ||
|
|
ce44e00bd4 | ||
|
|
0247458853 | ||
|
|
656a58c3fa | ||
|
|
9fdfef5057 | ||
|
|
18c5ccfe9d | ||
|
|
d064e1353c | ||
|
|
3c89ce6c7f | ||
|
|
07ea1e2887 | ||
|
|
f0b5e4f59e | ||
|
|
a54021bf19 | ||
|
|
dce63d3c87 | ||
|
|
47ab5d7584 | ||
|
|
b2182b4fe1 | ||
|
|
1d5aec037b | ||
|
|
6b5f702719 | ||
|
|
7bdcda1d62 | ||
|
|
66840a8eed | ||
|
|
98773ee5a6 | ||
|
|
719d818fd1 | ||
|
|
b8444070ee | ||
|
|
5b4f4f8e55 | ||
|
|
22d263c0a8 | ||
|
|
150d866c15 | ||
|
|
c051a48d56 | ||
|
|
b965ffcd82 | ||
|
|
7f863d182f | ||
|
|
d1041c57dc | ||
|
|
14b822a185 | ||
|
|
7204d277b4 | ||
|
|
5a0fd40dc4 | ||
|
|
59a6e27532 | ||
|
|
6b3b841c0e | ||
|
|
e6591ffe9c | ||
|
|
e316971764 | ||
|
|
d55278714f | ||
|
|
cb7eca9049 | ||
|
|
5b8c9e6f09 | ||
|
|
5d1043334d | ||
|
|
f24cbcf909 | ||
|
|
76a07c32ba | ||
|
|
e0c69086dc | ||
|
|
5606b70c1c | ||
|
|
28ae4242a6 | ||
|
|
f14df1925c | ||
|
|
e9ad3c0011 | ||
|
|
e2ad31e858 | ||
|
|
af614cd7ce | ||
|
|
e21b0ec89d | ||
|
|
3069b51c09 | ||
|
|
1662ac4cf8 | ||
|
|
1e09017549 | ||
|
|
84e9f13688 | ||
|
|
2b0a0bdad9 | ||
|
|
e8d1970f55 | ||
|
|
6861e9c2c7 | ||
|
|
376b8e7569 | ||
|
|
875e1d05cd | ||
|
|
9382161b6f | ||
|
|
a1b8d201ae | ||
|
|
1fed8f2802 | ||
|
|
ecea6c12cd | ||
|
|
81dce02431 | ||
|
|
a33ca44ca9 | ||
|
|
aee733b51f | ||
|
|
54ceca8680 | ||
|
|
90981e3877 | ||
|
|
d69826eb4a | ||
|
|
dc83282019 | ||
|
|
23c0d6f4aa | ||
|
|
8e4d4b7be5 | ||
|
|
ee906aaff9 | ||
|
|
e2b80e7f03 | ||
|
|
09073c5517 | ||
|
|
00050f4d0e | ||
|
|
cff6ec17ea | ||
|
|
64079d9331 | ||
|
|
541889d17b | ||
|
|
c91128995d | ||
|
|
fd2b7af1dc | ||
|
|
081e2d2846 | ||
|
|
9edb9417a1 | ||
|
|
4ae4165ba2 | ||
|
|
e441a575ea | ||
|
|
1575016885 | ||
|
|
987ad4b846 | ||
|
|
f4b03ae835 | ||
|
|
d6de01d05c | ||
|
|
09b7159119 | ||
|
|
4198ddd5d1 | ||
|
|
8332ed87e0 | ||
|
|
f6b091498f | ||
|
|
a45f314447 | ||
|
|
8c8cb70174 | ||
|
|
f09c18e78f | ||
|
|
f5d93d2f54 | ||
|
|
7402fbf7c1 | ||
|
|
2c590e5895 | ||
|
|
463a98b1bf | ||
|
|
6d1c6d7f61 | ||
|
|
08362fb6e5 | ||
|
|
4d5641f6ec | ||
|
|
f34ecf9468 | ||
|
|
aa5c829fae | ||
|
|
fc118d709e | ||
|
|
589a4a9803 | ||
|
|
944e314bab | ||
|
|
0b17ce9e61 | ||
|
|
ed4978bb89 | ||
|
|
7a4f28e939 | ||
|
|
5cb6a75e7d | ||
|
|
757af25d8f | ||
|
|
5e3e7eccbf | ||
|
|
9738fcd6cd | ||
|
|
5a6a33303c | ||
|
|
ae15d6c5f5 | ||
|
|
ff15973a25 | ||
|
|
b88a68dab8 | ||
|
|
b05bdcd83d | ||
|
|
6a4ad34324 | ||
|
|
9a2d94cc33 | ||
|
|
f1d1d4fe10 | ||
|
|
fa6fa1c425 | ||
|
|
f8c8300c9c | ||
|
|
09198b431f | ||
|
|
f426ced789 | ||
|
|
bab330b64e | ||
|
|
b59a06face | ||
|
|
bb44e88c3b | ||
|
|
8649068159 | ||
|
|
5476385553 | ||
|
|
56bac35768 | ||
|
|
4cdc6a07ae | ||
|
|
c30b34ae5c | ||
|
|
da5c6fd084 | ||
|
|
a4b6499530 | ||
|
|
eb4445ea59 | ||
|
|
be51bcfdfc | ||
|
|
7bc4131c02 | ||
|
|
da8debdade | ||
|
|
ef5e664981 | ||
|
|
8e50af3a7e | ||
|
|
8e96c64918 | ||
|
|
8a9c8a279d | ||
|
|
72ca0cecd1 | ||
|
|
3564f6d0a7 | ||
|
|
d3e2b4b5b2 | ||
|
|
c6de6e7056 | ||
|
|
55322a282c | ||
|
|
6789ea81ff | ||
|
|
ac8a9af89c | ||
|
|
553b817b2a | ||
|
|
96592bce3e | ||
|
|
4e393886aa | ||
|
|
2e13be2a7a | ||
|
|
41fb29eba4 | ||
|
|
b519291fa2 | ||
|
|
dd752cd5be | ||
|
|
6a153f9aa0 | ||
|
|
bba390dbcc | ||
|
|
32efeb970c | ||
|
|
310335813f | ||
|
|
487980c9a8 | ||
|
|
f8801e224f | ||
|
|
5e229a0b01 | ||
|
|
49cfcbe92d | ||
|
|
4e4ce282db | ||
|
|
e2fd3e18d6 | ||
|
|
605c06f85c | ||
|
|
4cdefeab81 | ||
|
|
8ab09898f0 | ||
|
|
9c8b4d627c | ||
|
|
8923077120 | ||
|
|
29c31d90e5 | ||
|
|
e281d26a3a | ||
|
|
8ed68f481a | ||
|
|
b1abff61a5 | ||
|
|
15638cea4c | ||
|
|
9ed77c10e0 | ||
|
|
ccf262d202 | ||
|
|
4be894bc10 | ||
|
|
6440863ce4 | ||
|
|
25d7c72b6e | ||
|
|
dc4dd6ffa4 | ||
|
|
bf79134405 | ||
|
|
4f8b9d0f81 | ||
|
|
70bda268e5 | ||
|
|
e559dce9d5 | ||
|
|
6a98a6bf5e | ||
|
|
9b53133ba4 | ||
|
|
5b319b0df1 | ||
|
|
572bf919aa | ||
|
|
1d960a9084 | ||
|
|
4b28d1c2df | ||
|
|
9c8fd4d45d | ||
|
|
b62f029da7 | ||
|
|
c711a3666e | ||
|
|
487c6da4ac | ||
|
|
e942b13d73 | ||
|
|
c5ae719b9c | ||
|
|
7b6e707e24 | ||
|
|
0114700dad | ||
|
|
ec9364db69 | ||
|
|
033e29985e | ||
|
|
61cba2342d | ||
|
|
a3acad4ef3 | ||
|
|
1e13eb4abe | ||
|
|
1bac06fe3c | ||
|
|
762a768969 | ||
|
|
d0a6e3a860 | ||
|
|
995187d258 | ||
|
|
5333a04e1c | ||
|
|
19be5263b5 | ||
|
|
6e79401ab5 | ||
|
|
903036f1c0 | ||
|
|
6bd3eea0fe | ||
|
|
f28a3cf5a3 | ||
|
|
c828c2c6e4 | ||
|
|
26ccaa4449 | ||
|
|
ae1193ab16 | ||
|
|
6d6a29368e | ||
|
|
897cb00351 | ||
|
|
8a1689b79d | ||
|
|
018dfae15e | ||
|
|
c83e803c85 | ||
|
|
fa4d33671d | ||
|
|
f8d77b9b50 | ||
|
|
6594811536 | ||
|
|
cc7eb7cd84 | ||
|
|
e6408b4693 | ||
|
|
330c3486af | ||
|
|
b9dfb5afe3 | ||
|
|
565ac87b65 | ||
|
|
f0c39c1770 | ||
|
|
896cf889e4 | ||
|
|
6b91570054 | ||
|
|
31906b36e5 | ||
|
|
4e2d4f3f05 | ||
|
|
ffdc2dc85a | ||
|
|
911bc74bf4 | ||
|
|
3467c9d291 | ||
|
|
15cd8543f1 | ||
|
|
864db0ebc5 | ||
|
|
9ee623112d | ||
|
|
d789b1a472 | ||
|
|
17a25b44e2 | ||
|
|
781260f3fc | ||
|
|
6c43fa55b1 | ||
|
|
c4440668bb | ||
|
|
e437bf2ffe | ||
|
|
0f2d2d5734 | ||
|
|
a49ae05599 | ||
|
|
8ae2755dbe | ||
|
|
3966bd5f0a | ||
|
|
384ba54c79 | ||
|
|
26dbc922eb | ||
|
|
31a4498056 | ||
|
|
044275d909 | ||
|
|
c5316f9231 | ||
|
|
2d1a61d184 | ||
|
|
f7744188f4 | ||
|
|
5b6c923eef | ||
|
|
b0b031afb2 | ||
|
|
fe09d8c03e | ||
|
|
c2813d5736 | ||
|
|
8b2b658ced | ||
|
|
e862bacc8a | ||
|
|
cac57dbf79 | ||
|
|
345fe783cc | ||
|
|
55efe6d65b | ||
|
|
dccbc30972 | ||
|
|
f914a82379 | ||
|
|
18979d8fb6 | ||
|
|
21149f6807 | ||
|
|
93e6dcab1d | ||
|
|
59dedbea2c | ||
|
|
8bda4fd31e | ||
|
|
8039ea49f9 | ||
|
|
fc90b4ae23 | ||
|
|
e02be69e40 | ||
|
|
35a90f2769 | ||
|
|
fa87149631 | ||
|
|
8dfe722e14 | ||
|
|
dcbfe1e0ab | ||
|
|
e11946fd10 | ||
|
|
44399cd185 | ||
|
|
927d7f55ba | ||
|
|
e323d7b155 | ||
|
|
d0b253c346 | ||
|
|
81430e6853 | ||
|
|
83696e92b7 | ||
|
|
b0538c09bf | ||
|
|
40f89d1dca | ||
|
|
fa2e041cc9 | ||
|
|
3c614663a3 | ||
|
|
b5c7185374 | ||
|
|
d0a9a3a594 | ||
|
|
2e6329bb86 | ||
|
|
d3ba04fc5b | ||
|
|
7a78ea0185 | ||
|
|
36b04f9eba | ||
|
|
be7c002869 | ||
|
|
e621e4a5a1 | ||
|
|
bd815d4ea2 | ||
|
|
4d3501118e |
102
.github/workflows/build-unix.yml
vendored
102
.github/workflows/build-unix.yml
vendored
@@ -29,6 +29,9 @@ on:
|
||||
description: Extensions to build (comma separated)
|
||||
required: true
|
||||
type: string
|
||||
shared-extensions:
|
||||
description: Shared extensions to build (optional, comma separated)
|
||||
type: string
|
||||
extra-libs:
|
||||
description: Extra libraries to build (optional, comma separated)
|
||||
type: string
|
||||
@@ -42,10 +45,22 @@ on:
|
||||
build-fpm:
|
||||
description: Build fpm binary
|
||||
type: boolean
|
||||
build-frankenphp:
|
||||
description: Build frankenphp binary (requires ZTS)
|
||||
type: boolean
|
||||
default: false
|
||||
enable-zts:
|
||||
description: Enable ZTS
|
||||
type: boolean
|
||||
default: false
|
||||
prefer-pre-built:
|
||||
description: Prefer pre-built binaries (reduce build time)
|
||||
type: boolean
|
||||
default: true
|
||||
with-suggested-libs:
|
||||
description: Build with suggested libs
|
||||
type: boolean
|
||||
default: false
|
||||
debug:
|
||||
description: Show full build logs
|
||||
type: boolean
|
||||
@@ -69,6 +84,9 @@ on:
|
||||
description: Extensions to build (comma separated)
|
||||
required: true
|
||||
type: string
|
||||
shared-extensions:
|
||||
description: Shared extensions to build (optional, comma separated)
|
||||
type: string
|
||||
extra-libs:
|
||||
description: Extra libraries to build (optional, comma separated)
|
||||
type: string
|
||||
@@ -82,10 +100,22 @@ on:
|
||||
build-fpm:
|
||||
description: Build fpm binary
|
||||
type: boolean
|
||||
build-frankenphp:
|
||||
description: Build frankenphp binary (requires ZTS)
|
||||
type: boolean
|
||||
default: false
|
||||
enable-zts:
|
||||
description: Enable ZTS
|
||||
type: boolean
|
||||
default: false
|
||||
prefer-pre-built:
|
||||
description: Prefer pre-built binaries (reduce build time)
|
||||
type: boolean
|
||||
default: true
|
||||
with-suggested-libs:
|
||||
description: Include suggested libs
|
||||
type: boolean
|
||||
default: false
|
||||
debug:
|
||||
description: Show full build logs
|
||||
type: boolean
|
||||
@@ -136,16 +166,27 @@ jobs:
|
||||
macos-x86_64)
|
||||
DOWN_CMD="composer update --no-dev --classmap-authoritative && ./bin/spc doctor --auto-fix && ./bin/spc download"
|
||||
BUILD_CMD="./bin/spc build"
|
||||
RUNS_ON="macos-13"
|
||||
RUNS_ON="macos-15-intel"
|
||||
;;
|
||||
macos-aarch64)
|
||||
DOWN_CMD="composer update --no-dev --classmap-authoritative && ./bin/spc doctor --auto-fix && ./bin/spc download"
|
||||
BUILD_CMD="./bin/spc build"
|
||||
RUNS_ON="macos-14"
|
||||
RUNS_ON="macos-15"
|
||||
;;
|
||||
esac
|
||||
DOWN_CMD="$DOWN_CMD --with-php=${{ inputs.php-version }} --for-extensions=${{ inputs.extensions }} --ignore-cache-sources=php-src"
|
||||
BUILD_CMD="$BUILD_CMD ${{ inputs.extensions }}"
|
||||
STATIC_EXTS="${{ inputs.extensions }}"
|
||||
SHARED_EXTS="${{ inputs['shared-extensions'] }}"
|
||||
BUILD_FRANKENPHP="${{ inputs['build-frankenphp'] }}"
|
||||
ENABLE_ZTS="${{ inputs['enable-zts'] }}"
|
||||
ALL_EXTS="$STATIC_EXTS"
|
||||
if [ -n "$SHARED_EXTS" ]; then
|
||||
ALL_EXTS="$ALL_EXTS,$SHARED_EXTS"
|
||||
fi
|
||||
DOWN_CMD="$DOWN_CMD --with-php=${{ inputs.php-version }} --for-extensions=$ALL_EXTS --ignore-cache-sources=php-src"
|
||||
BUILD_CMD="$BUILD_CMD $STATIC_EXTS"
|
||||
if [ -n "$SHARED_EXTS" ]; then
|
||||
BUILD_CMD="$BUILD_CMD --build-shared=$SHARED_EXTS"
|
||||
fi
|
||||
if [ -n "${{ inputs.extra-libs }}" ]; then
|
||||
DOWN_CMD="$DOWN_CMD --for-libs=${{ inputs.extra-libs }}"
|
||||
BUILD_CMD="$BUILD_CMD --with-libs=${{ inputs.extra-libs }}"
|
||||
@@ -157,6 +198,9 @@ jobs:
|
||||
if [ ${{ inputs.prefer-pre-built }} == true ]; then
|
||||
DOWN_CMD="$DOWN_CMD --prefer-pre-built"
|
||||
fi
|
||||
if [ ${{ inputs.with-suggested-libs }} == true ]; then
|
||||
BUILD_CMD="$BUILD_CMD --with-suggested-libs"
|
||||
fi
|
||||
if [ ${{ inputs.build-cli }} == true ]; then
|
||||
BUILD_CMD="$BUILD_CMD --build-cli"
|
||||
fi
|
||||
@@ -166,6 +210,12 @@ jobs:
|
||||
if [ ${{ inputs.build-fpm }} == true ]; then
|
||||
BUILD_CMD="$BUILD_CMD --build-fpm"
|
||||
fi
|
||||
if [ "$BUILD_FRANKENPHP" = "true" ]; then
|
||||
BUILD_CMD="$BUILD_CMD --build-frankenphp"
|
||||
fi
|
||||
if [ "$ENABLE_ZTS" = "true" ]; then
|
||||
BUILD_CMD="$BUILD_CMD --enable-zts"
|
||||
fi
|
||||
echo 'download='"$DOWN_CMD" >> "$GITHUB_OUTPUT"
|
||||
echo 'build='"$BUILD_CMD" >> "$GITHUB_OUTPUT"
|
||||
echo 'run='"$RUNS_ON" >> "$GITHUB_OUTPUT"
|
||||
@@ -188,6 +238,27 @@ jobs:
|
||||
env:
|
||||
phpts: nts
|
||||
|
||||
- if: ${{ inputs['build-frankenphp'] == true }}
|
||||
name: "Install go-xcaddy for FrankenPHP"
|
||||
run: |
|
||||
case "${{ inputs.os }}" in
|
||||
linux-x86_64|linux-aarch64)
|
||||
./bin/spc-alpine-docker install-pkg go-xcaddy
|
||||
;;
|
||||
linux-x86_64-glibc|linux-aarch64-glibc)
|
||||
./bin/spc-gnu-docker install-pkg go-xcaddy
|
||||
;;
|
||||
macos-x86_64|macos-aarch64)
|
||||
composer update --no-dev --classmap-authoritative
|
||||
./bin/spc doctor --auto-fix
|
||||
./bin/spc install-pkg go-xcaddy
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported OS for go-xcaddy install: ${{ inputs.os }}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v4
|
||||
@@ -202,6 +273,14 @@ jobs:
|
||||
# if: ${{ failure() }}
|
||||
# uses: mxschmitt/action-tmate@v3
|
||||
|
||||
# Upload debug logs
|
||||
- if: ${{ inputs.debug && failure() }}
|
||||
name: "Upload build logs on failure"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: spc-logs-${{ inputs.php-version }}-${{ inputs.os }}
|
||||
path: log/*.log
|
||||
|
||||
# Upload cli executable
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
name: "Upload PHP cli SAPI"
|
||||
@@ -226,7 +305,22 @@ jobs:
|
||||
name: php-fpm-${{ inputs.php-version }}-${{ inputs.os }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload frankenphp executable
|
||||
- if: ${{ inputs['build-frankenphp'] == true }}
|
||||
name: "Upload FrankenPHP SAPI"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-frankenphp-${{ inputs.php-version }}-${{ inputs.os }}
|
||||
path: buildroot/bin/frankenphp
|
||||
|
||||
# Upload extensions metadata
|
||||
- if: ${{ inputs['shared-extensions'] != '' }}
|
||||
name: "Upload shared extensions"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-shared-ext-${{ inputs.php-version }}-${{ inputs.os }}
|
||||
path: |
|
||||
buildroot/modules/*.so
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: "Upload License Files"
|
||||
with:
|
||||
|
||||
8
.github/workflows/ext-matrix-tests.yml
vendored
8
.github/workflows/ext-matrix-tests.yml
vendored
@@ -85,9 +85,9 @@ jobs:
|
||||
- "8.4"
|
||||
operating-system:
|
||||
- "ubuntu-latest"
|
||||
#- "macos-13"
|
||||
#- "macos-15-intel"
|
||||
#- "debian-arm64-self-hosted"
|
||||
- "macos-14"
|
||||
- "macos-15"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
@@ -99,11 +99,11 @@ jobs:
|
||||
OS=""
|
||||
if [ "${{ matrix.operating-system }}" = "ubuntu-latest" ]; then
|
||||
OS="linux-x86_64"
|
||||
elif [ "${{ matrix.operating-system }}" = "macos-13" ]; then
|
||||
elif [ "${{ matrix.operating-system }}" = "macos-15-intel" ]; then
|
||||
OS="macos-x86_64"
|
||||
elif [ "${{ matrix.operating-system }}" = "debian-arm64-self-hosted" ]; then
|
||||
OS="linux-aarch64"
|
||||
elif [ "${{ matrix.operating-system }}" = "macos-14" ]; then
|
||||
elif [ "${{ matrix.operating-system }}" = "macos-15" ]; then
|
||||
OS="macos-aarch64"
|
||||
fi
|
||||
echo "OS=$OS" >> $GITHUB_ENV
|
||||
|
||||
6
.github/workflows/release-build.yml
vendored
6
.github/workflows/release-build.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
os: "ubuntu-latest"
|
||||
filename: "spc-linux-x86_64.tar.gz"
|
||||
- name: "macos-x86_64"
|
||||
os: "macos-13"
|
||||
os: "macos-15-intel"
|
||||
filename: "spc-macos-x86_64.tar.gz"
|
||||
- name: "linux-aarch64"
|
||||
os: "ubuntu-latest"
|
||||
@@ -147,11 +147,11 @@ jobs:
|
||||
- name: "linux-x86_64"
|
||||
os: "ubuntu-latest"
|
||||
- name: "macos-x86_64"
|
||||
os: "macos-13"
|
||||
os: "macos-15-intel"
|
||||
- name: "linux-aarch64"
|
||||
os: "ubuntu-24.04-arm"
|
||||
- name: "macos-aarch64"
|
||||
os: "macos-latest"
|
||||
os: "macos-15"
|
||||
- name: "windows-x64"
|
||||
os: "windows-latest"
|
||||
steps:
|
||||
|
||||
8
.github/workflows/tests.yml
vendored
8
.github/workflows/tests.yml
vendored
@@ -1,13 +1,9 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'src/globals/test-extensions.php'
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
types: [ opened, synchronize, reopened ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'config/**'
|
||||
@@ -179,7 +175,7 @@ jobs:
|
||||
key: php-dependencies-${{ matrix.os }}
|
||||
|
||||
- name: "Install Dependencies"
|
||||
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||
run: composer update -vvv --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-plugins
|
||||
|
||||
- name: "Run Build Tests (doctor)"
|
||||
run: php src/globals/test-extensions.php doctor_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -22,6 +22,9 @@ docker/source/
|
||||
# default package root directory
|
||||
/pkgroot/**
|
||||
|
||||
# Windows PHP SDK binary tools
|
||||
/php-sdk-binary-tools/**
|
||||
|
||||
# default pack:lib and release directory
|
||||
/dist/**
|
||||
packlib_files.txt
|
||||
|
||||
344
README-zh.md
344
README-zh.md
@@ -5,310 +5,168 @@
|
||||
[](https://github.com/crazywhalecc/static-php-cli/releases)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/blob/main/LICENSE)
|
||||
[](https://static-php.dev/zh/guide/extensions.html)
|
||||
|
||||
**static-php-cli**是一个用于静态编译、构建 PHP 解释器的工具,支持众多流行扩展。
|
||||
|
||||
目前 static-php-cli 支持 `cli`、`fpm`、`embed`、`micro` 和 `frankenphp` SAPI。
|
||||
|
||||
**static-php-cli**也支持将 PHP 代码和 PHP 运行时打包为一个文件并运行。
|
||||
**static-php-cli** 是一个用于构建静态、独立 PHP 运行时的强大工具,支持众多流行扩展。
|
||||
|
||||
## 特性
|
||||
|
||||
static-php-cli(简称 `spc`)有许多特性:
|
||||
- :elephant: **支持多 PHP 版本** - 支持 PHP 8.1, 8.2, 8.3, 8.4, 8.5
|
||||
- :handbag: **单文件 PHP 可执行文件** - 构建零依赖的独立 PHP
|
||||
- :hamburger: **phpmicro 集成** - 构建 **[phpmicro](https://github.com/dixyes/phpmicro)** 自解压可执行文件(将 PHP 二进制文件和源代码合并为一个文件)
|
||||
- :pill: **智能环境检查器** - 自动构建环境检查器,具备自动修复功能
|
||||
- :zap: **跨平台支持** - 支持 Linux、macOS、FreeBSD 和 Windows
|
||||
- :wrench: **可配置补丁** - 可自定义的源代码补丁系统
|
||||
- :books: **智能依赖管理** - 自动处理构建依赖
|
||||
- 📦 **自包含工具** - 提供使用 [box](https://github.com/box-project/box) 构建的 `spc` 可执行文件
|
||||
- :fire: **广泛的扩展支持** - 支持 75+ 流行 [扩展](https://static-php.dev/zh/guide/extensions.html)
|
||||
- :floppy_disk: **UPX 压缩** - 减小二进制文件大小 30-50%(仅 Linux/Windows)
|
||||
|
||||
- :handbag: 构建独立的单文件 PHP 解释器,无需任何依赖
|
||||
- :hamburger: 构建 **[phpmicro](https://github.com/dixyes/phpmicro)** 自执行二进制(将 PHP 代码和 PHP 解释器打包为一个文件)
|
||||
- :pill: 提供一键检查和修复编译环境的 Doctor 模块
|
||||
- :zap: 支持多个系统:`Linux`、`macOS`、`FreeBSD`、`Windows`
|
||||
- :wrench: 高度自定义的代码 patch 功能
|
||||
- :books: 自带编译依赖管理
|
||||
- 📦 提供由自身编译的独立 `spc` 二进制(使用 spc 和 [box](https://github.com/box-project/box) 构建)
|
||||
- :fire: 支持大量 [扩展](https://static-php.dev/zh/guide/extensions.html)
|
||||
- :floppy_disk: 整合 UPX 工具(减小二进制文件体积)
|
||||
|
||||
**静态 php-cli:**
|
||||
**单文件独立 php-cli:**
|
||||
|
||||
<img width="700" alt="out1" src="https://github.com/crazywhalecc/static-php-cli/assets/20330940/01a2e60f-13b0-4242-a645-f7afa4936396">
|
||||
|
||||
**使用 phpmicro 打包 PHP 代码:**
|
||||
**使用 phpmicro 将 PHP 代码与 PHP 解释器结合:**
|
||||
|
||||
<img width="700" alt="out2" src="https://github.com/crazywhalecc/static-php-cli/assets/20330940/46b7128d-fb72-4169-957e-48564c3ff3e2">
|
||||
|
||||
## 文档
|
||||
## 快速开始
|
||||
|
||||
目前 README 编写了基本用法。有关 static-php-cli 所有的功能,请点击这里查看文档:<https://static-php.dev>。
|
||||
|
||||
## 直接下载
|
||||
|
||||
如果你不想自行编译 PHP,可以从本项目现有的示例 Action 下载 Artifact,也可以从自托管的服务器下载。
|
||||
|
||||
| 组合名称 | 组合扩展数 | 系统 | 备注 |
|
||||
|---------------------------------------------------------------------|----------------------------------------------------------------------------|-------------|--------------|
|
||||
| [common](https://dl.static-php.dev/static-php-cli/common/) | [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) | Linux/macOS | 体积为 7.5MB 左右 |
|
||||
| [bulk](https://dl.static-php.dev/static-php-cli/bulk/) | [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) | Linux/macOS | 体积为 25MB 左右 |
|
||||
| [minimal](https://dl.static-php.dev/static-php-cli/minimal/) | [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) | Linux/macOS | 体积为 3MB 左右 |
|
||||
| [spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min) | [5](https://dl.static-php.dev/static-php-cli/windows/spc-min/README.txt) | Windows | 体积为 3MB 左右 |
|
||||
| [spc-max](https://dl.static-php.dev/static-php-cli/windows/spc-max) | [40+](https://dl.static-php.dev/static-php-cli/windows/spc-max/README.txt) | Windows | 体积为 8.5MB 左右 |
|
||||
|
||||
> Linux 和 Windows 默认启用了 UPX 压缩,可减小 30~50% 的 PHP 二进制体积。
|
||||
> macOS 当前不支持 UPX,所以上述预编译的 macOS 版本体积可能较大。
|
||||
|
||||
## 使用 static-php-cli 构建 PHP
|
||||
|
||||
### 编译环境需求
|
||||
|
||||
- PHP >= 8.4(这是 spc 自身需要的版本,不是支持的构建版本)
|
||||
- 扩展:`mbstring,tokenizer,phar`
|
||||
- 系统安装了 `curl` 和 `git`
|
||||
|
||||
是的,本项目采用 PHP 编写,编译前需要一个 PHP 环境,比较滑稽。
|
||||
但本项目默认可通过自身构建的 micro 和 static-php 二进制运行,其他只需要包含上面提到的扩展和 PHP 版本大于等于 8.1 即可。
|
||||
|
||||
下面是架构支持情况,:octocat: 代表支持 GitHub Action 构建,:computer: 代表支持本地构建,空 代表暂不支持。
|
||||
|
||||
| | x86_64 | aarch64 |
|
||||
|---------|----------------------|----------------------|
|
||||
| macOS | :octocat: :computer: | :octocat: :computer: |
|
||||
| Linux | :octocat: :computer: | :octocat: :computer: |
|
||||
| Windows | :octocat: :computer: | |
|
||||
| FreeBSD | :computer: | :computer: |
|
||||
|
||||
当前支持编译的 PHP 版本:
|
||||
|
||||
> :warning: 部分支持,对于新的测试版和旧版本可能存在问题。
|
||||
>
|
||||
> :heavy_check_mark: 支持
|
||||
>
|
||||
> :x: 不支持
|
||||
|
||||
| PHP Version | Status | Comment |
|
||||
|-------------|--------------------|---------------------------------------------------------|
|
||||
| 7.2 | :x: | |
|
||||
| 7.3 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
|
||||
| 7.4 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
|
||||
| 8.0 | :warning: | PHP 官方已停止 8.0 的维护,我们不再处理 8.0 相关的 backport 支持 |
|
||||
| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新,在 8.5 发布后我们不再处理 8.1 相关的 backport 支持 |
|
||||
| 8.2 | :heavy_check_mark: | |
|
||||
| 8.3 | :heavy_check_mark: | |
|
||||
| 8.4 | :heavy_check_mark: | |
|
||||
| 8.5 (alpha) | :warning: | PHP 8.5 目前处于 alpha 阶段 |
|
||||
|
||||
> 这个表格的支持状态是 static-php-cli 对构建对应版本的支持情况,不是 PHP 官方对该版本的支持情况。
|
||||
|
||||
### 支持的扩展
|
||||
|
||||
请先根据下方扩展列表选择你要编译的扩展。
|
||||
|
||||
- [扩展支持列表](https://static-php.dev/zh/guide/extensions.html)
|
||||
- [编译命令生成器](https://static-php.dev/zh/guide/cli-generator.html)
|
||||
|
||||
> 如果这里没有你需要的扩展,可以提交 Issue。
|
||||
|
||||
### 在线构建(使用 GitHub Actions)
|
||||
|
||||
使用 GitHub Action 可以方便地构建一个静态编译的 PHP,同时可以自行定义要编译的扩展。
|
||||
|
||||
1. Fork 本项目。
|
||||
2. 进入项目的 Actions,选择 CI。
|
||||
3. 选择 `Run workflow`,填入你要编译的 PHP 版本、目标类型、扩展列表。(扩展列表使用英文逗号分割,例如 `bcmath,curl,mbstring`)
|
||||
4. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
|
||||
|
||||
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
||||
|
||||
### 本地构建(使用 spc 二进制,推荐)
|
||||
|
||||
该项目提供了 static-php-cli 的二进制文件:`spc`。
|
||||
您可以使用 `spc` 二进制文件,无需安装任何运行时(用起来就像 golang 程序)。
|
||||
目前,`spc` 二进制文件提供的平台有 Linux 和 macOS。
|
||||
|
||||
使用以下命令从自托管服务器下载:
|
||||
### 1. 下载 spc 二进制文件
|
||||
|
||||
```bash
|
||||
# Download from self-hosted nightly builds (sync with main branch)
|
||||
# For Linux x86_64
|
||||
# Linux x86_64
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||
# For Linux aarch64
|
||||
# Linux aarch64
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||
# macOS x86_64 (Intel)
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||
# macOS aarch64 (Apple)
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||
# Windows (x86_64, win10 build 17063 or later)
|
||||
# Windows (x86_64, win10 build 17063 或更高版本,请先安装 VS2022)
|
||||
curl.exe -fsSL -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||
```
|
||||
|
||||
# Add execute perm (Linux and macOS only)
|
||||
对于 macOS 和 Linux,请先添加执行权限:
|
||||
|
||||
```bash
|
||||
chmod +x ./spc
|
||||
|
||||
# Run (Linux and macOS)
|
||||
./spc --version
|
||||
# Run (Windows powershell)
|
||||
.\spc.exe --version
|
||||
```
|
||||
|
||||
自托管 `spc` 由 GitHub Actions 构建,你也可以从 Actions 直接下载:[此处](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml)。
|
||||
### 2. 构建静态 PHP
|
||||
|
||||
### 本地构建(使用 git 源码)
|
||||
首先,创建一个 `craft.yml` 文件,并从 [扩展列表](https://static-php.dev/zh/guide/extensions.html) 或 [命令生成器](https://static-php.dev/zh/guide/cli-generator.html) 中指定要包含的扩展:
|
||||
|
||||
如果你需要修改 static-php-cli 源码,或者使用 spc 二进制构建有问题,你可以使用 git 源码下载 static-php-cli。
|
||||
```yml
|
||||
# PHP 版本支持:8.1, 8.2, 8.3, 8.4, 8.5
|
||||
php-version: 8.4
|
||||
# 在此处放置您的扩展列表
|
||||
extensions: "apcu,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,gd,iconv,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib"
|
||||
sapi:
|
||||
- cli
|
||||
- micro
|
||||
- fpm
|
||||
download-options:
|
||||
prefer-pre-built: true
|
||||
```
|
||||
|
||||
运行命令:
|
||||
|
||||
```bash
|
||||
# clone 仓库即可
|
||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||
./spc craft
|
||||
|
||||
# 输出完整控制台日志
|
||||
./spc craft --debug
|
||||
```
|
||||
|
||||
如果您的系统上尚未安装 php,我们建议你使用内置的 setup-runtime 自动安装 PHP 和 Composer。
|
||||
### 3. 静态 PHP 使用
|
||||
|
||||
```bash
|
||||
cd static-php-cli
|
||||
chmod +x bin/setup-runtime
|
||||
# it will download static php (from self-hosted server) and composer (from getcomposer)
|
||||
bin/setup-runtime
|
||||
# initialize composer deps
|
||||
bin/composer install
|
||||
# chmod
|
||||
chmod +x bin/spc
|
||||
bin/spc --version
|
||||
现在您可以将 static-php-cli 构建的二进制文件复制到另一台机器上,无需依赖即可运行:
|
||||
|
||||
```
|
||||
# php-cli
|
||||
buildroot/bin/php -v
|
||||
|
||||
# phpmicro
|
||||
echo '<?php echo "Hello world!\n";' > a.php
|
||||
./spc micro:combine a.php -O my-app
|
||||
./my-app
|
||||
|
||||
# php-fpm
|
||||
buildroot/bin/php-fpm -v
|
||||
```
|
||||
|
||||
### 开始构建 PHP
|
||||
## 文档
|
||||
|
||||
下面是使用 static-php-cli 的基础用法:
|
||||
当前 README 包含基本用法。有关 static-php-cli 的所有功能,
|
||||
请访问 <https://static-php.dev>。
|
||||
|
||||
> 如果你使用的是打包好的 `spc` 二进制,你需要将下列命令的 `./bin/spc` 替换为 `./spc`。
|
||||
## 直接下载
|
||||
|
||||
```bash
|
||||
# 检查环境依赖,并根据尝试自动安装缺失的编译工具
|
||||
./bin/spc doctor --auto-fix
|
||||
如果您不想构建或想先测试,可以从 [Actions](https://github.com/static-php/static-php-cli-hosted/actions/workflows/build-php-bulk.yml) 下载示例预编译工件,或从自托管服务器下载。
|
||||
|
||||
# 输出目标项目依赖的扩展列表
|
||||
./bin/spc dump-extensions /path/to/your/project --format=text
|
||||
以下是几个具有不同扩展组合的预编译静态 PHP 二进制文件,
|
||||
您可以根据需要直接下载。
|
||||
|
||||
# 拉取所有依赖库
|
||||
./bin/spc download --all
|
||||
# 只拉取编译指定扩展需要的所有依赖(推荐)
|
||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||
# 下载依赖时,优先下载有预编译的库(节省编译依赖的时间)
|
||||
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
||||
# 下载编译不同版本的 PHP (--with-php=x.y 或 --with-php=x.y.z,推荐 8.1 ~ 8.3)
|
||||
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
||||
| 组合名称 | 扩展数量 | 系统 | 备注 |
|
||||
|----------------------------------------------------------------------|----------------------------------------------------------------------------|--------------|--------------------|
|
||||
| [common](https://dl.static-php.dev/static-php-cli/common/) | [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) | Linux, macOS | 二进制文件大小约为 7.5MB |
|
||||
| [bulk](https://dl.static-php.dev/static-php-cli/bulk/) | [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) | Linux, macOS | 二进制文件大小约为 25MB |
|
||||
| [gnu-bulk](https://dl.static-php.dev/static-php-cli/gnu-bulk/) | [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) | Linux, macOS | 使用 glibc 的 bulk 组合 |
|
||||
| [minimal](https://dl.static-php.dev/static-php-cli/minimal/) | [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) | Linux, macOS | 二进制文件大小约为 3MB |
|
||||
| [spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/) | [5](https://dl.static-php.dev/static-php-cli/windows/spc-min/README.txt) | Windows | 二进制文件大小约为 3MB |
|
||||
| [spc-max](https://dl.static-php.dev/static-php-cli/windows/spc-max/) | [40+](https://dl.static-php.dev/static-php-cli/windows/spc-max/README.txt) | Windows | 二进制文件大小约为 8.5MB |
|
||||
|
||||
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
||||
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
||||
# 编译线程安全版本 (--enable-zts)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli
|
||||
# 编译后使用 UPX 减小可执行文件体积 (仅 Linux、Windows 可用) (至少压缩至原来的 30~50%)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
||||
```
|
||||
> Linux 和 Windows 支持对二进制文件进行 UPX 压缩,可以将二进制文件大小减少 30% 到 50%。
|
||||
> macOS 不支持 UPX 压缩,因此 mac 的预构建二进制文件大小较大。
|
||||
|
||||
其中,目前支持构建 cli,micro,fpm 和 embed,使用以下参数的一个或多个来指定编译的 SAPI:
|
||||
### 在线构建(使用 GitHub Actions)
|
||||
|
||||
- `--build-cli`:构建 cli 二进制
|
||||
- `--build-micro`:构建 phpmicro 自执行二进制
|
||||
- `--build-fpm`:构建 fpm
|
||||
- `--build-embed`:构建 embed(libphp)
|
||||
- `--build-cgi`: 构建 cgi(不推荐)
|
||||
- `--build-all`:构建所有
|
||||
上方直接下载的二进制不能满足需求时,可使用 GitHub Action 可以轻松构建静态编译的 PHP,
|
||||
同时自行定义要编译的扩展。
|
||||
|
||||
如果出现了任何错误,可以使用 `--debug` 参数来展示完整的输出日志,以供排查错误:
|
||||
1. Fork 本项目。
|
||||
2. 进入项目的 Actions 并选择 `CI`。
|
||||
3. 选择 `Run workflow`,填入您要编译的 PHP 版本、目标类型和扩展列表。(扩展用逗号分隔,例如 `bcmath,curl,mbstring`)
|
||||
4. 等待一段时间后,进入相应的任务并获取 `Artifacts`。
|
||||
|
||||
```bash
|
||||
./bin/spc build "openssl,pcntl,mbstring" --debug --build-all
|
||||
./bin/spc download --all --debug
|
||||
```
|
||||
|
||||
## 不同 SAPI 的使用
|
||||
|
||||
### 使用 cli
|
||||
|
||||
> php-cli 是一个静态的二进制文件,类似 Go、Rust 语言编译后的单个可移植的二进制文件。
|
||||
|
||||
采用参数 `--build-cli` 或`--build-all` 参数时,最后编译结果会输出一个 `./php` 的二进制文件,此文件可分发、可直接使用。
|
||||
该文件编译后会存放在 `buildroot/bin/` 目录中,名称为 `php`,拷贝出来即可。
|
||||
|
||||
```bash
|
||||
cd buildroot/bin/
|
||||
./php -v # 检查版本
|
||||
./php -m # 检查编译的扩展
|
||||
./php your_code.php # 运行代码
|
||||
./php your_project.phar # 运行打包为 phar 单文件的项目
|
||||
```
|
||||
|
||||
### 使用 micro
|
||||
|
||||
> phpmicro 是一个提供自执行二进制 PHP 的项目,本项目依赖 phpmicro 进行编译自执行二进制。详见 [dixyes/phpmicro](https://github.com/dixyes/phpmicro)。
|
||||
|
||||
采用项目参数 `--build-micro` 或 `--build-all` 时,最后编译结果会输出一个 `./micro.sfx` 的文件,此文件需要配合你的 PHP 源码使用。
|
||||
该文件编译后会存放在 `buildroot/bin/` 目录中,拷贝出来即可。
|
||||
|
||||
使用时应准备好你的项目源码文件,可以是单个 PHP 文件,也可以是 Phar 文件。
|
||||
|
||||
```bash
|
||||
echo "<?php echo 'Hello world' . PHP_EOL;" > code.php
|
||||
cat micro.sfx code.php > single-app && chmod +x single-app
|
||||
./single-app
|
||||
```
|
||||
|
||||
如果打包 PHAR 文件,仅需把 code.php 更换为 phar 文件路径即可。
|
||||
你可以使用 [box-project/box](https://github.com/box-project/box) 将你的 CLI 项目打包为 Phar,
|
||||
然后将它与 phpmicro 结合,生成独立可执行的二进制文件。
|
||||
|
||||
```bash
|
||||
# 使用 static-php-cli 生成的 micro.sfx 结合,也可以直接使用 cat 命令结合它们
|
||||
bin/spc micro:combine my-app.phar
|
||||
cat buildroot/bin/micro.sfx my-app.phar > my-app && chmod +x my-app
|
||||
|
||||
# 使用 micro:combine 结合可以将 INI 选项注入到二进制中
|
||||
bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=system" --output my-app-2
|
||||
```
|
||||
|
||||
> 有些情况下的 phar 文件或 PHP 项目可能无法在 micro 环境下运行。
|
||||
|
||||
### 使用 fpm
|
||||
|
||||
采用项目参数 `--build-fpm` 或 `--build-all` 时,最后编译结果会输出一个 `./php-fpm` 的文件。
|
||||
该文件存放在 `buildroot/bin/` 目录,拷贝出来即可使用。
|
||||
|
||||
在正常的 Linux 发行版和 macOS 系统中,安装 php-fpm 后包管理会自动生成默认的 fpm 配置文件。
|
||||
因为 php-fpm 必须指定配置文件才可启动,本项目编译的 php-fpm 不会带任何配置文件,所以需自行编写 `php-fpm.conf` 和 `pool.conf` 配置文件。
|
||||
|
||||
指定 `php-fpm.conf` 可以使用命令参数 `-y`,例如:`./php-fpm -y php-fpm.conf`。
|
||||
|
||||
### 使用 embed
|
||||
|
||||
采用项目参数 `--build-embed` 或 `--build-all` 时,最后编译结果会输出一个 `libphp.a`、`php-config` 以及一系列头文件,存放在 `buildroot/`,你可以在你的其他代码中引入它们。
|
||||
|
||||
如果你知道 [embed SAPI](https://github.com/php/php-src/tree/master/sapi/embed),你应该知道如何使用它。对于有可能编译用到引入其他库的问题,你可以使用 `buildroot/bin/php-config` 来获取编译时的配置。
|
||||
|
||||
另外,有关如何使用此功能的高级示例,请查看[如何使用它构建 FrankenPHP 的静态版本](https://github.com/php/frankenphp/blob/main/docs/static.md)。
|
||||
如果您启用 `debug`,构建时将输出所有日志,包括编译日志,以便故障排除。
|
||||
|
||||
## 贡献
|
||||
|
||||
如果缺少你需要的扩展,可发起 Issue。如果你对本项目较熟悉,也欢迎为本项目发起 Pull Request。
|
||||
如果您需要的扩展缺失,可以创建 issue。
|
||||
如果您熟悉本项目,也欢迎发起 pull request。
|
||||
|
||||
另外,添加新扩展的贡献方式,可以参考下方 `进阶`。
|
||||
如果您想贡献文档,请直接编辑 `docs/` 目录。
|
||||
|
||||
如果你想贡献文档内容,请直接修改 `docs/` 目录。
|
||||
现在有一个 [static-php](https://github.com/static-php) 组织,用于存储与项目相关的仓库。
|
||||
|
||||
## 赞助本项目
|
||||
|
||||
你可以在 [我的个人赞助页](https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md) 支持我和我的项目。你捐赠的一部分将会被用于维护 **static-php.dev** 服务器。
|
||||
您可以从 [GitHub Sponsor](https://github.com/crazywhalecc) 赞助我或我的项目。您捐赠的一部分将用于维护 **static-php.dev** 服务器。
|
||||
|
||||
**特别赞助商**:
|
||||
**特别感谢以下赞助商**:
|
||||
|
||||
<a href="https://beyondco.de/"><img src="/docs/public/images/beyondcode-seeklogo.png" width="300" alt="Beyond Code Logo" /></a>
|
||||
|
||||
<a href="https://nativephp.com/"><img src="/docs/public/images/nativephp-logo.svg" width="300" alt="NativePHP Logo" /></a>
|
||||
|
||||
## 开源协议
|
||||
## 开源许可证
|
||||
|
||||
本项目采用 MIT License 许可开源,下面是类似的项目:
|
||||
本项目本身基于 MIT 许可证,
|
||||
一些新添加的扩展和依赖可能来自其他项目,
|
||||
这些代码文件的头部也会给出额外的许可证和作者说明。
|
||||
|
||||
这些是类似的项目:
|
||||
|
||||
- [dixyes/lwmbs](https://github.com/dixyes/lwmbs)
|
||||
- [swoole/swoole-cli](https://github.com/swoole/swoole-cli)
|
||||
|
||||
该项目使用了 [dixyes/lwmbs](https://github.com/dixyes/lwmbs) 中的一些代码,例如 Windows 静态构建目标和 libiconv 库支持。
|
||||
lwmbs 使用 [Mulan PSL 2](http://license.coscl.org.cn/MulanPSL2) 许可进行分发。对应文件有关于作者和许可的特殊说明,除此之外,均使用 MIT 授权许可。
|
||||
本项目使用了 [dixyes/lwmbs](https://github.com/dixyes/lwmbs) 的一些代码,例如 Windows 静态构建目标和 libiconv 支持。
|
||||
lwmbs 基于 [Mulan PSL 2](http://license.coscl.org.cn/MulanPSL2) 许可证。
|
||||
|
||||
因本项目的特殊性,使用项目编译过程中会使用很多其他开源项目,例如 curl、protobuf 等,它们都有各自的开源协议。
|
||||
请在编译完成后,使用命令 `bin/spc dump-license` 导出项目使用项目的开源协议,并遵守对应项目的 LICENSE。
|
||||
由于本项目的特殊性,
|
||||
项目编译过程中会使用许多其他开源项目,如 curl 和 protobuf,
|
||||
它们都有自己的开源许可证。
|
||||
|
||||
请在编译后使用 `bin/spc dump-license` 命令导出项目中使用的开源许可证,
|
||||
并遵守相应项目的 LICENSE。
|
||||
|
||||
329
README.md
329
README.md
@@ -5,29 +5,22 @@
|
||||
[](https://github.com/crazywhalecc/static-php-cli/releases)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/blob/main/LICENSE)
|
||||
[](https://static-php.dev/en/guide/extensions.html)
|
||||
|
||||
**static-php-cli** is a powerful tool designed for building static, standalone PHP runtime
|
||||
with popular extensions.
|
||||
|
||||
Static PHP built by **static-php-cli** supports `cli`, `fpm`, `embed`, `micro` and `frankenphp` SAPI.
|
||||
|
||||
**static-php-cli** also has the ability to package PHP projects
|
||||
along with the PHP interpreter into one single executable file.
|
||||
|
||||
## Features
|
||||
|
||||
static-php-cli (you can call it `spc`) has a lot of features:
|
||||
|
||||
- :handbag: Build single-file php executable, without any dependencies
|
||||
- :hamburger: Build **[phpmicro](https://github.com/dixyes/phpmicro)** self-extracted executable (glue php binary and php source code into one file)
|
||||
- :pill: Automatic build environment checker (Doctor module)
|
||||
- :elephant: Support multiple PHP versions - PHP 8.1, 8.2, 8.3, 8.4, 8.5
|
||||
- :handbag: Build single-file PHP executable with zero dependencies
|
||||
- :hamburger:Build **[phpmicro](https://github.com/dixyes/phpmicro)** self-extracting executables (combines PHP binary and source code into one file)
|
||||
- :pill: Automatic build environment checker with auto-fix capabilities
|
||||
- :zap: `Linux`, `macOS`, `FreeBSD`, `Windows` support
|
||||
- :wrench: Configurable source code patches
|
||||
- :books: Build dependency management
|
||||
- 📦 Provide `spc` own standalone executable (built by spc and [box](https://github.com/box-project/box))
|
||||
- :fire: Support many popular [extensions](https://static-php.dev/en/guide/extensions.html)
|
||||
- :floppy_disk: UPX integration (significantly reduces binary size)
|
||||
- :wrench: Configurable source code patching
|
||||
- :books: Intelligent dependency management
|
||||
- 📦 Self-contained `spc` executable (built with [box](https://github.com/box-project/box))
|
||||
- :fire: Support 100+ popular [extensions](https://static-php.dev/en/guide/extensions.html)
|
||||
- :floppy_disk: UPX compression support (reduces binary size by 30-50%)
|
||||
|
||||
**Single-file standalone php-cli:**
|
||||
|
||||
@@ -37,6 +30,72 @@ static-php-cli (you can call it `spc`) has a lot of features:
|
||||
|
||||
<img width="700" alt="out2" src="https://github.com/crazywhalecc/static-php-cli/assets/20330940/46b7128d-fb72-4169-957e-48564c3ff3e2">
|
||||
|
||||
## Quickstart
|
||||
|
||||
### 1. Download spc binary
|
||||
|
||||
```bash
|
||||
# For Linux x86_64
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||
# For Linux aarch64
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||
# macOS x86_64 (Intel)
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||
# macOS aarch64 (Apple)
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||
# Windows (x86_64, win10 build 17063 or later, please install VS2022 first)
|
||||
curl.exe -fsSL -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||
```
|
||||
|
||||
For macOS and Linux, add execute permission first:
|
||||
|
||||
```bash
|
||||
chmod +x ./spc
|
||||
```
|
||||
|
||||
### 2. Build Static PHP
|
||||
|
||||
First, create a `craft.yml` file and specify which extensions you want to include from [extension list](https://static-php.dev/en/guide/extensions.html) or [command generator](https://static-php.dev/en/guide/cli-generator.html):
|
||||
|
||||
```yml
|
||||
# PHP version support: 8.1, 8.2, 8.3, 8.4, 8.5
|
||||
php-version: 8.4
|
||||
# Put your extension list here
|
||||
extensions: "apcu,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,gd,iconv,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib"
|
||||
sapi:
|
||||
- cli
|
||||
- micro
|
||||
- fpm
|
||||
download-options:
|
||||
prefer-pre-built: true
|
||||
```
|
||||
|
||||
Run command:
|
||||
|
||||
```bash
|
||||
./spc craft
|
||||
|
||||
# Output full console log
|
||||
./spc craft --debug
|
||||
```
|
||||
|
||||
### 3. Static PHP usage
|
||||
|
||||
Now you can copy binaries built by static-php-cli to another machine and run with no dependencies:
|
||||
|
||||
```
|
||||
# php-cli
|
||||
buildroot/bin/php -v
|
||||
|
||||
# phpmicro
|
||||
echo '<?php echo "Hello world!\n";' > a.php
|
||||
./spc micro:combine a.php -O my-app
|
||||
./my-app
|
||||
|
||||
# php-fpm
|
||||
buildroot/bin/php-fpm -v
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
The current README contains basic usage. For all the features of static-php-cli,
|
||||
@@ -53,6 +112,7 @@ which can be downloaded directly according to your needs.
|
||||
|----------------------------------------------------------------------|----------------------------------------------------------------------------|--------------|--------------------------------|
|
||||
| [common](https://dl.static-php.dev/static-php-cli/common/) | [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) | Linux, macOS | The binary size is about 7.5MB |
|
||||
| [bulk](https://dl.static-php.dev/static-php-cli/bulk/) | [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) | Linux, macOS | The binary size is about 25MB |
|
||||
| [gnu-bulk](https://dl.static-php.dev/static-php-cli/gnu-bulk/) | [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) | Linux, macOS | Using shared glibc |
|
||||
| [minimal](https://dl.static-php.dev/static-php-cli/minimal/) | [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) | Linux, macOS | The binary size is about 3MB |
|
||||
| [spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/) | [5](https://dl.static-php.dev/static-php-cli/windows/spc-min/README.txt) | Windows | The binary size is about 3MB |
|
||||
| [spc-max](https://dl.static-php.dev/static-php-cli/windows/spc-max/) | [40+](https://dl.static-php.dev/static-php-cli/windows/spc-max/README.txt) | Windows | The binary size is about 8.5MB |
|
||||
@@ -60,64 +120,10 @@ which can be downloaded directly according to your needs.
|
||||
> Linux and Windows supports UPX compression for binaries, which can reduce the size of the binary by 30% to 50%.
|
||||
> macOS does not support UPX compression, so the size of the pre-built binaries for mac is larger.
|
||||
|
||||
## Build
|
||||
|
||||
### Compilation Requirements
|
||||
|
||||
You can say I made a PHP builder written in PHP, pretty funny.
|
||||
But static-php-cli runtime only requires an environment above PHP 8.1 and extensions mentioned below.
|
||||
|
||||
- PHP >= 8.4 (This is the version required by spc itself, not the build version)
|
||||
- Extension: `mbstring,tokenizer,phar`
|
||||
- Supported OS with `curl` and `git` installed
|
||||
|
||||
Here is the supported OS and arch, where :octocat: represents support for GitHub Action builds,
|
||||
:computer: represents support for local manual builds, and blank represents not currently supported.
|
||||
|
||||
| | x86_64 | aarch64 |
|
||||
|---------|----------------------|----------------------|
|
||||
| macOS | :octocat: :computer: | :octocat: :computer: |
|
||||
| Linux | :octocat: :computer: | :octocat: :computer: |
|
||||
| Windows | :octocat: :computer: | |
|
||||
| FreeBSD | :computer: | :computer: |
|
||||
|
||||
Currently supported PHP versions for compilation:
|
||||
|
||||
> :warning: Partial support, there may be issues with newer test versions or older versions.
|
||||
>
|
||||
> :heavy_check_mark: supported
|
||||
>
|
||||
> :x: not supported
|
||||
|
||||
| PHP Version | Status | Comment |
|
||||
|-------------|--------------------|----------------------------------------------------------------------------------------------------|
|
||||
| 7.2 | :x: | |
|
||||
| 7.3 | :x: | phpmicro and some extensions not supported on 7.x |
|
||||
| 7.4 | :x: | phpmicro and some extensions not supported on 7.x |
|
||||
| 8.0 | :warning: | PHP official has stopped maintenance of 8.0, we no longer provide backport support for version 8.0 |
|
||||
| 8.1 | :heavy_check_mark: | PHP official has security fixes only, we no longer provide backport support when 8.5 released |
|
||||
| 8.2 | :heavy_check_mark: | |
|
||||
| 8.3 | :heavy_check_mark: | |
|
||||
| 8.4 | :heavy_check_mark: | |
|
||||
| 8.5 (alpha) | :warning: | PHP 8.5 is in alpha |
|
||||
|
||||
> This table shows the support status for static-php-cli in building the corresponding version,
|
||||
> not the official PHP support status for that version.
|
||||
|
||||
### Supported Extensions
|
||||
|
||||
Please first select the extension you want to compile based on the extension list below.
|
||||
|
||||
- [Supported Extension List](https://static-php.dev/en/guide/extensions.html)
|
||||
- [Command Generator](https://static-php.dev/en/guide/cli-generator.html)
|
||||
|
||||
> If an extension you need is missing, you can submit an issue.
|
||||
|
||||
Here is the current planned roadmap for extension support: [#152](https://github.com/crazywhalecc/static-php-cli/issues/152) .
|
||||
|
||||
### Build Online (using GitHub Actions)
|
||||
|
||||
Use GitHub Action to easily build a statically compiled PHP,
|
||||
When the above direct download binaries cannot meet your needs,
|
||||
you can use GitHub Action to easily build a statically compiled PHP,
|
||||
and at the same time define the extensions to be compiled by yourself.
|
||||
|
||||
1. Fork me.
|
||||
@@ -127,185 +133,6 @@ and at the same time define the extensions to be compiled by yourself.
|
||||
|
||||
If you enable `debug`, all logs will be output at build time, including compiled logs, for troubleshooting.
|
||||
|
||||
### Build Locally (using SPC binary, recommended)
|
||||
|
||||
This project provides a binary file of static-php-cli: `spc`.
|
||||
You can use `spc` binary instead of installing any runtime like golang app.
|
||||
Currently, the platforms supported by `spc` binary are Linux and macOS.
|
||||
|
||||
Download from self-hosted nightly builds using commands below:
|
||||
|
||||
```bash
|
||||
# Download from self-hosted nightly builds (sync with main branch)
|
||||
# For Linux x86_64
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||
# For Linux aarch64
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||
# macOS x86_64 (Intel)
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||
# macOS aarch64 (Apple)
|
||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||
# Windows (x86_64, win10 build 17063 or later)
|
||||
curl.exe -fsSL -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||
|
||||
# Add execute perm (Linux and macOS only)
|
||||
chmod +x ./spc
|
||||
|
||||
# Run (Linux and macOS)
|
||||
./spc --version
|
||||
# Run (Windows powershell)
|
||||
.\spc.exe --version
|
||||
```
|
||||
|
||||
Self-hosted `spc` is built by GitHub Actions, you can also download from Actions artifacts [here](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml).
|
||||
|
||||
### Build Locally (using git source)
|
||||
|
||||
If you need to modify the static-php-cli source code, or have problems using the spc binary build,
|
||||
you can download static-php-cli using the git source code.
|
||||
|
||||
```bash
|
||||
# just clone me!
|
||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||
```
|
||||
|
||||
If you have not installed php on your system, we recommend that you use the built-in setup-runtime to install PHP and Composer automatically.
|
||||
|
||||
```bash
|
||||
cd static-php-cli
|
||||
chmod +x bin/setup-runtime
|
||||
# it will download static php (from self-hosted server) and composer (from getcomposer)
|
||||
bin/setup-runtime
|
||||
# initialize composer deps
|
||||
bin/composer install
|
||||
# chmod
|
||||
chmod +x bin/spc
|
||||
bin/spc --version
|
||||
```
|
||||
|
||||
### Start Building PHP
|
||||
|
||||
Basic usage for building php with some extensions:
|
||||
|
||||
> If you are using the packaged standalone `spc` binary, you need to replace `bin/spc` with `./spc` or `.\spc.exe` in the following commands.
|
||||
|
||||
```bash
|
||||
# Check system tool dependencies, auto-fix them if possible
|
||||
./bin/spc doctor --auto-fix
|
||||
|
||||
# fetch all libraries
|
||||
./bin/spc download --all
|
||||
# dump a list of extensions required by your project
|
||||
./bin/spc dump-extensions /path/to/your/project --format=text
|
||||
# only fetch necessary sources by needed extensions (recommended)
|
||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||
# download pre-built libraries first (save time for compiling dependencies)
|
||||
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
||||
# download different PHP version (--with-php=x.y or --with-php=x.y.z, recommend 8.3 ~ 8.4)
|
||||
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
||||
|
||||
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
||||
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
||||
# build thread-safe (ZTS) version (--enable-zts)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli
|
||||
# build, pack executable with UPX (linux and windows only) (reduce binary size for 30~50%)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
||||
```
|
||||
|
||||
Now we support `cli`, `micro`, `fpm` and `embed` SAPI. You can use one or more of the following parameters to specify the compiled SAPI:
|
||||
|
||||
- `--build-cli`: build static cli executable
|
||||
- `--build-micro`: build static phpmicro self-extracted executable
|
||||
- `--build-fpm`: build static fpm binary
|
||||
- `--build-embed`: build embed (libphp)
|
||||
- `--build-cgi`: build cgi binary (not recommended)
|
||||
- `--build-all`: build all
|
||||
|
||||
If anything goes wrong, use `--debug` option to display full terminal output:
|
||||
|
||||
```bash
|
||||
./bin/spc build "openssl,pcntl,mbstring" --debug --build-all
|
||||
./bin/spc download --all --debug
|
||||
```
|
||||
|
||||
## Different SAPI Usage
|
||||
|
||||
### Use cli
|
||||
|
||||
> php-cli is a single static binary, you can use it like normal php installed on your system.
|
||||
|
||||
When using the parameter `--build-cli` or `--build-all`,
|
||||
the final compilation result will output a binary file named `./php`,
|
||||
which can be distributed and used directly.
|
||||
This file will be located in the directory `buildroot/bin/`, copy it out for use.
|
||||
|
||||
```bash
|
||||
cd buildroot/bin/
|
||||
./php -v # check version
|
||||
./php -m # check extensions
|
||||
./php your_code.php # run your php code
|
||||
./php your_project.phar # run your phar (project archive)
|
||||
```
|
||||
|
||||
### Use micro
|
||||
|
||||
> phpmicro is a SelF-extracted eXecutable SAPI module,
|
||||
> provided by [phpmicro](https://github.com/dixyes/phpmicro) project.
|
||||
> But this project is using a [fork](https://github.com/static-php/phpmicro) of phpmicro, because we need to add some features to it.
|
||||
> It can put php runtime and your source code together.
|
||||
|
||||
When using the parameter `--build-all` or `--build-micro`,
|
||||
the final compilation result will output a file named `./micro.sfx`,
|
||||
which needs to be used with your PHP source code like `code.php`.
|
||||
This file will be located in the path `buildroot/bin/micro.sfx`, simply copy it out for use.
|
||||
|
||||
Prepare your project source code, which can be a single PHP file or a Phar file, for use.
|
||||
|
||||
```bash
|
||||
echo "<?php echo 'Hello world' . PHP_EOL;" > code.php
|
||||
cat micro.sfx code.php > single-app && chmod +x single-app
|
||||
./single-app
|
||||
```
|
||||
|
||||
If you package a PHAR file, just replace `code.php` with the phar file path.
|
||||
You can use [box-project/box](https://github.com/box-project/box) to package your CLI project as Phar,
|
||||
It is then combined with phpmicro to produce a standalone executable binary.
|
||||
|
||||
```bash
|
||||
# Use the micro.sfx generated by static-php-cli to combine,
|
||||
bin/spc micro:combine my-app.phar
|
||||
# or you can directly use the cat command to combine them.
|
||||
cat buildroot/bin/micro.sfx my-app.phar > my-app && chmod +x my-app
|
||||
|
||||
# Use micro:combine combination to inject INI options into the binary.
|
||||
bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=system" --output my-app-2
|
||||
```
|
||||
|
||||
> In some cases, PHAR files may not run in a micro environment. Overall, micro is not production ready.
|
||||
|
||||
### Use fpm
|
||||
|
||||
When using the parameter `--build-all` or `--build-fpm`,
|
||||
the final compilation result will output a file named `./php-fpm`,
|
||||
This file will be located in the path `buildroot/bin/`, simply copy it out for use.
|
||||
|
||||
In common Linux distributions and macOS systems, the package manager will automatically generate a default fpm configuration file after installing php-fpm.
|
||||
Because php-fpm must specify a configuration file before running, the php-fpm compiled by this project will not have any configuration files, so you need to write `php-fpm.conf` and `pool.conf` configuration files yourself.
|
||||
|
||||
Specifying `php-fpm.conf` can use the command parameter `-y`, for example: `./php-fpm -y php-fpm.conf`.
|
||||
|
||||
### Use embed
|
||||
|
||||
When using the project parameters `--build-embed` or `--build-all`,
|
||||
the final compilation result will output a `libphp.a`, `php-config` and a series of header files,
|
||||
stored in `buildroot/`. You can introduce them in your other projects.
|
||||
|
||||
If you know [embed SAPI](https://github.com/php/php-src/tree/master/sapi/embed), you should know how to use it.
|
||||
You may require the introduction of other libraries during compilation,
|
||||
you can use `buildroot/bin/php-config` to obtain the compile-time configuration.
|
||||
|
||||
For an advanced example of how to use this feature, take a look at [how to use it to build a static version of FrankenPHP](https://github.com/php/frankenphp/blob/main/docs/static.md).
|
||||
|
||||
## Contribution
|
||||
|
||||
If the extension you need is missing, you can create an issue.
|
||||
|
||||
@@ -108,8 +108,7 @@ RUN apk update; \
|
||||
wget \
|
||||
xz \
|
||||
gettext-dev \
|
||||
binutils-gold \
|
||||
patchelf
|
||||
binutils-gold
|
||||
|
||||
RUN curl -#fSL https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-linux-\$(uname -m).tar.gz | tar -xz -C /usr/local/bin && \
|
||||
chmod +x /usr/local/bin/php
|
||||
@@ -150,6 +149,7 @@ MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/source:/app/source"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/dist:/app/dist"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/downloads:/app/downloads"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/pkgroot:/app/pkgroot"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/log:/app/log"
|
||||
if [ -f "$(pwd)/craft.yml" ]; then
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/craft.yml:/app/craft.yml"
|
||||
fi
|
||||
@@ -161,6 +161,47 @@ if [ ! -z "$GITHUB_TOKEN" ]; then
|
||||
ENV_LIST="$ENV_LIST -e GITHUB_TOKEN=$GITHUB_TOKEN"
|
||||
fi
|
||||
|
||||
# Intercept and rewrite --with-frankenphp-app option, and mount host path to /app/app
|
||||
FRANKENPHP_APP_PATH=""
|
||||
NEW_ARGS=()
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--with-frankenphp-app=*)
|
||||
FRANKENPHP_APP_PATH="${1#*=}"
|
||||
NEW_ARGS+=("--with-frankenphp-app=/app/app")
|
||||
shift
|
||||
;;
|
||||
--with-frankenphp-app)
|
||||
if [ -n "${2:-}" ]; then
|
||||
FRANKENPHP_APP_PATH="$2"
|
||||
NEW_ARGS+=("--with-frankenphp-app=/app/app")
|
||||
shift 2
|
||||
else
|
||||
NEW_ARGS+=("$1")
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
NEW_ARGS+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Normalize the path and add mount if provided
|
||||
if [ -n "$FRANKENPHP_APP_PATH" ]; then
|
||||
# expand ~ to $HOME
|
||||
if [ "${FRANKENPHP_APP_PATH#~}" != "$FRANKENPHP_APP_PATH" ]; then
|
||||
FRANKENPHP_APP_PATH="$HOME${FRANKENPHP_APP_PATH#~}"
|
||||
fi
|
||||
# make absolute if relative
|
||||
case "$FRANKENPHP_APP_PATH" in
|
||||
/*) ABS_APP_PATH="$FRANKENPHP_APP_PATH" ;;
|
||||
*) ABS_APP_PATH="$(pwd)/$FRANKENPHP_APP_PATH" ;;
|
||||
esac
|
||||
MOUNT_LIST="$MOUNT_LIST -v $ABS_APP_PATH:/app/app"
|
||||
fi
|
||||
|
||||
# Run docker
|
||||
# shellcheck disable=SC2068
|
||||
# shellcheck disable=SC2086
|
||||
@@ -182,5 +223,5 @@ if [ "$SPC_DOCKER_DEBUG" = "yes" ]; then
|
||||
set -ex
|
||||
$DOCKER_EXECUTABLE run $PLATFORM_ARG --rm $INTERACT $ENV_LIST $MOUNT_LIST cwcc-spc-$SPC_USE_ARCH-$SPC_DOCKER_VERSION /bin/bash
|
||||
else
|
||||
$DOCKER_EXECUTABLE run $PLATFORM_ARG --rm $INTERACT $ENV_LIST $MOUNT_LIST cwcc-spc-$SPC_USE_ARCH-$SPC_DOCKER_VERSION bin/spc $@
|
||||
$DOCKER_EXECUTABLE run $PLATFORM_ARG --rm $INTERACT $ENV_LIST $MOUNT_LIST cwcc-spc-$SPC_USE_ARCH-$SPC_DOCKER_VERSION bin/spc "${NEW_ARGS[@]}"
|
||||
fi
|
||||
|
||||
@@ -92,11 +92,6 @@ RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc
|
||||
RUN source /etc/bashrc
|
||||
RUN yum install -y which
|
||||
|
||||
RUN curl -fsSL -o patchelf.tgz https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-$SPC_USE_ARCH.tar.gz && \
|
||||
mkdir -p /patchelf && \
|
||||
tar -xzf patchelf.tgz -C /patchelf --strip-components=1 && \
|
||||
cp /patchelf/bin/patchelf /usr/bin/
|
||||
|
||||
RUN curl -o cmake.tgz -#fSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$SPC_USE_ARCH.tar.gz && \
|
||||
mkdir /cmake && \
|
||||
tar -xzf cmake.tgz -C /cmake --strip-components 1
|
||||
@@ -158,6 +153,7 @@ MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/source:/app/source"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/dist:/app/dist"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/downloads:/app/downloads"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/pkgroot:/app/pkgroot"
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/log:/app/log"
|
||||
if [ -f "$(pwd)/craft.yml" ]; then
|
||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/craft.yml:/app/craft.yml"
|
||||
fi
|
||||
@@ -173,6 +169,47 @@ if [ ! -z "$GITHUB_TOKEN" ]; then
|
||||
ENV_LIST="$ENV_LIST -e GITHUB_TOKEN=$GITHUB_TOKEN"
|
||||
fi
|
||||
|
||||
# Intercept and rewrite --with-frankenphp-app option, and mount host path to /app/app
|
||||
FRANKENPHP_APP_PATH=""
|
||||
NEW_ARGS=()
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--with-frankenphp-app=*)
|
||||
FRANKENPHP_APP_PATH="${1#*=}"
|
||||
NEW_ARGS+=("--with-frankenphp-app=/app/app")
|
||||
shift
|
||||
;;
|
||||
--with-frankenphp-app)
|
||||
if [ -n "${2:-}" ]; then
|
||||
FRANKENPHP_APP_PATH="$2"
|
||||
NEW_ARGS+=("--with-frankenphp-app=/app/app")
|
||||
shift 2
|
||||
else
|
||||
NEW_ARGS+=("$1")
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
NEW_ARGS+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Normalize the path and add mount if provided
|
||||
if [ -n "$FRANKENPHP_APP_PATH" ]; then
|
||||
# expand ~ to $HOME
|
||||
if [ "${FRANKENPHP_APP_PATH#~}" != "$FRANKENPHP_APP_PATH" ]; then
|
||||
FRANKENPHP_APP_PATH="$HOME${FRANKENPHP_APP_PATH#~}"
|
||||
fi
|
||||
# make absolute if relative
|
||||
case "$FRANKENPHP_APP_PATH" in
|
||||
/*) ABS_APP_PATH="$FRANKENPHP_APP_PATH" ;;
|
||||
*) ABS_APP_PATH="$(pwd)/$FRANKENPHP_APP_PATH" ;;
|
||||
esac
|
||||
MOUNT_LIST="$MOUNT_LIST -v $ABS_APP_PATH:/app/app"
|
||||
fi
|
||||
|
||||
# Run docker
|
||||
# shellcheck disable=SC2068
|
||||
# shellcheck disable=SC2086
|
||||
@@ -195,5 +232,5 @@ if [ "$SPC_DOCKER_DEBUG" = "yes" ]; then
|
||||
set -ex
|
||||
$DOCKER_EXECUTABLE run $PLATFORM_ARG --privileged --rm -it $INTERACT $ENV_LIST --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH-$SPC_DOCKER_VERSION /bin/bash
|
||||
else
|
||||
$DOCKER_EXECUTABLE run $PLATFORM_ARG --rm $INTERACT $ENV_LIST --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH-$SPC_DOCKER_VERSION bin/spc $@
|
||||
$DOCKER_EXECUTABLE run $PLATFORM_ARG --rm $INTERACT $ENV_LIST --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH-$SPC_DOCKER_VERSION bin/spc "${NEW_ARGS[@]}"
|
||||
fi
|
||||
|
||||
679
composer.lock
generated
679
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,41 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; static-php-cli (spc) env configuration
|
||||
;
|
||||
; This file is used to set default env vars for static-php-cli build.
|
||||
; As dynamic build process, some of these vars can be overwritten by CLI options.
|
||||
; And you can also overwrite these vars by setting them in your shell environment.
|
||||
; The value should be changed only if you know what you are doing. Otherwise, please leave them as default.
|
||||
;
|
||||
; We need to use some pre-defined internal env vars, like `BUILD_ROOT_PATH`, `DOWNLOAD_PATH`, etc.
|
||||
; Please note that these vars cannot be defined in this file, they are only be defined before static-php-cli running.
|
||||
; Please note that these vars cannot be defined in this file, they should only be defined before static-php-cli running.
|
||||
;
|
||||
; Here's a list of env vars, these value cannot be changed anywhere:
|
||||
; Here's a list of env vars, these variables will be defined if not defined:
|
||||
;
|
||||
; SPC_VERSION: the version of static-php-cli.
|
||||
; WORKING_DIR: the working directory of the build process. (default: `$(pwd)`)
|
||||
; ROOT_DIR: the root directory of static-php-cli. (default: `/path/to/static-php-cli`, when running in phar or micro mode: `phar://path/to/spc.phar`)
|
||||
; BUILD_ROOT_PATH: the root path of the build process. (default: `$(pwd)/buildroot`)
|
||||
; BUILD_INCLUDE_PATH: the path of the include files. (default: `$BUILD_ROOT_PATH/include`)
|
||||
; BUILD_LIB_PATH: the path of the lib files. (default: `$BUILD_ROOT_PATH/lib`)
|
||||
; BUILD_BIN_PATH: the path of the bin files. (default: `$BUILD_ROOT_PATH/bin`)
|
||||
; PKG_ROOT_PATH: the root path of the package files. (default: `$(pwd)/pkgroot`)
|
||||
; BUILD_MODULES_PATH: the path of the php modules (shared extensions) files. (default: `$BUILD_ROOT_PATH/modules`)
|
||||
; PKG_ROOT_PATH: the root path of the package files. (default: `$(pwd)/pkgroot/$GNU_ARCH-{darwin|linux|windows}`)
|
||||
; SOURCE_PATH: the path of the source files. (default: `$(pwd)/source`)
|
||||
; DOWNLOAD_PATH: the path of the download files. (default: `$(pwd)/downloads`)
|
||||
; CPU_COUNT: the count of the CPU cores. (default: `$(nproc)`)
|
||||
; SPC_ARCH: the arch of the current system, for some libraries needed `--host=XXX` args. (default: `$(uname -m)`, e.g. `x86_64`, `aarch64`, `arm64`)
|
||||
; GNU_ARCH: the GNU arch of the current system. (default: `$(uname -m)`, e.g. `x86_64`, `aarch64`)
|
||||
; MAC_ARCH: the MAC arch of the current system. (default: `$(uname -m)`, e.g. `x86_64`, `arm64`)
|
||||
; PATH: (*nix only) static-php-cli will add `$BUILD_BIN_PATH` to PATH.
|
||||
; PKG_CONFIG_PATH: (*nix only) static-php-cli will set `$BUILD_LIB_PATH/pkgconfig` to PKG_CONFIG_PATH.
|
||||
;
|
||||
; * These vars are only be defined in Unix (macOS, Linux, FreeBSD)Builder and cannot be changed anywhere:
|
||||
; PATH: static-php-cli will add `$BUILD_BIN_PATH` to PATH.
|
||||
; PKG_CONFIG: static-php-cli will set `$BUILD_BIN_PATH/pkg-config` to PKG_CONFIG.
|
||||
; PKG_CONFIG_PATH: static-php-cli will set `$BUILD_LIB_PATH/pkgconfig` to PKG_CONFIG_PATH.
|
||||
; Here's a list of env vars, these variables is defined in SPC and cannot be changed anywhere:
|
||||
;
|
||||
; * These vars are only be defined in LinuxBuilder and cannot be changed anywhere:
|
||||
; SPC_LINUX_DEFAULT_CC: the default compiler for linux. (For alpine linux: `gcc`, default: `$GNU_ARCH-linux-musl-gcc`)
|
||||
; SPC_LINUX_DEFAULT_CXX: the default c++ compiler for linux. (For alpine linux: `g++`, default: `$GNU_ARCH-linux-musl-g++`)
|
||||
; SPC_LINUX_DEFAULT_AR: the default archiver for linux. (For alpine linux: `ar`, default: `$GNU_ARCH-linux-musl-ar`)
|
||||
; SPC_VERSION: the version of static-php-cli.
|
||||
; WORKING_DIR: the working directory of the build process. (default: `$(pwd)`)
|
||||
; ROOT_DIR: the root directory of static-php-cli. (default: `/path/to/static-php-cli`, when running in phar or micro mode: `phar://path/to/spc.phar`)
|
||||
; CPU_COUNT: the count of the CPU cores. (default: `$(nproc)`)
|
||||
; SPC_ARCH: the arch of the current system, for some libraries needed `--host=XXX` args. (default: `$(uname -m)`, e.g. `x86_64`, `aarch64`, `arm64`)
|
||||
; GNU_ARCH: the GNU arch of the current system. (default: `$(uname -m)`, e.g. `x86_64`, `aarch64`)
|
||||
; MAC_ARCH: the MAC arch of the current system. (default: `$(uname -m)`, e.g. `x86_64`, `arm64`)
|
||||
; PKG_CONFIG: (*nix only) static-php-cli will set `$BUILD_BIN_PATH/pkg-config` to PKG_CONFIG.
|
||||
; SPC_LINUX_DEFAULT_CC: (linux only) the default compiler for linux. (For alpine linux: `gcc`, default: `$GNU_ARCH-linux-musl-gcc`)
|
||||
; SPC_LINUX_DEFAULT_CXX: (linux only) the default c++ compiler for linux. (For alpine linux: `g++`, default: `$GNU_ARCH-linux-musl-g++`)
|
||||
; SPC_LINUX_DEFAULT_AR: (linux only) the default archiver for linux. (For alpine linux: `ar`, default: `$GNU_ARCH-linux-musl-ar`)
|
||||
; SPC_EXTRA_PHP_VARS: (linux only) the extra vars for building php, used in `configure` and `make` command.
|
||||
|
||||
[global]
|
||||
; Build concurrency for make -jN, default is CPU_COUNT, this value are used in every libs.
|
||||
@@ -43,7 +45,7 @@ SPC_SKIP_PHP_VERSION_CHECK="no"
|
||||
; Ignore some check item for bin/spc doctor command, comma separated (e.g. SPC_SKIP_DOCTOR_CHECK_ITEMS="if homebrew has installed")
|
||||
SPC_SKIP_DOCTOR_CHECK_ITEMS=""
|
||||
; extra modules that xcaddy will include in the FrankenPHP build
|
||||
SPC_CMD_VAR_FRANKENPHP_XCADDY_MODULES="--with github.com/dunglas/frankenphp/caddy --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with github.com/dunglas/caddy-cbrotli"
|
||||
SPC_CMD_VAR_FRANKENPHP_XCADDY_MODULES="--with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with github.com/dunglas/caddy-cbrotli"
|
||||
; The display message for php version output (PHP >= 8.4 available)
|
||||
PHP_BUILD_PROVIDER="static-php-cli ${SPC_VERSION}"
|
||||
|
||||
@@ -64,7 +66,7 @@ PHP_SDK_PATH="${WORKING_DIR}\php-sdk-binary-tools"
|
||||
; upx executable path
|
||||
UPX_EXEC="${PKG_ROOT_PATH}\bin\upx.exe"
|
||||
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
|
||||
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static
|
||||
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static,win32_api
|
||||
|
||||
[linux]
|
||||
; Linux can use different build toolchains.
|
||||
@@ -73,8 +75,10 @@ SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime
|
||||
; - musl-native: used for alpine linux, can build `musl` and `musl -dynamic` target.
|
||||
; - gnu-native: used for general linux distros, can build gnu target for the installed glibc version only.
|
||||
|
||||
; LEGACY option to specify the target
|
||||
; option to specify the target, superceded by SPC_TARGET if set
|
||||
SPC_LIBC=musl
|
||||
; uncomment to link libc dynamically on musl
|
||||
; SPC_MUSL_DYNAMIC=true
|
||||
|
||||
; Recommended: specify your target here. Zig toolchain will be used.
|
||||
; examples:
|
||||
@@ -104,19 +108,19 @@ SPC_MICRO_PATCHES=cli_checks,disable_huge_page
|
||||
SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force"
|
||||
; configure command
|
||||
SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --disable-shared --enable-static --disable-all --disable-phpdbg --with-pic"
|
||||
; make command
|
||||
SPC_CMD_PREFIX_PHP_MAKE="make -j${SPC_CONCURRENCY}"
|
||||
|
||||
; *** default build vars for building php ***
|
||||
; embed type for php, static (libphp.a) or shared (libphp.so)
|
||||
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
||||
; CFLAGS for configuring php
|
||||
SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS} -fPIE"
|
||||
; EXTRA_CFLAGS for `make` php
|
||||
; EXTRA_CFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fno-ident -fPIE ${SPC_DEFAULT_C_FLAGS}"
|
||||
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=""
|
||||
|
||||
; optional, path to openssl conf. This affects where openssl will look for the default CA.
|
||||
; default on Debian/Alpine: /etc/ssl, default on RHEL: /etc/pki/tls
|
||||
OPENSSLDIR=""
|
||||
|
||||
[macos]
|
||||
; build target: macho or macho (possibly we could support macho-universal in the future)
|
||||
; Currently we do not support universal and cross-compilation for macOS.
|
||||
@@ -138,16 +142,16 @@ SPC_MICRO_PATCHES=cli_checks,macos_iconv
|
||||
SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force"
|
||||
; configure command
|
||||
SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-phpdbg"
|
||||
; make command
|
||||
SPC_CMD_PREFIX_PHP_MAKE="make -j${SPC_CONCURRENCY}"
|
||||
|
||||
; *** default build vars for building php ***
|
||||
; embed type for php, static (libphp.a) or shared (libphp.dylib)
|
||||
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
||||
; CFLAGS for configuring php
|
||||
SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS} -Werror=unknown-warning-option"
|
||||
; EXTRA_CFLAGS for `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie ${SPC_DEFAULT_C_FLAGS}"
|
||||
; EXTRA_CFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Werror=unknown-warning-option ${SPC_DEFAULT_C_FLAGS}"
|
||||
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=""
|
||||
; minimum compatible macOS version (LLVM vars, availability not guaranteed)
|
||||
MACOSX_DEPLOYMENT_TARGET=12.0
|
||||
|
||||
[freebsd]
|
||||
; compiler environments
|
||||
|
||||
169
config/ext.json
169
config/ext.json
@@ -43,6 +43,14 @@
|
||||
"calendar": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"com_dotnet": {
|
||||
"support": {
|
||||
"BSD": "no",
|
||||
"Linux": "no",
|
||||
"Darwin": "no"
|
||||
},
|
||||
"type": "builtin"
|
||||
},
|
||||
"ctype": {
|
||||
"type": "builtin"
|
||||
},
|
||||
@@ -55,7 +63,8 @@
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"zlib",
|
||||
"openssl"
|
||||
"openssl",
|
||||
"brotli"
|
||||
]
|
||||
},
|
||||
"dba": {
|
||||
@@ -65,6 +74,19 @@
|
||||
"qdbm"
|
||||
]
|
||||
},
|
||||
"decimal": {
|
||||
"type": "external",
|
||||
"source": "ext-decimal",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libmpdec"
|
||||
]
|
||||
},
|
||||
"deepclone": {
|
||||
"type": "external",
|
||||
"source": "deepclone",
|
||||
"arg-type": "enable"
|
||||
},
|
||||
"dio": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
@@ -127,6 +149,14 @@
|
||||
"sockets"
|
||||
]
|
||||
},
|
||||
"excimer": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-excimer"
|
||||
},
|
||||
"exif": {
|
||||
"type": "builtin"
|
||||
},
|
||||
@@ -232,11 +262,14 @@
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "grpc",
|
||||
"source": "ext-grpc",
|
||||
"arg-type-unix": "enable-path",
|
||||
"cpp-extension": true,
|
||||
"lib-depends": [
|
||||
"grpc"
|
||||
"grpc",
|
||||
"zlib",
|
||||
"openssl",
|
||||
"libcares"
|
||||
]
|
||||
},
|
||||
"iconv": {
|
||||
@@ -341,6 +374,7 @@
|
||||
"ext-depends": [
|
||||
"xml"
|
||||
],
|
||||
"build-with-php": true,
|
||||
"target": [
|
||||
"static"
|
||||
]
|
||||
@@ -357,6 +391,18 @@
|
||||
"liblz4"
|
||||
]
|
||||
},
|
||||
"maxminddb": {
|
||||
"support": {
|
||||
"BSD": "wip",
|
||||
"Windows": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-maxminddb",
|
||||
"arg-type": "with",
|
||||
"lib-depends": [
|
||||
"libmaxminddb"
|
||||
]
|
||||
},
|
||||
"mbregex": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
@@ -395,8 +441,7 @@
|
||||
"ext-depends": [
|
||||
"zlib",
|
||||
"session"
|
||||
],
|
||||
"build-with-php": true
|
||||
]
|
||||
},
|
||||
"memcached": {
|
||||
"support": {
|
||||
@@ -453,7 +498,7 @@
|
||||
"type": "external",
|
||||
"source": "msgpack",
|
||||
"arg-type-unix": "with",
|
||||
"arg-type-win": "enable",
|
||||
"arg-type-windows": "enable",
|
||||
"ext-depends": [
|
||||
"session"
|
||||
]
|
||||
@@ -461,6 +506,7 @@
|
||||
"mysqli": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"build-with-php": true,
|
||||
"ext-depends": [
|
||||
"mysqlnd"
|
||||
]
|
||||
@@ -468,10 +514,45 @@
|
||||
"mysqlnd": {
|
||||
"type": "builtin",
|
||||
"arg-type-windows": "with",
|
||||
"build-with-php": true,
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"mysqlnd_ed25519": {
|
||||
"type": "external",
|
||||
"source": "mysqlnd_ed25519",
|
||||
"arg-type": "enable",
|
||||
"target": [
|
||||
"shared"
|
||||
],
|
||||
"ext-depends": [
|
||||
"mysqlnd"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libsodium"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"mysqlnd_parsec": {
|
||||
"type": "external",
|
||||
"source": "mysqlnd_parsec",
|
||||
"arg-type": "enable",
|
||||
"target": [
|
||||
"shared"
|
||||
],
|
||||
"ext-depends": [
|
||||
"mysqlnd"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libsodium"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"oci8": {
|
||||
"type": "wip",
|
||||
"support": {
|
||||
@@ -552,6 +633,13 @@
|
||||
"type": "builtin",
|
||||
"unix-only": true
|
||||
},
|
||||
"pcov": {
|
||||
"type": "external",
|
||||
"source": "pcov",
|
||||
"target": [
|
||||
"shared"
|
||||
]
|
||||
},
|
||||
"pdo": {
|
||||
"type": "builtin"
|
||||
},
|
||||
@@ -687,7 +775,7 @@
|
||||
"type": "builtin",
|
||||
"arg-type": "with-path",
|
||||
"lib-depends": [
|
||||
"readline"
|
||||
"libedit"
|
||||
],
|
||||
"target": [
|
||||
"static"
|
||||
@@ -753,17 +841,27 @@
|
||||
"apcu"
|
||||
]
|
||||
},
|
||||
"snmp": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type-unix": "with",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"net-snmp"
|
||||
]
|
||||
},
|
||||
"soap": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"xml"
|
||||
"ext-depends": [
|
||||
"libxml",
|
||||
"session"
|
||||
]
|
||||
},
|
||||
"sockets": {
|
||||
@@ -799,6 +897,7 @@
|
||||
"type": "builtin",
|
||||
"arg-type": "with-path",
|
||||
"arg-type-windows": "with",
|
||||
"build-with-php": true,
|
||||
"lib-depends": [
|
||||
"sqlite"
|
||||
]
|
||||
@@ -887,6 +986,22 @@
|
||||
"mysqli"
|
||||
]
|
||||
},
|
||||
"swoole-hook-odbc": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "addon",
|
||||
"arg-type": "none",
|
||||
"ext-depends": [
|
||||
"pdo",
|
||||
"swoole"
|
||||
],
|
||||
"lib-depends": [
|
||||
"unixodbc"
|
||||
]
|
||||
},
|
||||
"swoole-hook-pgsql": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
@@ -916,22 +1031,6 @@
|
||||
"swoole"
|
||||
]
|
||||
},
|
||||
"swoole-hook-odbc": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "addon",
|
||||
"arg-type": "none",
|
||||
"ext-depends": [
|
||||
"pdo",
|
||||
"swoole"
|
||||
],
|
||||
"lib-depends": [
|
||||
"unixodbc"
|
||||
]
|
||||
},
|
||||
"swow": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
@@ -986,6 +1085,14 @@
|
||||
"type": "builtin",
|
||||
"build-with-php": true
|
||||
},
|
||||
"trader": {
|
||||
"support": {
|
||||
"BSD": "wip",
|
||||
"Windows": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-trader"
|
||||
},
|
||||
"uuid": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
@@ -1154,8 +1261,9 @@
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-path",
|
||||
"type": "external",
|
||||
"source": "ext-zip",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "enable",
|
||||
"lib-depends-unix": [
|
||||
"libzip"
|
||||
@@ -1178,6 +1286,7 @@
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"build-with-php": true,
|
||||
"target": [
|
||||
"static"
|
||||
]
|
||||
|
||||
198
config/lib.json
198
config/lib.json
@@ -7,12 +7,14 @@
|
||||
"source": "php-src",
|
||||
"lib-depends": [
|
||||
"lib-base",
|
||||
"micro"
|
||||
"micro",
|
||||
"frankenphp"
|
||||
],
|
||||
"lib-depends-macos": [
|
||||
"lib-base",
|
||||
"micro",
|
||||
"libxml2"
|
||||
"libxml2",
|
||||
"frankenphp"
|
||||
],
|
||||
"lib-suggests-linux": [
|
||||
"libacl",
|
||||
@@ -24,6 +26,10 @@
|
||||
"watcher"
|
||||
]
|
||||
},
|
||||
"frankenphp": {
|
||||
"source": "frankenphp",
|
||||
"type": "target"
|
||||
},
|
||||
"micro": {
|
||||
"type": "target",
|
||||
"source": "micro"
|
||||
@@ -98,11 +104,12 @@
|
||||
"ngtcp2",
|
||||
"zstd",
|
||||
"libcares",
|
||||
"ldap"
|
||||
"ldap",
|
||||
"idn2",
|
||||
"krb5"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"brotli",
|
||||
"zstd"
|
||||
"brotli"
|
||||
],
|
||||
"frameworks": [
|
||||
"CoreFoundation",
|
||||
@@ -135,9 +142,7 @@
|
||||
"zlib"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libpng",
|
||||
"bzip2",
|
||||
"brotli"
|
||||
"libpng"
|
||||
]
|
||||
},
|
||||
"gettext": {
|
||||
@@ -202,7 +207,7 @@
|
||||
"openssl",
|
||||
"libcares"
|
||||
],
|
||||
"provide-pre-built": true,
|
||||
"cpp-library": true,
|
||||
"frameworks": [
|
||||
"CoreFoundation"
|
||||
]
|
||||
@@ -228,8 +233,27 @@
|
||||
"unicode"
|
||||
]
|
||||
},
|
||||
"idn2": {
|
||||
"source": "libidn2",
|
||||
"pkg-configs": [
|
||||
"libidn2"
|
||||
],
|
||||
"headers": [
|
||||
"idn2.h"
|
||||
],
|
||||
"lib-suggests-unix": [
|
||||
"libiconv",
|
||||
"gettext",
|
||||
"libunistring"
|
||||
],
|
||||
"lib-depends-macos": [
|
||||
"libiconv",
|
||||
"gettext"
|
||||
]
|
||||
},
|
||||
"imagemagick": {
|
||||
"source": "imagemagick",
|
||||
"cpp-library": true,
|
||||
"pkg-configs": [
|
||||
"Magick++-7.Q16HDRI",
|
||||
"MagickCore-7.Q16HDRI",
|
||||
@@ -274,6 +298,26 @@
|
||||
"jbig_ar.h"
|
||||
]
|
||||
},
|
||||
"krb5": {
|
||||
"source": "krb5",
|
||||
"pkg-configs": [
|
||||
"krb5-gssapi"
|
||||
],
|
||||
"headers": [
|
||||
"krb5.h",
|
||||
"gssapi/gssapi.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"openssl"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"ldap",
|
||||
"libedit"
|
||||
],
|
||||
"frameworks": [
|
||||
"Kerberos"
|
||||
]
|
||||
},
|
||||
"ldap": {
|
||||
"source": "ldap",
|
||||
"pkg-configs": [
|
||||
@@ -308,12 +352,18 @@
|
||||
"static-libs-unix": [
|
||||
"libaom.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"aom.lib"
|
||||
],
|
||||
"cpp-library": true
|
||||
},
|
||||
"libargon2": {
|
||||
"source": "libargon2",
|
||||
"static-libs-unix": [
|
||||
"libargon2.a"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libsodium"
|
||||
]
|
||||
},
|
||||
"libavif": {
|
||||
@@ -323,6 +373,15 @@
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"avif.lib"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libaom"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libwebp",
|
||||
"libjpeg",
|
||||
"libxml2",
|
||||
"libpng"
|
||||
]
|
||||
},
|
||||
"libcares": {
|
||||
@@ -343,6 +402,15 @@
|
||||
],
|
||||
"cpp-library": true
|
||||
},
|
||||
"libedit": {
|
||||
"source": "libedit",
|
||||
"static-libs-unix": [
|
||||
"libedit.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"ncurses"
|
||||
]
|
||||
},
|
||||
"libevent": {
|
||||
"source": "libevent",
|
||||
"static-libs-unix": [
|
||||
@@ -425,7 +493,7 @@
|
||||
"static-libs-windows": [
|
||||
"libjpeg_a.lib"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
@@ -450,6 +518,28 @@
|
||||
"liblz4.a"
|
||||
]
|
||||
},
|
||||
"libmaxminddb": {
|
||||
"source": "libmaxminddb",
|
||||
"static-libs-unix": [
|
||||
"libmaxminddb.a"
|
||||
],
|
||||
"headers": [
|
||||
"maxminddb.h",
|
||||
"maxminddb_config.h"
|
||||
]
|
||||
},
|
||||
"libmpdec": {
|
||||
"source": "libmpdec",
|
||||
"static-libs-unix": [
|
||||
"libmpdec.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libmpdec_a.lib"
|
||||
],
|
||||
"headers": [
|
||||
"mpdecimal.h"
|
||||
]
|
||||
},
|
||||
"libmemcached": {
|
||||
"source": "libmemcached",
|
||||
"cpp-library": true,
|
||||
@@ -496,13 +586,16 @@
|
||||
},
|
||||
"librdkafka": {
|
||||
"source": "librdkafka",
|
||||
"static-libs-unix": [
|
||||
"librdkafka.a",
|
||||
"librdkafka++.a",
|
||||
"librdkafka-static.a"
|
||||
"pkg-configs": [
|
||||
"rdkafka++-static",
|
||||
"rdkafka-static"
|
||||
],
|
||||
"cpp-library": true,
|
||||
"lib-suggests": [
|
||||
"curl",
|
||||
"liblz4",
|
||||
"openssl",
|
||||
"zlib",
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
@@ -549,6 +642,31 @@
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
"libunistring": {
|
||||
"source": "libunistring",
|
||||
"static-libs-unix": [
|
||||
"libunistring.a"
|
||||
],
|
||||
"headers": [
|
||||
"unistr.h",
|
||||
"unistring/"
|
||||
]
|
||||
},
|
||||
"liburing": {
|
||||
"source": "liburing",
|
||||
"pkg-configs": [
|
||||
"liburing",
|
||||
"liburing-ffi"
|
||||
],
|
||||
"static-libs-linux": [
|
||||
"liburing.a",
|
||||
"liburing-ffi.a"
|
||||
],
|
||||
"headers-linux": [
|
||||
"liburing/",
|
||||
"liburing.h"
|
||||
]
|
||||
},
|
||||
"libuuid": {
|
||||
"source": "libuuid",
|
||||
"static-libs-unix": [
|
||||
@@ -582,8 +700,8 @@
|
||||
},
|
||||
"libxml2": {
|
||||
"source": "libxml2",
|
||||
"static-libs-unix": [
|
||||
"libxml2.a"
|
||||
"pkg-configs": [
|
||||
"libxml-2.0"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libxml2s.lib",
|
||||
@@ -656,7 +774,6 @@
|
||||
"xz"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"zstd",
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
@@ -672,6 +789,17 @@
|
||||
"libncurses.a"
|
||||
]
|
||||
},
|
||||
"net-snmp": {
|
||||
"source": "net-snmp",
|
||||
"pkg-configs": [
|
||||
"netsnmp",
|
||||
"netsnmp-agent"
|
||||
],
|
||||
"lib-depends": [
|
||||
"openssl",
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"nghttp2": {
|
||||
"source": "nghttp2",
|
||||
"static-libs-unix": [
|
||||
@@ -745,6 +873,9 @@
|
||||
},
|
||||
"openssl": {
|
||||
"source": "openssl",
|
||||
"pkg-configs": [
|
||||
"openssl"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libssl.a",
|
||||
"libcrypto.a"
|
||||
@@ -770,7 +901,7 @@
|
||||
"libxml2",
|
||||
"openssl",
|
||||
"zlib",
|
||||
"readline"
|
||||
"libedit"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"icu",
|
||||
@@ -822,6 +953,7 @@
|
||||
},
|
||||
"snappy": {
|
||||
"source": "snappy",
|
||||
"cpp-library": true,
|
||||
"static-libs-unix": [
|
||||
"libsnappy.a"
|
||||
],
|
||||
@@ -856,6 +988,11 @@
|
||||
},
|
||||
"unixodbc": {
|
||||
"source": "unixodbc",
|
||||
"pkg-configs": [
|
||||
"odbc",
|
||||
"odbccr",
|
||||
"odbcinst"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libodbc.a",
|
||||
"libodbccr.a",
|
||||
@@ -867,11 +1004,15 @@
|
||||
},
|
||||
"watcher": {
|
||||
"source": "watcher",
|
||||
"cpp-library": true,
|
||||
"static-libs-unix": [
|
||||
"libwatcher-c.a"
|
||||
],
|
||||
"headers": [
|
||||
"wtr/watcher-c.h"
|
||||
],
|
||||
"frameworks": [
|
||||
"CoreServices"
|
||||
]
|
||||
},
|
||||
"xz": {
|
||||
@@ -896,6 +1037,9 @@
|
||||
},
|
||||
"zlib": {
|
||||
"source": "zlib",
|
||||
"pkg-configs": [
|
||||
"zlib"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libz.a"
|
||||
],
|
||||
@@ -909,6 +1053,9 @@
|
||||
},
|
||||
"zstd": {
|
||||
"source": "zstd",
|
||||
"pkg-configs": [
|
||||
"libzstd"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libzstd.a"
|
||||
],
|
||||
@@ -927,20 +1074,5 @@
|
||||
"zstd.h",
|
||||
"zstd_errors.h"
|
||||
]
|
||||
},
|
||||
"liburing": {
|
||||
"source": "liburing",
|
||||
"pkg-configs": [
|
||||
"liburing",
|
||||
"liburing-ffi"
|
||||
],
|
||||
"static-libs-linux": [
|
||||
"liburing.a",
|
||||
"liburing-ffi.a"
|
||||
],
|
||||
"headers-linux": [
|
||||
"liburing/",
|
||||
"liburing.h"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
"type": "url",
|
||||
"url": "https://dl.static-php.dev/static-php-cli/deps/nasm/nasm-2.16.01-win64.zip",
|
||||
"extract-files": {
|
||||
"nasm-2.16.01/nasm.exe": "{php_sdk_path}/bin/nasm.exe",
|
||||
"nasm-2.16.01/ndisasm.exe": "{php_sdk_path}/bin/ndisasm.exe"
|
||||
"nasm.exe": "{php_sdk_path}/bin/nasm.exe",
|
||||
"ndisasm.exe": "{php_sdk_path}/bin/ndisasm.exe"
|
||||
}
|
||||
},
|
||||
"pkg-config-aarch64-linux": {
|
||||
@@ -84,7 +84,7 @@
|
||||
"repo": "upx/upx",
|
||||
"match": "upx.+-win64\\.zip",
|
||||
"extract-files": {
|
||||
"upx-*-win64/upx.exe": "{pkg_root_path}/bin/upx.exe"
|
||||
"upx.exe": "{pkg_root_path}/bin/upx.exe"
|
||||
}
|
||||
},
|
||||
"zig-aarch64-linux": {
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "doc/COPYING"
|
||||
"path": "doc/COPYING.LGPL"
|
||||
}
|
||||
},
|
||||
"brotli": {
|
||||
@@ -84,6 +84,25 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"ext-decimal": {
|
||||
"type": "ghtagtar",
|
||||
"repo": "php-decimal/ext-decimal",
|
||||
"match": "v2\\.\\d.*",
|
||||
"path": "php-src/ext/decimal",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"deepclone": {
|
||||
"type": "ghtagtar",
|
||||
"repo": "symfony/php-ext-deepclone",
|
||||
"path": "php-src/ext/deepclone",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"dio": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/dio",
|
||||
@@ -126,13 +145,23 @@
|
||||
},
|
||||
"ext-event": {
|
||||
"type": "url",
|
||||
"url": "https://bitbucket.org/osmanov/pecl-event/get/3.0.8.tar.gz",
|
||||
"url": "https://bitbucket.org/osmanov/pecl-event/get/3.1.4.tar.gz",
|
||||
"path": "php-src/ext/event",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-excimer": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/excimer",
|
||||
"path": "php-src/ext/excimer",
|
||||
"filename": "excimer.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-glfw": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mario-deluna/php-glfw",
|
||||
@@ -151,6 +180,18 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-grpc": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/grpc",
|
||||
"path": "php-src/ext/grpc",
|
||||
"filename": "grpc.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": [
|
||||
"LICENSE"
|
||||
]
|
||||
}
|
||||
},
|
||||
"ext-imagick": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/imagick",
|
||||
@@ -184,6 +225,15 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"ext-maxminddb": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/maxminddb",
|
||||
"filename": "ext-maxminddb.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-memcache": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/memcache",
|
||||
@@ -196,7 +246,7 @@
|
||||
},
|
||||
"ext-rdkafka": {
|
||||
"type": "ghtar",
|
||||
"repo": "arnaud-lb/php-rdkafka",
|
||||
"repo": "php-rdkafka/php-rdkafka",
|
||||
"path": "php-src/ext/rdkafka",
|
||||
"license": {
|
||||
"type": "file",
|
||||
@@ -233,6 +283,16 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-trader": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/trader",
|
||||
"path": "php-src/ext/trader",
|
||||
"filename": "trader.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-uuid": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/uuid",
|
||||
@@ -263,6 +323,15 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-zip": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/zip",
|
||||
"filename": "ext-zip.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-zstd": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/zstd",
|
||||
@@ -282,10 +351,19 @@
|
||||
"path": "LICENSE.MIT"
|
||||
}
|
||||
},
|
||||
"frankenphp": {
|
||||
"type": "ghtar",
|
||||
"repo": "php/frankenphp",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"freetype": {
|
||||
"type": "git",
|
||||
"rev": "VER-2-13-2",
|
||||
"url": "https://github.com/freetype/freetype",
|
||||
"type": "ghtagtar",
|
||||
"repo": "freetype/freetype",
|
||||
"match": "VER-2-\\d+-\\d+",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.TXT"
|
||||
@@ -297,16 +375,17 @@
|
||||
"regex": "/href=\"(?<file>gettext-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
"path": "gettext-runtime/intl/COPYING.LIB"
|
||||
}
|
||||
},
|
||||
"gmp": {
|
||||
"type": "url",
|
||||
"url": "https://dl.static-php.dev/static-php-cli/deps/gmp/gmp-6.3.0.tar.xz",
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/gnu/gmp/",
|
||||
"regex": "/href=\"(?<file>gmp-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"provide-pre-built": true,
|
||||
"alt": {
|
||||
"type": "ghtagtar",
|
||||
"repo": "alisw/GMP"
|
||||
"type": "url",
|
||||
"url": "https://dl.static-php.dev/static-php-cli/deps/gmp/gmp-6.3.0.tar.xz"
|
||||
},
|
||||
"license": {
|
||||
"type": "text",
|
||||
@@ -324,7 +403,7 @@
|
||||
},
|
||||
"grpc": {
|
||||
"type": "git",
|
||||
"rev": "v1.68.x",
|
||||
"rev": "v1.75.x",
|
||||
"url": "https://github.com/grpc/grpc.git",
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
@@ -401,6 +480,14 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"krb5": {
|
||||
"type": "url",
|
||||
"url": "https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "NOTICE"
|
||||
}
|
||||
},
|
||||
"ldap": {
|
||||
"type": "filelist",
|
||||
"url": "https://www.openldap.org/software/download/OpenLDAP/openldap-release/",
|
||||
@@ -430,7 +517,7 @@
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "doc/COPYING"
|
||||
"path": "doc/COPYING.LGPL"
|
||||
}
|
||||
},
|
||||
"libaom": {
|
||||
@@ -456,7 +543,7 @@
|
||||
"libavif": {
|
||||
"type": "ghtar",
|
||||
"repo": "AOMediaCodec/libavif",
|
||||
"provide-pre-built": true,
|
||||
"provide-pre-built": false,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -489,6 +576,16 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libedit": {
|
||||
"type": "filelist",
|
||||
"url": "https://thrysoee.dk/editline/",
|
||||
"regex": "/href=\"(?<file>libedit-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libevent": {
|
||||
"type": "ghrel",
|
||||
"repo": "libevent/libevent",
|
||||
@@ -537,7 +634,7 @@
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
"path": "COPYING.LIB"
|
||||
}
|
||||
},
|
||||
"libiconv-win": {
|
||||
@@ -549,9 +646,19 @@
|
||||
"path": "source/COPYING"
|
||||
}
|
||||
},
|
||||
"libidn2": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/gnu/libidn/",
|
||||
"regex": "/href=\"(?<file>libidn2-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING.LESSERv3"
|
||||
}
|
||||
},
|
||||
"libjpeg": {
|
||||
"type": "ghtar",
|
||||
"repo": "libjpeg-turbo/libjpeg-turbo",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.md"
|
||||
@@ -583,6 +690,24 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libmaxminddb": {
|
||||
"type": "ghrel",
|
||||
"repo": "maxmind/libmaxminddb",
|
||||
"match": "libmaxminddb-.+\\.tar\\.gz",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libmpdec": {
|
||||
"type": "url",
|
||||
"url": "https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-4.0.1.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYRIGHT.txt"
|
||||
}
|
||||
},
|
||||
"libmemcached": {
|
||||
"type": "ghtagtar",
|
||||
"repo": "awesomized/libmemcached",
|
||||
@@ -593,9 +718,10 @@
|
||||
}
|
||||
},
|
||||
"libpng": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/glennrp/libpng.git",
|
||||
"rev": "libpng16",
|
||||
"type": "ghtagtar",
|
||||
"repo": "pnggroup/libpng",
|
||||
"match": "v1\\.6\\.\\d+",
|
||||
"query": "?per_page=150",
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
@@ -603,9 +729,9 @@
|
||||
}
|
||||
},
|
||||
"librabbitmq": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alanxz/rabbitmq-c.git",
|
||||
"rev": "master",
|
||||
"type": "ghtar",
|
||||
"repo": "alanxz/rabbitmq-c",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -622,7 +748,7 @@
|
||||
"libsodium": {
|
||||
"type": "ghrel",
|
||||
"repo": "jedisct1/libsodium",
|
||||
"match": "libsodium-\\d+(\\.\\d+)*\\.tar\\.gz",
|
||||
"match": "libsodium-(?!1\\.0\\.21)\\d+(\\.\\d+)*\\.tar\\.gz",
|
||||
"prefer-stable": true,
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
@@ -650,10 +776,30 @@
|
||||
"path": "LICENSE.md"
|
||||
}
|
||||
},
|
||||
"libunistring": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/gnu/libunistring/",
|
||||
"regex": "/href=\"(?<file>libunistring-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING.LIB"
|
||||
}
|
||||
},
|
||||
"liburing": {
|
||||
"type": "ghtar",
|
||||
"repo": "axboe/liburing",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libuuid": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/libuuid.git",
|
||||
"rev": "master",
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
@@ -674,8 +820,9 @@
|
||||
]
|
||||
},
|
||||
"libwebp": {
|
||||
"type": "url",
|
||||
"url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz",
|
||||
"type": "ghtagtar",
|
||||
"repo": "webmproject/libwebp",
|
||||
"match": "v1\\.\\d+\\.\\d+$",
|
||||
"provide-pre-built": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
@@ -683,8 +830,10 @@
|
||||
}
|
||||
},
|
||||
"libxml2": {
|
||||
"type": "url",
|
||||
"url": "https://github.com/GNOME/libxml2/archive/refs/tags/v2.12.5.tar.gz",
|
||||
"type": "ghtagtar",
|
||||
"repo": "GNOME/libxml2",
|
||||
"match": "v2\\.\\d+\\.\\d+$",
|
||||
"provide-pre-built": false,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "Copyright"
|
||||
@@ -733,7 +882,7 @@
|
||||
"micro": {
|
||||
"type": "git",
|
||||
"path": "php-src/sapi/micro",
|
||||
"rev": "php-85-win",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/static-php/phpmicro",
|
||||
"license": {
|
||||
"type": "file",
|
||||
@@ -771,6 +920,24 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"mysqlnd_ed25519": {
|
||||
"type": "pie",
|
||||
"repo": "mariadb/mysqlnd_ed25519",
|
||||
"path": "php-src/ext/mysqlnd_ed25519",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"mysqlnd_parsec": {
|
||||
"type": "pie",
|
||||
"repo": "mariadb/mysqlnd_parsec",
|
||||
"path": "php-src/ext/mysqlnd_parsec",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ncurses": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/pub/gnu/ncurses/",
|
||||
@@ -781,6 +948,14 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"net-snmp": {
|
||||
"type": "ghtagtar",
|
||||
"repo": "net-snmp/net-snmp",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"nghttp2": {
|
||||
"type": "ghrel",
|
||||
"repo": "nghttp2/nghttp2",
|
||||
@@ -825,7 +1000,7 @@
|
||||
"openssl": {
|
||||
"type": "ghrel",
|
||||
"repo": "openssl/openssl",
|
||||
"match": "openssl.+\\.tar\\.gz",
|
||||
"match": "openssl-3.+\\.tar\\.gz",
|
||||
"prefer-stable": true,
|
||||
"alt": {
|
||||
"type": "filelist",
|
||||
@@ -858,6 +1033,15 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"pcov": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/pcov",
|
||||
"filename": "pcov.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"pdo_sqlsrv": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/pdo_sqlsrv",
|
||||
@@ -880,7 +1064,7 @@
|
||||
"postgresql": {
|
||||
"type": "ghtagtar",
|
||||
"repo": "postgres/postgres",
|
||||
"match": "REL_16_\\d+",
|
||||
"match": "REL_18_\\d+",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYRIGHT"
|
||||
@@ -896,7 +1080,7 @@
|
||||
},
|
||||
"protobuf": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/protobuf",
|
||||
"url": "https://pecl.php.net/get/protobuf-5.34.1.tgz",
|
||||
"path": "php-src/ext/protobuf",
|
||||
"filename": "protobuf.tgz",
|
||||
"license": {
|
||||
@@ -971,7 +1155,6 @@
|
||||
},
|
||||
"snappy": {
|
||||
"type": "git",
|
||||
"repo": "google/snappy",
|
||||
"rev": "main",
|
||||
"url": "https://github.com/google/snappy",
|
||||
"license": {
|
||||
@@ -980,9 +1163,8 @@
|
||||
}
|
||||
},
|
||||
"spx": {
|
||||
"type": "git",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/static-php/php-spx.git",
|
||||
"type": "pie",
|
||||
"repo": "noisebynorthwest/php-spx",
|
||||
"path": "php-src/ext/spx",
|
||||
"license": {
|
||||
"type": "file",
|
||||
@@ -1012,7 +1194,6 @@
|
||||
"path": "php-src/ext/swoole",
|
||||
"type": "ghtar",
|
||||
"repo": "swoole/swoole-src",
|
||||
"match": "v6\\.+",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
@@ -1057,9 +1238,8 @@
|
||||
}
|
||||
},
|
||||
"xdebug": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/xdebug",
|
||||
"filename": "xdebug.tgz",
|
||||
"type": "pie",
|
||||
"repo": "xdebug/xdebug",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -1136,14 +1316,5 @@
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"liburing": {
|
||||
"type": "ghtar",
|
||||
"repo": "axboe/liburing",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -744,10 +744,26 @@ h2 {
|
||||
}
|
||||
|
||||
select {
|
||||
border-radius: 4px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
padding: 0 4px;
|
||||
padding: 8px 12px;
|
||||
width: 300px;
|
||||
background-color: var(--vp-c-bg-soft);
|
||||
color: var(--vp-c-text-1);
|
||||
font-size: 14px;
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
select:hover {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-bg);
|
||||
}
|
||||
|
||||
select:focus {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
box-shadow: 0 0 0 3px var(--vp-c-brand-soft);
|
||||
}
|
||||
|
||||
.my-btn {
|
||||
@@ -781,17 +797,160 @@ select {
|
||||
|
||||
.textarea {
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 4px;
|
||||
width: calc(100% - 12px);
|
||||
padding: 4px 8px;
|
||||
border-radius: 8px;
|
||||
width: calc(100% - 24px);
|
||||
padding: 12px;
|
||||
background-color: var(--vp-c-bg-soft);
|
||||
color: var(--vp-c-text-1);
|
||||
font-size: 14px;
|
||||
font-family: var(--vp-font-family-mono);
|
||||
line-height: 1.5;
|
||||
transition: all 0.2s ease;
|
||||
outline: none;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.textarea:hover {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-bg);
|
||||
}
|
||||
|
||||
.textarea:focus {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
box-shadow: 0 0 0 3px var(--vp-c-brand-soft);
|
||||
}
|
||||
|
||||
.input {
|
||||
display: block;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 4px;
|
||||
border-radius: 8px;
|
||||
width: 100%;
|
||||
padding: 4px 8px;
|
||||
padding: 10px 12px;
|
||||
background-color: var(--vp-c-bg-soft);
|
||||
color: var(--vp-c-text-1);
|
||||
font-size: 14px;
|
||||
transition: all 0.2s ease;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.input:hover {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-bg);
|
||||
}
|
||||
|
||||
.input:focus {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
box-shadow: 0 0 0 3px var(--vp-c-brand-soft);
|
||||
}
|
||||
|
||||
/* Radio button styles */
|
||||
input[type="radio"] {
|
||||
appearance: none;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 2px solid var(--vp-c-border);
|
||||
border-radius: 50%;
|
||||
background-color: var(--vp-c-bg);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
margin-right: 6px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
input[type="radio"]:hover {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-bg-soft);
|
||||
}
|
||||
|
||||
input[type="radio"]:checked {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
input[type="radio"]:checked::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--vp-c-bg);
|
||||
}
|
||||
|
||||
input[type="radio"]:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Checkbox styles */
|
||||
input[type="checkbox"] {
|
||||
appearance: none;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 2px solid var(--vp-c-border);
|
||||
border-radius: 4px;
|
||||
background-color: var(--vp-c-bg);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
margin-right: 6px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:hover {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-bg-soft);
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 5px;
|
||||
width: 4px;
|
||||
height: 8px;
|
||||
border: solid var(--vp-c-bg);
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
input[type="checkbox"]:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Label styles */
|
||||
label {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
color: var(--vp-c-text-1);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
label:hover {
|
||||
color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
input[type="radio"]:disabled + label,
|
||||
input[type="checkbox"]:disabled + label {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
input[type="radio"]:disabled + label:hover,
|
||||
input[type="checkbox"]:disabled + label:hover {
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.command-container {
|
||||
|
||||
219
docs/.vitepress/components/Contributors.vue
Normal file
219
docs/.vitepress/components/Contributors.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div class="contributors-container">
|
||||
<div class="contributors-header">
|
||||
<h2>Contributors</h2>
|
||||
<p class="contributors-description">
|
||||
Thanks to all the amazing people who have contributed to this project!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="loading-state">
|
||||
<div class="spinner"></div>
|
||||
<p>Loading contributors...</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="error" class="error-state">
|
||||
<p>{{ error }}</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="contributors-grid">
|
||||
<a
|
||||
v-for="contributor in contributors"
|
||||
:key="contributor.id"
|
||||
:href="contributor.html_url"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="contributor-card"
|
||||
:title="contributor.login"
|
||||
>
|
||||
<img
|
||||
:src="contributor.avatar_url"
|
||||
:alt="contributor.login"
|
||||
class="contributor-avatar"
|
||||
loading="lazy"
|
||||
/>
|
||||
<div class="contributor-name">{{ contributor.login }}</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
interface Contributor {
|
||||
id: number;
|
||||
login: string;
|
||||
avatar_url: string;
|
||||
html_url: string;
|
||||
contributions: number;
|
||||
}
|
||||
|
||||
const contributors = ref<Contributor[]>([]);
|
||||
const loading = ref(true);
|
||||
const error = ref('');
|
||||
|
||||
const fetchContributors = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
|
||||
const response = await fetch(
|
||||
'https://api.github.com/repos/crazywhalecc/static-php-cli/contributors?per_page=24'
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch contributors');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
contributors.value = data;
|
||||
} catch (err) {
|
||||
error.value = 'Failed to load contributors. Please try again later.';
|
||||
console.error('Error fetching contributors:', err);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetchContributors();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.contributors-container {
|
||||
margin: 48px auto;
|
||||
padding: 32px 24px;
|
||||
max-width: 1152px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-bg) 100%);
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.contributors-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.contributors-header h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 8px 0;
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.contributors-description {
|
||||
font-size: 0.95rem;
|
||||
color: var(--vp-c-text-2);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.loading-state,
|
||||
.error-state {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: 0 auto 16px;
|
||||
border: 4px solid var(--vp-c-divider);
|
||||
border-top-color: var(--vp-c-brand-1);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.contributors-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.contributor-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 12px;
|
||||
background: var(--vp-c-bg);
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
transition: all 0.3s ease;
|
||||
text-decoration: none;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.contributor-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
border-color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
.contributor-avatar {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid var(--vp-c-divider);
|
||||
transition: all 0.3s ease;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.contributor-card:hover .contributor-avatar {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.contributor-name {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
word-break: break-word;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.contributors-container {
|
||||
margin: 32px 16px;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.contributors-header h2 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.contributors-description {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.contributors-grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.contributor-card {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.contributor-avatar {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.contributor-name {
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@ import sidebarZh from "./sidebar.zh";
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default {
|
||||
title: "static-php-cli",
|
||||
title: "Static PHP",
|
||||
description: "Build single static PHP binary, with PHP project together, with popular extensions included.",
|
||||
locales: {
|
||||
en: {
|
||||
@@ -44,6 +44,7 @@ export default {
|
||||
},
|
||||
themeConfig: {
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
logo: '/images/static-php_nobg.png',
|
||||
nav: [],
|
||||
socialLinks: [
|
||||
{icon: 'github', link: 'https://github.com/crazywhalecc/static-php-cli'}
|
||||
|
||||
@@ -4,3 +4,21 @@
|
||||
max-width: 1000px !important;
|
||||
}
|
||||
|
||||
|
||||
.vp-doc .contributors-header h2 {
|
||||
padding-top: 0;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.vp-doc .sponsors-header h2 {
|
||||
padding-top: 0;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.dark .VPImage.logo {
|
||||
filter: contrast(0.7);
|
||||
}
|
||||
|
||||
.dark .VPImage.image-src {
|
||||
filter: contrast(0.7);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ The following is the source download configuration corresponding to the `libeven
|
||||
The most important field here is `type`. Currently, the types it supports are:
|
||||
|
||||
- `url`: Directly use URL to download, for example: `https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz`.
|
||||
- `pie`: Download PHP extensions from Packagist using the PIE (PHP Installer for Extensions) standard.
|
||||
- `ghrel`: Use the GitHub Release API to download, download the artifacts uploaded from the latest version released by maintainers.
|
||||
- `ghtar`: Use the GitHub Release API to download.
|
||||
Different from `ghrel`, `ghtar` is downloaded from the `source code (tar.gz)` in the latest Release of the project.
|
||||
@@ -89,6 +90,37 @@ Example (download the imagick extension and extract it to the extension storage
|
||||
}
|
||||
```
|
||||
|
||||
## Download type - pie
|
||||
|
||||
PIE (PHP Installer for Extensions) type sources refer to downloading PHP extensions from Packagist that follow the PIE standard.
|
||||
This method automatically fetches extension information from the Packagist repository and downloads the appropriate distribution file.
|
||||
|
||||
The parameters included are:
|
||||
|
||||
- `repo`: The Packagist vendor/package name, such as `vendor/package-name`
|
||||
|
||||
Example (download a PHP extension from Packagist using PIE):
|
||||
|
||||
```json
|
||||
{
|
||||
"ext-example": {
|
||||
"type": "pie",
|
||||
"repo": "vendor/example-extension",
|
||||
"path": "php-src/ext/example",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
::: tip
|
||||
The PIE download type will automatically detect the extension information from Packagist metadata,
|
||||
including the download URL, version, and distribution type.
|
||||
The extension must be marked as `type: php-ext` or contain `php-ext` metadata in its Packagist package definition.
|
||||
:::
|
||||
|
||||
## Download type - ghrel
|
||||
|
||||
ghrel will download files from Assets uploaded in GitHub Release.
|
||||
|
||||
@@ -44,6 +44,11 @@ So on macOS, you can **directly** use SPC to build statically compiled PHP binar
|
||||
2. You will get `buildroot/modules/xdebug.so` and `buildroot/bin/php`.
|
||||
3. The `xdebug.so` file could be used for php that version and thread-safe are the same.
|
||||
|
||||
For the Windows platform, since officially built extensions (such as `php_yaml.dll`) force the use of the `php8.dll` dynamic library as a link, and statically built PHP does not include any dynamic libraries other than system libraries,
|
||||
php.exe built by static-php cannot load officially built dynamic extensions. Since static-php-cli does not yet support building dynamic extensions, there is currently no way to load dynamic extensions with static-php.
|
||||
|
||||
However, Windows can normally use the `FFI` extension to load other dll files and call them.
|
||||
|
||||
## Can it support Oracle database extension?
|
||||
|
||||
Some extensions that rely on closed source libraries, such as `oci8`, `sourceguardian`, etc.,
|
||||
|
||||
@@ -16,8 +16,10 @@ while also defining the extensions to compile.
|
||||
|
||||
1. Fork project.
|
||||
2. Go to the Actions of the project and select `CI`.
|
||||
3. Select `Run workflow`, fill in the PHP version you want to compile, the target type, and the list of extensions. (extensions comma separated, e.g. `bcmath,curl,mbstring`)
|
||||
4. After waiting for about a period of time, enter the corresponding task and get `Artifacts`.
|
||||
3. Select `Run workflow`, fill in the PHP version you want to compile, the target type, and the list of static extensions. (comma separated, e.g. `bcmath,curl,mbstring`)
|
||||
4. If you need shared extensions (for example `xdebug`), set `shared-extensions` (comma separated, e.g. `xdebug`).
|
||||
5. If you need FrankenPHP, enable `build-frankenphp` and also enable `enable-zts`.
|
||||
6. After waiting for about a period of time, enter the corresponding task and get `Artifacts`.
|
||||
|
||||
If you enable `debug`, all logs will be output at build time, including compiled logs, for troubleshooting.
|
||||
|
||||
|
||||
@@ -21,19 +21,30 @@ The following is the architecture support situation, where :gear: represents sup
|
||||
| Windows | :gear: :computer: | |
|
||||
| FreeBSD | :computer: | :computer: |
|
||||
|
||||
Among them, Linux is currently only tested on Ubuntu, Debian, and Alpine distributions,
|
||||
and other distributions have not been tested, which cannot guarantee successful compilation.
|
||||
For untested distributions, local compilation can be done using methods such as Docker to avoid environmental issues.
|
||||
Current supported PHP versions for compilation:
|
||||
|
||||
There are two architectures for macOS: `x86_64` and `Arm`, but binaries compiled on one architecture cannot be directly used on the other architecture.
|
||||
Rosetta 2 cannot guarantee that programs compiled with `Arm` architecture can fully run on `x86_64` environment.
|
||||
> :warning: Partial support, there may be issues with new beta versions and old versions.
|
||||
>
|
||||
> :heavy_check_mark: Supported
|
||||
>
|
||||
> :x: Not supported
|
||||
|
||||
Windows currently only supports the x86_64 architecture, and does not support 32-bit x86 or arm64 architecture.
|
||||
| PHP Version | Status | Comment |
|
||||
|-------------|--------------------|-------------------------------------------------------------------------------------------------------------------------|
|
||||
| 7.2 | :x: | |
|
||||
| 7.3 | :x: | phpmicro and many extensions do not support 7.3, 7.4 versions |
|
||||
| 7.4 | :x: | phpmicro and many extensions do not support 7.3, 7.4 versions |
|
||||
| 8.0 | :warning: | PHP official has stopped maintaining 8.0, we no longer handle 8.0 related backport support |
|
||||
| 8.1 | :warning: | PHP official only provides security updates for 8.1, we no longer handle 8.1 related backport support after 8.5 release |
|
||||
| 8.2 | :heavy_check_mark: | |
|
||||
| 8.3 | :heavy_check_mark: | |
|
||||
| 8.4 | :heavy_check_mark: | |
|
||||
| 8.5 (beta) | :warning: | PHP 8.5 is currently in beta stage |
|
||||
|
||||
## Supported PHP Version
|
||||
> This table shows the support status of static-php-cli for building corresponding versions, not the PHP official support status for that version.
|
||||
|
||||
Currently, static php cli supports PHP versions 8.1 to 8.5, and theoretically supports PHP 8.0 and earlier versions.
|
||||
Simply select the earlier version when downloading.
|
||||
However, due to some extensions and special components that have stopped supporting earlier versions of PHP,
|
||||
static-php-cli will not explicitly support earlier versions.
|
||||
## PHP Support Versions
|
||||
|
||||
Currently, static-php-cli supports PHP versions 8.2 ~ 8.5, and theoretically supports PHP 8.1 and earlier versions, just select the earlier version when downloading.
|
||||
However, due to some extensions and special components that have stopped supporting earlier versions of PHP, static-php-cli will not explicitly support earlier versions.
|
||||
We recommend that you compile the latest PHP version possible for a better experience.
|
||||
|
||||
@@ -549,22 +549,24 @@ otherwise it will be executed repeatedly in other events.
|
||||
|
||||
The following are the supported `patch_point` event names and corresponding locations:
|
||||
|
||||
| Event name | Event description |
|
||||
|------------------------------|----------------------------------------------------------------------------------------------------|
|
||||
| before-libs-extract | Triggered before the dependent libraries extracted |
|
||||
| after-libs-extract | Triggered after the compiled dependent libraries extracted |
|
||||
| before-php-extract | Triggered before PHP source code extracted |
|
||||
| after-php-extract | Triggered after PHP source code extracted |
|
||||
| before-micro-extract | Triggered before phpmicro extract |
|
||||
| after-micro-extract | Triggered after phpmicro extracted |
|
||||
| before-exts-extract | Triggered before the extension (to be compiled) extracted to the PHP source directory |
|
||||
| after-exts-extract | Triggered after the extension extracted to the PHP source directory |
|
||||
| before-library[*name*]-build | Triggered before the library named `name` is compiled (such as `before-library[postgresql]-build`) |
|
||||
| after-library[*name*]-build | Triggered after the library named `name` is compiled |
|
||||
| before-php-buildconf | Triggered before compiling PHP command `./buildconf` |
|
||||
| before-php-configure | Triggered before compiling PHP command `./configure` |
|
||||
| before-php-make | Triggered before compiling PHP command `make` |
|
||||
| before-sanity-check | Triggered after compiling PHP but before running extended checks |
|
||||
| Event name | Event description |
|
||||
|---------------------------------|----------------------------------------------------------------------------------------------------|
|
||||
| before-libs-extract | Triggered before the dependent libraries extracted |
|
||||
| after-libs-extract | Triggered after the compiled dependent libraries extracted |
|
||||
| before-php-extract | Triggered before PHP source code extracted |
|
||||
| after-php-extract | Triggered after PHP source code extracted |
|
||||
| before-micro-extract | Triggered before phpmicro extract |
|
||||
| after-micro-extract | Triggered after phpmicro extracted |
|
||||
| before-exts-extract | Triggered before the extension (to be compiled) extracted to the PHP source directory |
|
||||
| after-exts-extract | Triggered after the extension extracted to the PHP source directory |
|
||||
| before-library[*name*]-build | Triggered before the library named `name` is compiled (such as `before-library[postgresql]-build`) |
|
||||
| after-library[*name*]-build | Triggered after the library named `name` is compiled |
|
||||
| after-shared-ext[*name*]-build | Triggered after the shared extension named `name` is compiled |
|
||||
| before-shared-ext[*name*]-build | Triggered before the shared extension named `name` is compiled |
|
||||
| before-php-buildconf | Triggered before compiling PHP command `./buildconf` |
|
||||
| before-php-configure | Triggered before compiling PHP command `./configure` |
|
||||
| before-php-make | Triggered before compiling PHP command `make` |
|
||||
| before-sanity-check | Triggered after compiling PHP but before running extended checks |
|
||||
|
||||
The following is a simple example of temporarily modifying the PHP source code.
|
||||
Enable the CLI function to search for the `php.ini` configuration in the current working directory:
|
||||
|
||||
125
docs/en/index.md
125
docs/en/index.md
@@ -3,11 +3,14 @@
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: "static-php-cli"
|
||||
name: "Static PHP"
|
||||
tagline: "Build standalone PHP binary on Linux, macOS, FreeBSD, Windows, with PHP project together, with popular extensions included."
|
||||
image:
|
||||
src: /images/static-php_nobg.png
|
||||
alt: Static PHP CLI Logo
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Guide
|
||||
text: Get Started
|
||||
link: ./guide/
|
||||
|
||||
features:
|
||||
@@ -19,3 +22,121 @@ features:
|
||||
details: static-php-cli comes with dependency management and supports installation of different types of PHP extensions.
|
||||
---
|
||||
|
||||
<script setup>
|
||||
import {VPSponsors} from "vitepress/theme";
|
||||
import Contributors from '../.vitepress/components/Contributors.vue';
|
||||
|
||||
const sponsors = [
|
||||
{ name: 'Beyond Code', img: '/images/beyondcode-seeklogo.png', url: 'https://beyondco.de/' },
|
||||
{ name: 'NativePHP', img: '/images/nativephp-logo.svg', url: 'https://nativephp.com/' },
|
||||
];
|
||||
</script>
|
||||
|
||||
<div class="sponsors-section">
|
||||
<div class="sponsors-header">
|
||||
<h2>Special Sponsors</h2>
|
||||
<p class="sponsors-description">
|
||||
Thank you to our amazing sponsors for supporting this project!
|
||||
</p>
|
||||
</div>
|
||||
<VPSponsors :data="sponsors"/>
|
||||
</div>
|
||||
|
||||
<style scoped>
|
||||
.sponsors-section {
|
||||
margin: 48px auto;
|
||||
padding: 32px 24px;
|
||||
max-width: 1152px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-bg) 100%);
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.sponsors-section:hover {
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.sponsors-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.sponsors-header h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 8px 0;
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.sponsors-description {
|
||||
font-size: 0.95rem;
|
||||
color: var(--vp-c-text-2);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.sponsors-section {
|
||||
margin: 32px 16px;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.sponsors-header h2 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.sponsors-description {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hero logo styling */
|
||||
:deep(.VPImage.image-src) {
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-default-soft) 100%);
|
||||
padding: 40px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
:deep(.VPImage.image-src:hover) {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* Dark mode adjustments for logo */
|
||||
.dark :deep(.VPImage.image-src) {
|
||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.dark :deep(.VPImage.image-src:hover) {
|
||||
opacity: 1;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
/* Additional styling for the logo image itself */
|
||||
:deep(.VPImage.image-src img) {
|
||||
max-height: 280px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.VPImage.image-src) {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
:deep(.VPImage.image-src img) {
|
||||
max-height: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<Contributors />
|
||||
|
||||
117
docs/index.md
117
docs/index.md
@@ -3,8 +3,11 @@
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: "static-php-cli"
|
||||
name: "Static PHP"
|
||||
tagline: "Build standalone PHP binary on Linux, macOS, FreeBSD, Windows, with PHP project together, with popular extensions included."
|
||||
image:
|
||||
src: /images/static-php_nobg.png
|
||||
alt: Static PHP CLI Logo
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Get Started
|
||||
@@ -24,13 +27,121 @@ features:
|
||||
|
||||
<script setup>
|
||||
import {VPSponsors} from "vitepress/theme";
|
||||
import Contributors from './.vitepress/components/Contributors.vue';
|
||||
|
||||
const sponsors = [
|
||||
{ name: 'Beyond Code', img: '/images/beyondcode-seeklogo.png', url: 'https://beyondco.de/' },
|
||||
{ name: 'NativePHP', img: '/images/nativephp-logo.svg', url: 'https://nativephp.com/' },
|
||||
];
|
||||
</script>
|
||||
|
||||
## Special Sponsors
|
||||
<div class="sponsors-section">
|
||||
<div class="sponsors-header">
|
||||
<h2>Special Sponsors</h2>
|
||||
<p class="sponsors-description">
|
||||
Thank you to our amazing sponsors for supporting this project!
|
||||
</p>
|
||||
</div>
|
||||
<VPSponsors :data="sponsors"/>
|
||||
</div>
|
||||
|
||||
<VPSponsors :data="sponsors"/>
|
||||
<style scoped>
|
||||
.sponsors-section {
|
||||
margin: 48px auto;
|
||||
padding: 32px 24px;
|
||||
max-width: 1152px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-bg) 100%);
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.sponsors-section:hover {
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.sponsors-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.sponsors-header h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 8px 0;
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.sponsors-description {
|
||||
font-size: 0.95rem;
|
||||
color: var(--vp-c-text-2);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.sponsors-section {
|
||||
margin: 32px 16px;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.sponsors-header h2 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.sponsors-description {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hero logo styling */
|
||||
:deep(.VPImage.image-src) {
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-default-soft) 100%);
|
||||
padding: 40px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
:deep(.VPImage.image-src:hover) {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* Dark mode adjustments for logo */
|
||||
.dark :deep(.VPImage.image-src) {
|
||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.dark :deep(.VPImage.image-src:hover) {
|
||||
opacity: 1;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
/* Additional styling for the logo image itself */
|
||||
:deep(.VPImage.image-src img) {
|
||||
max-height: 280px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.VPImage.image-src) {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
:deep(.VPImage.image-src img) {
|
||||
max-height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<Contributors />
|
||||
|
||||
|
||||
BIN
docs/public/images/static-php_nobg.png
Normal file
BIN
docs/public/images/static-php_nobg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 965 KiB |
@@ -30,6 +30,7 @@ static-php-cli 的下载资源模块是一个主要的功能,它包含了所
|
||||
这里最主要的字段是 `type`,目前它支持的类型有:
|
||||
|
||||
- `url`: 直接使用 URL 下载,例如:`https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz`。
|
||||
- `pie`: 使用 PIE(PHP Installer for Extensions)标准从 Packagist 下载 PHP 扩展。
|
||||
- `ghrel`: 使用 GitHub Release API 下载,即从 GitHub 项目发布的最新版本中上传的附件下载。
|
||||
- `ghtar`: 使用 GitHub Release API 下载,与 `ghrel` 不同的是,`ghtar` 是从项目的最新 Release 中找 `source code (tar.gz)` 下载的。
|
||||
- `ghtagtar`: 使用 GitHub Release API 下载,与 `ghtar` 相比,`ghtagtar` 可以从 `tags` 列表找最新的,并下载 `tar.gz` 格式的源码(因为有些项目只使用了 `tag` 发布版本)。
|
||||
@@ -77,6 +78,36 @@ url 类型的资源指的是从 URL 直接下载文件。
|
||||
}
|
||||
```
|
||||
|
||||
## 下载类型 - pie
|
||||
|
||||
PIE(PHP Installer for Extensions)类型的资源是从 Packagist 下载遵循 PIE 标准的 PHP 扩展。
|
||||
该方法会自动从 Packagist 仓库获取扩展信息,并下载相应的分发文件。
|
||||
|
||||
包含的参数有:
|
||||
|
||||
- `repo`: Packagist 的 vendor/package 名称,如 `vendor/package-name`
|
||||
|
||||
例子(使用 PIE 从 Packagist 下载 PHP 扩展):
|
||||
|
||||
```json
|
||||
{
|
||||
"ext-example": {
|
||||
"type": "pie",
|
||||
"repo": "vendor/example-extension",
|
||||
"path": "php-src/ext/example",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
::: tip
|
||||
PIE 下载类型会自动从 Packagist 元数据中检测扩展信息,包括下载 URL、版本和分发类型。
|
||||
扩展必须在其 Packagist 包定义中标记为 `type: php-ext` 或包含 `php-ext` 元数据。
|
||||
:::
|
||||
|
||||
## 下载类型 - ghrel
|
||||
|
||||
ghrel 会从 GitHub Release 中上传的 Assets 下载文件。首先使用 GitHub Release API 获取最新版本,然后根据正则匹配方式下载相应的文件。
|
||||
|
||||
@@ -41,6 +41,11 @@ buildroot/bin/php -d "zend_extension=/path/to/php{PHP_VER}-{ts/nts}/xdebug.so" -
|
||||
2. 你将获得 `buildroot/modules/xdebug.so` 和 `buildroot/bin/php`。
|
||||
3. `xdebug.so` 文件可用于版本和线程安全相同的 php。
|
||||
|
||||
对于 Windows 平台,由于官方构建的扩展(如 `php_yaml.dll`)强制使用了 `php8.dll` 动态库作为链接,静态构建的 PHP 不包含任何系统库以外的动态库,
|
||||
所以 Windows 下无法加载官方构建的动态扩展。 由于 static-php-cli 还暂未支持构建动态扩展,所以目前还没有让 static-php 加载动态扩展的方法。
|
||||
|
||||
不过,Windows 可以正常使用 `FFI` 扩展加载其他的 dll 文件并调用。
|
||||
|
||||
## 可以支持 Oracle 数据库扩展吗?
|
||||
|
||||
部分依赖库闭源的扩展,如 `oci8`、`sourceguardian` 等,它们没有提供纯静态编译的依赖库文件(`.a`),仅提供了动态依赖库文件(`.so`),
|
||||
|
||||
@@ -14,7 +14,9 @@ Action 构建指的是直接使用 GitHub Action 进行编译。
|
||||
1. Fork 本项目。
|
||||
2. 进入项目的 Actions,选择 CI 开头的 Workflow(根据你需要的操作系统选择)。
|
||||
3. 选择 `Run workflow`,填入你要编译的 PHP 版本、目标类型、扩展列表。(扩展列表使用英文逗号分割,例如 `bcmath,curl,mbstring`)
|
||||
4. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
|
||||
4. 如果需要共享扩展(例如 `xdebug`),请设置 `shared-extensions`(使用英文逗号分割,例如 `xdebug`)。
|
||||
5. 如果需要 FrankenPHP,请启用 `build-frankenphp`,同时也需要启用 `enable-zts`。
|
||||
6. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
|
||||
|
||||
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
||||
|
||||
|
||||
@@ -19,16 +19,30 @@ static-php-cli 是一个用于构建静态编译的 PHP 二进制的工具,目
|
||||
| Windows | :gear: :computer: | |
|
||||
| FreeBSD | :computer: | :computer: |
|
||||
|
||||
其中,Linux 目前仅在 Ubuntu、Debian、Alpine 发行版测试通过,其他发行版未进行测试,不能保证编译成功。
|
||||
对于未经过测试的发行版,可以使用 Docker 等方式本地编译,避免环境导致的问题。
|
||||
当前支持编译的 PHP 版本:
|
||||
|
||||
macOS 下支持 x86_64 和 Arm 两种架构,但在其中一个架构上编译的二进制无法直接在另一个架构上使用。
|
||||
Rosetta 2 不能保证 Arm 架构编译的程序可以完全运行在 x86_64 环境下。
|
||||
> :warning: 部分支持,对于新的测试版和旧版本可能存在问题。
|
||||
>
|
||||
> :heavy_check_mark: 支持
|
||||
>
|
||||
> :x: 不支持
|
||||
|
||||
Windows 目前只支持 x86_64 架构,不支持 32 位 x86、不支持 arm64 架构。
|
||||
| PHP Version | Status | Comment |
|
||||
|-------------|--------------------|---------------------------------------------------------|
|
||||
| 7.2 | :x: | |
|
||||
| 7.3 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
|
||||
| 7.4 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
|
||||
| 8.0 | :warning: | PHP 官方已停止 8.0 的维护,我们不再处理 8.0 相关的 backport 支持 |
|
||||
| 8.1 | :warning: | PHP 官方仅对 8.1 提供安全更新,在 8.5 发布后我们不再处理 8.1 相关的 backport 支持 |
|
||||
| 8.2 | :heavy_check_mark: | |
|
||||
| 8.3 | :heavy_check_mark: | |
|
||||
| 8.4 | :heavy_check_mark: | |
|
||||
| 8.5 (beta) | :warning: | PHP 8.5 目前处于 beta 阶段 |
|
||||
|
||||
> 这个表格的支持状态是 static-php-cli 对构建对应版本的支持情况,不是 PHP 官方对该版本的支持情况。
|
||||
|
||||
## PHP 支持版本
|
||||
|
||||
目前,static-php-cli 对 PHP 8.1 ~ 8.5 版本是支持的,对于 PHP 8.0 及更早版本理论上支持,只需下载时选择早期版本即可。
|
||||
目前,static-php-cli 对 PHP 8.2 ~ 8.5 版本是支持的,对于 PHP 8.1 及更早版本理论上支持,只需下载时选择早期版本即可。
|
||||
但由于部分扩展和特殊组件已对早期版本的 PHP 停止了支持,所以 static-php-cli 不会明确支持早期版本。
|
||||
我们推荐你编译尽可能新的 PHP 版本,以获得更好的体验。
|
||||
|
||||
@@ -500,6 +500,8 @@ bin/spc dev:sort-config ext
|
||||
| after-exts-extract | 在要编译的扩展解压到 PHP 源码目录后触发 |
|
||||
| before-library[*name*]-build | 在名称为 `name` 的库编译前触发(如 `before-library[postgresql]-build`) |
|
||||
| after-library[*name*]-build | 在名称为 `name` 的库编译后触发 |
|
||||
| after-shared-ext[*name*]-build | 在名称为 `name` 的共享扩展编译后触发(如 `after-shared-ext[redis]-build`) |
|
||||
| before-shared-ext[*name*]-build | 在名称为 `name` 的共享扩展编译前触发 |
|
||||
| before-php-buildconf | 在编译 PHP 命令 `./buildconf` 前触发 |
|
||||
| before-php-configure | 在编译 PHP 命令 `./configure` 前触发 |
|
||||
| before-php-make | 在编译 PHP 命令 `make` 前触发 |
|
||||
|
||||
138
docs/zh/index.md
138
docs/zh/index.md
@@ -3,18 +3,140 @@
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: "static-php-cli"
|
||||
name: "Static PHP"
|
||||
tagline: "在 Linux、macOS、FreeBSD、Windows 上与 PHP 项目一起构建独立的 PHP 二进制文件,并包含流行的扩展。"
|
||||
image:
|
||||
src: /images/static-php_nobg.png
|
||||
alt: Static PHP CLI Logo
|
||||
actions:
|
||||
- theme: brand
|
||||
text: 指南
|
||||
text: 开始使用
|
||||
link: ./guide/
|
||||
|
||||
features:
|
||||
- title: 静态二进制
|
||||
details: 您可以轻松地编译一个独立的 PHP 二进制文件以供嵌入程序使用。包括 cli、fpm、micro。
|
||||
- title: phpmicro 自执行二进制
|
||||
details: 您可以使用 micro SAPI 编译一个自解压的可执行文件,并将 PHP 代码与二进制文件打包为一个文件。
|
||||
- title: 依赖管理
|
||||
details: static-php-cli 附带依赖项管理,支持安装不同类型的 PHP 扩展和不同的依赖库。
|
||||
- title: 静态 CLI 二进制
|
||||
details: 您可以轻松地编译一个独立的 PHP 二进制文件以供通用使用,包括 CLI、FPM SAPI。
|
||||
- title: Micro 自解压可执行文件
|
||||
details: 您可以编译一个自解压的可执行文件,并将 PHP 源代码与二进制文件打包在一起。
|
||||
- title: 依赖管理
|
||||
details: static-php-cli 附带依赖项管理,支持安装不同类型的 PHP 扩展。
|
||||
---
|
||||
|
||||
<script setup>
|
||||
import {VPSponsors} from "vitepress/theme";
|
||||
import Contributors from '../.vitepress/components/Contributors.vue';
|
||||
|
||||
const sponsors = [
|
||||
{ name: 'Beyond Code', img: '/images/beyondcode-seeklogo.png', url: 'https://beyondco.de/' },
|
||||
{ name: 'NativePHP', img: '/images/nativephp-logo.svg', url: 'https://nativephp.com/' },
|
||||
];
|
||||
</script>
|
||||
|
||||
<div class="sponsors-section">
|
||||
<div class="sponsors-header">
|
||||
<h2>特别赞助商</h2>
|
||||
<p class="sponsors-description">
|
||||
感谢我们出色的赞助商对本项目的支持!
|
||||
</p>
|
||||
</div>
|
||||
<VPSponsors :data="sponsors"/>
|
||||
</div>
|
||||
|
||||
<style scoped>
|
||||
.sponsors-section {
|
||||
margin: 48px auto;
|
||||
padding: 32px 24px;
|
||||
max-width: 1152px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-bg) 100%);
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.sponsors-section:hover {
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.sponsors-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.sponsors-header h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 8px 0;
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.sponsors-description {
|
||||
font-size: 0.95rem;
|
||||
color: var(--vp-c-text-2);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.sponsors-section {
|
||||
margin: 32px 16px;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.sponsors-header h2 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.sponsors-description {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hero logo styling */
|
||||
:deep(.VPImage.image-src) {
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-default-soft) 100%);
|
||||
padding: 40px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
:deep(.VPImage.image-src:hover) {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* Dark mode adjustments for logo */
|
||||
.dark :deep(.VPImage.image-src) {
|
||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.dark :deep(.VPImage.image-src:hover) {
|
||||
opacity: 1;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
/* Additional styling for the logo image itself */
|
||||
:deep(.VPImage.image-src img) {
|
||||
max-height: 280px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.VPImage.image-src) {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
:deep(.VPImage.image-src img) {
|
||||
max-height: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<Contributors />
|
||||
|
||||
@@ -14,6 +14,7 @@ parameters:
|
||||
- PHP_OS_FAMILY
|
||||
excludePaths:
|
||||
analyseAndScan:
|
||||
- ./src/globals/ext-tests/decimal.php
|
||||
- ./src/globals/ext-tests/swoole.php
|
||||
- ./src/globals/ext-tests/swoole.phpt
|
||||
- ./src/globals/test-extensions.php
|
||||
|
||||
@@ -34,7 +34,7 @@ use Symfony\Component\Console\Application;
|
||||
*/
|
||||
final class ConsoleApplication extends Application
|
||||
{
|
||||
public const string VERSION = '2.7.4';
|
||||
public const string VERSION = '2.8.6';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -128,27 +128,6 @@ abstract class BuilderBase
|
||||
return array_filter($this->exts, fn ($ext) => $ext->isBuildStatic());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is a cpp extensions or libraries.
|
||||
*/
|
||||
public function hasCpp(): bool
|
||||
{
|
||||
// judge cpp-extension
|
||||
$exts = array_keys($this->getExts(false));
|
||||
foreach ($exts as $ext) {
|
||||
if (Config::getExt($ext, 'cpp-extension', false) === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$libs = array_keys($this->getLibs());
|
||||
foreach ($libs as $lib) {
|
||||
if (Config::getLib($lib, 'cpp-library', false) === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set libs only mode.
|
||||
*
|
||||
|
||||
@@ -4,17 +4,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
use SPC\builder\unix\UnixBuilderBase;
|
||||
use SPC\exception\EnvironmentException;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\SPCException;
|
||||
use SPC\exception\ValidationException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\toolchain\ClangNativeToolchain;
|
||||
use SPC\toolchain\GccNativeToolchain;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\toolchain\ZigToolchain;
|
||||
use SPC\util\GlobalEnvManager;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
use SPC\util\SPCTarget;
|
||||
|
||||
@@ -100,7 +99,8 @@ class Extension
|
||||
fn ($x) => $x->getStaticLibFiles(),
|
||||
$this->getLibraryDependencies(recursive: true)
|
||||
);
|
||||
return implode(' ', $ret);
|
||||
$libs = implode(' ', $ret);
|
||||
return deduplicate_flags($libs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,13 +225,25 @@ class Extension
|
||||
*/
|
||||
public function patchBeforeSharedMake(): bool
|
||||
{
|
||||
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], array_map(fn ($l) => $l->getName(), $this->builder->getLibs()));
|
||||
[$staticLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
|
||||
FileSystem::replaceFileRegex(
|
||||
$this->source_dir . '/Makefile',
|
||||
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
|
||||
'$1 ' . trim($staticLibs)
|
||||
);
|
||||
$config = (new SPCConfigUtil($this->builder))->getExtensionConfig($this);
|
||||
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
|
||||
$lstdcpp = str_contains($sharedLibs, '-l:libstdc++.a') ? '-l:libstdc++.a' : null;
|
||||
$lstdcpp ??= str_contains($sharedLibs, '-lstdc++') ? '-lstdc++' : '';
|
||||
|
||||
$makefileContent = file_get_contents($this->source_dir . '/Makefile');
|
||||
if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) {
|
||||
$prefix = $matches[1];
|
||||
$currentLibs = trim($matches[2]);
|
||||
$newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp}");
|
||||
$deduplicatedLibs = deduplicate_flags($newLibs);
|
||||
|
||||
FileSystem::replaceFileRegex(
|
||||
$this->source_dir . '/Makefile',
|
||||
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
|
||||
$prefix . $deduplicatedLibs
|
||||
);
|
||||
}
|
||||
|
||||
if ($objs = getenv('SPC_EXTRA_RUNTIME_OBJECTS')) {
|
||||
FileSystem::replaceFileRegex(
|
||||
$this->source_dir . '/Makefile',
|
||||
@@ -298,7 +310,7 @@ class Extension
|
||||
// Run compile check if build target is cli
|
||||
// If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php
|
||||
$sharedExtensions = $this->getSharedExtensionLoadString();
|
||||
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
|
||||
[$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
|
||||
if ($ret !== 0) {
|
||||
throw new ValidationException(
|
||||
"extension {$this->getName()} failed compile check: php-cli returned {$ret}",
|
||||
@@ -328,7 +340,7 @@ class Extension
|
||||
{
|
||||
// Run compile check if build target is cli
|
||||
// If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php
|
||||
[$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -n --ri "' . $this->getDistName() . '"', false);
|
||||
[$ret] = cmd()->execWithResult(BUILD_BIN_PATH . '/php.exe -n --ri "' . $this->getDistName() . '"', false);
|
||||
if ($ret !== 0) {
|
||||
throw new ValidationException("extension {$this->getName()} failed compile check: php-cli returned {$ret}", validation_module: "Extension {$this->getName()} sanity check");
|
||||
}
|
||||
@@ -377,6 +389,9 @@ class Extension
|
||||
logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)');
|
||||
return;
|
||||
}
|
||||
if ((string) Config::getExt($this->getName(), 'type') === 'addon') {
|
||||
return;
|
||||
}
|
||||
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
|
||||
foreach ($this->dependencies as $dependency) {
|
||||
if (!$dependency instanceof Extension) {
|
||||
@@ -387,13 +402,12 @@ class Extension
|
||||
$dependency->buildShared([...$visited, $this->getName()]);
|
||||
}
|
||||
}
|
||||
if (Config::getExt($this->getName(), 'type') === 'addon') {
|
||||
return;
|
||||
}
|
||||
$this->builder->emitPatchPoint('before-shared-ext[' . $this->getName() . ']-build');
|
||||
match (PHP_OS_FAMILY) {
|
||||
'Darwin', 'Linux' => $this->buildUnixShared(),
|
||||
default => throw new WrongUsageException(PHP_OS_FAMILY . ' build shared extensions is not supported yet'),
|
||||
};
|
||||
$this->builder->emitPatchPoint('after-shared-ext[' . $this->getName() . ']-build');
|
||||
} catch (SPCException $e) {
|
||||
$e->bindExtensionInfo(['extension_name' => $this->getName()]);
|
||||
throw $e;
|
||||
@@ -405,42 +419,7 @@ class Extension
|
||||
*/
|
||||
public function buildUnixShared(): void
|
||||
{
|
||||
$config = (new SPCConfigUtil($this->builder))->config(
|
||||
[$this->getName()],
|
||||
array_map(fn ($l) => $l->getName(), $this->getLibraryDependencies(recursive: true)),
|
||||
$this->builder->getOption('with-suggested-exts'),
|
||||
$this->builder->getOption('with-suggested-libs'),
|
||||
);
|
||||
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
|
||||
$preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group ';
|
||||
$postStatic = PHP_OS_FAMILY === 'Darwin' ? '' : ' -Wl,--end-group ';
|
||||
$env = [
|
||||
'CFLAGS' => $config['cflags'],
|
||||
'CXXFLAGS' => $config['cflags'],
|
||||
'LDFLAGS' => $config['ldflags'],
|
||||
'LIBS' => clean_spaces("{$preStatic} {$staticLibs} {$postStatic} {$sharedLibs}"),
|
||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||
];
|
||||
if (str_contains($env['LIBS'], '-lstdc++') && SPCTarget::getTargetOS() === 'Linux') {
|
||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
$env['SPC_COMPILER_EXTRA'] = '-lstdc++';
|
||||
} elseif (ToolchainManager::getToolchainClass() === GccNativeToolchain::class || ToolchainManager::getToolchainClass() === ClangNativeToolchain::class) {
|
||||
try {
|
||||
$content = FileSystem::readFile($this->source_dir . '/config.m4');
|
||||
if ($content && !str_contains($content, 'PHP_ADD_LIBRARY(stdc++')) {
|
||||
$pattern = '/(PHP_NEW_EXTENSION\(' . $this->name . ',.*\))/m';
|
||||
$replacement = "$1\nPHP_ADD_LIBRARY(stdc++, 1, " . strtoupper($this->name) . '_SHARED_LIBADD)';
|
||||
FileSystem::replaceFileRegex(
|
||||
$this->source_dir . '/config.m4',
|
||||
$pattern,
|
||||
$replacement
|
||||
);
|
||||
}
|
||||
} catch (FileSystemException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$env = $this->getSharedExtensionEnv();
|
||||
if ($this->patchBeforeSharedPhpize()) {
|
||||
logger()->info("Extension [{$this->getName()}] patched before shared phpize");
|
||||
}
|
||||
@@ -455,13 +434,15 @@ class Extension
|
||||
logger()->info("Extension [{$this->getName()}] patched before shared configure");
|
||||
}
|
||||
|
||||
$phpvars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->setEnv($env)
|
||||
->appendEnv($this->getExtraEnv())
|
||||
->exec(
|
||||
'./configure ' . $this->getUnixConfigureArg(true) .
|
||||
' --with-php-config=' . BUILD_BIN_PATH . '/php-config ' .
|
||||
'--enable-shared --disable-static'
|
||||
"--enable-shared --disable-static {$phpvars}"
|
||||
);
|
||||
|
||||
if ($this->patchBeforeSharedMake()) {
|
||||
@@ -474,6 +455,20 @@ class Extension
|
||||
->exec('make clean')
|
||||
->exec('make -j' . $this->builder->concurrency)
|
||||
->exec('make install');
|
||||
|
||||
// process *.so file
|
||||
$soFile = BUILD_MODULES_PATH . '/' . $this->getName() . '.so';
|
||||
$soDest = $soFile;
|
||||
preg_match('/-release\s+(\S*)/', getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'), $matches);
|
||||
if (!empty($matches[1])) {
|
||||
$soDest = str_replace('.so', '-' . $matches[1] . '.so', $soFile);
|
||||
}
|
||||
if (!file_exists($soFile)) {
|
||||
throw new ValidationException("extension {$this->getName()} build failed: {$soFile} not found", validation_module: "Extension {$this->getName()} build");
|
||||
}
|
||||
/** @var UnixBuilderBase $builder */
|
||||
$builder = $this->builder;
|
||||
$builder->deployBinary($soFile, $soDest, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,6 +507,64 @@ class Extension
|
||||
return $this->build_static;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the library dependencies that current extension depends on.
|
||||
*
|
||||
* @param bool $recursive Whether it includes dependencies recursively
|
||||
*/
|
||||
public function getLibraryDependencies(bool $recursive = false): array
|
||||
{
|
||||
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
||||
if (!$recursive) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$deps = [];
|
||||
|
||||
$added = 1;
|
||||
while ($added !== 0) {
|
||||
$added = 0;
|
||||
foreach ($ret as $depName => $dep) {
|
||||
foreach ($dep->getDependencies(true) as $depdepName => $depdep) {
|
||||
if (!array_key_exists($depdepName, $deps)) {
|
||||
$deps[$depdepName] = $depdep;
|
||||
++$added;
|
||||
}
|
||||
}
|
||||
if (!array_key_exists($depName, $deps)) {
|
||||
$deps[$depName] = $dep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $deps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the environment variables a shared extension needs to be built.
|
||||
* CFLAGS, CXXFLAGS, LDFLAGS and so on.
|
||||
*/
|
||||
protected function getSharedExtensionEnv(): array
|
||||
{
|
||||
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
|
||||
if (!str_contains($compiler_extra, '-lcompiler_rt') && ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
$compiler_extra = trim($compiler_extra . ' -lcompiler_rt');
|
||||
GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}");
|
||||
}
|
||||
$config = (new SPCConfigUtil($this->builder, ['no_php' => true]))->getExtensionConfig($this);
|
||||
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
|
||||
$preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group ';
|
||||
$postStatic = PHP_OS_FAMILY === 'Darwin' ? '' : ' -Wl,--end-group ';
|
||||
return [
|
||||
'CFLAGS' => $config['cflags'],
|
||||
'CXXFLAGS' => $config['cflags'],
|
||||
'LDFLAGS' => $config['ldflags'],
|
||||
'EXTRA_LDFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'),
|
||||
'LIBS' => clean_spaces("{$preStatic} {$staticLibs} {$postStatic} {$sharedLibs}"),
|
||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||
];
|
||||
}
|
||||
|
||||
protected function addLibraryDependency(string $name, bool $optional = false): void
|
||||
{
|
||||
$depLib = $this->builder->getLib($name);
|
||||
@@ -521,7 +574,7 @@ class Extension
|
||||
}
|
||||
logger()->info("enabling {$this->name} without library {$name}");
|
||||
} else {
|
||||
$this->dependencies[] = $depLib;
|
||||
$this->dependencies[$name] = $depLib;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,7 +587,7 @@ class Extension
|
||||
}
|
||||
logger()->info("enabling {$this->name} without extension {$name}");
|
||||
} else {
|
||||
$this->dependencies[] = $depExt;
|
||||
$this->dependencies[$name] = $depExt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,37 +622,4 @@ class Extension
|
||||
}
|
||||
return [trim($staticLibString), trim($sharedLibString)];
|
||||
}
|
||||
|
||||
private function getLibraryDependencies(bool $recursive = false): array
|
||||
{
|
||||
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
||||
if (!$recursive) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$deps = [];
|
||||
|
||||
$added = 1;
|
||||
while ($added !== 0) {
|
||||
$added = 0;
|
||||
foreach ($ret as $depName => $dep) {
|
||||
foreach ($dep->getDependencies(true) as $depdepName => $depdep) {
|
||||
if (!in_array($depdepName, array_keys($deps), true)) {
|
||||
$deps[$depdepName] = $depdep;
|
||||
++$added;
|
||||
}
|
||||
}
|
||||
if (!in_array($depName, array_keys($deps), true)) {
|
||||
$deps[$depName] = $dep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists(0, $deps)) {
|
||||
$zero = [0 => $deps[0]];
|
||||
unset($deps[0]);
|
||||
return $zero + $deps;
|
||||
}
|
||||
return $deps;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,18 +184,18 @@ abstract class LibraryBase
|
||||
|
||||
// extract first if not exists
|
||||
if (!is_dir($this->source_dir)) {
|
||||
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-extract');
|
||||
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-extract');
|
||||
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-extract');
|
||||
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-extract');
|
||||
}
|
||||
|
||||
if (!$this->patched && $this->patchBeforeBuild()) {
|
||||
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
|
||||
}
|
||||
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-build');
|
||||
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-build');
|
||||
$this->build();
|
||||
$this->installLicense();
|
||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-build');
|
||||
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-build');
|
||||
return LIB_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -346,25 +346,46 @@ abstract class LibraryBase
|
||||
*/
|
||||
protected function installLicense(): void
|
||||
{
|
||||
FileSystem::createDir(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName());
|
||||
$source = Config::getLib($this->getName(), 'source');
|
||||
FileSystem::createDir(BUILD_ROOT_PATH . "/source-licenses/{$source}");
|
||||
$license_files = Config::getSource($source)['license'] ?? [];
|
||||
if (is_assoc_array($license_files)) {
|
||||
$license_files = [$license_files];
|
||||
}
|
||||
foreach ($license_files as $index => $license) {
|
||||
if ($license['type'] === 'text') {
|
||||
FileSystem::writeFile(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName() . "/{$index}.txt", $license['text']);
|
||||
FileSystem::writeFile(BUILD_ROOT_PATH . "/source-licenses/{$source}/{$index}.txt", $license['text']);
|
||||
continue;
|
||||
}
|
||||
if ($license['type'] === 'file') {
|
||||
copy($this->source_dir . '/' . $license['path'], BUILD_ROOT_PATH . '/source-licenses/' . $this->getName() . "/{$index}.txt");
|
||||
copy($this->source_dir . '/' . $license['path'], BUILD_ROOT_PATH . "/source-licenses/{$source}/{$index}.txt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function isLibraryInstalled(): bool
|
||||
{
|
||||
if ($pkg_configs = Config::getLib(static::NAME, 'pkg-configs', [])) {
|
||||
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||
$search_paths = array_unique(array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path)));
|
||||
|
||||
foreach ($pkg_configs as $name) {
|
||||
$found = false;
|
||||
foreach ($search_paths as $path) {
|
||||
if (file_exists($path . "/{$name}.pc")) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// allow using system dependencies if pkg_config_path is explicitly defined
|
||||
if (count($search_paths) > 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
foreach (Config::getLib(static::NAME, 'static-libs', []) as $name) {
|
||||
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
||||
return false;
|
||||
@@ -375,8 +396,17 @@ abstract class LibraryBase
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||
$search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
|
||||
foreach (Config::getLib(static::NAME, 'pkg-configs', []) as $name) {
|
||||
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$name}.pc")) {
|
||||
$found = false;
|
||||
foreach ($search_paths as $path) {
|
||||
if (file_exists($path . "/{$name}.pc")) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
17
src/SPC/builder/extension/com_dotnet.php
Normal file
17
src/SPC/builder/extension/com_dotnet.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('com_dotnet')]
|
||||
class com_dotnet extends Extension
|
||||
{
|
||||
public function getWindowsConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--enable-com-dotnet=yes';
|
||||
}
|
||||
}
|
||||
46
src/SPC/builder/extension/decimal.php
Normal file
46
src/SPC/builder/extension/decimal.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('decimal')]
|
||||
class decimal extends Extension
|
||||
{
|
||||
// TODO: remove this when https://github.com/php-decimal/ext-decimal/issues/92 is merged
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
$this->source_dir . '/php_decimal.c',
|
||||
[
|
||||
'zend_module_entry decimal_module_entry',
|
||||
'ZEND_GET_MODULE(decimal)',
|
||||
],
|
||||
[
|
||||
'zend_module_entry php_decimal_module_entry',
|
||||
'ZEND_GET_MODULE(php_decimal)',
|
||||
]
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
$this->source_dir . '/config.w32',
|
||||
'ARG_WITH("decimal", "for decimal support", "no");',
|
||||
'ARG_WITH("decimal", "for decimal support", "no");' . "\n" .
|
||||
'ADD_EXTENSION_DEP("decimal", "json");'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--enable-decimal --with-libmpdec-path="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
|
||||
public function getWindowsConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--with-decimal';
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,21 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\linux\SystemUtil;
|
||||
use SPC\store\SourcePatcher;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('ffi')]
|
||||
class ffi extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if (PHP_OS_FAMILY === 'Linux' && SystemUtil::getOSRelease()['dist'] === 'centos') {
|
||||
return SourcePatcher::patchFfiCentos7FixO3strncmp();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--with-ffi' . ($shared ? '=shared' : '') . ' --enable-zend-signals';
|
||||
|
||||
@@ -15,7 +15,11 @@ class gettext extends Extension
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if ($this->builder instanceof MacOSBuilder) {
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB(intl');
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/gettext/config.m4',
|
||||
['AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB'],
|
||||
['AC_CHECK_LIB(intl', 'AC_CHECK_LIB([intl'] // new php versions use a bracket
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\GlobalEnvManager;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
use SPC\util\SPCTarget;
|
||||
|
||||
#[CustomExt('grpc')]
|
||||
class grpc extends Extension
|
||||
@@ -21,29 +20,66 @@ class grpc extends Extension
|
||||
if ($this->builder instanceof WindowsBuilder) {
|
||||
throw new ValidationException('grpc extension does not support windows yet');
|
||||
}
|
||||
if (file_exists(SOURCE_PATH . '/php-src/ext/grpc')) {
|
||||
return false;
|
||||
}
|
||||
// soft link to the grpc source code
|
||||
if (is_dir($this->source_dir . '/src/php/ext/grpc')) {
|
||||
shell()->exec('ln -s ' . $this->source_dir . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc');
|
||||
} else {
|
||||
throw new ValidationException('Cannot find grpc source code in ' . $this->source_dir . '/src/php/ext/grpc');
|
||||
}
|
||||
if (SPCTarget::getTargetOS() === 'Darwin') {
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/ext/grpc/config.m4',
|
||||
'/GRPC_LIBDIR=.*$/m',
|
||||
'GRPC_LIBDIR=' . BUILD_LIB_PATH . "\n" . 'LDFLAGS="$LDFLAGS -framework CoreFoundation"'
|
||||
);
|
||||
|
||||
// Fix deprecated PHP API usage in call.c
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->source_dir}/src/php/ext/grpc/call.c",
|
||||
'zend_exception_get_default(TSRMLS_C),',
|
||||
'zend_ce_exception,',
|
||||
);
|
||||
|
||||
// Fix include path conflict with pdo_sqlsrv: grpc's PHP ext dir is added to the global include path via
|
||||
$grpc_php_dir = "{$this->source_dir}/src/php/ext/grpc";
|
||||
if (file_exists("{$grpc_php_dir}/version.h")) {
|
||||
copy("{$grpc_php_dir}/version.h", "{$grpc_php_dir}/php_grpc_version.h");
|
||||
unlink("{$grpc_php_dir}/version.h");
|
||||
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.h", '#include "version.h"', '#include "php_grpc_version.h"');
|
||||
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.c", '#include "version.h"', '#include "php_grpc_version.h"');
|
||||
}
|
||||
|
||||
$config_m4 = <<<'M4'
|
||||
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])
|
||||
|
||||
if test "$PHP_GRPC" != "no"; then
|
||||
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include)
|
||||
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
|
||||
GRPC_LIBDIR=@@build_lib_path@@
|
||||
PHP_ADD_LIBPATH($GRPC_LIBDIR)
|
||||
PHP_ADD_LIBRARY(grpc,,GRPC_SHARED_LIBADD)
|
||||
LIBS="-lpthread $LIBS"
|
||||
PHP_ADD_LIBRARY(pthread)
|
||||
|
||||
case $host in
|
||||
*darwin*)
|
||||
PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD)
|
||||
;;
|
||||
*)
|
||||
PHP_ADD_LIBRARY(stdc++,1,GRPC_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY(rt)
|
||||
;;
|
||||
esac
|
||||
|
||||
PHP_NEW_EXTENSION(grpc, @grpc_c_files@, $ext_shared, , -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1)
|
||||
PHP_SUBST(GRPC_SHARED_LIBADD)
|
||||
PHP_INSTALL_HEADERS([ext/grpc], [php_grpc.h])
|
||||
fi
|
||||
M4;
|
||||
$replace = get_pack_replace();
|
||||
// load grpc c files from src/php/ext/grpc
|
||||
$c_files = glob($this->source_dir . '/src/php/ext/grpc/*.c');
|
||||
$replace['@grpc_c_files@'] = implode(" \\\n ", array_map(fn ($f) => 'src/php/ext/grpc/' . basename($f), $c_files));
|
||||
$config_m4 = str_replace(array_keys($replace), array_values($replace), $config_m4);
|
||||
file_put_contents($this->source_dir . '/config.m4', $config_m4);
|
||||
|
||||
copy($this->source_dir . '/src/php/ext/grpc/php_grpc.h', $this->source_dir . '/php_grpc.h');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
$util = new SPCConfigUtil($this->builder, ['libs_only_deps' => true]);
|
||||
$config = $util->config(['grpc']);
|
||||
$config = $util->getExtensionConfig($this);
|
||||
$libs = $config['libs'];
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lgrpc', $libs);
|
||||
return true;
|
||||
@@ -52,8 +88,14 @@ class grpc extends Extension
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
parent::patchBeforeMake();
|
||||
// add -Wno-strict-prototypes
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes');
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getSharedExtensionEnv(): array
|
||||
{
|
||||
$env = parent::getSharedExtensionEnv();
|
||||
$env['CPPFLAGS'] = $env['CXXFLAGS'] . ' -Wno-attributes';
|
||||
return $env;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\toolchain\ZigToolchain;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('imagick')]
|
||||
@@ -19,7 +21,9 @@ class imagick extends Extension
|
||||
protected function splitLibsIntoStaticAndShared(string $allLibs): array
|
||||
{
|
||||
[$static, $shared] = parent::splitLibsIntoStaticAndShared($allLibs);
|
||||
if (str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset')) {
|
||||
if (ToolchainManager::getToolchainClass() !== ZigToolchain::class &&
|
||||
(str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset'))
|
||||
) {
|
||||
$static .= ' -l:libstdc++.a';
|
||||
$shared = str_replace('-lstdc++', '', $shared);
|
||||
}
|
||||
|
||||
25
src/SPC/builder/extension/maxminddb.php
Normal file
25
src/SPC/builder/extension/maxminddb.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('maxminddb')]
|
||||
class maxminddb extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if (!is_dir(SOURCE_PATH . '/php-src/ext/maxminddb')) {
|
||||
$original = $this->source_dir;
|
||||
FileSystem::copyDir($original . '/ext', SOURCE_PATH . '/php-src/ext/maxminddb');
|
||||
$this->source_dir = SOURCE_PATH . '/php-src/ext/maxminddb';
|
||||
return true;
|
||||
}
|
||||
$this->source_dir = SOURCE_PATH . '/php-src/ext/maxminddb';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ class memcache extends Extension
|
||||
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if (!$this->isBuildStatic()) {
|
||||
return false;
|
||||
}
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/memcache/config9.m4',
|
||||
'if test -d $abs_srcdir/src ; then',
|
||||
@@ -43,4 +46,27 @@ EOF
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function patchBeforeSharedConfigure(): bool
|
||||
{
|
||||
if (!$this->isBuildShared()) {
|
||||
return false;
|
||||
}
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/memcache/config9.m4',
|
||||
'if test -d $abs_srcdir/main ; then',
|
||||
'if test -d $abs_srcdir/src ; then',
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/memcache/config9.m4',
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir/main"',
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES"',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getExtraEnv(): array
|
||||
{
|
||||
return ['CFLAGS' => '-std=c17'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,22 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mongodb')]
|
||||
class mongodb extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/ext/mongodb/config.m4',
|
||||
'/^(\s+)(src\/libmongoc\/)/m',
|
||||
'$1${ac_config_dir}/$2'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' ';
|
||||
@@ -24,4 +35,9 @@ class mongodb extends Extension
|
||||
$arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
|
||||
return clean_spaces($arg);
|
||||
}
|
||||
|
||||
public function getExtraEnv(): array
|
||||
{
|
||||
return ['CFLAGS' => '-std=c17'];
|
||||
}
|
||||
}
|
||||
|
||||
22
src/SPC/builder/extension/mysqlnd_ed25519.php
Normal file
22
src/SPC/builder/extension/mysqlnd_ed25519.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mysqlnd_ed25519')]
|
||||
class mysqlnd_ed25519 extends Extension
|
||||
{
|
||||
public function getConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--with-mysqlnd_ed25519' . ($shared ? '=shared' : '');
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return $this->getConfigureArg();
|
||||
}
|
||||
}
|
||||
22
src/SPC/builder/extension/mysqlnd_parsec.php
Normal file
22
src/SPC/builder/extension/mysqlnd_parsec.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mysqlnd_parsec')]
|
||||
class mysqlnd_parsec extends Extension
|
||||
{
|
||||
public function getConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--enable-mysqlnd_parsec' . ($shared ? '=shared' : '');
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return $this->getConfigureArg();
|
||||
}
|
||||
}
|
||||
@@ -24,28 +24,9 @@ class password_argon2 extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
$patched = parent::patchBeforeMake();
|
||||
if ($this->builder->getLib('libsodium') !== null) {
|
||||
$extraLibs = getenv('SPC_EXTRA_LIBS');
|
||||
if ($extraLibs !== false) {
|
||||
$extraLibs = str_replace(
|
||||
[BUILD_LIB_PATH . '/libargon2.a', BUILD_LIB_PATH . '/libsodium.a'],
|
||||
['', BUILD_LIB_PATH . '/libargon2.a ' . BUILD_LIB_PATH . '/libsodium.a'],
|
||||
$extraLibs,
|
||||
);
|
||||
$extraLibs = trim(preg_replace('/\s+/', ' ', $extraLibs)); // normalize spacing
|
||||
f_putenv('SPC_EXTRA_LIBS=' . $extraLibs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return $patched;
|
||||
}
|
||||
|
||||
public function getConfigureArg(bool $shared = false): string
|
||||
{
|
||||
if ($this->builder->getLib('openssl') !== null) {
|
||||
if ($this->builder->getExt('openssl')?->isBuildStatic() || $this->isBuildShared()) {
|
||||
if ($this->builder->getPHPVersionID() >= 80500 || ($this->builder->getPHPVersionID() >= 80400 && !$this->builder->getOption('enable-zts'))) {
|
||||
return '--without-password-argon2'; // use --with-openssl-argon2 in openssl extension instead
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class pgsql extends Extension
|
||||
protected function getExtraEnv(): array
|
||||
{
|
||||
return [
|
||||
'CFLAGS' => '-Wno-int-conversion',
|
||||
'CFLAGS' => '-std=c17 -Wno-int-conversion',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace SPC\builder\extension;
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
|
||||
#[CustomExt('rdkafka')]
|
||||
class rdkafka extends Extension
|
||||
@@ -15,6 +16,7 @@ class rdkafka extends Extension
|
||||
{
|
||||
FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\n", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm \$RDKAFKA_LIBS\n");
|
||||
FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\"\n", '-L$RDKAFKA_DIR/$PHP_LIBDIR -lm $RDKAFKA_LIBS"');
|
||||
FileSystem::replaceFileStr("{$this->source_dir}/config.m4", 'PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,', 'AC_CHECK_LIB([$LIBNAME], [$LIBSYMBOL],');
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,8 +39,7 @@ class rdkafka extends Extension
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1];
|
||||
$pkgconf_libs = trim(implode('', $pkgconf_libs));
|
||||
return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' RDKAFKA_LIBS="' . $pkgconf_libs . '"';
|
||||
$pkgconf_libs = (new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]))->getExtensionConfig($this);
|
||||
return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . " RDKAFKA_LIBS=\"{$pkgconf_libs['libs']}\"";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\ValidationException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
@@ -23,12 +24,7 @@ class readline extends Extension
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$enable = '--without-libedit --with-readline=' . BUILD_ROOT_PATH;
|
||||
if ($this->builder->getPHPVersionID() < 84000) {
|
||||
// the check uses `char rl_pending_input()` instead of `extern int rl_pending_input`, which makes LTO fail
|
||||
$enable .= ' ac_cv_lib_readline_rl_pending_input=yes';
|
||||
}
|
||||
return $enable;
|
||||
return '--with-libedit --without-readline';
|
||||
}
|
||||
|
||||
public function buildUnixShared(): void
|
||||
@@ -39,4 +35,13 @@ class readline extends Extension
|
||||
}
|
||||
parent::buildUnixShared();
|
||||
}
|
||||
|
||||
public function runCliCheckUnix(): void
|
||||
{
|
||||
parent::runCliCheckUnix();
|
||||
[$ret, $out] = shell()->execWithResult('printf "exit\n" | ' . BUILD_BIN_PATH . '/php -a');
|
||||
if ($ret !== 0 || !str_contains(implode("\n", $out), 'Interactive shell')) {
|
||||
throw new ValidationException("readline extension failed sanity check. Code: {$ret}, output: " . implode("\n", $out));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\toolchain\ZigToolchain;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('simdjson')]
|
||||
@@ -17,7 +19,7 @@ class simdjson extends Extension
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||
'/php_version=(`.*`)$/m',
|
||||
'php_version=' . strval($php_ver)
|
||||
'php_version=' . $php_ver
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||
@@ -31,4 +33,18 @@ class simdjson extends Extension
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$env = parent::getSharedExtensionEnv();
|
||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
$extra = getenv('SPC_COMPILER_EXTRA');
|
||||
if (!str_contains((string) $extra, '-lstdc++')) {
|
||||
f_putenv('SPC_COMPILER_EXTRA=' . clean_spaces($extra . ' -lstdc++'));
|
||||
}
|
||||
$env['CFLAGS'] .= ' -Xclang -target-feature -Xclang +evex512';
|
||||
$env['CXXFLAGS'] .= ' -Xclang -target-feature -Xclang +evex512';
|
||||
}
|
||||
return $env;
|
||||
}
|
||||
}
|
||||
|
||||
29
src/SPC/builder/extension/snmp.php
Normal file
29
src/SPC/builder/extension/snmp.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\PkgConfigUtil;
|
||||
|
||||
#[CustomExt('snmp')]
|
||||
class snmp extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
// Overwrite m4 config using newer PHP version
|
||||
if ($this->builder->getPHPVersionID() < 80400) {
|
||||
FileSystem::copy(ROOT_DIR . '/src/globals/extra/snmp-ext-config-old.m4', "{$this->source_dir}/config.m4");
|
||||
}
|
||||
$libs = implode(' ', PkgConfigUtil::getLibsArray('netsnmp'));
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->source_dir}/config.m4",
|
||||
'PHP_EVAL_LIBLINE([$SNMP_LIBS], [SNMP_SHARED_LIBADD])',
|
||||
"SNMP_LIBS=\"{$libs}\"\nPHP_EVAL_LIBLINE([\$SNMP_LIBS], [SNMP_SHARED_LIBADD])"
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class spx extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$arg = '--enable-spx' . ($shared ? '=shared' : '');
|
||||
$arg = '--enable-SPX' . ($shared ? '=shared' : '');
|
||||
if ($this->builder->getLib('zlib') !== null) {
|
||||
$arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
@@ -29,4 +29,27 @@ class spx extends Extension
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
$this->source_dir . '/config.m4',
|
||||
'CFLAGS="$CFLAGS -Werror -Wall -O3 -pthread -std=gnu90"',
|
||||
'CFLAGS="$CFLAGS -pthread"'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
$this->source_dir . '/src/php_spx.h',
|
||||
"extern zend_module_entry spx_module_entry;\n",
|
||||
"extern zend_module_entry spx_module_entry;;\n#define phpext_spx_ptr &spx_module_entry\n"
|
||||
);
|
||||
FileSystem::copy($this->source_dir . '/src/php_spx.h', $this->source_dir . '/php_spx.h');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$env = parent::getSharedExtensionEnv();
|
||||
$env['SPX_SHARED_LIBADD'] = $env['LIBS'];
|
||||
return $env;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,14 @@ class sqlsrv extends Extension
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
$makefile = SOURCE_PATH . '/php-src/Makefile';
|
||||
$makeContent = file_get_contents($makefile);
|
||||
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/W4\b/m', '$1', $makeContent);
|
||||
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/WX\b/m', '$1', $makeContent);
|
||||
file_put_contents($makefile, $makeContent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ class swoole extends Extension
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
$patched = parent::patchBeforeMake();
|
||||
FileSystem::replaceFileStr($this->source_dir . '/ext-src/php_swoole_private.h', 'PHP_VERSION_ID > 80500', 'PHP_VERSION_ID >= 80600');
|
||||
if ($this->builder instanceof MacOSBuilder) {
|
||||
// Fix swoole with event extension <util.h> conflict bug
|
||||
$util_path = shell()->execWithResult('xcrun --show-sdk-path', false)[1][0] . '/usr/include/util.h';
|
||||
@@ -49,19 +50,16 @@ class swoole extends Extension
|
||||
|
||||
// commonly used feature: coroutine-time
|
||||
$arg .= ' --enable-swoole-coro-time --with-pic';
|
||||
$arg .= ' --enable-swoole-ssh --enable-swoole-curl';
|
||||
|
||||
$arg .= $this->builder->getOption('enable-zts') ? ' --enable-swoole-thread --disable-thread-context' : ' --disable-swoole-thread --enable-thread-context';
|
||||
|
||||
// required features: curl, openssl (but curl hook is buggy for php 8.0)
|
||||
$arg .= $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
|
||||
$arg .= ' --enable-openssl';
|
||||
|
||||
// additional features that only require libraries
|
||||
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
|
||||
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
|
||||
$arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
|
||||
$arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : '';
|
||||
$arg .= $this->builder->getLib('liburing') ? ' --enable-iouring' : '';
|
||||
$arg .= $this->builder->getLib('liburing') && getenv('SPC_LIBC') !== 'glibc' ? ' --enable-iouring --enable-uring-socket' : '--disable-iouring';
|
||||
$arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : '';
|
||||
|
||||
// enable additional features that require the pdo extension, but conflict with pdo_* extensions
|
||||
@@ -69,11 +67,15 @@ class swoole extends Extension
|
||||
$arg .= $this->builder->getExt('swoole-hook-pgsql') ? ' --enable-swoole-pgsql' : ' --disable-swoole-pgsql';
|
||||
$arg .= $this->builder->getExt('swoole-hook-mysql') ? ' --enable-mysqlnd' : ' --disable-mysqlnd';
|
||||
$arg .= $this->builder->getExt('swoole-hook-sqlite') ? ' --enable-swoole-sqlite' : ' --disable-swoole-sqlite';
|
||||
|
||||
if ($this->builder->getExt('swoole-hook-odbc')) {
|
||||
$config = (new SPCConfigUtil($this->builder, ['libs_only_deps' => true]))->config([], ['unixodbc']);
|
||||
$config = (new SPCConfigUtil($this->builder))->getLibraryConfig($this->builder->getLib('unixodbc'));
|
||||
$arg .= ' --with-swoole-odbc=unixODBC,' . BUILD_ROOT_PATH . ' SWOOLE_ODBC_LIBS="' . $config['libs'] . '"';
|
||||
}
|
||||
$arg .= $this->builder->getExt('ftp')?->isBuildStatic() ? ' --disable-swoole-ftp' : ' --enable-swoole-ftp';
|
||||
|
||||
if ($this->getExtVersion() >= '6.1.0') {
|
||||
$arg .= ' --enable-swoole-stdext';
|
||||
}
|
||||
|
||||
if (SPCTarget::getTargetOS() === 'Darwin') {
|
||||
$arg .= ' ac_cv_lib_pthread_pthread_barrier_init=no';
|
||||
|
||||
19
src/SPC/builder/extension/trader.php
Normal file
19
src/SPC/builder/extension/trader.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('trader')]
|
||||
class trader extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/trader/config.m4', 'PHP_TA', 'PHP_TRADER');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace SPC\builder\extension;
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\SourcePatcher;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\GlobalEnvManager;
|
||||
|
||||
#[CustomExt('xlswriter')]
|
||||
class xlswriter extends Extension
|
||||
@@ -28,6 +29,13 @@ class xlswriter extends Extension
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
$patched = parent::patchBeforeMake();
|
||||
|
||||
// Remove when https://github.com/viest/php-ext-xlswriter/pull/560 is merged
|
||||
if (PHP_OS_FAMILY !== 'Windows') {
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -std=gnu17');
|
||||
$patched = true;
|
||||
}
|
||||
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
// fix windows build with openssl extension duplicate symbol bug
|
||||
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir);
|
||||
@@ -40,4 +48,10 @@ class xlswriter extends Extension
|
||||
}
|
||||
return $patched;
|
||||
}
|
||||
|
||||
// Remove when https://github.com/viest/php-ext-xlswriter/pull/560 is merged
|
||||
protected function getExtraEnv(): array
|
||||
{
|
||||
return ['CFLAGS' => '-std=gnu17'];
|
||||
}
|
||||
}
|
||||
|
||||
17
src/SPC/builder/extension/zip.php
Normal file
17
src/SPC/builder/extension/zip.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('zip')]
|
||||
class zip extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return !$shared ? '--with-zip=' . BUILD_ROOT_PATH : '--enable-zip=shared';
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class BSDBuilder extends UnixBuilderBase
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('strip sapi/cli/php');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_CLI);
|
||||
$this->deploySAPIBinary(BUILD_TARGET_CLI);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,7 @@ class BSDBuilder extends UnixBuilderBase
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/micro')->exec('strip --strip-unneeded micro.sfx');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_MICRO);
|
||||
$this->deploySAPIBinary(BUILD_TARGET_MICRO);
|
||||
|
||||
if ($this->phar_patched) {
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
@@ -206,7 +206,7 @@ class BSDBuilder extends UnixBuilderBase
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('strip sapi/fpm/php-fpm');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_FPM);
|
||||
$this->deploySAPIBinary(BUILD_TARGET_FPM);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
12
src/SPC/builder/freebsd/library/libmpdec.php
Normal file
12
src/SPC/builder/freebsd/library/libmpdec.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd\library;
|
||||
|
||||
class libmpdec extends BSDLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libmpdec;
|
||||
|
||||
public const NAME = 'libmpdec';
|
||||
}
|
||||
@@ -7,8 +7,12 @@ namespace SPC\builder\linux;
|
||||
use SPC\builder\unix\UnixBuilderBase;
|
||||
use SPC\exception\PatchException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\DirDiff;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\store\SourcePatcher;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\toolchain\ZigToolchain;
|
||||
use SPC\util\GlobalEnvManager;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
use SPC\util\SPCTarget;
|
||||
@@ -63,7 +67,8 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
// php 8.5 contains opcache extension by default,
|
||||
// if opcache_jit is enabled for 8.5 or opcache enabled,
|
||||
// we need to disable undefined behavior sanitizer.
|
||||
f_putenv('SPC_COMPILER_EXTRA=-fno-sanitize=undefined');
|
||||
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
|
||||
f_putenv('SPC_COMPILER_EXTRA=' . trim($compiler_extra . ' -fno-sanitize=undefined'));
|
||||
}
|
||||
|
||||
if ($this->getOption('enable-zts', false)) {
|
||||
@@ -89,12 +94,14 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
// prepare build php envs
|
||||
// $musl_flag = SPCTarget::getLibc() === 'musl' ? ' -D__MUSL__' : ' -U__MUSL__';
|
||||
$php_configure_env = SystemUtil::makeEnvVarString([
|
||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
|
||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
||||
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH, // . ' -Dsomethinghere', // . $musl_flag,
|
||||
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
|
||||
// 'LIBS' => SPCTarget::getRuntimeLibs(), // do not pass static libraries here yet, they may contain polyfills for libc functions!
|
||||
]);
|
||||
|
||||
$phpvars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
|
||||
|
||||
$embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static';
|
||||
if ($embed_type !== 'static' && SPCTarget::isStatic()) {
|
||||
throw new WrongUsageException(
|
||||
@@ -105,18 +112,19 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
|
||||
$this->seekPhpSrcLogFileOnException(fn () => shell()->cd(SOURCE_PATH . '/php-src')->exec(
|
||||
$php_configure_env . ' ' .
|
||||
getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' .
|
||||
($enableCli ? '--enable-cli ' : '--disable-cli ') .
|
||||
($enableFpm ? '--enable-fpm ' . ($this->getLib('libacl') !== null ? '--with-fpm-acl ' : '') : '--disable-fpm ') .
|
||||
($enableEmbed ? "--enable-embed={$embed_type} " : '--disable-embed ') .
|
||||
($enableMicro ? '--enable-micro=all-static ' : '--disable-micro ') .
|
||||
($enableCgi ? '--enable-cgi ' : '--disable-cgi ') .
|
||||
$config_file_path .
|
||||
$config_file_scan_dir .
|
||||
$json_74 .
|
||||
$zts .
|
||||
$maxExecutionTimers .
|
||||
$this->makeStaticExtensionArgs() . ' '
|
||||
getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' .
|
||||
($enableCli ? '--enable-cli ' : '--disable-cli ') .
|
||||
($enableFpm ? '--enable-fpm ' . ($this->getLib('libacl') !== null ? '--with-fpm-acl ' : '') : '--disable-fpm ') .
|
||||
($enableEmbed ? "--enable-embed={$embed_type} " : '--disable-embed ') .
|
||||
($enableMicro ? '--enable-micro=all-static ' : '--disable-micro ') .
|
||||
($enableCgi ? '--enable-cgi ' : '--disable-cgi ') .
|
||||
$config_file_path .
|
||||
$config_file_scan_dir .
|
||||
$json_74 .
|
||||
$zts .
|
||||
$maxExecutionTimers .
|
||||
$phpvars . ' ' .
|
||||
$this->makeStaticExtensionArgs() . ' '
|
||||
));
|
||||
|
||||
$this->emitPatchPoint('before-php-make');
|
||||
@@ -153,7 +161,14 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
}
|
||||
$shared_extensions = array_map('trim', array_filter(explode(',', $this->getOption('build-shared'))));
|
||||
if (!empty($shared_extensions)) {
|
||||
logger()->info('Building shared extensions ...');
|
||||
if (SPCTarget::isStatic()) {
|
||||
throw new WrongUsageException(
|
||||
"You're building against musl libc statically (the default on Linux), but you're trying to build shared extensions.\n" .
|
||||
'Static musl libc does not implement `dlopen`, so your php binary is not able to load shared extensions.' . "\n" .
|
||||
'Either use SPC_LIBC=glibc to link against glibc on a glibc OS, use SPC_TARGET="native-native-musl -dynamic" to link against musl libc dynamically using `zig cc` or use SPC_MUSL_DYNAMIC=true on alpine.'
|
||||
);
|
||||
}
|
||||
logger()->info('Building shared extensions...');
|
||||
$this->buildSharedExts();
|
||||
}
|
||||
}
|
||||
@@ -169,40 +184,32 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
*/
|
||||
protected function buildCli(): void
|
||||
{
|
||||
if ($this->getExt('readline') && SPCTarget::isStatic()) {
|
||||
SourcePatcher::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src');
|
||||
}
|
||||
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cli");
|
||||
->exec("make {$concurrency} {$vars} cli");
|
||||
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/cli')->exec('strip --strip-unneeded php');
|
||||
}
|
||||
if ($this->getOption('with-upx-pack')) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/cli')
|
||||
->exec(getenv('UPX_EXEC') . ' --best php');
|
||||
if ($this->getExt('readline') && SPCTarget::isStatic()) {
|
||||
SourcePatcher::patchFile('musl_static_readline.patch', SOURCE_PATH . '/php-src', true);
|
||||
}
|
||||
|
||||
$this->deployBinary(BUILD_TARGET_CLI);
|
||||
$this->deploySAPIBinary(BUILD_TARGET_CLI);
|
||||
}
|
||||
|
||||
protected function buildCgi(): void
|
||||
{
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cgi");
|
||||
->exec("make {$concurrency} {$vars} cgi");
|
||||
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/cgi')->exec('strip --strip-unneeded php-cgi');
|
||||
}
|
||||
if ($this->getOption('with-upx-pack')) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/cgi')
|
||||
->exec(getenv('UPX_EXEC') . ' --best php-cgi');
|
||||
}
|
||||
|
||||
$this->deployBinary(BUILD_TARGET_CGI);
|
||||
$this->deploySAPIBinary(BUILD_TARGET_CGI);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,29 +220,33 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
if ($this->getPHPVersionID() < 80000) {
|
||||
throw new WrongUsageException('phpmicro only support PHP >= 8.0!');
|
||||
}
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
SourcePatcher::patchMicroPhar($this->getPHPVersionID());
|
||||
}
|
||||
try {
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
SourcePatcher::patchMicroPhar($this->getPHPVersionID());
|
||||
}
|
||||
|
||||
$enable_fake_cli = $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '';
|
||||
$vars = $this->getMakeExtraVars();
|
||||
$enable_fake_cli = $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '';
|
||||
$vars = $this->getMakeExtraVars();
|
||||
|
||||
// patch fake cli for micro
|
||||
$vars['EXTRA_CFLAGS'] .= $enable_fake_cli;
|
||||
$vars = SystemUtil::makeEnvVarString($vars);
|
||||
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
|
||||
// patch fake cli for micro
|
||||
$vars['EXTRA_CFLAGS'] .= $enable_fake_cli;
|
||||
$vars = SystemUtil::makeEnvVarString($vars);
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} micro");
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec("make {$concurrency} {$vars} micro");
|
||||
|
||||
$this->processMicroUPX();
|
||||
// deploy micro.sfx
|
||||
$dst = $this->deploySAPIBinary(BUILD_TARGET_MICRO);
|
||||
|
||||
$this->deployBinary(BUILD_TARGET_MICRO);
|
||||
|
||||
if ($this->phar_patched) {
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
// patch after UPX-ed micro.sfx
|
||||
$this->processUpxedMicroSfx($dst);
|
||||
} finally {
|
||||
if ($this->phar_patched) {
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,19 +256,12 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
protected function buildFpm(): void
|
||||
{
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} fpm");
|
||||
->exec("make {$concurrency} {$vars} fpm");
|
||||
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/fpm')->exec('strip --strip-unneeded php-fpm');
|
||||
}
|
||||
if ($this->getOption('with-upx-pack')) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/fpm')
|
||||
->exec(getenv('UPX_EXEC') . ' --best php-fpm');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_FPM);
|
||||
$this->deploySAPIBinary(BUILD_TARGET_FPM);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,79 +269,45 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
*/
|
||||
protected function buildEmbed(): void
|
||||
{
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
|
||||
if (!str_contains($compiler_extra, '-lcompiler_rt') && ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
$compiler_extra = trim($compiler_extra . ' -lcompiler_rt');
|
||||
GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}");
|
||||
}
|
||||
$sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared());
|
||||
$sharedExts = array_filter($sharedExts, static function ($ext) {
|
||||
return Config::getExt($ext->getName(), 'build-with-php') === true;
|
||||
});
|
||||
$install_modules = $sharedExts ? 'install-modules' : '';
|
||||
|
||||
// detect changes in module path
|
||||
$diff = new DirDiff(BUILD_MODULES_PATH, true);
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile')
|
||||
->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install");
|
||||
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs");
|
||||
|
||||
$ldflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS') ?: '';
|
||||
$libDir = BUILD_LIB_PATH;
|
||||
$modulesDir = BUILD_MODULES_PATH;
|
||||
$libphpSo = "{$libDir}/libphp.so";
|
||||
$realLibName = 'libphp.so';
|
||||
$cwd = getcwd();
|
||||
|
||||
if (preg_match('/-release\s+(\S+)/', $ldflags, $matches)) {
|
||||
$release = $matches[1];
|
||||
$realLibName = "libphp-{$release}.so";
|
||||
$libphpRelease = "{$libDir}/{$realLibName}";
|
||||
if (!file_exists($libphpRelease) && file_exists($libphpSo)) {
|
||||
rename($libphpSo, $libphpRelease);
|
||||
// process libphp.so for shared embed
|
||||
$libphpSo = BUILD_LIB_PATH . '/libphp.so';
|
||||
$libphpSoDest = BUILD_LIB_PATH . '/libphp.so';
|
||||
if (file_exists($libphpSo)) {
|
||||
// deploy libphp.so
|
||||
preg_match('/-release\s+(\S*)/', getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'), $matches);
|
||||
if (!empty($matches[1])) {
|
||||
$libphpSoDest = str_replace('.so', '-' . $matches[1] . '.so', $libphpSo);
|
||||
}
|
||||
if (file_exists($libphpRelease)) {
|
||||
chdir($libDir);
|
||||
if (file_exists($libphpSo)) {
|
||||
unlink($libphpSo);
|
||||
}
|
||||
symlink($realLibName, 'libphp.so');
|
||||
shell()->exec(sprintf(
|
||||
'patchelf --set-soname %s %s',
|
||||
escapeshellarg($realLibName),
|
||||
escapeshellarg($libphpRelease)
|
||||
));
|
||||
}
|
||||
if (is_dir($modulesDir)) {
|
||||
chdir($modulesDir);
|
||||
foreach ($this->getExts() as $ext) {
|
||||
if (!$ext->isBuildShared()) {
|
||||
continue;
|
||||
}
|
||||
$name = $ext->getName();
|
||||
$versioned = "{$name}-{$release}.so";
|
||||
$unversioned = "{$name}.so";
|
||||
$src = "{$modulesDir}/{$versioned}";
|
||||
$dst = "{$modulesDir}/{$unversioned}";
|
||||
if (is_file($src)) {
|
||||
rename($src, $dst);
|
||||
shell()->exec(sprintf(
|
||||
'patchelf --set-soname %s %s',
|
||||
escapeshellarg($unversioned),
|
||||
escapeshellarg($dst)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
chdir($cwd);
|
||||
$this->deployBinary($libphpSo, $libphpSoDest, false);
|
||||
}
|
||||
|
||||
$target = "{$libDir}/{$realLibName}";
|
||||
if (file_exists($target)) {
|
||||
[, $output] = shell()->execWithResult('readelf -d ' . escapeshellarg($target));
|
||||
$output = implode("\n", $output);
|
||||
if (preg_match('/SONAME.*\[(.+)]/', $output, $sonameMatch)) {
|
||||
$currentSoname = $sonameMatch[1];
|
||||
if ($currentSoname !== basename($target)) {
|
||||
shell()->exec(sprintf(
|
||||
'patchelf --set-soname %s %s',
|
||||
escapeshellarg(basename($target)),
|
||||
escapeshellarg($target)
|
||||
));
|
||||
}
|
||||
}
|
||||
// process shared extensions build-with-php
|
||||
$increment_files = $diff->getChangedFiles();
|
||||
foreach ($increment_files as $increment_file) {
|
||||
$this->deployBinary($increment_file, $increment_file, false);
|
||||
}
|
||||
|
||||
// process libphp.a for static embed
|
||||
if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'static') {
|
||||
$AR = getenv('AR') ?: 'ar';
|
||||
f_passthru("{$AR} -t " . BUILD_LIB_PATH . "/libphp.a | grep '\\.a$' | xargs -n1 {$AR} d " . BUILD_LIB_PATH . '/libphp.a');
|
||||
@@ -345,9 +315,7 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
SystemUtil::exportDynamicSymbols(BUILD_LIB_PATH . '/libphp.a');
|
||||
}
|
||||
|
||||
if (!$this->getOption('no-strip', false) && file_exists(BUILD_LIB_PATH . '/' . $realLibName)) {
|
||||
shell()->cd(BUILD_LIB_PATH)->exec("strip --strip-unneeded {$realLibName}");
|
||||
}
|
||||
// patch embed php scripts
|
||||
$this->patchPhpScripts();
|
||||
}
|
||||
|
||||
@@ -359,38 +327,35 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
$config = (new SPCConfigUtil($this, ['libs_only_deps' => true, 'absolute_libs' => true]))->config($this->ext_list, $this->lib_list, $this->getOption('with-suggested-exts'), $this->getOption('with-suggested-libs'));
|
||||
$static = SPCTarget::isStatic() ? '-all-static' : '';
|
||||
$lib = BUILD_LIB_PATH;
|
||||
return [
|
||||
return array_filter([
|
||||
'EXTRA_CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
||||
'EXTRA_LIBS' => $config['libs'],
|
||||
'EXTRA_LDFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'),
|
||||
'EXTRA_LDFLAGS_PROGRAM' => "-L{$lib} {$static} -pie",
|
||||
];
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip micro.sfx for Linux.
|
||||
* The micro.sfx does not support UPX directly, but we can remove UPX-info segment to adapt.
|
||||
* This will also make micro.sfx with upx-packed more like a malware fore antivirus :(
|
||||
* Patch micro.sfx after UPX compression.
|
||||
* micro needs special section handling in LinuxBuilder.
|
||||
* The micro.sfx does not support UPX directly, but we can remove UPX
|
||||
* info segment to adapt.
|
||||
* This will also make micro.sfx with upx-packed more like a malware fore antivirus
|
||||
*/
|
||||
private function processMicroUPX(): void
|
||||
private function processUpxedMicroSfx(string $dst): void
|
||||
{
|
||||
if (version_compare($this->getMicroVersion(), '0.2.0') >= 0 && !$this->getOption('no-strip', false)) {
|
||||
shell()->exec('strip --strip-unneeded ' . SOURCE_PATH . '/php-src/sapi/micro/micro.sfx');
|
||||
|
||||
if ($this->getOption('with-upx-pack')) {
|
||||
// strip first
|
||||
shell()->exec(getenv('UPX_EXEC') . ' --best ' . SOURCE_PATH . '/php-src/sapi/micro/micro.sfx');
|
||||
// cut binary with readelf
|
||||
[$ret, $out] = shell()->execWithResult('readelf -l ' . SOURCE_PATH . '/php-src/sapi/micro/micro.sfx | awk \'/LOAD|GNU_STACK/ {getline; print $1, $2, $3, $4, $6, $7}\'');
|
||||
$out[1] = explode(' ', $out[1]);
|
||||
$offset = $out[1][0];
|
||||
if ($ret !== 0 || !str_starts_with($offset, '0x')) {
|
||||
throw new PatchException('phpmicro UPX patcher', 'Cannot find offset in readelf output');
|
||||
}
|
||||
$offset = hexdec($offset);
|
||||
// remove upx extra wastes
|
||||
file_put_contents(SOURCE_PATH . '/php-src/sapi/micro/micro.sfx', substr(file_get_contents(SOURCE_PATH . '/php-src/sapi/micro/micro.sfx'), 0, $offset));
|
||||
if ($this->getOption('with-upx-pack') && version_compare($this->getMicroVersion(), '0.2.0') >= 0) {
|
||||
// strip first
|
||||
// cut binary with readelf
|
||||
[$ret, $out] = shell()->execWithResult("readelf -l {$dst} | awk '/LOAD|GNU_STACK/ {getline; print \$1, \$2, \$3, \$4, \$6, \$7}'");
|
||||
$out[1] = explode(' ', $out[1]);
|
||||
$offset = $out[1][0];
|
||||
if ($ret !== 0 || !str_starts_with($offset, '0x')) {
|
||||
throw new PatchException('phpmicro UPX patcher', 'Cannot find offset in readelf output');
|
||||
}
|
||||
$offset = hexdec($offset);
|
||||
// remove upx extra wastes
|
||||
file_put_contents($dst, substr(file_get_contents($dst), 0, $offset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
src/SPC/builder/linux/library/idn2.php
Normal file
12
src/SPC/builder/linux/library/idn2.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class idn2 extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\idn2;
|
||||
|
||||
public const NAME = 'idn2';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/krb5.php
Normal file
12
src/SPC/builder/linux/library/krb5.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class krb5 extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\krb5;
|
||||
|
||||
public const NAME = 'krb5';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libedit.php
Normal file
12
src/SPC/builder/linux/library/libedit.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libedit extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libedit;
|
||||
|
||||
public const NAME = 'libedit';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libmaxminddb.php
Normal file
12
src/SPC/builder/linux/library/libmaxminddb.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libmaxminddb extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libmaxminddb;
|
||||
|
||||
public const NAME = 'libmaxminddb';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libmpdec.php
Normal file
12
src/SPC/builder/linux/library/libmpdec.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libmpdec extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libmpdec;
|
||||
|
||||
public const NAME = 'libmpdec';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libunistring.php
Normal file
12
src/SPC/builder/linux/library/libunistring.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libunistring extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libunistring;
|
||||
|
||||
public const NAME = 'libunistring';
|
||||
}
|
||||
@@ -6,6 +6,8 @@ namespace SPC\builder\linux\library;
|
||||
|
||||
use SPC\builder\linux\SystemUtil;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\toolchain\GccNativeToolchain;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\util\executor\UnixAutoconfExecutor;
|
||||
use SPC\util\SPCTarget;
|
||||
|
||||
@@ -15,26 +17,19 @@ class liburing extends LinuxLibraryBase
|
||||
|
||||
public function patchBeforeBuild(): bool
|
||||
{
|
||||
if (!SystemUtil::isMuslDist()) {
|
||||
return false;
|
||||
if (SystemUtil::isMuslDist()) {
|
||||
FileSystem::replaceFileStr($this->source_dir . '/configure', 'realpath -s', 'realpath');
|
||||
return true;
|
||||
}
|
||||
FileSystem::replaceFileStr($this->source_dir . '/configure', 'realpath -s', 'realpath');
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function build(): void
|
||||
{
|
||||
$use_libc = SPCTarget::getLibc() !== 'glibc' || version_compare(SPCTarget::getLibcVersion(), '2.30', '>=');
|
||||
$use_libc = ToolchainManager::getToolchainClass() !== GccNativeToolchain::class || version_compare(SPCTarget::getLibcVersion(), '2.30', '>=');
|
||||
$make = UnixAutoconfExecutor::create($this);
|
||||
|
||||
if (!$use_libc) {
|
||||
$make->appendEnv([
|
||||
'CC' => 'gcc', // libc-less version fails to compile with clang or zig
|
||||
'CXX' => 'g++',
|
||||
'AR' => 'ar',
|
||||
'LD' => 'ld',
|
||||
]);
|
||||
} else {
|
||||
if ($use_libc) {
|
||||
$make->appendEnv([
|
||||
'CFLAGS' => '-D_GNU_SOURCE',
|
||||
]);
|
||||
@@ -51,7 +46,7 @@ class liburing extends LinuxLibraryBase
|
||||
$use_libc ? '--use-libc' : '',
|
||||
)
|
||||
->configure()
|
||||
->make('library', 'install ENABLE_SHARED=0', with_clean: false);
|
||||
->make('library ENABLE_SHARED=0', 'install ENABLE_SHARED=0', with_clean: false);
|
||||
|
||||
$this->patchPkgconfPrefix();
|
||||
}
|
||||
|
||||
12
src/SPC/builder/linux/library/net_snmp.php
Normal file
12
src/SPC/builder/linux/library/net_snmp.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class net_snmp extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\net_snmp;
|
||||
|
||||
public const NAME = 'net-snmp';
|
||||
}
|
||||
@@ -21,6 +21,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
use SPC\builder\linux\SystemUtil;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
class openssl extends LinuxLibraryBase
|
||||
@@ -51,6 +52,9 @@ class openssl extends LinuxLibraryBase
|
||||
$zlib_extra = '';
|
||||
}
|
||||
|
||||
$openssl_dir = getenv('OPENSSLDIR') ?: null;
|
||||
// TODO: in v3 use the following: $openssl_dir ??= SystemUtil::getOSRelease()['dist'] === 'redhat' ? '/etc/pki/tls' : '/etc/ssl';
|
||||
$openssl_dir ??= '/etc/ssl';
|
||||
$ex_lib = trim($ex_lib);
|
||||
|
||||
shell()->cd($this->source_dir)->initializeEnv($this)
|
||||
@@ -58,10 +62,11 @@ class openssl extends LinuxLibraryBase
|
||||
"{$env} ./Configure no-shared {$extra} " .
|
||||
'--prefix=' . BUILD_ROOT_PATH . ' ' .
|
||||
'--libdir=' . BUILD_LIB_PATH . ' ' .
|
||||
'--openssldir=/etc/ssl ' .
|
||||
"--openssldir={$openssl_dir} " .
|
||||
"{$zlib_extra}" .
|
||||
'enable-pie ' .
|
||||
'no-legacy ' .
|
||||
'no-tests ' .
|
||||
"linux-{$arch}"
|
||||
)
|
||||
->exec('make clean')
|
||||
@@ -78,7 +83,7 @@ class openssl extends LinuxLibraryBase
|
||||
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc'), 'prefix=')) {
|
||||
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||
}
|
||||
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Libs.private: ${libdir}/libz.a');
|
||||
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Requires.private: zlib');
|
||||
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/cmake/OpenSSL/OpenSSLConfig.cmake', '/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m', 'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}/libz.a")');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class readline extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\readline;
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace SPC\builder\macos;
|
||||
use SPC\builder\macos\library\MacOSLibraryBase;
|
||||
use SPC\builder\unix\UnixBuilderBase;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\DirDiff;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\store\SourcePatcher;
|
||||
use SPC\util\GlobalEnvManager;
|
||||
@@ -104,7 +106,7 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
|
||||
// prepare build php envs
|
||||
$envs_build_php = SystemUtil::makeEnvVarString([
|
||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
|
||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
||||
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
|
||||
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
|
||||
]);
|
||||
@@ -186,12 +188,9 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
|
||||
$shell->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cli");
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('dsymutil -f sapi/cli/php')->exec('strip -S sapi/cli/php');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_CLI);
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
$shell->exec("make {$concurrency} {$vars} cli");
|
||||
$this->deploySAPIBinary(BUILD_TARGET_CLI);
|
||||
}
|
||||
|
||||
protected function buildCgi(): void
|
||||
@@ -199,12 +198,9 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
$SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make';
|
||||
$shell->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cgi");
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('dsymutil -f sapi/cgi/php-cgi')->exec('strip -S sapi/cgi/php-cgi');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_CGI);
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
$shell->exec("make {$concurrency} {$vars} cgi");
|
||||
$this->deploySAPIBinary(BUILD_TARGET_CGI);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,30 +211,30 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
if ($this->getPHPVersionID() < 80000) {
|
||||
throw new WrongUsageException('phpmicro only support PHP >= 8.0!');
|
||||
}
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
SourcePatcher::patchMicroPhar($this->getPHPVersionID());
|
||||
}
|
||||
|
||||
$enable_fake_cli = $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '';
|
||||
$vars = $this->getMakeExtraVars();
|
||||
try {
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
SourcePatcher::patchMicroPhar($this->getPHPVersionID());
|
||||
}
|
||||
|
||||
// patch fake cli for micro
|
||||
$vars['EXTRA_CFLAGS'] .= $enable_fake_cli;
|
||||
$vars = SystemUtil::makeEnvVarString($vars);
|
||||
$enable_fake_cli = $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '';
|
||||
$vars = $this->getMakeExtraVars();
|
||||
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
// build
|
||||
$shell->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . " {$vars} micro");
|
||||
// strip
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('dsymutil -f sapi/micro/micro.sfx')->exec('strip -S sapi/micro/micro.sfx');
|
||||
}
|
||||
// patch fake cli for micro
|
||||
$vars['EXTRA_CFLAGS'] .= $enable_fake_cli;
|
||||
$vars = SystemUtil::makeEnvVarString($vars);
|
||||
|
||||
$this->deployBinary(BUILD_TARGET_MICRO);
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
// build
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
$shell->exec("make {$concurrency} {$vars} micro");
|
||||
|
||||
if ($this->phar_patched) {
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
$this->deploySAPIBinary(BUILD_TARGET_MICRO);
|
||||
} finally {
|
||||
if ($this->phar_patched) {
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,11 +246,9 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
$shell->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . " {$vars} fpm");
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('dsymutil -f sapi/fpm/php-fpm')->exec('strip -S sapi/fpm/php-fpm');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_FPM);
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
$shell->exec("make {$concurrency} {$vars} fpm");
|
||||
$this->deploySAPIBinary(BUILD_TARGET_FPM);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,10 +256,31 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
*/
|
||||
protected function buildEmbed(): void
|
||||
{
|
||||
$sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared());
|
||||
$sharedExts = array_filter($sharedExts, static function ($ext) {
|
||||
return Config::getExt($ext->getName(), 'build-with-php') === true;
|
||||
});
|
||||
$install_modules = $sharedExts ? 'install-modules' : '';
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
|
||||
|
||||
$diff = new DirDiff(BUILD_MODULES_PATH, true);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install");
|
||||
->exec('sed -i "" "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile')
|
||||
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs");
|
||||
|
||||
$libphp = BUILD_LIB_PATH . '/libphp.dylib';
|
||||
if (file_exists($libphp)) {
|
||||
$this->deployBinary($libphp, $libphp, false);
|
||||
// macOS currently have no -release option for dylib, so we just rename it here
|
||||
}
|
||||
|
||||
// process shared extensions build-with-php
|
||||
$increment_files = $diff->getChangedFiles();
|
||||
foreach ($increment_files as $increment_file) {
|
||||
$this->deployBinary($increment_file, $increment_file, false);
|
||||
}
|
||||
|
||||
if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'static') {
|
||||
$AR = getenv('AR') ?: 'ar';
|
||||
@@ -279,10 +294,10 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
private function getMakeExtraVars(): array
|
||||
{
|
||||
$config = (new SPCConfigUtil($this, ['libs_only_deps' => true]))->config($this->ext_list, $this->lib_list, $this->getOption('with-suggested-exts'), $this->getOption('with-suggested-libs'));
|
||||
return [
|
||||
return array_filter([
|
||||
'EXTRA_CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
||||
'EXTRA_LDFLAGS_PROGRAM' => '-L' . BUILD_LIB_PATH,
|
||||
'EXTRA_LIBS' => $config['libs'],
|
||||
];
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
12
src/SPC/builder/macos/library/idn2.php
Normal file
12
src/SPC/builder/macos/library/idn2.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class idn2 extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\idn2;
|
||||
|
||||
public const NAME = 'idn2';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/krb5.php
Normal file
12
src/SPC/builder/macos/library/krb5.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class krb5 extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\krb5;
|
||||
|
||||
public const NAME = 'krb5';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/libedit.php
Normal file
12
src/SPC/builder/macos/library/libedit.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libedit extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libedit;
|
||||
|
||||
public const NAME = 'libedit';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/libmaxminddb.php
Normal file
12
src/SPC/builder/macos/library/libmaxminddb.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libmaxminddb extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libmaxminddb;
|
||||
|
||||
public const NAME = 'libmaxminddb';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/libmpdec.php
Normal file
12
src/SPC/builder/macos/library/libmpdec.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libmpdec extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libmpdec;
|
||||
|
||||
public const NAME = 'libmpdec';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/libunistring.php
Normal file
12
src/SPC/builder/macos/library/libunistring.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libunistring extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libunistring;
|
||||
|
||||
public const NAME = 'libunistring';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/net_snmp.php
Normal file
12
src/SPC/builder/macos/library/net_snmp.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class net_snmp extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\net_snmp;
|
||||
|
||||
public const NAME = 'net-snmp';
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class openssl extends MacOSLibraryBase
|
||||
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc'), 'prefix=')) {
|
||||
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||
}
|
||||
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Libs.private: ${libdir}/libz.a');
|
||||
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Requires.private: zlib');
|
||||
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/cmake/OpenSSL/OpenSSLConfig.cmake', '/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m', 'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}/libz.a")');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class readline extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\readline;
|
||||
|
||||
@@ -34,7 +34,7 @@ trait UnixLibraryTrait
|
||||
$files = array_map(fn ($x) => "{$x}.pc", $conf_pc);
|
||||
}
|
||||
foreach ($files as $name) {
|
||||
$realpath = realpath(BUILD_ROOT_PATH . '/lib/pkgconfig/' . $name);
|
||||
$realpath = realpath(BUILD_LIB_PATH . '/pkgconfig/' . $name);
|
||||
if ($realpath === false) {
|
||||
throw new PatchException('pkg-config prefix patcher', 'Cannot find library [' . static::NAME . '] pkgconfig file [' . $name . '] in ' . BUILD_LIB_PATH . '/pkgconfig/ !');
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ trait UnixSystemUtilTrait
|
||||
$defined = array_unique($defined);
|
||||
sort($defined);
|
||||
// export
|
||||
if (SPCTarget::getTargetOS() === 'Linux') {
|
||||
if (SPCTarget::getTargetOS() === 'Linux' && ToolchainManager::getToolchainClass() !== ZigToolchain::class) {
|
||||
file_put_contents("{$lib_file}.dynsym", "{\n" . implode("\n", array_map(fn ($x) => " {$x};", $defined)) . "};\n");
|
||||
} else {
|
||||
file_put_contents("{$lib_file}.dynsym", implode("\n", $defined) . "\n");
|
||||
@@ -72,12 +72,8 @@ trait UnixSystemUtilTrait
|
||||
if (!is_file($symbol_file)) {
|
||||
throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available.");
|
||||
}
|
||||
// https://github.com/ziglang/zig/issues/24662
|
||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
return '-Wl,--export-dynamic';
|
||||
}
|
||||
// macOS
|
||||
if (SPCTarget::getTargetOS() !== 'Linux') {
|
||||
// macOS/zig
|
||||
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
return "-Wl,-exported_symbols_list,{$symbol_file}";
|
||||
}
|
||||
return "-Wl,--dynamic-list={$symbol_file}";
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\unix;
|
||||
|
||||
use SPC\builder\BuilderBase;
|
||||
use SPC\builder\linux\SystemUtil;
|
||||
use SPC\builder\linux\SystemUtil as LinuxSystemUtil;
|
||||
use SPC\exception\SPCException;
|
||||
use SPC\exception\SPCInternalException;
|
||||
@@ -13,6 +14,7 @@ use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\store\pkg\GoXcaddy;
|
||||
use SPC\store\SourceManager;
|
||||
use SPC\toolchain\GccNativeToolchain;
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\util\DependencyUtil;
|
||||
@@ -78,6 +80,91 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
$this->lib_list = $sorted_libraries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip unneeded symbols from binary file.
|
||||
*/
|
||||
public function stripBinary(string $binary_path): void
|
||||
{
|
||||
shell()->exec(match (PHP_OS_FAMILY) {
|
||||
'Darwin' => "strip -S {$binary_path}",
|
||||
'Linux' => "strip --strip-unneeded {$binary_path}",
|
||||
default => throw new SPCInternalException('stripBinary is only supported on Linux and macOS'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract debug information from binary file.
|
||||
*
|
||||
* @param string $binary_path the path to the binary file, including executables, shared libraries, etc
|
||||
*/
|
||||
public function extractDebugInfo(string $binary_path): string
|
||||
{
|
||||
$target_dir = BUILD_ROOT_PATH . '/debug';
|
||||
FileSystem::createDir($target_dir);
|
||||
$basename = basename($binary_path);
|
||||
$debug_file = "{$target_dir}/{$basename}" . (PHP_OS_FAMILY === 'Darwin' ? '.dwarf' : '.debug');
|
||||
if (PHP_OS_FAMILY === 'Darwin') {
|
||||
shell()->exec("dsymutil -f {$binary_path} -o {$debug_file}");
|
||||
} elseif (PHP_OS_FAMILY === 'Linux') {
|
||||
if ($eu_strip = SystemUtil::findCommand('eu-strip')) {
|
||||
shell()
|
||||
->exec("{$eu_strip} -f {$debug_file} {$binary_path}")
|
||||
->exec("objcopy --add-gnu-debuglink={$debug_file} {$binary_path}");
|
||||
} else {
|
||||
shell()
|
||||
->exec("objcopy --only-keep-debug {$binary_path} {$debug_file}")
|
||||
->exec("objcopy --add-gnu-debuglink={$debug_file} {$binary_path}");
|
||||
}
|
||||
} else {
|
||||
throw new SPCInternalException('extractDebugInfo is only supported on Linux and macOS');
|
||||
}
|
||||
return $debug_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploy the binary file from src to dst.
|
||||
*/
|
||||
public function deployBinary(string $src, string $dst, bool $executable = true): string
|
||||
{
|
||||
logger()->debug('Deploying binary from ' . $src . ' to ' . $dst);
|
||||
|
||||
// file must exists
|
||||
if (!file_exists($src)) {
|
||||
throw new SPCInternalException("Deploy failed. Cannot find file: {$src}");
|
||||
}
|
||||
// dst dir must exists
|
||||
FileSystem::createDir(dirname($dst));
|
||||
|
||||
// ignore copy to self
|
||||
if (realpath($src) !== realpath($dst)) {
|
||||
shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg($dst));
|
||||
}
|
||||
|
||||
// file exist
|
||||
if (!file_exists($dst)) {
|
||||
throw new SPCInternalException("Deploy failed. Cannot find file after copy: {$dst}");
|
||||
}
|
||||
|
||||
if (!$this->getOption('no-strip')) {
|
||||
// extract debug info
|
||||
$this->extractDebugInfo($dst);
|
||||
// extra strip
|
||||
$this->stripBinary($dst);
|
||||
}
|
||||
|
||||
// UPX for linux
|
||||
$upx_option = $this->getOption('with-upx-pack');
|
||||
if ($upx_option && PHP_OS_FAMILY === 'Linux' && $executable) {
|
||||
if ($this->getOption('no-strip')) {
|
||||
logger()->warning('UPX compression is not recommended when --no-strip is enabled.');
|
||||
}
|
||||
logger()->info("Compressing {$dst} with UPX");
|
||||
shell()->exec(getenv('UPX_EXEC') . " --best {$dst}");
|
||||
}
|
||||
|
||||
return $dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanity check after build complete.
|
||||
*/
|
||||
@@ -148,8 +235,10 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
$lens .= ' -static';
|
||||
}
|
||||
$dynamic_exports = '';
|
||||
$embedType = 'static';
|
||||
// if someone changed to EMBED_TYPE=shared, we need to add LD_LIBRARY_PATH
|
||||
if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'shared') {
|
||||
$embedType = 'shared';
|
||||
if (PHP_OS_FAMILY === 'Darwin') {
|
||||
$ext_path = 'DYLD_LIBRARY_PATH=' . BUILD_LIB_PATH . ':$DYLD_LIBRARY_PATH ';
|
||||
} else {
|
||||
@@ -168,18 +257,19 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
}
|
||||
}
|
||||
$cc = getenv('CC');
|
||||
|
||||
[$ret, $out] = shell()->cd($sample_file_path)->execWithResult("{$cc} -o embed embed.c {$lens} {$dynamic_exports}");
|
||||
if ($ret !== 0) {
|
||||
throw new ValidationException(
|
||||
'embed failed sanity check: build failed. Error message: ' . implode("\n", $out),
|
||||
validation_module: 'static libphp.a sanity check'
|
||||
'embed failed to build. Error message: ' . implode("\n", $out),
|
||||
validation_module: $embedType . ' libphp embed build sanity check'
|
||||
);
|
||||
}
|
||||
[$ret, $output] = shell()->cd($sample_file_path)->execWithResult($ext_path . './embed');
|
||||
if ($ret !== 0 || trim(implode('', $output)) !== 'hello') {
|
||||
throw new ValidationException(
|
||||
'embed failed sanity check: run failed. Error message: ' . implode("\n", $output),
|
||||
validation_module: 'static libphp.a sanity check'
|
||||
'embed failed to run. Error message: ' . implode("\n", $output),
|
||||
validation_module: $embedType . ' libphp embed run sanity check'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -208,23 +298,20 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploy the binary file to the build bin path.
|
||||
*
|
||||
* @param int $type Type integer, one of BUILD_TARGET_CLI, BUILD_TARGET_MICRO, BUILD_TARGET_FPM
|
||||
* Deploy binaries that produces executable SAPI
|
||||
*/
|
||||
protected function deployBinary(int $type): bool
|
||||
protected function deploySAPIBinary(int $type): string
|
||||
{
|
||||
$src = match ($type) {
|
||||
BUILD_TARGET_CLI => SOURCE_PATH . '/php-src/sapi/cli/php',
|
||||
BUILD_TARGET_MICRO => SOURCE_PATH . '/php-src/sapi/micro/micro.sfx',
|
||||
BUILD_TARGET_FPM => SOURCE_PATH . '/php-src/sapi/fpm/php-fpm',
|
||||
BUILD_TARGET_CGI => SOURCE_PATH . '/php-src/sapi/cgi/php-cgi',
|
||||
BUILD_TARGET_FRANKENPHP => BUILD_BIN_PATH . '/frankenphp',
|
||||
default => throw new SPCInternalException("Deployment does not accept type {$type}"),
|
||||
};
|
||||
logger()->info('Deploying ' . $this->getBuildTypeName($type) . ' file');
|
||||
FileSystem::createDir(BUILD_BIN_PATH);
|
||||
shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg(BUILD_BIN_PATH));
|
||||
return true;
|
||||
$dst = BUILD_BIN_PATH . '/' . basename($src);
|
||||
return $this->deployBinary($src, $dst);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,22 +352,76 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the --with-frankenphp-app option
|
||||
* Creates app.tar and app.checksum in source/frankenphp directory
|
||||
*/
|
||||
protected function processFrankenphpApp(): void
|
||||
{
|
||||
$frankenphpSourceDir = getenv('FRANKENPHP_SOURCE_PATH') ?: SOURCE_PATH . '/frankenphp';
|
||||
if (!is_dir($frankenphpSourceDir)) {
|
||||
SourceManager::initSource(['frankenphp'], ['frankenphp']);
|
||||
}
|
||||
$frankenphpAppPath = $this->getOption('with-frankenphp-app');
|
||||
|
||||
if ($frankenphpAppPath) {
|
||||
$frankenphpAppPath = trim($frankenphpAppPath, "\"'");
|
||||
if (!is_dir($frankenphpAppPath)) {
|
||||
throw new WrongUsageException("The path provided to --with-frankenphp-app is not a valid directory: {$frankenphpAppPath}");
|
||||
}
|
||||
$appTarPath = $frankenphpSourceDir . '/app.tar';
|
||||
logger()->info("Creating app.tar from {$frankenphpAppPath}");
|
||||
|
||||
shell()->exec('tar -cf ' . escapeshellarg($appTarPath) . ' -C ' . escapeshellarg($frankenphpAppPath) . ' .');
|
||||
|
||||
$checksum = hash_file('md5', $appTarPath);
|
||||
file_put_contents($frankenphpSourceDir . '/app_checksum.txt', $checksum);
|
||||
} else {
|
||||
FileSystem::removeFileIfExists($frankenphpSourceDir . '/app.tar');
|
||||
FileSystem::removeFileIfExists($frankenphpSourceDir . '/app_checksum.txt');
|
||||
file_put_contents($frankenphpSourceDir . '/app.tar', '');
|
||||
file_put_contents($frankenphpSourceDir . '/app_checksum.txt', '');
|
||||
}
|
||||
}
|
||||
|
||||
protected function getFrankenPHPVersion(): string
|
||||
{
|
||||
if ($version = getenv('FRANKENPHP_VERSION')) {
|
||||
return $version;
|
||||
}
|
||||
$frankenphpSourceDir = getenv('FRANKENPHP_SOURCE_PATH') ?: SOURCE_PATH . '/frankenphp';
|
||||
$goModPath = $frankenphpSourceDir . '/caddy/go.mod';
|
||||
|
||||
if (!file_exists($goModPath)) {
|
||||
throw new SPCInternalException("FrankenPHP caddy/go.mod file not found at {$goModPath}, why did we not download FrankenPHP?");
|
||||
}
|
||||
|
||||
$content = file_get_contents($goModPath);
|
||||
if (preg_match('/github\.com\/dunglas\/frankenphp\s+v?(\d+\.\d+\.\d+)/', $content, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
throw new SPCInternalException('Could not find FrankenPHP version in caddy/go.mod');
|
||||
}
|
||||
|
||||
protected function buildFrankenphp(): void
|
||||
{
|
||||
GlobalEnvManager::addPathIfNotExists(GoXcaddy::getPath());
|
||||
$this->processFrankenphpApp();
|
||||
$nobrotli = $this->getLib('brotli') === null ? ',nobrotli' : '';
|
||||
$nowatcher = $this->getLib('watcher') === null ? ',nowatcher' : '';
|
||||
$xcaddyModules = getenv('SPC_CMD_VAR_FRANKENPHP_XCADDY_MODULES');
|
||||
// make it possible to build from a different frankenphp directory!
|
||||
if (!str_contains($xcaddyModules, '--with github.com/dunglas/frankenphp')) {
|
||||
$xcaddyModules = '--with github.com/dunglas/frankenphp ' . $xcaddyModules;
|
||||
}
|
||||
$frankenphpSourceDir = getenv('FRANKENPHP_SOURCE_PATH') ?: SOURCE_PATH . '/frankenphp';
|
||||
|
||||
$xcaddyModules = preg_replace('#--with github.com/dunglas/frankenphp\S*#', '', $xcaddyModules);
|
||||
$xcaddyModules = "--with github.com/dunglas/frankenphp={$frankenphpSourceDir} " .
|
||||
"--with github.com/dunglas/frankenphp/caddy={$frankenphpSourceDir}/caddy {$xcaddyModules}";
|
||||
if ($this->getLib('brotli') === null && str_contains($xcaddyModules, '--with github.com/dunglas/caddy-cbrotli')) {
|
||||
logger()->warning('caddy-cbrotli module is enabled, but brotli library is not built. Disabling caddy-cbrotli.');
|
||||
$xcaddyModules = str_replace('--with github.com/dunglas/caddy-cbrotli', '', $xcaddyModules);
|
||||
}
|
||||
[, $out] = shell()->execWithResult('go list -m github.com/dunglas/frankenphp@latest');
|
||||
$frankenPhpVersion = str_replace('github.com/dunglas/frankenphp v', '', $out[0]);
|
||||
|
||||
$frankenPhpVersion = $this->getFrankenPHPVersion();
|
||||
$libphpVersion = $this->getPHPVersion();
|
||||
$dynamic_exports = '';
|
||||
if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'shared') {
|
||||
@@ -290,20 +431,18 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
$dynamic_exports = ' ' . $dynamicSymbolsArgument;
|
||||
}
|
||||
}
|
||||
$debugFlags = $this->getOption('no-strip') ? '-w -s ' : '';
|
||||
$extLdFlags = "-extldflags '-pie{$dynamic_exports}'";
|
||||
$extLdFlags = "-extldflags '-pie{$dynamic_exports} {$this->arch_ld_flags}'";
|
||||
$muslTags = '';
|
||||
$staticFlags = '';
|
||||
if (SPCTarget::isStatic()) {
|
||||
$extLdFlags = "-extldflags '-static-pie -Wl,-z,stack-size=0x80000{$dynamic_exports}'";
|
||||
$extLdFlags = "-extldflags '-static-pie -Wl,-z,stack-size=0x80000{$dynamic_exports} {$this->arch_ld_flags}'";
|
||||
$muslTags = 'static_build,';
|
||||
$staticFlags = '-static-pie';
|
||||
}
|
||||
|
||||
$config = (new SPCConfigUtil($this))->config($this->ext_list, $this->lib_list);
|
||||
$cflags = "{$this->arch_c_flags} {$config['cflags']} " . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS');
|
||||
$cflags = "{$this->arch_c_flags} {$config['cflags']} " . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -DFRANKENPHP_VERSION=' . $frankenPhpVersion;
|
||||
$libs = $config['libs'];
|
||||
$libs .= PHP_OS_FAMILY === 'Linux' ? ' -lrt' : '';
|
||||
// Go's gcc driver doesn't automatically link against -lgcov or -lrt. Ugly, but necessary fix.
|
||||
if ((str_contains((string) getenv('SPC_DEFAULT_C_FLAGS'), '-fprofile') ||
|
||||
str_contains((string) getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'), '-fprofile')) &&
|
||||
@@ -316,23 +455,20 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
'CGO_CFLAGS' => clean_spaces($cflags),
|
||||
'CGO_LDFLAGS' => "{$this->arch_ld_flags} {$staticFlags} {$config['ldflags']} {$libs}",
|
||||
'XCADDY_GO_BUILD_FLAGS' => '-buildmode=pie ' .
|
||||
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' . $debugFlags .
|
||||
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' .
|
||||
'-X \'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy\' ' .
|
||||
'-X \'github.com/caddyserver/caddy/v2.CustomBinaryName=frankenphp\' ' .
|
||||
'-X \'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ' .
|
||||
"v{$frankenPhpVersion} PHP {$libphpVersion} Caddy'\\\" " .
|
||||
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",
|
||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||
], ...GoXcaddy::getEnvironment()];
|
||||
$pgo = file_exists("{$frankenphpSourceDir}/caddy/frankenphp/default.pgo") ? "--pgo {$frankenphpSourceDir}/caddy/frankenphp/default.pgo " : '';
|
||||
shell()->cd(BUILD_BIN_PATH)
|
||||
->setEnv($env)
|
||||
->exec("xcaddy build --output frankenphp {$xcaddyModules}");
|
||||
->exec("xcaddy build --output frankenphp {$pgo}{$xcaddyModules}");
|
||||
|
||||
if (!$this->getOption('no-strip', false) && file_exists(BUILD_BIN_PATH . '/frankenphp')) {
|
||||
if (PHP_OS_FAMILY === 'Linux') {
|
||||
shell()->cd(BUILD_BIN_PATH)->exec('strip --strip-unneeded frankenphp');
|
||||
} else { // macOS doesn't understand strip-unneeded
|
||||
shell()->cd(BUILD_BIN_PATH)->exec('strip -S frankenphp');
|
||||
}
|
||||
}
|
||||
$this->deploySAPIBinary(BUILD_TARGET_FRANKENPHP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ trait attr
|
||||
->exec('libtoolize --force --copy')
|
||||
->exec('./autogen.sh || autoreconf -if')
|
||||
->configure('--disable-nls')
|
||||
->make();
|
||||
->make('install-attributes_h install-data install-libattr_h install-libLTLIBRARIES install-pkgincludeHEADERS install-pkgconfDATA', with_install: false);
|
||||
$this->patchPkgconfPrefix(['libattr.pc'], PKGCONF_PATCH_PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\executor\UnixCMakeExecutor;
|
||||
|
||||
trait curl
|
||||
@@ -23,6 +24,8 @@ trait curl
|
||||
->optionalLib('zstd', ...cmake_boolean_args('CURL_ZSTD'))
|
||||
->optionalLib('idn2', ...cmake_boolean_args('USE_LIBIDN2'))
|
||||
->optionalLib('psl', ...cmake_boolean_args('CURL_USE_LIBPSL'))
|
||||
->optionalLib('krb5', ...cmake_boolean_args('CURL_USE_GSSAPI'))
|
||||
->optionalLib('idn2', ...cmake_boolean_args('CURL_USE_IDN2'))
|
||||
->optionalLib('libcares', '-DENABLE_ARES=ON')
|
||||
->addConfigureArgs(
|
||||
'-DBUILD_CURL_EXE=OFF',
|
||||
@@ -30,8 +33,16 @@ trait curl
|
||||
)
|
||||
->build();
|
||||
|
||||
// patch pkgconf
|
||||
$this->patchPkgconfPrefix(['libcurl.pc']);
|
||||
// On glibc <2.28 without built-in pthreads, FindThreads sets
|
||||
// INTERFACE_LINK_LIBRARIES to '-lpthread'
|
||||
// curls .pc generator walks and prepends '-l' to each
|
||||
// entry, resulting in -l-lpthread
|
||||
FileSystem::replaceFileRegex(
|
||||
BUILD_LIB_PATH . '/pkgconfig/libcurl.pc',
|
||||
'/-l(-l\S+)/',
|
||||
'$1'
|
||||
);
|
||||
shell()->cd(BUILD_LIB_PATH . '/cmake/CURL/')
|
||||
->exec("sed -ie 's|\"/lib/libcurl.a\"|\"" . BUILD_LIB_PATH . "/libcurl.a\"|g' CURLTargets-release.cmake");
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ trait freetype
|
||||
{
|
||||
$cmake = UnixCMakeExecutor::create($this)
|
||||
->optionalLib('libpng', ...cmake_boolean_args('FT_DISABLE_PNG', true))
|
||||
->optionalLib('bzip2', ...cmake_boolean_args('FT_DISABLE_BZIP2', true))
|
||||
->optionalLib('brotli', ...cmake_boolean_args('FT_DISABLE_BROTLI', true))
|
||||
->addConfigureArgs('-DFT_DISABLE_BZIP2=ON')
|
||||
->addConfigureArgs('-DFT_DISABLE_BROTLI=ON')
|
||||
->addConfigureArgs('-DFT_DISABLE_HARFBUZZ=ON');
|
||||
|
||||
// fix cmake 4.0 compatibility
|
||||
|
||||
@@ -16,7 +16,11 @@ trait gettext
|
||||
->addConfigureArgs(
|
||||
'--disable-java',
|
||||
'--disable-c++',
|
||||
'--with-included-gettext',
|
||||
'--disable-d',
|
||||
'--disable-rpath',
|
||||
'--disable-modula2',
|
||||
'--disable-libasprintf',
|
||||
'--with-included-libintl',
|
||||
"--with-iconv-prefix={$this->getBuildRootPath()}",
|
||||
);
|
||||
|
||||
@@ -31,7 +35,7 @@ trait gettext
|
||||
$autoconf->addConfigureArgs('--disable-threads');
|
||||
}
|
||||
|
||||
$autoconf->configure()->make();
|
||||
$autoconf->configure()->make(dir: $this->getSourceDir() . '/gettext-runtime/intl');
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,14 @@ trait gmp
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)->configure()->make();
|
||||
UnixAutoconfExecutor::create($this)
|
||||
->appendEnv([
|
||||
'CFLAGS' => '-std=c17',
|
||||
])
|
||||
->configure(
|
||||
'--enable-fat'
|
||||
)
|
||||
->make();
|
||||
$this->patchPkgconfPrefix(['gmp.pc']);
|
||||
}
|
||||
}
|
||||
|
||||
27
src/SPC/builder/unix/library/idn2.php
Normal file
27
src/SPC/builder/unix/library/idn2.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\util\executor\UnixAutoconfExecutor;
|
||||
|
||||
trait idn2
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)
|
||||
->configure(
|
||||
'--disable-nls',
|
||||
'--disable-doc',
|
||||
'--enable-year2038',
|
||||
'--disable-rpath'
|
||||
)
|
||||
->optionalLib('libiconv', "--with-libiconv-prefix={$this->getBuildRootPath()}")
|
||||
->optionalLib('libunistring', "--with-libunistring-prefix={$this->getBuildRootPath()}")
|
||||
->optionalLib('gettext', "--with-libnintl-prefix={$this->getBuildRootPath()}")
|
||||
->make();
|
||||
$this->patchPkgconfPrefix(['libidn2.pc']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,11 @@ trait imagemagick
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
$original_ldflags = $this->builder->arch_ld_flags;
|
||||
if (str_contains($this->builder->arch_ld_flags, '-Wl,--as-needed')) {
|
||||
$this->builder->arch_ld_flags = str_replace('-Wl,--as-needed', '', $original_ldflags);
|
||||
}
|
||||
|
||||
$ac = UnixAutoconfExecutor::create($this)
|
||||
->optionalLib('libzip', ...ac_with_args('zip'))
|
||||
->optionalLib('libjpeg', ...ac_with_args('jpeg'))
|
||||
@@ -32,7 +37,7 @@ trait imagemagick
|
||||
);
|
||||
|
||||
// special: linux-static target needs `-static`
|
||||
$ldflags = SPCTarget::isStatic() ? ('-static -ldl') : '-ldl';
|
||||
$ldflags = SPCTarget::isStatic() ? '-static -ldl' : '-ldl';
|
||||
|
||||
// special: macOS needs -iconv
|
||||
$libs = SPCTarget::getTargetOS() === 'Darwin' ? '-liconv' : '';
|
||||
@@ -45,6 +50,8 @@ trait imagemagick
|
||||
|
||||
$ac->configure()->make();
|
||||
|
||||
$this->builder->arch_ld_flags = $original_ldflags;
|
||||
|
||||
$filelist = [
|
||||
'ImageMagick.pc',
|
||||
'ImageMagick-7.Q16HDRI.pc',
|
||||
|
||||
66
src/SPC/builder/unix/library/krb5.php
Normal file
66
src/SPC/builder/unix/library/krb5.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\toolchain\ToolchainManager;
|
||||
use SPC\toolchain\ZigToolchain;
|
||||
use SPC\util\executor\UnixAutoconfExecutor;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
|
||||
trait krb5
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
$origin_source_dir = $this->source_dir;
|
||||
$this->source_dir .= '/src';
|
||||
shell()->cd($this->source_dir)->exec('ls -lah');
|
||||
if (!file_exists($this->source_dir . '/configure')) {
|
||||
shell()->cd($this->source_dir)->exec('autoreconf -if');
|
||||
}
|
||||
$libs = array_map(fn ($x) => $x->getName(), $this->getDependencies(true));
|
||||
$spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]);
|
||||
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs', false));
|
||||
$extraEnv = [
|
||||
'CFLAGS' => '-fcommon',
|
||||
'LIBS' => $config['libs'],
|
||||
];
|
||||
if (getenv('SPC_LD_LIBRARY_PATH') && getenv('SPC_LIBRARY_PATH')) {
|
||||
$extraEnv = [...$extraEnv, ...[
|
||||
'LD_LIBRARY_PATH' => getenv('SPC_LD_LIBRARY_PATH'),
|
||||
'LIBRARY_PATH' => getenv('SPC_LIBRARY_PATH'),
|
||||
]];
|
||||
}
|
||||
$args = [
|
||||
'--disable-nls',
|
||||
'--disable-rpath',
|
||||
'--without-system-verto',
|
||||
];
|
||||
if (PHP_OS_FAMILY === 'Darwin') {
|
||||
$extraEnv['LDFLAGS'] = '-framework Kerberos';
|
||||
$args[] = 'ac_cv_func_secure_getenv=no';
|
||||
}
|
||||
$make = UnixAutoconfExecutor::create($this)
|
||||
->appendEnv($extraEnv)
|
||||
->optionalLib('ldap', '--with-ldap', '--without-ldap')
|
||||
->optionalLib('libedit', '--with-libedit', '--without-libedit')
|
||||
->configure(...$args);
|
||||
|
||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
$make->exec('find . -name Makefile -exec sed -i "s/-Werror=incompatible-pointer-types//g" {} +');
|
||||
}
|
||||
$make->make();
|
||||
$this->patchPkgconfPrefix([
|
||||
'krb5-gssapi.pc',
|
||||
'krb5.pc',
|
||||
'kadm-server.pc',
|
||||
'kadm-client.pc',
|
||||
'kdb.pc',
|
||||
'mit-krb5-gssapi.pc',
|
||||
'mit-krb5.pc',
|
||||
'gssrpc.pc',
|
||||
]);
|
||||
$this->source_dir = $origin_source_dir;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ trait libacl
|
||||
->exec('libtoolize --force --copy')
|
||||
->exec('./autogen.sh || autoreconf -if')
|
||||
->configure('--disable-nls', '--disable-tests')
|
||||
->make();
|
||||
->make('install-acl_h install-libacl_h install-data install-libLTLIBRARIES install-pkgincludeHEADERS install-sysincludeHEADERS install-pkgconfDATA', with_install: false);
|
||||
$this->patchPkgconfPrefix(['libacl.pc'], PKGCONF_PATCH_PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@ trait libavif
|
||||
protected function build(): void
|
||||
{
|
||||
UnixCMakeExecutor::create($this)
|
||||
->optionalLib('libaom', '-DAVIF_CODEC_AOM=SYSTEM', '-DAVIF_CODEC_AOM=OFF')
|
||||
->optionalLib('libsharpyuv', '-DAVIF_LIBSHARPYUV=SYSTEM', '-DAVIF_LIBSHARPYUV=OFF')
|
||||
->optionalLib('libjpeg', '-DAVIF_JPEG=SYSTEM', '-DAVIF_JPEG=OFF')
|
||||
->optionalLib('libxml2', '-DAVIF_LIBXML2=SYSTEM', '-DAVIF_LIBXML2=OFF')
|
||||
->optionalLib('libpng', '-DAVIF_LIBPNG=SYSTEM', '-DAVIF_LIBPNG=OFF')
|
||||
->addConfigureArgs('-DAVIF_LIBYUV=OFF')
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
|
||||
@@ -11,7 +11,11 @@ trait libde265
|
||||
protected function build(): void
|
||||
{
|
||||
UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs('-DENABLE_SDL=OFF')
|
||||
->addConfigureArgs(
|
||||
'-DENABLE_SDL=OFF',
|
||||
'-DENABLE_DECODER=OFF',
|
||||
'-DHAVE_NEON=OFF',
|
||||
)
|
||||
->build();
|
||||
$this->patchPkgconfPrefix(['libde265.pc']);
|
||||
}
|
||||
|
||||
30
src/SPC/builder/unix/library/libedit.php
Normal file
30
src/SPC/builder/unix/library/libedit.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\executor\UnixAutoconfExecutor;
|
||||
|
||||
trait libedit
|
||||
{
|
||||
public function patchBeforeBuild(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
$this->source_dir . '/src/sys.h',
|
||||
'|//#define\s+strl|',
|
||||
'#define strl'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function build(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)
|
||||
->appendEnv(['CFLAGS' => '-D__STDC_ISO_10646__=201103L'])
|
||||
->configure()
|
||||
->make();
|
||||
$this->patchPkgconfPrefix(['libedit.pc']);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,13 @@ trait libiconv
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)->configure('--enable-extra-encodings')->make();
|
||||
UnixAutoconfExecutor::create($this)
|
||||
->configure(
|
||||
'--enable-extra-encodings',
|
||||
'--enable-year2038',
|
||||
)
|
||||
->make('install-lib', with_install: false)
|
||||
->make('install-lib', with_install: false, dir: $this->getSourceDir() . '/libcharset');
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user