mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 22:35:43 +08:00
Compare commits
503 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9cd4d7e36 | ||
|
|
56080f40ef | ||
|
|
bb0a3589c1 | ||
|
|
db109e3586 | ||
|
|
289f4b300a | ||
|
|
0ee9a0cfa4 | ||
|
|
d9f7aa760e | ||
|
|
01ab0d3530 | ||
|
|
8bd7794a2e | ||
|
|
fcfbb59637 | ||
|
|
089b94d753 | ||
|
|
bfba598ef4 | ||
|
|
e2efaab2b2 | ||
|
|
28e5e584b4 | ||
|
|
e0734fe848 | ||
|
|
2ea8a7e662 | ||
|
|
c0ea47ce75 | ||
|
|
84fb354bc0 | ||
|
|
9f35c954ac | ||
|
|
78b3778442 | ||
|
|
0e092284eb | ||
|
|
4be1e75128 | ||
|
|
62a581393d | ||
|
|
cec5274ea3 | ||
|
|
80f2912026 | ||
|
|
70b91867cb | ||
|
|
a1ccddb53c | ||
|
|
5a7db86471 | ||
|
|
518ed3a7fd | ||
|
|
d322be1666 | ||
|
|
a503aaa8a0 | ||
|
|
a7771e95f2 | ||
|
|
311de9381c | ||
|
|
c3aa7356ec | ||
|
|
63656cf383 | ||
|
|
6d3e2d9316 | ||
|
|
dcdd167db3 | ||
|
|
9ed62b02b6 | ||
|
|
145fe7ce13 | ||
|
|
b320eb853a | ||
|
|
474fe63ad3 | ||
|
|
da45aa7f15 | ||
|
|
11f21304f9 | ||
|
|
6cb2cdd5a2 | ||
|
|
9e8119e69c | ||
|
|
25c2bafa88 | ||
|
|
ae56bed032 | ||
|
|
4c8f9e154d | ||
|
|
0ed6f2924e | ||
|
|
8896d477aa | ||
|
|
1b08a250f6 | ||
|
|
8b09e1a446 | ||
|
|
720251458f | ||
|
|
a48680c26f | ||
|
|
684b5d4534 | ||
|
|
aedcc86fc5 | ||
|
|
978975d396 | ||
|
|
c9e9119bff | ||
|
|
20f222d19e | ||
|
|
187d51e501 | ||
|
|
fa744bb802 | ||
|
|
bed5b9d4ef | ||
|
|
13540c8008 | ||
|
|
48df491c31 | ||
|
|
3fbf8fcfb8 | ||
|
|
104038bc7e | ||
|
|
bb37c0058e | ||
|
|
f4e1d7d4c1 | ||
|
|
e6c9a82cd3 | ||
|
|
0ca71b62db | ||
|
|
936c4d8696 | ||
|
|
1c1f7b19dd | ||
|
|
0558d67240 | ||
|
|
3bb9a7b1f8 | ||
|
|
123cc92756 | ||
|
|
9babe7f1d2 | ||
|
|
f46b714990 | ||
|
|
3497b2a760 | ||
|
|
acd10bd978 | ||
|
|
802950d941 | ||
|
|
f158fba48d | ||
|
|
059d134990 | ||
|
|
f7871c0036 | ||
|
|
42943b315c | ||
|
|
37b9ccfaa8 | ||
|
|
1cf2a3dd3f | ||
|
|
1718806042 | ||
|
|
7d26aa533a | ||
|
|
521af84797 | ||
|
|
53eb6dcc80 | ||
|
|
6ed440d861 | ||
|
|
a99c4a3fee | ||
|
|
0ebd44bc4f | ||
|
|
2f53915064 | ||
|
|
08d3849c43 | ||
|
|
bb1f086674 | ||
|
|
f4771b4f21 | ||
|
|
2093b4ec85 | ||
|
|
e5f483de1d | ||
|
|
23be5484e3 | ||
|
|
0b8543e6dd | ||
|
|
a3025479e7 | ||
|
|
a6ea49981d | ||
|
|
2a39fb0bd5 | ||
|
|
2dde53760a | ||
|
|
a7e48a8d3b | ||
|
|
4fae158a3c | ||
|
|
7d87856f4a | ||
|
|
cfa525351a | ||
|
|
f9de43c7d4 | ||
|
|
e00227f0c6 | ||
|
|
e31942bf1e | ||
|
|
111de20a57 | ||
|
|
635fbae3c9 | ||
|
|
f29ee95176 | ||
|
|
0d91ad7d94 | ||
|
|
715650c4db | ||
|
|
a68212672b | ||
|
|
fce115d39c | ||
|
|
301f2d8a97 | ||
|
|
500c19d900 | ||
|
|
617b0de31f | ||
|
|
92ad792eff | ||
|
|
560f684f7f | ||
|
|
a0c0555089 | ||
|
|
9fa1fb7b44 | ||
|
|
f5fa49338d | ||
|
|
df7cfa0d6a | ||
|
|
a0579efbc2 | ||
|
|
b6a1182876 | ||
|
|
4582e1f508 | ||
|
|
621e396373 | ||
|
|
300723419b | ||
|
|
f75ab9f428 | ||
|
|
dbc7ff5de7 | ||
|
|
856db3df08 | ||
|
|
1479bef00d | ||
|
|
3761a9c8ba | ||
|
|
7c4c8c6275 | ||
|
|
3b9670c202 | ||
|
|
861010af0e | ||
|
|
57b527c886 | ||
|
|
31652e8b04 | ||
|
|
8b94a7174f | ||
|
|
01a79fcc6e | ||
|
|
17b4c18830 | ||
|
|
86541b1aa8 | ||
|
|
e022a45048 | ||
|
|
94e31f1953 | ||
|
|
ad8581db97 | ||
|
|
e2191113b0 | ||
|
|
161a553948 | ||
|
|
80f63e66c3 | ||
|
|
2f25409475 | ||
|
|
67320d3eb3 | ||
|
|
92aeb2d816 | ||
|
|
3420f6ca42 | ||
|
|
8e5efb923f | ||
|
|
ab4e0bc406 | ||
|
|
8993b3f4f0 | ||
|
|
499c281931 | ||
|
|
bb7e0f6f89 | ||
|
|
8919a2fcca | ||
|
|
ba0796c9ea | ||
|
|
1b7404f194 | ||
|
|
5add534848 | ||
|
|
ef7ebdfd1f | ||
|
|
42f356d322 | ||
|
|
dabf52511f | ||
|
|
df85f97646 | ||
|
|
a9d37bb2a2 | ||
|
|
6b689f1584 | ||
|
|
4b0fa94b3c | ||
|
|
c53b06c3d2 | ||
|
|
ed87a7cd67 | ||
|
|
108bf34cca | ||
|
|
8b98792ccf | ||
|
|
7c009b6dce | ||
|
|
5ae5a3d75d | ||
|
|
396ddd3e6f | ||
|
|
da7a125faf | ||
|
|
febf9b1815 | ||
|
|
55b4ba5832 | ||
|
|
3bc5ac28be | ||
|
|
93eb6378ba | ||
|
|
61837f0d68 | ||
|
|
c44b8b1029 | ||
|
|
8312ce4d4c | ||
|
|
3052b1cca5 | ||
|
|
ad3860981a | ||
|
|
2dbcbc6963 | ||
|
|
8767181a80 | ||
|
|
4c64707138 | ||
|
|
764fdd4d08 | ||
|
|
4c124770ed | ||
|
|
78b2a89b0a | ||
|
|
6147721314 | ||
|
|
2a5915f4b6 | ||
|
|
5382362168 | ||
|
|
3867b9933d | ||
|
|
4299abf68b | ||
|
|
b68701f51b | ||
|
|
c551efb75c | ||
|
|
92acb95a58 | ||
|
|
e2ea10d2eb | ||
|
|
d833d8946c | ||
|
|
3662e079ac | ||
|
|
c972a94876 | ||
|
|
234df8d11f | ||
|
|
14ca782672 | ||
|
|
9665473669 | ||
|
|
a8987d48ed | ||
|
|
f83715c370 | ||
|
|
a9d5dcf4a2 | ||
|
|
e568041143 | ||
|
|
4ce7374ac9 | ||
|
|
ed35b65390 | ||
|
|
15dc672bcf | ||
|
|
51891478e4 | ||
|
|
c2d5afc4e9 | ||
|
|
835fc1e360 | ||
|
|
2a70b998e3 | ||
|
|
5eecd14ce0 | ||
|
|
0afe0e5f46 | ||
|
|
396d4b341f | ||
|
|
bc002d500e | ||
|
|
6a86b28977 | ||
|
|
b91c83b6cd | ||
|
|
4b8412dfdb | ||
|
|
3713ae8c93 | ||
|
|
310be957b6 | ||
|
|
c29ca9722f | ||
|
|
64b6f98ce7 | ||
|
|
4a44282556 | ||
|
|
e3d7969b96 | ||
|
|
b68d71b7b7 | ||
|
|
b376d1682f | ||
|
|
af51469b62 | ||
|
|
fc7df585bd | ||
|
|
3ff31d20cf | ||
|
|
11c116480f | ||
|
|
fd5bc54cd0 | ||
|
|
95380168ef | ||
|
|
d349627fa1 | ||
|
|
3f8d297fb1 | ||
|
|
aae6c2c98b | ||
|
|
7698ceb108 | ||
|
|
495e868a71 | ||
|
|
95a2f4600b | ||
|
|
c43423a7d0 | ||
|
|
fa285ecc82 | ||
|
|
f47daac3cc | ||
|
|
03ca3f4f59 | ||
|
|
a9f81dd38e | ||
|
|
93c6928624 | ||
|
|
1e50dac5a6 | ||
|
|
545a653c0d | ||
|
|
20b6870f90 | ||
|
|
ca6f19f77d | ||
|
|
14a0e1a6cc | ||
|
|
38dfcdabd0 | ||
|
|
683371adaa | ||
|
|
7ba1948101 | ||
|
|
5bd53ed714 | ||
|
|
bff99fa537 | ||
|
|
54ff71798c | ||
|
|
81474336c1 | ||
|
|
6b50700d8c | ||
|
|
f708907d99 | ||
|
|
117923791a | ||
|
|
ea7c145c62 | ||
|
|
bdd764218b | ||
|
|
1fbd2c1adc | ||
|
|
2ff300970a | ||
|
|
f88c10d4aa | ||
|
|
eab8c27e4a | ||
|
|
c1e91e1ccb | ||
|
|
05e9129a66 | ||
|
|
76a9be2167 | ||
|
|
872673655e | ||
|
|
1ae27c7b5a | ||
|
|
b402b735d6 | ||
|
|
22001792cd | ||
|
|
9557c9ef21 | ||
|
|
6fe8b591ce | ||
|
|
23ae3f60f3 | ||
|
|
03b634b961 | ||
|
|
2897fdda04 | ||
|
|
f5fffafd43 | ||
|
|
e884f97621 | ||
|
|
e4028da886 | ||
|
|
a65bc95091 | ||
|
|
14563417a7 | ||
|
|
a3ee3e5a24 | ||
|
|
16a36b8315 | ||
|
|
861c49c9bc | ||
|
|
b3dacf9c5a | ||
|
|
2c13eb257b | ||
|
|
348decf72f | ||
|
|
92483cf188 | ||
|
|
8143b1d768 | ||
|
|
e7d6f37e98 | ||
|
|
d275a44895 | ||
|
|
f755d66342 | ||
|
|
22a438ed5e | ||
|
|
a014294d58 | ||
|
|
39953b5223 | ||
|
|
bd341db54a | ||
|
|
455ed7d503 | ||
|
|
637ae89583 | ||
|
|
7fd858b472 | ||
|
|
74d8377400 | ||
|
|
a29992b907 | ||
|
|
57097d1275 | ||
|
|
b21c62c11d | ||
|
|
0b3421e3cd | ||
|
|
a7adec1341 | ||
|
|
a236ee3ac3 | ||
|
|
d7b9e5a7d4 | ||
|
|
3d1738b14b | ||
|
|
f0e634a4fa | ||
|
|
0f5f60e477 | ||
|
|
9fe09f57f6 | ||
|
|
cf24b88bc8 | ||
|
|
d34fa0ba4e | ||
|
|
f40170ee6f | ||
|
|
2da750d5f9 | ||
|
|
720e700701 | ||
|
|
b452f7f32a | ||
|
|
7bfb8d6f53 | ||
|
|
b06db1f920 | ||
|
|
61eafa48ff | ||
|
|
8b07b15f6c | ||
|
|
5e67133495 | ||
|
|
30b740b7f0 | ||
|
|
7501ae4b4d | ||
|
|
4391c30299 | ||
|
|
536641eadd | ||
|
|
21594cd4c0 | ||
|
|
d4b263bc9f | ||
|
|
4e4eaed123 | ||
|
|
610843398e | ||
|
|
615e680b9b | ||
|
|
4e67c63808 | ||
|
|
f556f375ee | ||
|
|
f21f833aed | ||
|
|
0c6dd7a577 | ||
|
|
fc4872c5d6 | ||
|
|
3fe50e9ca3 | ||
|
|
a5e4d6a5ec | ||
|
|
0524129b64 | ||
|
|
7ce13751a0 | ||
|
|
e149ee0d70 | ||
|
|
2f3c71e55a | ||
|
|
5c04638cb4 | ||
|
|
6dd6d807b6 | ||
|
|
237d39f09c | ||
|
|
7a2f77193f | ||
|
|
d21980170e | ||
|
|
7dec34bdfe | ||
|
|
62d619b6cd | ||
|
|
67afffeb96 | ||
|
|
c58ea0c3bd | ||
|
|
acb8cea437 | ||
|
|
11f0957963 | ||
|
|
2d7c052fd9 | ||
|
|
23bd216cc7 | ||
|
|
50cfc5899b | ||
|
|
01d3cb4b11 | ||
|
|
a940200164 | ||
|
|
4e5c0f0a48 | ||
|
|
8e5657eff0 | ||
|
|
631a1b5864 | ||
|
|
67d2ad5511 | ||
|
|
ab4d7fae7d | ||
|
|
0e4a3f5e2b | ||
|
|
87c0535624 | ||
|
|
5648681ecc | ||
|
|
2c0bb1f7ba | ||
|
|
16d82212dd | ||
|
|
6ea1d06460 | ||
|
|
936413a6d9 | ||
|
|
88ce2eafab | ||
|
|
3915c8410b | ||
|
|
4115e42dc6 | ||
|
|
48f257f85a | ||
|
|
acdec64144 | ||
|
|
0beb97648a | ||
|
|
5564559192 | ||
|
|
8cb93bc1fe | ||
|
|
ae23b721b3 | ||
|
|
df06a4bb2c | ||
|
|
f37110605e | ||
|
|
8459754692 | ||
|
|
fc08e5cf23 | ||
|
|
6dec44bdc3 | ||
|
|
8cd69b2b70 | ||
|
|
625a03e799 | ||
|
|
aa4d4db11f | ||
|
|
76c353e790 | ||
|
|
8909b62dc4 | ||
|
|
371a588396 | ||
|
|
ee54b6d347 | ||
|
|
3ba215c35c | ||
|
|
161a3924d2 | ||
|
|
7b6fae6d92 | ||
|
|
71b52e58b2 | ||
|
|
d0a66ab16b | ||
|
|
9d75265e25 | ||
|
|
744e066d5f | ||
|
|
1791b443bc | ||
|
|
e850df505c | ||
|
|
918223e7da | ||
|
|
1552d992df | ||
|
|
f0a895691b | ||
|
|
1f7c805da4 | ||
|
|
1ad33556e9 | ||
|
|
6b5e83b98e | ||
|
|
6fb9c2df3b | ||
|
|
1b29803ed2 | ||
|
|
3477857584 | ||
|
|
0ce2c894e9 | ||
|
|
92470a35da | ||
|
|
6447fec028 | ||
|
|
0bc143cac3 | ||
|
|
8a4ba7a876 | ||
|
|
146a4d334b | ||
|
|
d86b7c4cec | ||
|
|
b1931059a5 | ||
|
|
a2476690c2 | ||
|
|
99be7b078b | ||
|
|
8925e97e62 | ||
|
|
4558204962 | ||
|
|
b4f3657323 | ||
|
|
91a3a01c39 | ||
|
|
4cc985a39b | ||
|
|
39a66daf04 | ||
|
|
2681a88488 | ||
|
|
e1162606f5 | ||
|
|
c6d4934dd6 | ||
|
|
21265cd561 | ||
|
|
a6b843f4dd | ||
|
|
d643051759 | ||
|
|
58eafe5100 | ||
|
|
74edcb7d6f | ||
|
|
e7bac8f78d | ||
|
|
5caf5b7694 | ||
|
|
76ac57edf4 | ||
|
|
d15b387bea | ||
|
|
b534cdce11 | ||
|
|
f246125677 | ||
|
|
2c644d5c18 | ||
|
|
ec3c0dc934 | ||
|
|
09c0e43501 | ||
|
|
878e17ddb4 | ||
|
|
c52ab62fa6 | ||
|
|
40ea306008 | ||
|
|
be3d68cebe | ||
|
|
4e32ff47df | ||
|
|
c6552f6800 | ||
|
|
511fd0e301 | ||
|
|
77bbc7fcaa | ||
|
|
53f82d286c | ||
|
|
bed40c3d05 | ||
|
|
29a0f2facb | ||
|
|
4bc4c2ff05 | ||
|
|
460699c48c | ||
|
|
89e8c152dc | ||
|
|
5caaa4d1d4 | ||
|
|
939fd88789 | ||
|
|
067b02f6d7 | ||
|
|
2afd39fbf1 | ||
|
|
1ce1c326b2 | ||
|
|
b6324fd71e | ||
|
|
7e462d6625 | ||
|
|
2a9cd436b6 | ||
|
|
4eeb48cdc2 | ||
|
|
23bfad6f87 | ||
|
|
36dc18012a | ||
|
|
d30d1fc447 | ||
|
|
15c7e41501 | ||
|
|
b6243d8478 | ||
|
|
cf30418be9 | ||
|
|
a95d034e98 | ||
|
|
29ea46bd17 | ||
|
|
8a17e2384e | ||
|
|
60dbb18504 | ||
|
|
5f53b34fae | ||
|
|
6b227d88ac | ||
|
|
34934368a2 | ||
|
|
15af034b34 | ||
|
|
1f281cd376 | ||
|
|
95d741496e | ||
|
|
21de1a2291 | ||
|
|
d047176fc9 | ||
|
|
7b1e2fb89e | ||
|
|
cb73222e21 | ||
|
|
9c878ce613 | ||
|
|
4beea4ad39 | ||
|
|
0aab10ba31 | ||
|
|
daa6196afc | ||
|
|
75ee69b07d | ||
|
|
f19e90afd7 |
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml, vue}]
|
||||||
|
indent_size = 2
|
||||||
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Build PHP or library failed, download failed, doesn't seem to work...
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: crazywhalecc
|
||||||
|
|
||||||
|
---
|
||||||
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: new feature
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
10
.github/ISSUE_TEMPLATE/something-want-to-know.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/something-want-to-know.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Something want to know
|
||||||
|
about: Describe your question about static-php, we will reply ASAP
|
||||||
|
title: ''
|
||||||
|
labels: question
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
1
.github/pull_request_template.md
vendored
1
.github/pull_request_template.md
vendored
@@ -7,6 +7,7 @@
|
|||||||
> If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
|
> If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
|
||||||
> If a modification is not involved, please skip it directly.
|
> If a modification is not involved, please skip it directly.
|
||||||
|
|
||||||
|
- [ ] If you modified `*.php`, run `composer cs-fix` at local machine.
|
||||||
- [ ] If it's an extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`.
|
- [ ] If it's an extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`.
|
||||||
- [ ] If you changed the behavior of static-php-cli, update docs in `./docs/`.
|
- [ ] If you changed the behavior of static-php-cli, update docs in `./docs/`.
|
||||||
- [ ] If you updated `config/xxx.json` content, run `bin/spc dev:sort-config xxx`.
|
- [ ] If you updated `config/xxx.json` content, run `bin/spc dev:sort-config xxx`.
|
||||||
|
|||||||
65
.github/workflows/build-unix.yml
vendored
65
.github/workflows/build-unix.yml
vendored
@@ -6,23 +6,65 @@ on:
|
|||||||
os:
|
os:
|
||||||
required: true
|
required: true
|
||||||
description: Build target OS
|
description: Build target OS
|
||||||
|
default: 'linux-x86_64'
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- 'linux-x86_64'
|
- 'linux-x86_64'
|
||||||
- 'linux-aarch64'
|
- 'linux-aarch64'
|
||||||
|
- 'linux-x86_64-glibc'
|
||||||
|
- 'linux-aarch64-glibc'
|
||||||
- 'macos-x86_64'
|
- 'macos-x86_64'
|
||||||
- 'macos-aarch64'
|
- 'macos-aarch64'
|
||||||
php-version:
|
php-version:
|
||||||
required: true
|
required: true
|
||||||
description: PHP version to compile
|
description: PHP version to compile
|
||||||
default: '8.3'
|
default: '8.4'
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- '8.4'
|
- '8.4'
|
||||||
- '8.3'
|
- '8.3'
|
||||||
- '8.2'
|
- '8.2'
|
||||||
- '8.1'
|
- '8.1'
|
||||||
- '8.0'
|
extensions:
|
||||||
|
description: Extensions to build (comma separated)
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
extra-libs:
|
||||||
|
description: Extra libraries to build (optional, comma separated)
|
||||||
|
type: string
|
||||||
|
build-cli:
|
||||||
|
description: Build cli binary
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
build-micro:
|
||||||
|
description: Build phpmicro binary
|
||||||
|
type: boolean
|
||||||
|
build-fpm:
|
||||||
|
description: Build fpm binary
|
||||||
|
type: boolean
|
||||||
|
prefer-pre-built:
|
||||||
|
description: Prefer pre-built binaries (reduce build time)
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
debug:
|
||||||
|
description: Show full build logs
|
||||||
|
type: boolean
|
||||||
|
no-strip:
|
||||||
|
description: Keep debug symbols for debugging
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
os:
|
||||||
|
required: true
|
||||||
|
description: Build target OS
|
||||||
|
default: 'linux-x86_64'
|
||||||
|
type: string
|
||||||
|
php-version:
|
||||||
|
required: true
|
||||||
|
description: PHP version to compile
|
||||||
|
default: '8.4'
|
||||||
|
type: string
|
||||||
extensions:
|
extensions:
|
||||||
description: Extensions to build (comma separated)
|
description: Extensions to build (comma separated)
|
||||||
required: true
|
required: true
|
||||||
@@ -77,9 +119,19 @@ jobs:
|
|||||||
RUNS_ON="ubuntu-latest"
|
RUNS_ON="ubuntu-latest"
|
||||||
;;
|
;;
|
||||||
linux-aarch64)
|
linux-aarch64)
|
||||||
DOWN_CMD="SPC_USE_ARCH=aarch64 ./bin/spc-alpine-docker download"
|
DOWN_CMD="./bin/spc-alpine-docker download"
|
||||||
BUILD_CMD="SPC_USE_ARCH=aarch64 ./bin/spc-alpine-docker build"
|
BUILD_CMD="./bin/spc-alpine-docker build"
|
||||||
RUNS_ON="ubuntu-latest"
|
RUNS_ON="ubuntu-24.04-arm"
|
||||||
|
;;
|
||||||
|
linux-x86_64-glibc)
|
||||||
|
DOWN_CMD="./bin/spc-gnu-docker download"
|
||||||
|
BUILD_CMD="./bin/spc-gnu-docker build"
|
||||||
|
RUNS_ON="ubuntu-22.04"
|
||||||
|
;;
|
||||||
|
linux-aarch64-glibc)
|
||||||
|
DOWN_CMD="./bin/spc-gnu-docker download"
|
||||||
|
BUILD_CMD="./bin/spc-gnu-docker build"
|
||||||
|
RUNS_ON="ubuntu-22.04-arm"
|
||||||
;;
|
;;
|
||||||
macos-x86_64)
|
macos-x86_64)
|
||||||
DOWN_CMD="composer update --no-dev --classmap-authoritative && ./bin/spc doctor --auto-fix && ./bin/spc download"
|
DOWN_CMD="composer update --no-dev --classmap-authoritative && ./bin/spc doctor --auto-fix && ./bin/spc download"
|
||||||
@@ -129,7 +181,7 @@ jobs:
|
|||||||
- name: "Setup PHP"
|
- name: "Setup PHP"
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ inputs.php-version }}
|
php-version: 8.4
|
||||||
tools: pecl, composer
|
tools: pecl, composer
|
||||||
extensions: curl, openssl, mbstring
|
extensions: curl, openssl, mbstring
|
||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
@@ -142,7 +194,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: downloads
|
path: downloads
|
||||||
key: php-dependencies-${{ inputs.os }}
|
key: php-dependencies-${{ inputs.os }}
|
||||||
|
|
||||||
- name: "Download sources"
|
- name: "Download sources"
|
||||||
run: ${{ needs.define-build.outputs.download }}
|
run: ${{ needs.define-build.outputs.download }}
|
||||||
- name: "Build PHP"
|
- name: "Build PHP"
|
||||||
|
|||||||
2
.github/workflows/build-windows-x86_64.yml
vendored
2
.github/workflows/build-windows-x86_64.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
version:
|
version:
|
||||||
required: true
|
required: true
|
||||||
description: php version to compile
|
description: php version to compile
|
||||||
default: '8.2'
|
default: '8.4'
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- '8.4'
|
- '8.4'
|
||||||
|
|||||||
2
.github/workflows/ext-matrix-tests.yml
vendored
2
.github/workflows/ext-matrix-tests.yml
vendored
@@ -113,7 +113,7 @@ jobs:
|
|||||||
- name: "Setup PHP"
|
- name: "Setup PHP"
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: 8.2
|
php-version: 8.4
|
||||||
tools: pecl, composer
|
tools: pecl, composer
|
||||||
extensions: curl, openssl, mbstring
|
extensions: curl, openssl, mbstring
|
||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
|
|||||||
4
.github/workflows/release-build.yml
vendored
4
.github/workflows/release-build.yml
vendored
@@ -9,8 +9,8 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PHP_VERSION: 8.2
|
PHP_VERSION: 8.4
|
||||||
MICRO_VERSION: 8.2.18
|
MICRO_VERSION: 8.4.4
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-release-artifacts:
|
build-release-artifacts:
|
||||||
|
|||||||
35
.github/workflows/tests.yml
vendored
35
.github/workflows/tests.yml
vendored
@@ -17,8 +17,7 @@ on:
|
|||||||
- 'box.json'
|
- 'box.json'
|
||||||
- '.php-cs-fixer.php'
|
- '.php-cs-fixer.php'
|
||||||
|
|
||||||
permissions:
|
permissions: read-all
|
||||||
contents: read
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -34,13 +33,13 @@ jobs:
|
|||||||
- name: "Setup PHP"
|
- name: "Setup PHP"
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.4'
|
||||||
extensions: curl, openssl, mbstring
|
extensions: curl, openssl, mbstring
|
||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
tools: pecl, composer, php-cs-fixer
|
tools: pecl, composer, php-cs-fixer
|
||||||
|
|
||||||
- name: Run PHP-CS-Fixer fix
|
- name: Run PHP-CS-Fixer fix
|
||||||
run: php-cs-fixer fix --dry-run --diff --ansi
|
run: PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --dry-run --diff --ansi
|
||||||
|
|
||||||
phpstan:
|
phpstan:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -52,7 +51,7 @@ jobs:
|
|||||||
- name: "Setup PHP"
|
- name: "Setup PHP"
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.4'
|
||||||
extensions: curl, openssl, mbstring
|
extensions: curl, openssl, mbstring
|
||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
tools: composer
|
tools: composer
|
||||||
@@ -79,9 +78,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- php: '8.1'
|
|
||||||
- php: '8.2'
|
|
||||||
- php: '8.3'
|
|
||||||
- php: '8.4'
|
- php: '8.4'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -103,14 +99,13 @@ jobs:
|
|||||||
path: vendor
|
path: vendor
|
||||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-php-
|
${{ runner.os }}-php
|
||||||
|
|
||||||
- name: "Install Dependencies"
|
- name: "Install Dependencies"
|
||||||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||||
|
|
||||||
- name: "Run PHPUnit Tests"
|
- name: "Run PHPUnit Tests"
|
||||||
run: |
|
run: SPC_LIBC=glibc vendor/bin/phpunit tests/ --no-coverage
|
||||||
SPC_NO_MUSL_PATH=yes vendor/bin/phpunit tests/ --no-coverage
|
|
||||||
|
|
||||||
define-matrix:
|
define-matrix:
|
||||||
name: "Define Matrix"
|
name: "Define Matrix"
|
||||||
@@ -125,7 +120,7 @@ jobs:
|
|||||||
- name: "Setup PHP"
|
- name: "Setup PHP"
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: 8.2
|
php-version: 8.4
|
||||||
|
|
||||||
- name: Define
|
- name: Define
|
||||||
id: gendef
|
id: gendef
|
||||||
@@ -153,7 +148,7 @@ jobs:
|
|||||||
- name: "Setup PHP"
|
- name: "Setup PHP"
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: 8.2
|
php-version: 8.4
|
||||||
tools: pecl, composer
|
tools: pecl, composer
|
||||||
extensions: curl, openssl, mbstring
|
extensions: curl, openssl, mbstring
|
||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
@@ -180,26 +175,26 @@ jobs:
|
|||||||
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||||
|
|
||||||
- name: "Run Build Tests (doctor)"
|
- name: "Run Build Tests (doctor)"
|
||||||
run: bin/spc doctor --auto-fix --debug
|
run: php src/globals/test-extensions.php doctor_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
|
|
||||||
- name: "Prepare UPX for Windows"
|
- name: "Prepare UPX for Windows"
|
||||||
if: matrix.os == 'windows-latest'
|
if: ${{ startsWith(matrix.os, 'windows-') }}
|
||||||
run: |
|
run: |
|
||||||
bin/spc install-pkg upx
|
php src/globals/test-extensions.php install_upx_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $env:GITHUB_ENV
|
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $env:GITHUB_ENV
|
||||||
|
|
||||||
- name: "Prepare UPX for Linux"
|
- name: "Prepare UPX for Linux"
|
||||||
if: matrix.os == 'ubunut-latest'
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||||
run: |
|
run: |
|
||||||
bin/spc install-pkg upx
|
php src/globals/test-extensions.php install_upx_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $GITHUB_ENV
|
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: "Run Build Tests (download)"
|
- name: "Run Build Tests (download)"
|
||||||
run: php src/globals/test-extensions.php download_cmd ${{ matrix.os }} ${{ matrix.php }}
|
run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php src/globals/test-extensions.php download_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
|
|
||||||
- name: "Run Build Tests (build)"
|
- name: "Run Build Tests (build)"
|
||||||
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}
|
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
|
|
||||||
- name: "Run Build Tests (build - embed for non-windows)"
|
- name: "Run Build Tests (build - embed for non-windows)"
|
||||||
if: matrix.os != 'windows-latest'
|
if: ${{ !startsWith(matrix.os, 'windows-') }}
|
||||||
run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }}
|
run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
|
|||||||
2
.github/workflows/vitepress-deploy.yml
vendored
2
.github/workflows/vitepress-deploy.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
coverage: none
|
coverage: none
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
php-version: 8.2
|
php-version: 8.4
|
||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
|
|
||||||
- name: "Get Composer Cache Directory"
|
- name: "Get Composer Cache Directory"
|
||||||
|
|||||||
21
.gitignore
vendored
21
.gitignore
vendored
@@ -5,22 +5,25 @@ docker/extensions/
|
|||||||
docker/source/
|
docker/source/
|
||||||
|
|
||||||
# Vendor files
|
# Vendor files
|
||||||
/vendor/
|
/vendor/**
|
||||||
|
|
||||||
# default source extract directory
|
# default source extract directory
|
||||||
/source/
|
/source/**
|
||||||
|
|
||||||
|
# built by shared embed tests
|
||||||
|
/locale/
|
||||||
|
|
||||||
# default source download directory
|
# default source download directory
|
||||||
/downloads/
|
/downloads/**
|
||||||
|
|
||||||
# default source build root directory
|
# default source build root directory
|
||||||
/buildroot/
|
/buildroot/**
|
||||||
|
|
||||||
# default package root directory
|
# default package root directory
|
||||||
/pkgroot/
|
/pkgroot/**
|
||||||
|
|
||||||
# default pack:lib and release directory
|
# default pack:lib and release directory
|
||||||
/dist/
|
/dist/**
|
||||||
packlib_files.txt
|
packlib_files.txt
|
||||||
|
|
||||||
# tools cache files
|
# tools cache files
|
||||||
@@ -32,6 +35,8 @@ packlib_files.txt
|
|||||||
!/bin/spc*
|
!/bin/spc*
|
||||||
!/bin/setup-runtime*
|
!/bin/setup-runtime*
|
||||||
!/bin/spc-alpine-docker
|
!/bin/spc-alpine-docker
|
||||||
|
!/bin/php-cs-fixer-wrapper
|
||||||
|
!/bin/build-static-frankenphp
|
||||||
|
|
||||||
# exclude windows build tools
|
# exclude windows build tools
|
||||||
/php-sdk-binary-tools/
|
/php-sdk-binary-tools/
|
||||||
@@ -45,3 +50,7 @@ packlib_files.txt
|
|||||||
/docs/.vitepress/cache/
|
/docs/.vitepress/cache/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
# craft.log
|
||||||
|
craft.log
|
||||||
|
craft.yml
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ return (new PhpCsFixer\Config())
|
|||||||
'php_unit_test_class_requires_covers' => false,
|
'php_unit_test_class_requires_covers' => false,
|
||||||
'phpdoc_var_without_name' => false,
|
'phpdoc_var_without_name' => false,
|
||||||
'fully_qualified_strict_types' => false,
|
'fully_qualified_strict_types' => false,
|
||||||
|
'operator_linebreak' => false,
|
||||||
|
'php_unit_data_provider_method_order' => false,
|
||||||
])
|
])
|
||||||
->setFinder(
|
->setFinder(
|
||||||
PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests/SPC'])
|
PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests/SPC'])
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ static-php-cli(简称 `spc`)有许多特性:
|
|||||||
|
|
||||||
### 编译环境需求
|
### 编译环境需求
|
||||||
|
|
||||||
- PHP >= 8.1(这是 spc 自身需要的版本,不是支持的构建版本)
|
- PHP >= 8.4(这是 spc 自身需要的版本,不是支持的构建版本)
|
||||||
- 扩展:`mbstring,tokenizer,phar`
|
- 扩展:`mbstring,tokenizer,phar`
|
||||||
- 系统安装了 `curl` 和 `git`
|
- 系统安装了 `curl` 和 `git`
|
||||||
|
|
||||||
@@ -180,6 +180,9 @@ bin/spc --version
|
|||||||
# 检查环境依赖,并根据尝试自动安装缺失的编译工具
|
# 检查环境依赖,并根据尝试自动安装缺失的编译工具
|
||||||
./bin/spc doctor --auto-fix
|
./bin/spc doctor --auto-fix
|
||||||
|
|
||||||
|
# 输出目标项目依赖的扩展列表
|
||||||
|
./bin/spc dump-extensions /path/to/your/project --format=text
|
||||||
|
|
||||||
# 拉取所有依赖库
|
# 拉取所有依赖库
|
||||||
./bin/spc download --all
|
./bin/spc download --all
|
||||||
# 只拉取编译指定扩展需要的所有依赖(推荐)
|
# 只拉取编译指定扩展需要的所有依赖(推荐)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ which can be downloaded directly according to your needs.
|
|||||||
You can say I made a PHP builder written in PHP, pretty funny.
|
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.
|
But static-php-cli runtime only requires an environment above PHP 8.1 and extensions mentioned below.
|
||||||
|
|
||||||
- PHP >= 8.1 (This is the version required by spc itself, not the build version)
|
- PHP >= 8.4 (This is the version required by spc itself, not the build version)
|
||||||
- Extension: `mbstring,tokenizer,phar`
|
- Extension: `mbstring,tokenizer,phar`
|
||||||
- Supported OS with `curl` and `git` installed
|
- Supported OS with `curl` and `git` installed
|
||||||
|
|
||||||
@@ -194,11 +194,13 @@ Basic usage for building php with some extensions:
|
|||||||
|
|
||||||
# fetch all libraries
|
# fetch all libraries
|
||||||
./bin/spc download --all
|
./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)
|
# only fetch necessary sources by needed extensions (recommended)
|
||||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||||
# download pre-built libraries first (save time for compiling dependencies)
|
# download pre-built libraries first (save time for compiling dependencies)
|
||||||
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
./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.1 ~ 8.3)
|
# 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
|
./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
|
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
||||||
|
|||||||
158
bin/build-static-frankenphp
Executable file
158
bin/build-static-frankenphp
Executable file
@@ -0,0 +1,158 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This file is using docker to run commands
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Detect docker can run
|
||||||
|
if ! which docker >/dev/null; then
|
||||||
|
echo "Docker is not installed, please install docker first !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
DOCKER_EXECUTABLE="docker"
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
if [ $(id -u) -ne 0 ]; then
|
||||||
|
if ! docker info > /dev/null 2>&1; then
|
||||||
|
if [ "$SPC_USE_SUDO" != "yes" ]; then
|
||||||
|
echo "Docker command requires sudo"
|
||||||
|
# shellcheck disable=SC2039
|
||||||
|
echo -n 'To use sudo to run docker, run "export SPC_USE_SUDO=yes" and run command again'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
DOCKER_EXECUTABLE="sudo docker"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# to check if qemu-docker run
|
||||||
|
if [ "$SPC_USE_ARCH" = "" ]; then
|
||||||
|
SPC_USE_ARCH=current
|
||||||
|
fi
|
||||||
|
case $SPC_USE_ARCH in
|
||||||
|
current)
|
||||||
|
BASE_ARCH=$(uname -m)
|
||||||
|
if [ "$BASE_ARCH" = "arm64" ]; then
|
||||||
|
BASE_ARCH=aarch64
|
||||||
|
GO_ARCH=arm64
|
||||||
|
else
|
||||||
|
GO_ARCH=amd64
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
BASE_ARCH=aarch64
|
||||||
|
GO_ARCH=arm64
|
||||||
|
# shellcheck disable=SC2039
|
||||||
|
echo -e "\e[033m* Using different arch needs to setup qemu-static for docker !\e[0m"
|
||||||
|
$DOCKER_EXECUTABLE run --rm --privileged multiarch/qemu-user-static:register --reset > /dev/null
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Current arch is not supported to run in docker: $SPC_USE_ARCH"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Detect docker env is setup
|
||||||
|
if ! $DOCKER_EXECUTABLE images | grep -q cwcc-frankenphp-gnu-$SPC_USE_ARCH; then
|
||||||
|
echo "Docker container does not exist. Building docker image ..."
|
||||||
|
$DOCKER_EXECUTABLE build -t cwcc-frankenphp-gnu-$SPC_USE_ARCH -f- . <<EOF
|
||||||
|
FROM centos:7
|
||||||
|
RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
|
||||||
|
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
|
||||||
|
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
|
||||||
|
RUN yum clean all && \
|
||||||
|
yum makecache && \
|
||||||
|
yum update -y && \
|
||||||
|
localedef -c -i en_US -f UTF-8 en_US.UTF-8
|
||||||
|
|
||||||
|
RUN yum install -y centos-release-scl
|
||||||
|
|
||||||
|
RUN if [ "$BASE_ARCH" = "aarch64" ]; then \
|
||||||
|
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo ; \
|
||||||
|
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl.repo ; \
|
||||||
|
else \
|
||||||
|
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo ; \
|
||||||
|
fi
|
||||||
|
RUN sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
|
||||||
|
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
|
||||||
|
|
||||||
|
RUN yum update -y && \
|
||||||
|
yum install -y devtoolset-10-gcc-*
|
||||||
|
RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc
|
||||||
|
RUN source /etc/bashrc
|
||||||
|
|
||||||
|
RUN curl -o cmake.tgz -fsSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$BASE_ARCH.tar.gz && \
|
||||||
|
mkdir /cmake && \
|
||||||
|
tar -xzf cmake.tgz -C /cmake --strip-components 1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
ADD ./src /app/src
|
||||||
|
COPY ./composer.* /app/
|
||||||
|
ADD ./bin/setup-runtime /app/bin/setup-runtime
|
||||||
|
ADD ./bin/spc /app/bin/spc
|
||||||
|
RUN /app/bin/setup-runtime
|
||||||
|
RUN /app/bin/php /app/bin/composer install --no-dev --classmap-authoritative
|
||||||
|
ENV PATH="/app/bin:/cmake/bin:/usr/local/go/bin:$PATH"
|
||||||
|
ENV SPC_LIBC=glibc
|
||||||
|
|
||||||
|
ADD ./config/env.ini /app/config/env.ini
|
||||||
|
RUN bin/spc doctor --auto-fix --debug
|
||||||
|
|
||||||
|
RUN curl -o make.tgz -fsSL https://ftp.gnu.org/gnu/make/make-4.4.tar.gz && \
|
||||||
|
tar -zxvf make.tgz && \
|
||||||
|
cd make-4.4 && \
|
||||||
|
./configure && \
|
||||||
|
make && \
|
||||||
|
make install && \
|
||||||
|
ln -sf /usr/local/bin/make /usr/bin/make
|
||||||
|
|
||||||
|
RUN curl -o automake.tgz -fsSL https://ftp.gnu.org/gnu/automake/automake-1.17.tar.xz && \
|
||||||
|
tar -xvf automake.tgz && \
|
||||||
|
cd automake-1.17 && \
|
||||||
|
./configure && \
|
||||||
|
make && \
|
||||||
|
make install && \
|
||||||
|
ln -sf /usr/local/bin/automake /usr/bin/automake
|
||||||
|
|
||||||
|
RUN git clone https://github.com/static-php/gnu-frankenphp --depth=1 /frankenphp
|
||||||
|
WORKDIR /frankenphp
|
||||||
|
|
||||||
|
RUN curl -o go.tgz -fsSL https://go.dev/dl/go1.24.1.linux-$GO_ARCH.tar.gz && \
|
||||||
|
rm -rf /usr/local/go && tar -C /usr/local -xzf go.tgz
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if in ci (local terminal can execute with -it)
|
||||||
|
if [ -t 0 ]; then
|
||||||
|
INTERACT=-it
|
||||||
|
else
|
||||||
|
INTERACT=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mounting volumes
|
||||||
|
MOUNT_LIST=""
|
||||||
|
# shellcheck disable=SC2089
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/config:/app/config"
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/src:/app/src"
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/buildroot:/app/buildroot"
|
||||||
|
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)""/frankenphp-dist:/frankenphp/dist"
|
||||||
|
|
||||||
|
# Apply env in temp env file
|
||||||
|
echo 'CC=/opt/rh/devtoolset-10/root/usr/bin/gcc' > /tmp/spc-gnu-docker.env
|
||||||
|
echo 'CXX=/opt/rh/devtoolset-10/root/usr/bin/g++' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'AR=/opt/rh/devtoolset-10/root/usr/bin/ar' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'LD=/opt/rh/devtoolset-10/root/usr/bin/ld' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_DEFAULT_C_FLAGS=-fPIE -fPIC' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_LIBC=glibc' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil -lrt"' >> /tmp/spc-gnu-docker.env
|
||||||
|
|
||||||
|
# Run docker
|
||||||
|
# shellcheck disable=SC2068
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
# shellcheck disable=SC2090
|
||||||
|
|
||||||
|
$DOCKER_EXECUTABLE run --rm $INTERACT -e SPC_FIX_DEPLOY_ROOT="$(pwd)" --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-frankenphp-gnu-$SPC_USE_ARCH ./build-static.sh
|
||||||
4
bin/php-cs-fixer-wrapper
Executable file
4
bin/php-cs-fixer-wrapper
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# get parent dir, and run the php-cs-fixer
|
||||||
|
PHP_CS_FIXER_IGNORE_ENV=1 "$(dirname "$0")/../vendor/bin/php-cs-fixer" "$@"
|
||||||
@@ -25,7 +25,7 @@ __DIR__=$(cd "$(dirname "$0")" && pwd)
|
|||||||
__PROJECT__=$(cd "${__DIR__}"/../ && pwd)
|
__PROJECT__=$(cd "${__DIR__}"/../ && pwd)
|
||||||
|
|
||||||
# set download dir
|
# set download dir
|
||||||
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
||||||
__COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar"
|
__COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar"
|
||||||
|
|
||||||
# use china mirror
|
# use china mirror
|
||||||
@@ -45,7 +45,7 @@ done
|
|||||||
|
|
||||||
case "$mirror" in
|
case "$mirror" in
|
||||||
china)
|
china)
|
||||||
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
||||||
__COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
|
__COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ test -f "${__PROJECT__}"/downloads/runtime.tar.gz || { echo "Downloading $__PHP_
|
|||||||
test -f "${__DIR__}"/php || { tar -xf "${__PROJECT__}"/downloads/runtime.tar.gz -C "${__DIR__}"/ ; }
|
test -f "${__DIR__}"/php || { tar -xf "${__PROJECT__}"/downloads/runtime.tar.gz -C "${__DIR__}"/ ; }
|
||||||
chmod +x "${__DIR__}"/php
|
chmod +x "${__DIR__}"/php
|
||||||
# download composer
|
# download composer
|
||||||
test -f "${__DIR__}"/composer || curl -#fSL -o "${__DIR__}"/composer "$__COMPOSER_URL__"
|
test -f "${__DIR__}"/composer || { echo "Downloading Composer from $__COMPOSER_URL__" && curl -#fSL -o "${__DIR__}"/composer "$__COMPOSER_URL__" ; }
|
||||||
chmod +x "${__DIR__}"/composer
|
chmod +x "${__DIR__}"/composer
|
||||||
# sanity check for php and composer
|
# sanity check for php and composer
|
||||||
"${__DIR__}"/php -v >/dev/null || { echo "Failed to run php" && exit 1; }
|
"${__DIR__}"/php -v >/dev/null || { echo "Failed to run php" && exit 1; }
|
||||||
|
|||||||
@@ -51,10 +51,11 @@ if ($action -eq 'add-path') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# get php 8.1 specific version
|
# get php 8.1 specific version
|
||||||
$API = (Invoke-WebRequest -Uri "https://www.php.net/releases/index.php?json&version=8.3") | ConvertFrom-Json
|
|
||||||
|
|
||||||
# php windows download
|
# php windows download
|
||||||
$PHPRuntimeUrl = "https://windows.php.net/downloads/releases/php-" + $API.version + "-nts-Win32-vs16-x64.zip"
|
$PHPRuntimeUrl = "https://windows.php.net/downloads/releases/archives/php-8.4.4-nts-Win32-vs17-x64.zip"
|
||||||
|
Write-Host "Downloading PHP from: " -NoNewline
|
||||||
|
Write-Host $PHPRuntimeUrl -ForegroundColor Cyan
|
||||||
$ComposerUrl = "https://getcomposer.org/download/latest-stable/composer.phar"
|
$ComposerUrl = "https://getcomposer.org/download/latest-stable/composer.phar"
|
||||||
|
|
||||||
# create dir
|
# create dir
|
||||||
|
|||||||
10
bin/spc
10
bin/spc
@@ -4,6 +4,11 @@
|
|||||||
use SPC\ConsoleApplication;
|
use SPC\ConsoleApplication;
|
||||||
use SPC\exception\ExceptionHandler;
|
use SPC\exception\ExceptionHandler;
|
||||||
|
|
||||||
|
// Load custom php if exists
|
||||||
|
if (PHP_OS_FAMILY !== 'Windows' && PHP_BINARY !== (__DIR__ . '/php') && file_exists(__DIR__ . '/php') && is_executable(__DIR__ . '/php')) {
|
||||||
|
pcntl_exec(__DIR__ . '/php', $argv);
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
|
if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
|
||||||
// Current: ./bin (git/project mode)
|
// Current: ./bin (git/project mode)
|
||||||
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
@@ -17,6 +22,11 @@ if (PHP_OS_FAMILY === 'Windows' && Phar::running()) {
|
|||||||
exec('CHCP 65001');
|
exec('CHCP 65001');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print deprecation notice on PHP < 8.4, use red and highlight background
|
||||||
|
if (PHP_VERSION_ID < 80400) {
|
||||||
|
echo "\e[43mDeprecation Notice: PHP < 8.4 is deprecated, please upgrade your PHP version.\e[0m\n";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(new ConsoleApplication())->run();
|
(new ConsoleApplication())->run();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# This file is using docker to run commands
|
# This file is using docker to run commands
|
||||||
|
SPC_DOCKER_VERSION=v3
|
||||||
|
|
||||||
# Detect docker can run
|
# Detect docker can run
|
||||||
if ! which docker >/dev/null; then
|
if ! which docker >/dev/null; then
|
||||||
@@ -50,9 +51,9 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect docker env is setup
|
# Detect docker env is setup
|
||||||
if ! $DOCKER_EXECUTABLE images | grep -q cwcc-spc-$SPC_USE_ARCH; then
|
if ! $DOCKER_EXECUTABLE images | grep -q cwcc-spc-$SPC_USE_ARCH-$SPC_DOCKER_VERSION; then
|
||||||
echo "Docker container does not exist. Building docker image ..."
|
echo "Docker container does not exist. Building docker image ..."
|
||||||
$DOCKER_EXECUTABLE build -t cwcc-spc-$SPC_USE_ARCH -f- . <<EOF
|
$DOCKER_EXECUTABLE build -t cwcc-spc-$SPC_USE_ARCH-$SPC_DOCKER_VERSION -f- . <<EOF
|
||||||
FROM $ALPINE_FROM
|
FROM $ALPINE_FROM
|
||||||
$SPC_USE_MIRROR
|
$SPC_USE_MIRROR
|
||||||
RUN apk update; \
|
RUN apk update; \
|
||||||
@@ -79,26 +80,23 @@ RUN apk update; \
|
|||||||
linux-headers \
|
linux-headers \
|
||||||
m4 \
|
m4 \
|
||||||
make \
|
make \
|
||||||
php82 \
|
|
||||||
php82-common \
|
|
||||||
php82-pcntl \
|
|
||||||
php82-phar \
|
|
||||||
php82-posix \
|
|
||||||
php82-sodium \
|
|
||||||
php82-tokenizer \
|
|
||||||
php82-dom \
|
|
||||||
php82-xml \
|
|
||||||
php82-xmlwriter \
|
|
||||||
composer \
|
|
||||||
pkgconfig \
|
pkgconfig \
|
||||||
wget \
|
wget \
|
||||||
xz
|
xz \
|
||||||
|
gettext-dev \
|
||||||
|
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
|
||||||
|
|
||||||
|
RUN curl -#fSL https://getcomposer.org/download/latest-stable/composer.phar -o /usr/local/bin/composer && \
|
||||||
|
chmod +x /usr/local/bin/composer
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ADD ./src /app/src
|
ADD ./src /app/src
|
||||||
COPY ./composer.* /app/
|
COPY ./composer.* /app/
|
||||||
ADD ./bin /app/bin
|
ADD ./bin /app/bin
|
||||||
RUN composer install --no-dev --classmap-authoritative
|
RUN composer install --no-dev
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -119,9 +117,37 @@ MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/source:/app/source"
|
|||||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/dist:/app/dist"
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/dist:/app/dist"
|
||||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/downloads:/app/downloads"
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/downloads:/app/downloads"
|
||||||
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/pkgroot:/app/pkgroot"
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/pkgroot:/app/pkgroot"
|
||||||
|
if [ -f "$(pwd)/craft.yml" ]; then
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/craft.yml:/app/craft.yml"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Environment variable passthrough
|
||||||
|
ENV_LIST=""
|
||||||
|
ENV_LIST="$ENV_LIST -e SPC_FIX_DEPLOY_ROOT="$(pwd)""
|
||||||
|
if [ ! -z "$GITHUB_TOKEN" ]; then
|
||||||
|
ENV_LIST="$ENV_LIST -e GITHUB_TOKEN=$GITHUB_TOKEN"
|
||||||
|
fi
|
||||||
|
|
||||||
# Run docker
|
# Run docker
|
||||||
# shellcheck disable=SC2068
|
# shellcheck disable=SC2068
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
# shellcheck disable=SC2090
|
# shellcheck disable=SC2090
|
||||||
$DOCKER_EXECUTABLE run --rm $INTERACT -e SPC_FIX_DEPLOY_ROOT="$(pwd)" $MOUNT_LIST cwcc-spc-$SPC_USE_ARCH bin/spc $@
|
if [ "$SPC_DOCKER_DEBUG" = "yes" ]; then
|
||||||
|
echo "* Debug mode enabled, run docker in interactive mode."
|
||||||
|
echo "* You can use 'exit' to exit the docker container."
|
||||||
|
echo "* You can use 'bin/spc' like normal builds."
|
||||||
|
echo "*"
|
||||||
|
echo "* Mounted directories:"
|
||||||
|
echo "* ./config: $(pwd)/config"
|
||||||
|
echo "* ./src: $(pwd)/src"
|
||||||
|
echo "* ./buildroot: $(pwd)/buildroot"
|
||||||
|
echo "* ./source: $(pwd)/source"
|
||||||
|
echo "* ./dist: $(pwd)/dist"
|
||||||
|
echo "* ./downloads: $(pwd)/downloads"
|
||||||
|
echo "* ./pkgroot: $(pwd)/pkgroot"
|
||||||
|
echo "*"
|
||||||
|
set -ex
|
||||||
|
$DOCKER_EXECUTABLE run --rm $INTERACT $ENV_LIST $MOUNT_LIST cwcc-spc-$SPC_USE_ARCH-$SPC_DOCKER_VERSION
|
||||||
|
else
|
||||||
|
$DOCKER_EXECUTABLE run --rm $INTERACT $ENV_LIST $MOUNT_LIST cwcc-spc-$SPC_USE_ARCH-$SPC_DOCKER_VERSION bin/spc $@
|
||||||
|
fi
|
||||||
|
|||||||
174
bin/spc-gnu-docker
Executable file
174
bin/spc-gnu-docker
Executable file
@@ -0,0 +1,174 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Detect docker can run
|
||||||
|
if ! which docker >/dev/null; then
|
||||||
|
echo "Docker is not installed, please install docker first !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
DOCKER_EXECUTABLE="docker"
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
if [ $(id -u) -ne 0 ]; then
|
||||||
|
if ! docker info > /dev/null 2>&1; then
|
||||||
|
if [ "$SPC_USE_SUDO" != "yes" ] && [ "$SPC_DOCKER_DEBUG" != "yes" ]; then
|
||||||
|
echo "Docker command requires sudo"
|
||||||
|
# shellcheck disable=SC2039
|
||||||
|
echo -n 'To use sudo to run docker, run "export SPC_USE_SUDO=yes" and run command again'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
DOCKER_EXECUTABLE="sudo docker"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# to check if qemu-docker run
|
||||||
|
if [ "$SPC_USE_ARCH" = "" ]; then
|
||||||
|
SPC_USE_ARCH=current
|
||||||
|
fi
|
||||||
|
case $SPC_USE_ARCH in
|
||||||
|
current)
|
||||||
|
BASE_ARCH=$(uname -m)
|
||||||
|
if [ "$BASE_ARCH" = "arm64" ]; then
|
||||||
|
BASE_ARCH=aarch64
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
BASE_ARCH=aarch64
|
||||||
|
# shellcheck disable=SC2039
|
||||||
|
echo -e "\e[033m* Using different arch needs to setup qemu-static for docker !\e[0m"
|
||||||
|
$DOCKER_EXECUTABLE run --rm --privileged multiarch/qemu-user-static:register --reset > /dev/null
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Current arch is not supported to run in docker: $SPC_USE_ARCH"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Detect docker env is setup
|
||||||
|
if ! $DOCKER_EXECUTABLE images | grep -q cwcc-spc-gnu-$SPC_USE_ARCH; then
|
||||||
|
echo "Docker container does not exist. Building docker image ..."
|
||||||
|
$DOCKER_EXECUTABLE build -t cwcc-spc-gnu-$SPC_USE_ARCH -f- . <<EOF
|
||||||
|
FROM centos:7
|
||||||
|
RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
|
||||||
|
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
|
||||||
|
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
|
||||||
|
RUN yum clean all && \
|
||||||
|
yum makecache && \
|
||||||
|
yum update -y && \
|
||||||
|
localedef -c -i en_US -f UTF-8 en_US.UTF-8
|
||||||
|
|
||||||
|
RUN yum install -y centos-release-scl
|
||||||
|
|
||||||
|
RUN if [ "$BASE_ARCH" = "aarch64" ]; then \
|
||||||
|
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo ; \
|
||||||
|
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl.repo ; \
|
||||||
|
else \
|
||||||
|
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo ; \
|
||||||
|
fi
|
||||||
|
RUN sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
|
||||||
|
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
|
||||||
|
|
||||||
|
RUN yum update -y && \
|
||||||
|
yum install -y devtoolset-10-gcc-*
|
||||||
|
RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc
|
||||||
|
RUN source /etc/bashrc
|
||||||
|
RUN yum install -y which
|
||||||
|
|
||||||
|
RUN curl -o cmake.tgz -fsSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$BASE_ARCH.tar.gz && \
|
||||||
|
mkdir /cmake && \
|
||||||
|
tar -xzf cmake.tgz -C /cmake --strip-components 1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
ADD ./src /app/src
|
||||||
|
COPY ./composer.* /app/
|
||||||
|
ADD ./bin/setup-runtime /app/bin/setup-runtime
|
||||||
|
ADD ./bin/spc /app/bin/spc
|
||||||
|
RUN /app/bin/setup-runtime
|
||||||
|
RUN /app/bin/php /app/bin/composer install --no-dev
|
||||||
|
ENV PATH="/app/bin:/cmake/bin:$PATH"
|
||||||
|
ENV SPC_LIBC=glibc
|
||||||
|
|
||||||
|
ADD ./config/env.ini /app/config/env.ini
|
||||||
|
RUN bin/spc doctor --auto-fix --debug
|
||||||
|
|
||||||
|
RUN curl -o make.tgz -fsSL https://ftp.gnu.org/gnu/make/make-4.4.tar.gz && \
|
||||||
|
tar -zxvf make.tgz && \
|
||||||
|
cd make-4.4 && \
|
||||||
|
./configure && \
|
||||||
|
make && \
|
||||||
|
make install && \
|
||||||
|
ln -sf /usr/local/bin/make /usr/bin/make
|
||||||
|
|
||||||
|
RUN curl -o automake.tgz -fsSL https://ftp.gnu.org/gnu/automake/automake-1.17.tar.xz && \
|
||||||
|
tar -xvf automake.tgz && \
|
||||||
|
cd automake-1.17 && \
|
||||||
|
./configure && \
|
||||||
|
make && \
|
||||||
|
make install && \
|
||||||
|
ln -sf /usr/local/bin/automake /usr/bin/automake
|
||||||
|
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if in ci (local terminal can execute with -it)
|
||||||
|
if [ -t 0 ]; then
|
||||||
|
INTERACT=-it
|
||||||
|
else
|
||||||
|
INTERACT=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mounting volumes
|
||||||
|
MOUNT_LIST=""
|
||||||
|
# shellcheck disable=SC2089
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/config:/app/config"
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/src:/app/src"
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/buildroot:/app/buildroot"
|
||||||
|
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"
|
||||||
|
if [ -f "$(pwd)/craft.yml" ]; then
|
||||||
|
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/craft.yml:/app/craft.yml"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Apply env in temp env file
|
||||||
|
echo 'CC=/opt/rh/devtoolset-10/root/usr/bin/gcc' > /tmp/spc-gnu-docker.env
|
||||||
|
echo 'CXX=/opt/rh/devtoolset-10/root/usr/bin/g++' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'AR=/opt/rh/devtoolset-10/root/usr/bin/ar' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'LD=/opt/rh/devtoolset-10/root/usr/bin/ld' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_DEFAULT_C_FLAGS=-fPIE -fPIC' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_LIBC=glibc' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"' >> /tmp/spc-gnu-docker.env
|
||||||
|
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil -lrt"' >> /tmp/spc-gnu-docker.env
|
||||||
|
|
||||||
|
# Environment variable passthrough
|
||||||
|
ENV_LIST=""
|
||||||
|
ENV_LIST="$ENV_LIST -e SPC_FIX_DEPLOY_ROOT="$(pwd)""
|
||||||
|
if [ ! -z "$GITHUB_TOKEN" ]; then
|
||||||
|
ENV_LIST="$ENV_LIST -e GITHUB_TOKEN=$GITHUB_TOKEN"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run docker
|
||||||
|
# shellcheck disable=SC2068
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
# shellcheck disable=SC2090
|
||||||
|
|
||||||
|
if [ "$SPC_DOCKER_DEBUG" = "yes" ]; then
|
||||||
|
echo "* Debug mode enabled, run docker in interactive mode."
|
||||||
|
echo "* You can use 'exit' to exit the docker container."
|
||||||
|
echo "* You can use 'bin/spc' like normal builds."
|
||||||
|
echo "*"
|
||||||
|
echo "* Mounted directories:"
|
||||||
|
echo "* ./config: $(pwd)/config"
|
||||||
|
echo "* ./src: $(pwd)/src"
|
||||||
|
echo "* ./buildroot: $(pwd)/buildroot"
|
||||||
|
echo "* ./source: $(pwd)/source"
|
||||||
|
echo "* ./dist: $(pwd)/dist"
|
||||||
|
echo "* ./downloads: $(pwd)/downloads"
|
||||||
|
echo "* ./pkgroot: $(pwd)/pkgroot"
|
||||||
|
echo "*"
|
||||||
|
set -ex
|
||||||
|
$DOCKER_EXECUTABLE run --rm -it --privileged $INTERACT $ENV_LIST --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH
|
||||||
|
else
|
||||||
|
$DOCKER_EXECUTABLE run --rm $INTERACT $ENV_LIST --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH bin/spc $@
|
||||||
|
fi
|
||||||
@@ -9,17 +9,19 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">= 8.1",
|
"php": ">= 8.3",
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"ext-zlib": "*",
|
"ext-zlib": "*",
|
||||||
"laravel/prompts": "^0.1.12",
|
"laravel/prompts": "^0.1.12",
|
||||||
"symfony/console": "^5.4 || ^6 || ^7",
|
"symfony/console": "^5.4 || ^6 || ^7",
|
||||||
|
"symfony/process": "^7.2",
|
||||||
|
"symfony/yaml": "^7.2",
|
||||||
"zhamao/logger": "^1.0"
|
"zhamao/logger": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"captainhook/captainhook-phar": "^5.23",
|
"captainhook/captainhook-phar": "^5.23",
|
||||||
"captainhook/hook-installer": "^1.0",
|
"captainhook/hook-installer": "^1.0",
|
||||||
"friendsofphp/php-cs-fixer": "^3.25",
|
"friendsofphp/php-cs-fixer": "^3.60",
|
||||||
"humbug/box": "^4.5.0 || ^4.6.0",
|
"humbug/box": "^4.5.0 || ^4.6.0",
|
||||||
"nunomaduro/collision": "^7.8",
|
"nunomaduro/collision": "^7.8",
|
||||||
"phpstan/phpstan": "^1.10",
|
"phpstan/phpstan": "^1.10",
|
||||||
|
|||||||
2836
composer.lock
generated
2836
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -7,8 +7,11 @@
|
|||||||
;
|
;
|
||||||
; We need to use some pre-defined internal env vars, like `BUILD_ROOT_PATH`, `DOWNLOAD_PATH`, etc.
|
; 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 are only be defined before static-php-cli running.
|
||||||
; Here's a list of these pre-defined internal env vars, these vars are only be defined in the static-php-cli build process if not set in the shell environment:
|
|
||||||
;
|
;
|
||||||
|
; Here's a list of env vars, these value cannot be changed anywhere:
|
||||||
|
;
|
||||||
|
; 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_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_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_LIB_PATH: the path of the lib files. (default: `$BUILD_ROOT_PATH/lib`)
|
||||||
@@ -17,25 +20,19 @@
|
|||||||
; SOURCE_PATH: the path of the source files. (default: `$(pwd)/source`)
|
; SOURCE_PATH: the path of the source files. (default: `$(pwd)/source`)
|
||||||
; DOWNLOAD_PATH: the path of the download files. (default: `$(pwd)/downloads`)
|
; DOWNLOAD_PATH: the path of the download files. (default: `$(pwd)/downloads`)
|
||||||
; CPU_COUNT: the count of the CPU cores. (default: `$(nproc)`)
|
; 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`)
|
; 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`)
|
; MAC_ARCH: the MAC arch of the current system. (default: `$(uname -m)`, e.g. `x86_64`, `arm64`)
|
||||||
;
|
;
|
||||||
; Here's a list of env vars, these value cannot be changed anywhere:
|
; * These vars are only be defined in Unix (macOS, Linux, FreeBSD)Builder and cannot be changed anywhere:
|
||||||
;
|
|
||||||
; 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`)
|
|
||||||
;
|
|
||||||
; * These vars are only be defined in Unix (macOS, Linux, FreeBSD)Builder *
|
|
||||||
; PATH: static-php-cli will add `$BUILD_BIN_PATH` to PATH.
|
; 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: 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.
|
; PKG_CONFIG_PATH: static-php-cli will set `$BUILD_LIB_PATH/pkgconfig` to PKG_CONFIG_PATH.
|
||||||
; SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS: the default optimization CFLAGS for compiling php. (if --no-strip option is set: `-g -O0`, else: `-g -Os`)
|
|
||||||
;
|
;
|
||||||
; * These vars are only be defined in LinuxBuilder *
|
; * 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_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_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_LINUX_DEFAULT_AR: the default archiver for linux. (For alpine linux: `ar`, default: `$GNU_ARCH-linux-musl-ar`)
|
||||||
; SPC_PHP_DEFAULT_LD_LIBRARY_PATH_CMD: the default LD_LIBRARY_PATH for php. (linux: `LD_LIBRARY_PATH=/usr/local/musl/$GNU_ARCH-linux-musl/lib`, default: empty)
|
|
||||||
|
|
||||||
|
|
||||||
[global]
|
[global]
|
||||||
@@ -45,6 +42,14 @@ SPC_CONCURRENCY=${CPU_COUNT}
|
|||||||
SPC_SKIP_PHP_VERSION_CHECK="no"
|
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")
|
; 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=""
|
SPC_SKIP_DOCTOR_CHECK_ITEMS=""
|
||||||
|
; EXTENSION_DIR where the built php will look for extension when a .ini instructs to load them
|
||||||
|
; only useful for builds targeting not pure-static linking
|
||||||
|
; default paths
|
||||||
|
; Ubuntu/Debian: /usr/lib/php/{PHP_VERSION}/
|
||||||
|
; RHEL: /usr/lib64/php/modules
|
||||||
|
; Alpine: /usr/lib/php{PHP_VERSION}/modules
|
||||||
|
; where {PHP_VERSION} is 84 for php 8.4
|
||||||
|
; EXTENSION_DIR=
|
||||||
|
|
||||||
[windows]
|
[windows]
|
||||||
; php-sdk-binary-tools path
|
; php-sdk-binary-tools path
|
||||||
@@ -56,15 +61,15 @@ SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime
|
|||||||
|
|
||||||
[linux]
|
[linux]
|
||||||
; include PATH for musl libc.
|
; include PATH for musl libc.
|
||||||
SPC_NO_MUSL_PATH=no
|
SPC_LIBC=musl
|
||||||
; compiler environments
|
; compiler environments
|
||||||
CC=${SPC_LINUX_DEFAULT_CC}
|
CC=${SPC_LINUX_DEFAULT_CC}
|
||||||
CXX=${SPC_LINUX_DEFAULT_CXX}
|
CXX=${SPC_LINUX_DEFAULT_CXX}
|
||||||
AR=${SPC_LINUX_DEFAULT_AR}
|
AR=${SPC_LINUX_DEFAULT_AR}
|
||||||
LD=ld.gold
|
LD=ld.gold
|
||||||
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
|
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
|
||||||
SPC_DEFAULT_C_FLAGS=
|
SPC_DEFAULT_C_FLAGS="-fpic -Os"
|
||||||
SPC_DEFAULT_CXX_FLAGS=
|
SPC_DEFAULT_CXX_FLAGS="-fpic -Os"
|
||||||
; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated)
|
; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated)
|
||||||
SPC_EXTRA_LIBS=
|
SPC_EXTRA_LIBS=
|
||||||
; upx executable path
|
; upx executable path
|
||||||
@@ -76,13 +81,15 @@ SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime
|
|||||||
; buildconf command
|
; buildconf command
|
||||||
SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force"
|
SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force"
|
||||||
; configure command
|
; configure command
|
||||||
SPC_CMD_PREFIX_PHP_CONFIGURE="${SPC_PHP_DEFAULT_LD_LIBRARY_PATH_CMD} ./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg"
|
SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --disable-shared --enable-static --disable-all --disable-cgi --disable-phpdbg --with-pic"
|
||||||
; make command
|
; make command
|
||||||
SPC_CMD_PREFIX_PHP_MAKE="make -j${CPU_COUNT}"
|
SPC_CMD_PREFIX_PHP_MAKE="make -j${CPU_COUNT}"
|
||||||
|
; embed type for php, static (libphp.a) or shared (libphp.so)
|
||||||
|
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
||||||
|
|
||||||
; *** default build vars for building php ***
|
; *** default build vars for building php ***
|
||||||
; CFLAGS for configuring php
|
; CFLAGS for configuring php
|
||||||
SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS}"
|
SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS} -fpie"
|
||||||
; CPPFLAGS for configuring php
|
; CPPFLAGS for configuring php
|
||||||
SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}"
|
SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}"
|
||||||
; LDFLAGS for configuring php
|
; LDFLAGS for configuring php
|
||||||
@@ -90,9 +97,11 @@ SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}"
|
|||||||
; LIBS for configuring php
|
; LIBS for configuring php
|
||||||
SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm"
|
SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm"
|
||||||
; EXTRA_CFLAGS for `make` php
|
; EXTRA_CFLAGS for `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="${SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS} -fno-ident -fPIE"
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fno-ident -fpie ${SPC_DEFAULT_C_FLAGS}"
|
||||||
; EXTRA_LIBS for `make` php
|
; EXTRA_LIBS for `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS=""
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm"
|
||||||
|
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so
|
||||||
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=""
|
||||||
; EXTRA_LDFLAGS_PROGRAM for `make` php
|
; EXTRA_LDFLAGS_PROGRAM for `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie"
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie"
|
||||||
|
|
||||||
@@ -101,8 +110,8 @@ SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie"
|
|||||||
CC=clang
|
CC=clang
|
||||||
CXX=clang++
|
CXX=clang++
|
||||||
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
|
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
|
||||||
SPC_DEFAULT_C_FLAGS="--target=${MAC_ARCH}-apple-darwin"
|
SPC_DEFAULT_C_FLAGS="--target=${MAC_ARCH}-apple-darwin -Os"
|
||||||
SPC_DEFAULT_CXX_FLAGS="--target=${MAC_ARCH}-apple-darwin"
|
SPC_DEFAULT_CXX_FLAGS="--target=${MAC_ARCH}-apple-darwin -Os"
|
||||||
; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated)
|
; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated)
|
||||||
SPC_EXTRA_LIBS=
|
SPC_EXTRA_LIBS=
|
||||||
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
|
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
|
||||||
@@ -124,9 +133,11 @@ SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}"
|
|||||||
; LDFLAGS for configuring php
|
; LDFLAGS for configuring php
|
||||||
SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}"
|
SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}"
|
||||||
; EXTRA_CFLAGS for `make` php
|
; EXTRA_CFLAGS for `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="${SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS}"
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie ${SPC_DEFAULT_C_FLAGS}"
|
||||||
; EXTRA_LIBS for `make` php
|
; EXTRA_LIBS for `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-lresolv"
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-lresolv"
|
||||||
|
; embed type for php, static (libphp.a) or shared (libphp.dylib)
|
||||||
|
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
||||||
|
|
||||||
[freebsd]
|
[freebsd]
|
||||||
; compiler environments
|
; compiler environments
|
||||||
|
|||||||
174
config/ext.json
174
config/ext.json
@@ -24,6 +24,14 @@
|
|||||||
"bcmath": {
|
"bcmath": {
|
||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
|
"brotli": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-brotli",
|
||||||
|
"arg-type": "enable",
|
||||||
|
"lib-depends": [
|
||||||
|
"brotli"
|
||||||
|
]
|
||||||
|
},
|
||||||
"bz2": {
|
"bz2": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type-unix": "with-prefix",
|
"arg-type-unix": "with-prefix",
|
||||||
@@ -57,6 +65,13 @@
|
|||||||
"qdbm"
|
"qdbm"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"dio": {
|
||||||
|
"support": {
|
||||||
|
"BSD": "wip"
|
||||||
|
},
|
||||||
|
"type": "external",
|
||||||
|
"source": "dio"
|
||||||
|
},
|
||||||
"dom": {
|
"dom": {
|
||||||
"support": {
|
"support": {
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
@@ -85,6 +100,14 @@
|
|||||||
},
|
},
|
||||||
"type": "wip"
|
"type": "wip"
|
||||||
},
|
},
|
||||||
|
"ev": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "ev",
|
||||||
|
"arg-type-windows": "with",
|
||||||
|
"ext-depends": [
|
||||||
|
"sockets"
|
||||||
|
]
|
||||||
|
},
|
||||||
"event": {
|
"event": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
"Windows": "wip",
|
||||||
@@ -109,7 +132,7 @@
|
|||||||
},
|
},
|
||||||
"ffi": {
|
"ffi": {
|
||||||
"support": {
|
"support": {
|
||||||
"Linux": "no",
|
"Linux": "partial",
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"notes": true,
|
"notes": true,
|
||||||
@@ -246,6 +269,7 @@
|
|||||||
"Windows": "wip",
|
"Windows": "wip",
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
|
"notes": true,
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "ext-imagick",
|
"source": "ext-imagick",
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
@@ -312,13 +336,28 @@
|
|||||||
},
|
},
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "none",
|
"arg-type": "none",
|
||||||
"ext-depends": [
|
"target": [
|
||||||
"xml"
|
"static"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"lz4": {
|
||||||
|
"support": {
|
||||||
|
"Windows": "wip",
|
||||||
|
"BSD": "wip"
|
||||||
|
},
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-lz4",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"lib-depends": [
|
||||||
|
"liblz4"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mbregex": {
|
"mbregex": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
|
"target": [
|
||||||
|
"static"
|
||||||
|
],
|
||||||
"ext-depends": [
|
"ext-depends": [
|
||||||
"mbstring"
|
"mbstring"
|
||||||
],
|
],
|
||||||
@@ -348,18 +387,16 @@
|
|||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "ext-memcache",
|
"source": "ext-memcache",
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
"lib-depends": [
|
|
||||||
"zlib"
|
|
||||||
],
|
|
||||||
"ext-depends": [
|
"ext-depends": [
|
||||||
|
"zlib",
|
||||||
"session"
|
"session"
|
||||||
]
|
],
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"memcached": {
|
"memcached": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
"Windows": "wip",
|
||||||
"BSD": "wip",
|
"BSD": "wip"
|
||||||
"Linux": "no"
|
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "memcached",
|
"source": "memcached",
|
||||||
@@ -368,6 +405,10 @@
|
|||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"libmemcached"
|
"libmemcached"
|
||||||
],
|
],
|
||||||
|
"lib-depends-unix": [
|
||||||
|
"libmemcached",
|
||||||
|
"fastlz"
|
||||||
|
],
|
||||||
"ext-depends": [
|
"ext-depends": [
|
||||||
"session",
|
"session",
|
||||||
"zlib"
|
"zlib"
|
||||||
@@ -386,6 +427,10 @@
|
|||||||
"openssl",
|
"openssl",
|
||||||
"zstd",
|
"zstd",
|
||||||
"zlib"
|
"zlib"
|
||||||
|
],
|
||||||
|
"frameworks": [
|
||||||
|
"CoreFoundation",
|
||||||
|
"Security"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"msgpack": {
|
"msgpack": {
|
||||||
@@ -395,7 +440,10 @@
|
|||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "msgpack",
|
"source": "msgpack",
|
||||||
"arg-type-unix": "with",
|
"arg-type-unix": "with",
|
||||||
"arg-type-win": "enable"
|
"arg-type-win": "enable",
|
||||||
|
"ext-depends": [
|
||||||
|
"session"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"mysqli": {
|
"mysqli": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
@@ -421,9 +469,21 @@
|
|||||||
},
|
},
|
||||||
"notes": true
|
"notes": true
|
||||||
},
|
},
|
||||||
|
"odbc": {
|
||||||
|
"support": {
|
||||||
|
"BSD": "wip",
|
||||||
|
"Windows": "wip"
|
||||||
|
},
|
||||||
|
"type": "builtin",
|
||||||
|
"arg-type-unix": "custom",
|
||||||
|
"lib-depends-unix": [
|
||||||
|
"unixodbc"
|
||||||
|
]
|
||||||
|
},
|
||||||
"opcache": {
|
"opcache": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type-unix": "custom"
|
"arg-type-unix": "custom",
|
||||||
|
"zend-extension": true
|
||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"notes": true,
|
"notes": true,
|
||||||
@@ -438,6 +498,13 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"opentelemetry": {
|
||||||
|
"support": {
|
||||||
|
"BSD": "wip"
|
||||||
|
},
|
||||||
|
"type": "external",
|
||||||
|
"source": "opentelemetry"
|
||||||
|
},
|
||||||
"parallel": {
|
"parallel": {
|
||||||
"support": {
|
"support": {
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
@@ -480,19 +547,36 @@
|
|||||||
"mysqlnd"
|
"mysqlnd"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"pdo_odbc": {
|
||||||
|
"support": {
|
||||||
|
"BSD": "wip"
|
||||||
|
},
|
||||||
|
"type": "builtin",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"lib-depends-unix": [
|
||||||
|
"unixodbc"
|
||||||
|
],
|
||||||
|
"ext-depends": [
|
||||||
|
"pdo",
|
||||||
|
"odbc"
|
||||||
|
]
|
||||||
|
},
|
||||||
"pdo_pgsql": {
|
"pdo_pgsql": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "with-prefix",
|
"arg-type": "with-prefix",
|
||||||
|
"arg-type-windows": "custom",
|
||||||
"ext-depends": [
|
"ext-depends": [
|
||||||
"pdo",
|
"pdo",
|
||||||
"pgsql"
|
"pgsql"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends-unix": [
|
||||||
"postgresql"
|
"postgresql"
|
||||||
|
],
|
||||||
|
"lib-depends-windows": [
|
||||||
|
"postgresql-win"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"pdo_sqlite": {
|
"pdo_sqlite": {
|
||||||
@@ -523,14 +607,16 @@
|
|||||||
},
|
},
|
||||||
"pgsql": {
|
"pgsql": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"notes": true,
|
"notes": true,
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
"lib-depends": [
|
"lib-depends-unix": [
|
||||||
"postgresql"
|
"postgresql"
|
||||||
|
],
|
||||||
|
"lib-depends-windows": [
|
||||||
|
"postgresql-win"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"phar": {
|
"phar": {
|
||||||
@@ -586,6 +672,9 @@
|
|||||||
"arg-type": "with-prefix",
|
"arg-type": "with-prefix",
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"readline"
|
"readline"
|
||||||
|
],
|
||||||
|
"target": [
|
||||||
|
"static"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"redis": {
|
"redis": {
|
||||||
@@ -605,10 +694,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"session": {
|
"session": {
|
||||||
"type": "builtin"
|
"type": "builtin",
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"shmop": {
|
"shmop": {
|
||||||
"type": "builtin"
|
"type": "builtin",
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"simdjson": {
|
"simdjson": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
@@ -626,7 +717,8 @@
|
|||||||
],
|
],
|
||||||
"ext-depends-windows": [
|
"ext-depends-windows": [
|
||||||
"xml"
|
"xml"
|
||||||
]
|
],
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"snappy": {
|
"snappy": {
|
||||||
"support": {
|
"support": {
|
||||||
@@ -662,7 +754,6 @@
|
|||||||
},
|
},
|
||||||
"sodium": {
|
"sodium": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
@@ -720,7 +811,7 @@
|
|||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"libssh2"
|
"libssh2"
|
||||||
],
|
],
|
||||||
"ext-depends-windows": [
|
"ext-depends": [
|
||||||
"openssl",
|
"openssl",
|
||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
@@ -847,7 +938,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"tokenizer": {
|
"tokenizer": {
|
||||||
"type": "builtin"
|
"type": "builtin",
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"uuid": {
|
"uuid": {
|
||||||
"support": {
|
"support": {
|
||||||
@@ -877,14 +969,19 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"xdebug": {
|
"xdebug": {
|
||||||
"type": "builtin",
|
"type": "external",
|
||||||
|
"source": "xdebug",
|
||||||
|
"target": [
|
||||||
|
"shared"
|
||||||
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
"Windows": "wip",
|
||||||
"BSD": "no",
|
"BSD": "no",
|
||||||
"Darwin": "no",
|
"Darwin": "partial",
|
||||||
"Linux": "no"
|
"Linux": "partial"
|
||||||
},
|
},
|
||||||
"notes": true
|
"notes": true,
|
||||||
|
"zend-extension": true
|
||||||
},
|
},
|
||||||
"xhprof": {
|
"xhprof": {
|
||||||
"support": {
|
"support": {
|
||||||
@@ -896,11 +993,11 @@
|
|||||||
"source": "xhprof",
|
"source": "xhprof",
|
||||||
"ext-depends": [
|
"ext-depends": [
|
||||||
"ctype"
|
"ctype"
|
||||||
]
|
],
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"xlswriter": {
|
"xlswriter": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
@@ -927,7 +1024,8 @@
|
|||||||
],
|
],
|
||||||
"ext-depends-windows": [
|
"ext-depends-windows": [
|
||||||
"iconv"
|
"iconv"
|
||||||
]
|
],
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"xmlreader": {
|
"xmlreader": {
|
||||||
"support": {
|
"support": {
|
||||||
@@ -941,7 +1039,8 @@
|
|||||||
"ext-depends-windows": [
|
"ext-depends-windows": [
|
||||||
"xml",
|
"xml",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
],
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"xmlwriter": {
|
"xmlwriter": {
|
||||||
"support": {
|
"support": {
|
||||||
@@ -954,7 +1053,8 @@
|
|||||||
],
|
],
|
||||||
"ext-depends-windows": [
|
"ext-depends-windows": [
|
||||||
"xml"
|
"xml"
|
||||||
]
|
],
|
||||||
|
"build-with-php": true
|
||||||
},
|
},
|
||||||
"xsl": {
|
"xsl": {
|
||||||
"support": {
|
"support": {
|
||||||
@@ -971,6 +1071,14 @@
|
|||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"xz": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-xz",
|
||||||
|
"arg-type": "with",
|
||||||
|
"lib-depends": [
|
||||||
|
"xz"
|
||||||
|
]
|
||||||
|
},
|
||||||
"yac": {
|
"yac": {
|
||||||
"support": {
|
"support": {
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
@@ -978,6 +1086,9 @@
|
|||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "yac",
|
"source": "yac",
|
||||||
"arg-type-unix": "custom",
|
"arg-type-unix": "custom",
|
||||||
|
"lib-depends-unix": [
|
||||||
|
"fastlz"
|
||||||
|
],
|
||||||
"ext-depends-unix": [
|
"ext-depends-unix": [
|
||||||
"igbinary"
|
"igbinary"
|
||||||
]
|
]
|
||||||
@@ -1021,6 +1132,9 @@
|
|||||||
"arg-type-windows": "enable",
|
"arg-type-windows": "enable",
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"zlib"
|
"zlib"
|
||||||
|
],
|
||||||
|
"target": [
|
||||||
|
"static"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"zstd": {
|
"zstd": {
|
||||||
|
|||||||
130
config/lib.json
130
config/lib.json
@@ -1,4 +1,38 @@
|
|||||||
{
|
{
|
||||||
|
"lib-base": {
|
||||||
|
"type": "root",
|
||||||
|
"lib-depends-unix": [
|
||||||
|
"pkg-config"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"php": {
|
||||||
|
"type": "root",
|
||||||
|
"source": "php-src",
|
||||||
|
"lib-depends": [
|
||||||
|
"lib-base",
|
||||||
|
"micro"
|
||||||
|
],
|
||||||
|
"lib-suggests-linux": [
|
||||||
|
"libacl"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"micro": {
|
||||||
|
"type": "target",
|
||||||
|
"source": "micro"
|
||||||
|
},
|
||||||
|
"pkg-config": {
|
||||||
|
"type": "package",
|
||||||
|
"source": "pkg-config",
|
||||||
|
"bin-unix": [
|
||||||
|
"pkg-config"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"source": "attr",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libattr.a"
|
||||||
|
]
|
||||||
|
},
|
||||||
"brotli": {
|
"brotli": {
|
||||||
"source": "brotli",
|
"source": "brotli",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@@ -44,7 +78,6 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
],
|
],
|
||||||
"lib-depends-windows": [
|
"lib-depends-windows": [
|
||||||
"openssl",
|
|
||||||
"zlib",
|
"zlib",
|
||||||
"libssh2",
|
"libssh2",
|
||||||
"nghttp2"
|
"nghttp2"
|
||||||
@@ -53,6 +86,8 @@
|
|||||||
"libssh2",
|
"libssh2",
|
||||||
"brotli",
|
"brotli",
|
||||||
"nghttp2",
|
"nghttp2",
|
||||||
|
"nghttp3",
|
||||||
|
"ngtcp2",
|
||||||
"zstd",
|
"zstd",
|
||||||
"libcares"
|
"libcares"
|
||||||
],
|
],
|
||||||
@@ -66,6 +101,15 @@
|
|||||||
"SystemConfiguration"
|
"SystemConfiguration"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"fastlz": {
|
||||||
|
"source": "fastlz",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libfastlz.a"
|
||||||
|
],
|
||||||
|
"headers": [
|
||||||
|
"fastlz/fastlz.h"
|
||||||
|
]
|
||||||
|
},
|
||||||
"freetype": {
|
"freetype": {
|
||||||
"source": "freetype",
|
"source": "freetype",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@@ -177,12 +221,12 @@
|
|||||||
"libwebp",
|
"libwebp",
|
||||||
"freetype",
|
"freetype",
|
||||||
"libtiff",
|
"libtiff",
|
||||||
"libheif"
|
"libheif",
|
||||||
|
"bzip2"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
"zstd",
|
"zstd",
|
||||||
"xz",
|
"xz",
|
||||||
"bzip2",
|
|
||||||
"libzip",
|
"libzip",
|
||||||
"libxml2"
|
"libxml2"
|
||||||
]
|
]
|
||||||
@@ -199,8 +243,8 @@
|
|||||||
"ldap": {
|
"ldap": {
|
||||||
"source": "ldap",
|
"source": "ldap",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"liblber.a",
|
"libldap.a",
|
||||||
"libldap.a"
|
"liblber.a"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"openssl",
|
"openssl",
|
||||||
@@ -209,6 +253,15 @@
|
|||||||
"libsodium"
|
"libsodium"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libacl": {
|
||||||
|
"source": "libacl",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libacl.a"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"attr"
|
||||||
|
]
|
||||||
|
},
|
||||||
"libaom": {
|
"libaom": {
|
||||||
"source": "libaom",
|
"source": "libaom",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@@ -239,8 +292,7 @@
|
|||||||
"headers-unix": [
|
"headers-unix": [
|
||||||
"ares.h",
|
"ares.h",
|
||||||
"ares_dns.h",
|
"ares_dns.h",
|
||||||
"ares_nameser.h",
|
"ares_nameser.h"
|
||||||
"ares_rules.h"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libde265": {
|
"libde265": {
|
||||||
@@ -346,7 +398,9 @@
|
|||||||
"source": "libmemcached",
|
"source": "libmemcached",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libmemcached.a",
|
"libmemcached.a",
|
||||||
"libmemcachedutil.a"
|
"libmemcachedprotocol.a",
|
||||||
|
"libmemcachedutil.a",
|
||||||
|
"libhashkit.a"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libpng": {
|
"libpng": {
|
||||||
@@ -399,6 +453,9 @@
|
|||||||
"source": "libsodium",
|
"source": "libsodium",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libsodium.a"
|
"libsodium.a"
|
||||||
|
],
|
||||||
|
"static-libs-windows": [
|
||||||
|
"libsodium.lib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libssh2": {
|
"libssh2": {
|
||||||
@@ -543,6 +600,12 @@
|
|||||||
"openssl"
|
"openssl"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"mimalloc": {
|
||||||
|
"source": "mimalloc",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"mimalloc.o"
|
||||||
|
]
|
||||||
|
},
|
||||||
"ncurses": {
|
"ncurses": {
|
||||||
"source": "ncurses",
|
"source": "ncurses",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@@ -565,7 +628,45 @@
|
|||||||
"openssl"
|
"openssl"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
"libxml2"
|
"libxml2",
|
||||||
|
"nghttp3",
|
||||||
|
"ngtcp2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nghttp3": {
|
||||||
|
"source": "nghttp3",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libnghttp3.a"
|
||||||
|
],
|
||||||
|
"static-libs-windows": [
|
||||||
|
"nghttp3.lib"
|
||||||
|
],
|
||||||
|
"headers": [
|
||||||
|
"nghttp3"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"openssl"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ngtcp2": {
|
||||||
|
"source": "ngtcp2",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libngtcp2.a",
|
||||||
|
"libngtcp2_crypto_ossl.a"
|
||||||
|
],
|
||||||
|
"static-libs-windows": [
|
||||||
|
"ngtcp2.lib",
|
||||||
|
"ngtcp2_crypto_ossl.lib"
|
||||||
|
],
|
||||||
|
"headers": [
|
||||||
|
"ngtcp2"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"openssl"
|
||||||
|
],
|
||||||
|
"lib-suggests": [
|
||||||
|
"nghttp3",
|
||||||
|
"brotli"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"onig": {
|
"onig": {
|
||||||
@@ -599,9 +700,6 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"pkg-config": {
|
|
||||||
"source": "pkg-config"
|
|
||||||
},
|
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
"source": "postgresql",
|
"source": "postgresql",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@@ -623,6 +721,14 @@
|
|||||||
"zstd"
|
"zstd"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"postgresql-win": {
|
||||||
|
"source": "postgresql-win",
|
||||||
|
"static-libs": [
|
||||||
|
"libpq.lib",
|
||||||
|
"libpgport.lib",
|
||||||
|
"libpgcommon.lib"
|
||||||
|
]
|
||||||
|
},
|
||||||
"pthreads4w": {
|
"pthreads4w": {
|
||||||
"source": "pthreads4w",
|
"source": "pthreads4w",
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"nasm-x86_64-win": {
|
"nasm-x86_64-win": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip",
|
"url": "https://dl.static-php.dev/static-php-cli/deps/nasm/nasm-2.16.01-win64.zip",
|
||||||
"extract-files": {
|
"extract-files": {
|
||||||
"nasm-2.16.01/nasm.exe": "{php_sdk_path}/bin/nasm.exe",
|
"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-2.16.01/ndisasm.exe": "{php_sdk_path}/bin/ndisasm.exe"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"repo": "static-php/static-php-cli-hosted",
|
"repo": "static-php/static-php-cli-hosted",
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"match-pattern": "{name}-{arch}-{os}.txz",
|
"match-pattern-linux": "{name}-{arch}-{os}-{libc}-{libcver}.txz",
|
||||||
"suffix": "txz"
|
"match-pattern-macos": "{name}-{arch}-{os}.txz",
|
||||||
}
|
"match-pattern-windows": "{name}-{arch}-{os}.tgz"
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,9 +36,23 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"attr": {
|
||||||
|
"alt": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://mirror.souseiseki.middlendian.com/nongnu/attr/attr-2.5.2.tar.gz"
|
||||||
|
},
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://download.savannah.nongnu.org/releases/attr/attr-2.5.2.tar.gz",
|
||||||
|
"provide-pre-built": true,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "doc/COPYING"
|
||||||
|
}
|
||||||
|
},
|
||||||
"brotli": {
|
"brotli": {
|
||||||
"type": "ghtar",
|
"type": "ghtagtar",
|
||||||
"repo": "google/brotli",
|
"repo": "google/brotli",
|
||||||
|
"match": "v1\\.\\d.*",
|
||||||
"provide-pre-built": true,
|
"provide-pre-built": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -69,6 +83,36 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dio": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/dio",
|
||||||
|
"path": "php-src/ext/dio",
|
||||||
|
"filename": "dio.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ev": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/ev",
|
||||||
|
"path": "php-src/ext/ev",
|
||||||
|
"filename": "ev.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ext-brotli": {
|
||||||
|
"type": "git",
|
||||||
|
"path": "php-src/ext/brotli",
|
||||||
|
"rev": "master",
|
||||||
|
"url": "https://github.com/kjdev/php-ext-brotli",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ext-ds": {
|
"ext-ds": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://pecl.php.net/get/ds",
|
"url": "https://pecl.php.net/get/ds",
|
||||||
@@ -128,6 +172,17 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ext-lz4": {
|
||||||
|
"type": "ghtagtar",
|
||||||
|
"repo": "kjdev/php-ext-lz4",
|
||||||
|
"path": "php-src/ext/lz4",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": [
|
||||||
|
"LICENSE"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"ext-memcache": {
|
"ext-memcache": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://pecl.php.net/get/memcache",
|
"url": "https://pecl.php.net/get/memcache",
|
||||||
@@ -197,6 +252,16 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ext-xz": {
|
||||||
|
"type": "git",
|
||||||
|
"path": "php-src/ext/xz",
|
||||||
|
"rev": "main",
|
||||||
|
"url": "https://github.com/codemasher/php-ext-xz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ext-zstd": {
|
"ext-zstd": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"path": "php-src/ext/zstd",
|
"path": "php-src/ext/zstd",
|
||||||
@@ -207,6 +272,15 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fastlz": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ariya/FastLZ.git",
|
||||||
|
"rev": "master",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE.MIT"
|
||||||
|
}
|
||||||
|
},
|
||||||
"freetype": {
|
"freetype": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"rev": "VER-2-13-2",
|
"rev": "VER-2-13-2",
|
||||||
@@ -241,6 +315,7 @@
|
|||||||
"gmssl": {
|
"gmssl": {
|
||||||
"type": "ghtar",
|
"type": "ghtar",
|
||||||
"repo": "guanzhi/GmSSL",
|
"repo": "guanzhi/GmSSL",
|
||||||
|
"provide-pre-built": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -313,6 +388,19 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libacl": {
|
||||||
|
"alt": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://mirror.souseiseki.middlendian.com/nongnu/acl/acl-2.3.2.tar.gz"
|
||||||
|
},
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://download.savannah.nongnu.org/releases/acl/acl-2.3.2.tar.gz",
|
||||||
|
"provide-pre-built": true,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "doc/COPYING"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libaom": {
|
"libaom": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"rev": "main",
|
"rev": "main",
|
||||||
@@ -449,12 +537,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libmemcached": {
|
"libmemcached": {
|
||||||
"type": "git",
|
"type": "ghtagtar",
|
||||||
"url": "https://github.com/static-php/libmemcached-macos.git",
|
"repo": "awesomized/libmemcached",
|
||||||
"rev": "master",
|
"match": "1.\\d.\\d",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYING"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libpng": {
|
"libpng": {
|
||||||
@@ -561,7 +649,7 @@
|
|||||||
"regex": "/href=\"(?<file>libxslt-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
"regex": "/href=\"(?<file>libxslt-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYING"
|
"path": "Copyright"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libyaml": {
|
"libyaml": {
|
||||||
@@ -605,6 +693,16 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mimalloc": {
|
||||||
|
"type": "ghtagtar",
|
||||||
|
"repo": "microsoft/mimalloc",
|
||||||
|
"match": "v2\\.\\d\\.[^3].*",
|
||||||
|
"provide-pre-built": false,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mongodb": {
|
"mongodb": {
|
||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "mongodb/mongo-php-driver",
|
"repo": "mongodb/mongo-php-driver",
|
||||||
@@ -646,6 +744,26 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nghttp3": {
|
||||||
|
"type": "ghrel",
|
||||||
|
"repo": "ngtcp2/nghttp3",
|
||||||
|
"match": "nghttp3.+\\.tar\\.xz",
|
||||||
|
"prefer-stable": true,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "COPYING"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ngtcp2": {
|
||||||
|
"type": "ghrel",
|
||||||
|
"repo": "ngtcp2/ngtcp2",
|
||||||
|
"match": "ngtcp2.+\\.tar\\.xz",
|
||||||
|
"prefer-stable": true,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "COPYING"
|
||||||
|
}
|
||||||
|
},
|
||||||
"onig": {
|
"onig": {
|
||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "kkos/oniguruma",
|
"repo": "kkos/oniguruma",
|
||||||
@@ -673,6 +791,16 @@
|
|||||||
"path": "LICENSE.txt"
|
"path": "LICENSE.txt"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"opentelemetry": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/opentelemetry",
|
||||||
|
"path": "php-src/ext/opentelemetry",
|
||||||
|
"filename": "opentelemetry.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"parallel": {
|
"parallel": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://pecl.php.net/get/parallel",
|
"url": "https://pecl.php.net/get/parallel",
|
||||||
@@ -703,13 +831,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
"type": "url",
|
"type": "ghtagtar",
|
||||||
"url": "https://ftp.postgresql.org/pub/source/v16.2/postgresql-16.2.tar.bz2",
|
"repo": "postgres/postgres",
|
||||||
|
"match": "REL_16_\\d+",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYRIGHT"
|
"path": "COPYRIGHT"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"postgresql-win": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://get.enterprisedb.com/postgresql/postgresql-16.8-1-windows-x64-binaries.zip",
|
||||||
|
"license": {
|
||||||
|
"type": "text",
|
||||||
|
"text": "PostgreSQL Database Management System\n(also known as Postgres, formerly as Postgres95)\n\nPortions Copyright (c) 1996-2025, The PostgreSQL Global Development Group\n\nPortions Copyright (c) 1994, The Regents of the University of California\n\nPermission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose, without fee, and without a written\nagreement is hereby granted, provided that the above copyright notice\nand this paragraph and the following two paragraphs appear in all\ncopies.\n\nIN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY\nFOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,\nINCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS\nDOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF\nTHE POSSIBILITY OF SUCH DAMAGE.\n\nTHE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\nON AN \"AS IS\" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS\nTO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
|
||||||
|
}
|
||||||
|
},
|
||||||
"protobuf": {
|
"protobuf": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://pecl.php.net/get/protobuf",
|
"url": "https://pecl.php.net/get/protobuf",
|
||||||
@@ -830,7 +967,6 @@
|
|||||||
"path": "php-src/ext/swow-src",
|
"path": "php-src/ext/swow-src",
|
||||||
"rev": "ci",
|
"rev": "ci",
|
||||||
"url": "https://github.com/swow/swow",
|
"url": "https://github.com/swow/swow",
|
||||||
"patch": "patchSwow",
|
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -854,6 +990,15 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"xdebug": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/xdebug",
|
||||||
|
"filename": "xdebug.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"xhprof": {
|
"xhprof": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://pecl.php.net/get/xhprof",
|
"url": "https://pecl.php.net/get/xhprof",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-btn" v-if="selectedSystem !== 'windows'" @click="selectCommon">{{ I18N[lang].selectCommon }}</div>
|
<div class="my-btn" v-if="selectedSystem !== 'windows'" @click="selectCommon">{{ I18N[lang].selectCommon }}</div>
|
||||||
|
<div class="my-btn" v-if="selectedSystem !== 'windows'" @click="selectAll">{{ I18N[lang].selectAll }}</div>
|
||||||
<div class="my-btn" @click="checkedExts = []">{{ I18N[lang].selectNone }}</div>
|
<div class="my-btn" @click="checkedExts = []">{{ I18N[lang].selectNone }}</div>
|
||||||
|
|
||||||
<details class="details custom-block" open>
|
<details class="details custom-block" open>
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
<div class="tip custom-block">
|
<div class="tip custom-block">
|
||||||
<p class="custom-block-title">TIP</p>
|
<p class="custom-block-title">TIP</p>
|
||||||
<p>{{ I18N[lang].depTips }}</p>
|
<p>{{ I18N[lang].depTips }}</p>
|
||||||
|
<p>{{ I18N[lang].depTips2 }}</p>
|
||||||
</div>
|
</div>
|
||||||
<h2>{{ I18N[lang].buildTarget }}</h2>
|
<h2>{{ I18N[lang].buildTarget }}</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -175,6 +177,12 @@
|
|||||||
{{ buildCommandString }}
|
{{ buildCommandString }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="command-container">
|
||||||
|
<b>craft.yml</b>
|
||||||
|
<div id="craft-cmd" class="command-preview pre">
|
||||||
|
{{ craftCommandString }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -246,6 +254,7 @@ const I18N = {
|
|||||||
no: '否',
|
no: '否',
|
||||||
resultShow: '结果展示',
|
resultShow: '结果展示',
|
||||||
selectCommon: '选择常用扩展',
|
selectCommon: '选择常用扩展',
|
||||||
|
selectAll: '选择全部',
|
||||||
selectNone: '全部取消选择',
|
selectNone: '全部取消选择',
|
||||||
useZTS: '是否编译线程安全版',
|
useZTS: '是否编译线程安全版',
|
||||||
hardcodedINI: '硬编码 INI 选项',
|
hardcodedINI: '硬编码 INI 选项',
|
||||||
@@ -261,6 +270,7 @@ const I18N = {
|
|||||||
selectedSystem: '选择操作系统',
|
selectedSystem: '选择操作系统',
|
||||||
buildLibs: '要构建的库',
|
buildLibs: '要构建的库',
|
||||||
depTips: '选择扩展后,不可选中的项目为必需的依赖,编译的依赖库列表中可选的为现有扩展和依赖库的可选依赖。选择可选依赖后,将生成 --with-libs 参数。',
|
depTips: '选择扩展后,不可选中的项目为必需的依赖,编译的依赖库列表中可选的为现有扩展和依赖库的可选依赖。选择可选依赖后,将生成 --with-libs 参数。',
|
||||||
|
depTips2: '无法同时构建所有扩展,因为有些扩展之间相互冲突。请根据需要选择扩展。',
|
||||||
microUnavailable: 'micro 不支持 PHP 7.4 及更早版本!',
|
microUnavailable: 'micro 不支持 PHP 7.4 及更早版本!',
|
||||||
windowsSAPIUnavailable: 'Windows 目前不支持 fpm、embed 构建!',
|
windowsSAPIUnavailable: 'Windows 目前不支持 fpm、embed 构建!',
|
||||||
useUPX: '是否开启 UPX 压缩(减小二进制体积)',
|
useUPX: '是否开启 UPX 压缩(减小二进制体积)',
|
||||||
@@ -280,6 +290,7 @@ const I18N = {
|
|||||||
no: 'No',
|
no: 'No',
|
||||||
resultShow: 'Result',
|
resultShow: 'Result',
|
||||||
selectCommon: 'Select common extensions',
|
selectCommon: 'Select common extensions',
|
||||||
|
selectAll: 'Select all',
|
||||||
selectNone: 'Unselect all',
|
selectNone: 'Unselect all',
|
||||||
useZTS: 'Enable ZTS',
|
useZTS: 'Enable ZTS',
|
||||||
hardcodedINI: 'Hardcoded INI options',
|
hardcodedINI: 'Hardcoded INI options',
|
||||||
@@ -295,6 +306,7 @@ const I18N = {
|
|||||||
selectedSystem: 'Select Build OS',
|
selectedSystem: 'Select Build OS',
|
||||||
buildLibs: 'Select Dependencies',
|
buildLibs: 'Select Dependencies',
|
||||||
depTips: 'After selecting the extensions, the unselectable items are essential dependencies. In the compiled dependencies list, optional dependencies consist of existing extensions and optional dependencies of libraries. Optional dependencies will be added in --with-libs parameter.',
|
depTips: 'After selecting the extensions, the unselectable items are essential dependencies. In the compiled dependencies list, optional dependencies consist of existing extensions and optional dependencies of libraries. Optional dependencies will be added in --with-libs parameter.',
|
||||||
|
depTips2: 'It is not possible to build all extensions at the same time, as some extensions conflict with each other. Please select the extensions you need.',
|
||||||
microUnavailable: 'Micro does not support PHP 7.4 and earlier versions!',
|
microUnavailable: 'Micro does not support PHP 7.4 and earlier versions!',
|
||||||
windowsSAPIUnavailable: 'Windows does not support fpm and embed build!',
|
windowsSAPIUnavailable: 'Windows does not support fpm and embed build!',
|
||||||
useUPX: 'Enable UPX compression (reduce binary size)',
|
useUPX: 'Enable UPX compression (reduce binary size)',
|
||||||
@@ -331,6 +343,10 @@ const selectCommon = () => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const selectAll = () => {
|
||||||
|
checkedExts.value = extFilter.value;
|
||||||
|
};
|
||||||
|
|
||||||
const extList = computed(() => {
|
const extList = computed(() => {
|
||||||
return checkedExts.value.join(',');
|
return checkedExts.value.join(',');
|
||||||
});
|
});
|
||||||
@@ -358,7 +374,7 @@ const checkedTargets = ref(['cli']);
|
|||||||
const selectedEnv = ref('spc');
|
const selectedEnv = ref('spc');
|
||||||
|
|
||||||
// chosen php version
|
// chosen php version
|
||||||
const selectedPhpVersion = ref('8.2');
|
const selectedPhpVersion = ref('8.4');
|
||||||
|
|
||||||
// chosen debug
|
// chosen debug
|
||||||
const debug = ref(0);
|
const debug = ref(0);
|
||||||
@@ -499,6 +515,38 @@ const buildCommandString = computed(() => {
|
|||||||
return `${spcCommand.value} build ${buildCommand.value} "${extList.value}"${additionalLibs.value}${debug.value ? ' --debug' : ''}${zts.value ? ' --enable-zts' : ''}${enableUPX.value ? ' --with-upx-pack' : ''}${displayINI.value}`;
|
return `${spcCommand.value} build ${buildCommand.value} "${extList.value}"${additionalLibs.value}${debug.value ? ' --debug' : ''}${zts.value ? ' --enable-zts' : ''}${enableUPX.value ? ' --with-upx-pack' : ''}${displayINI.value}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const craftCommandString = computed(() => {
|
||||||
|
let str = `php-version: ${selectedPhpVersion.value}\n`;
|
||||||
|
str += `extensions: "${extList.value}"\n`;
|
||||||
|
if (checkedTargets.value.join(',') === 'all') {
|
||||||
|
str += 'sapi: ' + ['cli', 'fpm', 'micro', 'embed'].join(',') + '\n';
|
||||||
|
} else {
|
||||||
|
str += `sapi: ${checkedTargets.value.join(',')}\n`;
|
||||||
|
}
|
||||||
|
if (additionalLibs.value) {
|
||||||
|
str += `libs: ${additionalLibs.value.replace('--with-libs="', '').replace('"', '').trim()}\n`;
|
||||||
|
}
|
||||||
|
if (debug.value) {
|
||||||
|
str += 'debug: true\n';
|
||||||
|
}
|
||||||
|
str += '{{position_hold}}';
|
||||||
|
if (enableUPX.value) {
|
||||||
|
str += ' with-upx-pack: true\n';
|
||||||
|
}
|
||||||
|
if (zts.value) {
|
||||||
|
str += ' enable-zts: true\n';
|
||||||
|
}
|
||||||
|
if (preBuilt.value) {
|
||||||
|
str += ' prefer-pre-built: true\n';
|
||||||
|
}
|
||||||
|
if (!str.endsWith('{{position_hold}}')) {
|
||||||
|
str = str.replace('{{position_hold}}', 'build-options:\n');
|
||||||
|
} else {
|
||||||
|
str = str.replace('{{position_hold}}', '');
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
});
|
||||||
|
|
||||||
const calculateExtLibDepends = (input) => {
|
const calculateExtLibDepends = (input) => {
|
||||||
const result = new Set();
|
const result = new Set();
|
||||||
|
|
||||||
@@ -617,6 +665,12 @@ h2 {
|
|||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pre {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
.option-line {
|
.option-line {
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,54 +1,57 @@
|
|||||||
export default {
|
export default {
|
||||||
'/en/guide/': [
|
'/en/guide/': [
|
||||||
{
|
{
|
||||||
text: 'Guide',
|
text: 'Basic Build Guides',
|
||||||
items: [
|
items: [
|
||||||
{text: 'Guide', link: '/en/guide/'},
|
{text: 'Guide', link: '/en/guide/'},
|
||||||
{text: 'Actions Build', link: '/en/guide/action-build'},
|
{text: 'Build (Local)', link: '/en/guide/manual-build'},
|
||||||
{text: 'Manual Build', link: '/en/guide/manual-build'},
|
{text: 'Build (CI)', link: '/en/guide/action-build'},
|
||||||
{text: 'Extension List', link: '/en/guide/extensions'},
|
{text: 'Supported Extensions', link: '/en/guide/extensions'},
|
||||||
{text: 'Extension Notes', link: '/en/guide/extension-notes'},
|
{text: 'Extension Notes', link: '/en/guide/extension-notes'},
|
||||||
{text: 'Command Generator', link: '/en/guide/cli-generator'},
|
{text: 'Build Command Generator', link: '/en/guide/cli-generator'},
|
||||||
{text: 'Environment Variables', link: '/en/guide/env-vars', collapsed: true,},
|
{text: 'Environment Variables', link: '/en/guide/env-vars', collapsed: true,},
|
||||||
{text: 'Dependency Table', link: '/en/guide/deps-map'},
|
{text: 'Dependency Table', link: '/en/guide/deps-map'},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
items: [
|
text: 'Extended Build Guides',
|
||||||
{text: 'Troubleshooting', link: '/en/guide/troubleshooting'},
|
items: [
|
||||||
{text: 'Build on Windows', link: '/en/guide/build-on-windows'},
|
{text: 'Troubleshooting', link: '/en/guide/troubleshooting'},
|
||||||
],
|
{text: 'Build on Windows', link: '/en/guide/build-on-windows'},
|
||||||
}
|
{text: 'Build with GNU libc', link: '/en/guide/build-with-glibc'},
|
||||||
],
|
],
|
||||||
'/en/develop/': [
|
}
|
||||||
{
|
],
|
||||||
text: 'Development',
|
'/en/develop/': [
|
||||||
items: [
|
{
|
||||||
{text: 'Get Started', link: '/en/develop/'},
|
text: 'Development',
|
||||||
{text: 'Project Structure', link: '/en/develop/structure'},
|
items: [
|
||||||
{text: 'PHP Source Modification', link: '/en/develop/php-src-changes'},
|
{text: 'Get Started', link: '/en/develop/'},
|
||||||
],
|
{text: 'Project Structure', link: '/en/develop/structure'},
|
||||||
},
|
{text: 'PHP Source Modification', link: '/en/develop/php-src-changes'},
|
||||||
{
|
],
|
||||||
text: 'Module',
|
},
|
||||||
items: [
|
{
|
||||||
{text: 'Doctor ', link: '/en/develop/doctor-module'},
|
text: 'Module',
|
||||||
{text: 'Source', link: '/en/develop/source-module'},
|
items: [
|
||||||
]
|
{text: 'Doctor ', link: '/en/develop/doctor-module'},
|
||||||
},
|
{text: 'Source', link: '/en/develop/source-module'},
|
||||||
{
|
]
|
||||||
text: 'Extra',
|
},
|
||||||
items: [
|
{
|
||||||
{text: 'Compilation Tools', link: '/en/develop/system-build-tools'},
|
text: 'Extra',
|
||||||
]
|
items: [
|
||||||
}
|
{text: 'Compilation Tools', link: '/en/develop/system-build-tools'},
|
||||||
],
|
{text: 'craft.yml Configuration', link: '/zh/develop/craft-yml'},
|
||||||
'/en/contributing/': [
|
]
|
||||||
{
|
}
|
||||||
text: 'Contributing',
|
],
|
||||||
items: [
|
'/en/contributing/': [
|
||||||
{text: 'Contributing', link: '/en/contributing/'},
|
{
|
||||||
],
|
text: 'Contributing',
|
||||||
}
|
items: [
|
||||||
],
|
{text: 'Contributing', link: '/en/contributing/'},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,54 +1,57 @@
|
|||||||
export default {
|
export default {
|
||||||
'/zh/guide/': [
|
'/zh/guide/': [
|
||||||
{
|
{
|
||||||
text: '构建指南',
|
text: '构建指南',
|
||||||
items: [
|
items: [
|
||||||
{text: '指南', link: '/zh/guide/'},
|
{text: '指南', link: '/zh/guide/'},
|
||||||
{text: 'Actions 构建', link: '/zh/guide/action-build'},
|
{text: '本地构建', link: '/zh/guide/manual-build'},
|
||||||
{text: '本地构建', link: '/zh/guide/manual-build'},
|
{text: 'Actions 构建', link: '/zh/guide/action-build'},
|
||||||
{text: '扩展列表', link: '/zh/guide/extensions'},
|
{text: '扩展列表', link: '/zh/guide/extensions'},
|
||||||
{text: '扩展注意事项', link: '/zh/guide/extension-notes'},
|
{text: '扩展注意事项', link: '/zh/guide/extension-notes'},
|
||||||
{text: '编译命令生成器', link: '/zh/guide/cli-generator'},
|
{text: '编译命令生成器', link: '/zh/guide/cli-generator'},
|
||||||
{text: '环境变量列表', link: '/zh/guide/env-vars'},
|
{text: '环境变量列表', link: '/zh/guide/env-vars'},
|
||||||
{text: '依赖关系图表', link: '/zh/guide/deps-map'},
|
{text: '依赖关系图表', link: '/zh/guide/deps-map'},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
items: [
|
text: '扩展构建指南',
|
||||||
{text: '故障排除', link: '/zh/guide/troubleshooting'},
|
items: [
|
||||||
{text: '在 Windows 上构建', link: '/zh/guide/build-on-windows'},
|
{text: '故障排除', link: '/zh/guide/troubleshooting'},
|
||||||
],
|
{text: '在 Windows 上构建', link: '/zh/guide/build-on-windows'},
|
||||||
}
|
{text: '构建 GNU libc 兼容的二进制', link: '/zh/guide/build-with-glibc'},
|
||||||
],
|
],
|
||||||
'/zh/develop/': [
|
}
|
||||||
{
|
],
|
||||||
text: '开发指南',
|
'/zh/develop/': [
|
||||||
items: [
|
{
|
||||||
{ text: '开发简介', link: '/zh/develop/' },
|
text: '开发指南',
|
||||||
{ text: '项目结构简介', link: '/zh/develop/structure' },
|
items: [
|
||||||
{text: '对 PHP 源码的修改', link: '/zh/develop/php-src-changes'},
|
{text: '开发简介', link: '/zh/develop/'},
|
||||||
],
|
{text: '项目结构简介', link: '/zh/develop/structure'},
|
||||||
},
|
{text: '对 PHP 源码的修改', link: '/zh/develop/php-src-changes'},
|
||||||
{
|
],
|
||||||
text: '模块',
|
},
|
||||||
items: [
|
{
|
||||||
{ text: 'Doctor 环境检查工具', link: '/zh/develop/doctor-module' },
|
text: '模块',
|
||||||
{ text: '资源模块', link: '/zh/develop/source-module' },
|
items: [
|
||||||
]
|
{text: 'Doctor 环境检查工具', link: '/zh/develop/doctor-module'},
|
||||||
},
|
{text: '资源模块', link: '/zh/develop/source-module'},
|
||||||
{
|
]
|
||||||
text: '其他',
|
},
|
||||||
items: [
|
{
|
||||||
{text: '系统编译工具', link: '/zh/develop/system-build-tools'},
|
text: '其他',
|
||||||
]
|
items: [
|
||||||
}
|
{text: '系统编译工具', link: '/zh/develop/system-build-tools'},
|
||||||
],
|
{text: 'craft.yml 配置详解', link: '/zh/develop/craft-yml'},
|
||||||
'/zh/contributing/': [
|
]
|
||||||
{
|
}
|
||||||
text: '贡献指南',
|
],
|
||||||
items: [
|
'/zh/contributing/': [
|
||||||
{text: '贡献指南', link: '/zh/contributing/'},
|
{
|
||||||
],
|
text: '贡献指南',
|
||||||
}
|
items: [
|
||||||
],
|
{text: '贡献指南', link: '/zh/contributing/'},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
67
docs/deps-craft-yml.md
Normal file
67
docs/deps-craft-yml.md
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
```yaml
|
||||||
|
# PHP version to build (default: 8.4)
|
||||||
|
php-version: 8.4
|
||||||
|
# [REQUIRED] Static PHP extensions to build (list or comma-separated are both accepted)
|
||||||
|
extensions: bcmath,fileinfo,phar,zlib,sodium,posix,pcntl
|
||||||
|
# Extra libraries to build (list or comma-separated are both accepted)
|
||||||
|
libs: [ ]
|
||||||
|
# [REQUIRED] Build SAPIs (list or comma-separated are both accepted)
|
||||||
|
sapi: cli,micro,fpm
|
||||||
|
# Show full console output (default: false)
|
||||||
|
debug: false
|
||||||
|
# Build options (same as `build` command options, all options are optional)
|
||||||
|
build-options:
|
||||||
|
# Before build, remove all old build files and sources (default: false)
|
||||||
|
with-clean: false
|
||||||
|
# Build with all suggested libraries (default: false)
|
||||||
|
with-suggested-libs: false
|
||||||
|
# Build with all suggested extensions (default: false)
|
||||||
|
with-suggested-exts: false
|
||||||
|
# Build extra shared extensions (list or comma-separated are both accepted)
|
||||||
|
build-shared: [ ]
|
||||||
|
# Build without stripping the binary (default: false)
|
||||||
|
no-strip: false
|
||||||
|
# Disable Opcache JIT (default: false)
|
||||||
|
disable-opcache-jit: false
|
||||||
|
# PHP configuration options (same as --with-config-file-path)
|
||||||
|
with-config-file-path: ""
|
||||||
|
# PHP configuration options (same as --with-config-file-scan-dir)
|
||||||
|
with-config-file-scan-dir: ""
|
||||||
|
# Hardcoded INI options for cli and micro SAPI (e.g. "memory_limit=4G", list accepted)
|
||||||
|
with-hardcoded-ini: [ ]
|
||||||
|
# Pretend micro SAPI as cli SAPI to avoid some frameworks to limit the usage of micro SAPI
|
||||||
|
with-micro-fake-cli: false
|
||||||
|
# Additional patch point injection files (e.g. "path/to/patch.php", list accepted)
|
||||||
|
with-added-patch: [ ]
|
||||||
|
# Ignore micro extension tests (if you are using micro SAPI, default: false)
|
||||||
|
without-micro-ext-test: false
|
||||||
|
# UPX pack the binary (default: false)
|
||||||
|
with-upx-pack: false
|
||||||
|
# Set the micro.exe program icon (only for Windows, default: "")
|
||||||
|
with-micro-logo: ""
|
||||||
|
# Set micro SAPI as win32 mode, without this, micro SAPI will be compiled as a console application (only for Windows, default: false)
|
||||||
|
enable-micro-win32: false
|
||||||
|
|
||||||
|
# Download options
|
||||||
|
download-options:
|
||||||
|
# Use custom url for specified sources, format: "{source-name}:{url}" (e.g. "php-src:https://example.com/php-8.4.0.tar.gz")
|
||||||
|
custom-url: [ ]
|
||||||
|
# Use custom git repo for specified sources, format: "{source-name}:{branch}:{url}" (e.g. "php-src:master:https://github.com/php/php-src.git")
|
||||||
|
custom-git: [ ]
|
||||||
|
# Retries count for downloading sources (default: 5)
|
||||||
|
retry: 5
|
||||||
|
# Use pre-built libraries if available (default: false)
|
||||||
|
prefer-pre-built: true
|
||||||
|
# Do not download from alternative sources (default: false)
|
||||||
|
no-alt: false
|
||||||
|
|
||||||
|
craft-options:
|
||||||
|
doctor: true
|
||||||
|
download: true
|
||||||
|
build: true
|
||||||
|
|
||||||
|
# Extra environment variables
|
||||||
|
extra-env:
|
||||||
|
# e.g. Use github token to avoid rate limit
|
||||||
|
GITHUB_TOKEN: your-github-token
|
||||||
|
```
|
||||||
7
docs/en/develop/craft-yml.md
Normal file
7
docs/en/develop/craft-yml.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
aside: false
|
||||||
|
---
|
||||||
|
|
||||||
|
# craft.yml Configuration
|
||||||
|
|
||||||
|
<!--@include: ../../deps-craft-yml.md-->
|
||||||
@@ -16,13 +16,29 @@ The directory can be changed using the manual build option `--with-config-file-s
|
|||||||
|
|
||||||
## Can statically-compiled PHP install extensions?
|
## Can statically-compiled PHP install extensions?
|
||||||
|
|
||||||
Because the principle of installing extensions in PHP under the traditional architecture is to install new extensions using `.so` type dynamic link libraries,
|
Because the principle of installing PHP extensions under the normal mode is to use `.so` type dynamic link library to install new extensions,
|
||||||
and statically linked PHP compiled using this project cannot **directly** install new extensions using dynamic link libraries.
|
and we use the static link PHP compiled by this project. However, static linking has different definitions in different operating systems.
|
||||||
|
|
||||||
For the macOS platform, almost all binary files under macOS cannot be linked purely statically,
|
First of all, for Linux systems, statically linked binaries will not link the system's dynamic link library.
|
||||||
and almost all binary files will link macOS system libraries: `/usr/lib/libresolv.9.dylib` and `/usr/lib/libSystem.B.dylib`.
|
Purely statically linked binaries (`build with -all-static`) cannot load dynamic libraries, so new extensions cannot be added.
|
||||||
So under macOS system, statically compiled php binary files can be used under certain compilation conditions,
|
At the same time, in pure static mode, you cannot use extensions such as `ffi` to load external `.so` modules.
|
||||||
and dynamic link extensions can be used at the same time:
|
|
||||||
|
You can use the command `ldd buildroot/bin/php` to check whether the binary you built under Linux is purely statically linked.
|
||||||
|
|
||||||
|
If you [build GNU libc based PHP](../guide/build-with-glibc), you can use the `ffi` extension to load external `.so` modules and load `.so` extensions with the same ABI.
|
||||||
|
|
||||||
|
For example, you can use the following command to build a static PHP binary dynamically linked with glibc,
|
||||||
|
supporting FFI extensions and loading the `xdebug.so` extension of the same PHP version and the same TS type:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc-gnu-docker download --for-extensions=ffi,xml --with-php=8.4
|
||||||
|
bin/spc-gnu-docker build ffi,xml --build-cli --debug
|
||||||
|
|
||||||
|
buildroot/bin/php -d "zend_extension=/path/to/php{PHP_VER}-{ts/nts}/xdebug.so" --ri xdebug
|
||||||
|
```
|
||||||
|
|
||||||
|
For macOS platform, almost all binaries under macOS cannot be truly purely statically linked, and almost all binaries will link macOS system libraries: `/usr/lib/libresolv.9.dylib` and `/usr/lib/libSystem.B.dylib`.
|
||||||
|
So on macOS, you can use statically compiled PHP binaries under certain compilation conditions, and dynamically linked extensions:
|
||||||
|
|
||||||
1. Using the `--no-strip` parameter will not strip information such as debugging symbols from the binary file for use with external Zend extensions such as `Xdebug`.
|
1. Using the `--no-strip` parameter will not strip information such as debugging symbols from the binary file for use with external Zend extensions such as `Xdebug`.
|
||||||
2. If you want to compile some Zend extensions, use Homebrew, MacPorts, source code compilation, and install a normal version of PHP on your operating system.
|
2. If you want to compile some Zend extensions, use Homebrew, MacPorts, source code compilation, and install a normal version of PHP on your operating system.
|
||||||
@@ -34,15 +50,12 @@ and dynamic link extensions can be used at the same time:
|
|||||||
bin/spc build ffi --build-cli --no-strip
|
bin/spc build ffi --build-cli --no-strip
|
||||||
```
|
```
|
||||||
|
|
||||||
For the Linux platform, the current compilation result is a purely statically linked binary file,
|
|
||||||
and new extensions cannot be installed using a dynamic link library.
|
|
||||||
|
|
||||||
## Can it support Oracle database extension?
|
## Can it support Oracle database extension?
|
||||||
|
|
||||||
Some extensions that rely on closed source libraries, such as `oci8`, `sourceguardian`, etc.,
|
Some extensions that rely on closed source libraries, such as `oci8`, `sourceguardian`, etc.,
|
||||||
they do not provide purely statically compiled dependent library files (`.a`), only dynamic dependent library files (`.so`).
|
they do not provide purely statically compiled dependent library files (`.a`), only dynamic dependent library files (`.so`).
|
||||||
These extensions cannot be compiled into static-php-cli from source, so this project may never support them.
|
These extensions cannot be compiled into static-php-cli using source code, so this project may never support these extensions.
|
||||||
However, in theory, you can access and use such extensions under macOS according to the above questions.
|
However, in theory you can access and use such extensions under macOS and Linux according to the above questions.
|
||||||
|
|
||||||
If you have a need for such extensions, or most people have needs for these closed-source extensions,
|
If you have a need for such extensions, or most people have needs for these closed-source extensions,
|
||||||
see the discussion on [standalone-php-cli](https://github.com/crazywhalecc/static-php-cli/discussions/58). Welcome to leave a message.
|
see the discussion on [standalone-php-cli](https://github.com/crazywhalecc/static-php-cli/discussions/58). Welcome to leave a message.
|
||||||
@@ -75,6 +88,8 @@ such as Swoole Compiler, Source Guardian, etc.
|
|||||||
|
|
||||||
## Unable to use ssl
|
## Unable to use ssl
|
||||||
|
|
||||||
|
**Update: This issue has been fixed in the latest version of static-php-cli, which now reads the system's certificate file by default. If you still have problems, try the solution below.**
|
||||||
|
|
||||||
When using curl, pgsql, etc. to request an HTTPS website or establish an SSL connection, there may be an `error:80000002:system library::No such file or directory` error.
|
When using curl, pgsql, etc. to request an HTTPS website or establish an SSL connection, there may be an `error:80000002:system library::No such file or directory` error.
|
||||||
This error is caused by statically compiled PHP without specifying `openssl.cafile` via `php.ini`.
|
This error is caused by statically compiled PHP without specifying `openssl.cafile` via `php.ini`.
|
||||||
|
|
||||||
|
|||||||
64
docs/en/guide/build-with-glibc.md
Normal file
64
docs/en/guide/build-with-glibc.md
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
# Build glibc Compatible Linux Binary
|
||||||
|
|
||||||
|
## Why Build glibc Compatible Binary
|
||||||
|
|
||||||
|
Currently, the binaries built by static-php-cli on Linux by default are based on musl-libc (statically linked).
|
||||||
|
musl-libc is a lightweight libc implementation
|
||||||
|
that aims to be compatible with glibc and provides good support for pure static linking.
|
||||||
|
This means that the compiled static PHP executable can be used on almost any Linux distribution without worrying about the versions of libc, libstdc++, etc.
|
||||||
|
|
||||||
|
However, there are some issues with pure static linking of musl-libc binaries on Linux:
|
||||||
|
|
||||||
|
- The `dl()` function in PHP cannot be used to load dynamic libraries and external PHP extensions.
|
||||||
|
- The FFI extension in PHP cannot be used.
|
||||||
|
- In some extreme cases, performance issues may occur. See [musl-libc performance issues](https://github.com/php/php-src/issues/13648).
|
||||||
|
|
||||||
|
Different Linux distributions use different default libc.
|
||||||
|
For example, Alpine Linux uses musl libc, while most Linux distributions use glibc.
|
||||||
|
However, even so, we cannot directly use any distribution using glibc to build portable static binaries because glibc has some issues:
|
||||||
|
|
||||||
|
- Binaries built with gcc and other tools on newer versions of distributions cannot run on older versions of distributions.
|
||||||
|
- glibc is not recommended to be statically linked because some of its features require the support of dynamic libraries.
|
||||||
|
|
||||||
|
However, we can use Docker to solve this problem.
|
||||||
|
The final output is a binary **dynamically linked with glibc** and some necessary libraries,
|
||||||
|
but **statically linked with all other dependencies**.
|
||||||
|
|
||||||
|
1. Use an older version of a Linux distribution (such as CentOS 7.x), which has an older version of glibc but can run on most modern Linux distributions.
|
||||||
|
2. Build the static binary of PHP in this container so that it can run on most modern Linux distributions.
|
||||||
|
|
||||||
|
> Using glibc static binaries can run on most modern Linux distributions but cannot run on musl libc distributions, such as CentOS 6, Alpine Linux, etc.
|
||||||
|
|
||||||
|
## Build glibc Compatible Linux Binary
|
||||||
|
|
||||||
|
The latest version of static-php-cli includes the `bin/spc-gnu-docker` script,
|
||||||
|
which can create a CentOS 7.x (glibc-2.17) Docker container with one click and build a glibc compatible PHP static binary in the container.
|
||||||
|
|
||||||
|
Then, run the following command once.
|
||||||
|
The first run will take a long time because it needs to download the CentOS 7.x image and some build tools.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc-gnu-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
After the image is built, you will see the same command help menu as `bin/spc`, which means the container is ready.
|
||||||
|
|
||||||
|
After the container is ready, you can refer to the [local build](./manual-build) section to build your PHP static binary.
|
||||||
|
Just replace `bin/spc` or `./spc` with `bin/spc-gnu-docker`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc-gnu-docker build bcmath,ctype,openssl,pdo,phar,posix,session,tokenizer,xml,zip --build-cli --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
In rare cases, glibc-based static PHP may encounter segment faults and other errors, but there are currently few examples.
|
||||||
|
If you encounter any issues, please submit an issue.
|
||||||
|
|
||||||
|
glibc build is an extended feature and is not part of the default static-php support.
|
||||||
|
If you have related issues or requirements, please indicate that you are building based on glibc when submitting an issue.
|
||||||
|
|
||||||
|
If you need to build glibc-based binaries without using Docker,
|
||||||
|
please refer to the `bin/spc-gnu-docker` script to manually create a similar environment.
|
||||||
|
|
||||||
|
Please keep in mind that we only support glibc build with `bin/spc-gnu-docker`. Compilation on RHEL 9 & 10 has been tested and is stable, but if you run into issues, we may choose not to fix them.
|
||||||
@@ -39,6 +39,21 @@ Or, if you need to modify an environment variable for a long time, you can modif
|
|||||||
|
|
||||||
For example, if you need to modify the `./configure` command for compiling PHP, you can find the `SPC_CMD_PREFIX_PHP_CONFIGURE` environment variable in the `config/env.ini` file, and then modify its value.
|
For example, if you need to modify the `./configure` command for compiling PHP, you can find the `SPC_CMD_PREFIX_PHP_CONFIGURE` environment variable in the `config/env.ini` file, and then modify its value.
|
||||||
|
|
||||||
|
If your build conditions are more complex and require multiple `env.ini` files to switch,
|
||||||
|
we recommend that you use the `config/env.custom.ini` file.
|
||||||
|
In this way, you can specify your environment variables by writing additional override items
|
||||||
|
without modifying the default `config/env.ini` file.
|
||||||
|
|
||||||
|
```ini
|
||||||
|
; This is an example of `config/env.custom.ini` file,
|
||||||
|
; we modify the `SPC_CONCURRENCY` and linux default CFLAGS passing to libs and PHP
|
||||||
|
[global]
|
||||||
|
SPC_CONCURRENCY=4
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
SPC_DEFAULT_C_FLAGS="-O3"
|
||||||
|
```
|
||||||
|
|
||||||
## Library environment variables (Unix only)
|
## Library environment variables (Unix only)
|
||||||
|
|
||||||
Starting from 2.2.0, static-php-cli supports custom environment variables for all compilation dependent library commands of macOS, Linux, FreeBSD and other Unix systems.
|
Starting from 2.2.0, static-php-cli supports custom environment variables for all compilation dependent library commands of macOS, Linux, FreeBSD and other Unix systems.
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ which will be listed one by one here.
|
|||||||
|
|
||||||
## curl
|
## curl
|
||||||
|
|
||||||
|
HTTP3 support is not enabled by default, compile with `--with-libs="nghttp2,nghttp3,ngtcp2"` to enable HTTP3 support for PHP >= 8.4.
|
||||||
|
|
||||||
When using curl to request HTTPS, there may be an `error:80000002:system library::No such file or directory` error.
|
When using curl to request HTTPS, there may be an `error:80000002:system library::No such file or directory` error.
|
||||||
For details on the solution, see [FAQ - Unable to use ssl](../faq/#unable-to-use-ssl).
|
For details on the solution, see [FAQ - Unable to use ssl](../faq/#unable-to-use-ssl).
|
||||||
|
|
||||||
@@ -48,6 +50,10 @@ This extension contains an implementation of the coroutine environment for `pdo_
|
|||||||
|
|
||||||
1. Only PHP 8.0 ~ 8.4 is supported.
|
1. Only PHP 8.0 ~ 8.4 is supported.
|
||||||
|
|
||||||
|
## imagick
|
||||||
|
|
||||||
|
1. The imagick extension currently only has openmp support on musl libc. This means that multithreading is disabled on glibc or other operating systems. The extension is still fully functional.
|
||||||
|
|
||||||
## imap
|
## imap
|
||||||
|
|
||||||
1. Kerberos is not supported
|
1. Kerberos is not supported
|
||||||
@@ -76,11 +82,9 @@ and this extension cannot be compiled into php by static linking, so it cannot b
|
|||||||
|
|
||||||
## xdebug
|
## xdebug
|
||||||
|
|
||||||
1. Xdebug is a Zend extension. The functions of Xdebug depend on PHP's Zend engine and underlying code.
|
1. Xdebug is only buildable as a shared extension. On Linux, you need to use static-php-cli with SPC_LIBC=glibc.
|
||||||
If you want to statically compile it into PHP, you may need a huge amount of patch code, which is not feasible.
|
2. When using Linux/glibc or macOS, you can compile Xdebug as a shared extension using --build-shared="xdebug".
|
||||||
2. The macOS platform can compile an xdebug extension under PHP compiled on the same platform,
|
The compiled `./php` binary can be configured and run by specifying the INI, eg `./php -d 'zend_extension=/path/to/xdebug.so' your-code.php`.
|
||||||
extract the `xdebug.so` file, and then use the `--no-strip` parameter in static-php-cli to retain the debug symbol table and add the `ffi` extension.
|
|
||||||
The compiled `./php` binary can be configured and run by specifying the INI, eg `./php -d 'zend_extension=/path/to/xdebug.so' your-code.php`.
|
|
||||||
|
|
||||||
## xml
|
## xml
|
||||||
|
|
||||||
@@ -123,8 +127,8 @@ For details on the solution, see [FAQ - Unable to use ssl](../faq/#unable-to-use
|
|||||||
|
|
||||||
## ffi
|
## ffi
|
||||||
|
|
||||||
1. Linux not supported yet: Due to limitations of the Linux system, although the ffi extension can be compiled successfully, it cannot be used to load other `so` extensions.
|
1. Due to the limitation of musl libc's static linkage, you cannot use ffi because dynamic libraries cannot be loaded.
|
||||||
The prerequisite for Linux to support loading `so` extensions is dynamic compilation, but dynamic compilation conflicts with the purpose of this project.
|
If you need to use the ffi extension, see [Compile PHP with GNU libc](./build-with-glibc).
|
||||||
2. macOS supports the ffi extension, but errors will occur when some kernels do not contain debugging symbols.
|
2. macOS supports the ffi extension, but errors will occur when some kernels do not contain debugging symbols.
|
||||||
3. Windows x64 supports the ffi extension.
|
3. Windows x64 supports the ffi extension.
|
||||||
|
|
||||||
@@ -147,5 +151,10 @@ Parallel is only supported on PHP 8.0 ZTS and above.
|
|||||||
|
|
||||||
## spx
|
## spx
|
||||||
|
|
||||||
1. The [SPX extension](https://github.com/NoiseByNorthwest/php-spx) only supports NTS mode.
|
1. SPX does not support Windows, and the official repository does not support static compilation. static-php-cli uses a [modified version](https://github.com/static-php/php-spx).
|
||||||
2. SPX does not support Windows, and the official repository does not support static compilation. static-php-cli uses a [modified version](https://github.com/static-php/php-spx).
|
|
||||||
|
## mimalloc
|
||||||
|
|
||||||
|
1. This is not technically an extension, but a library.
|
||||||
|
2. Building with `--with-libs="mimalloc"` on Linux or macOS will override the default allocator.
|
||||||
|
3. This is experimental for now, but is recommended in threaded environments.
|
||||||
|
|||||||
@@ -5,14 +5,10 @@ currently supporting Linux and macOS systems.
|
|||||||
|
|
||||||
In the guide section, you will learn how to use static php cli to build standalone PHP programs.
|
In the guide section, you will learn how to use static php cli to build standalone PHP programs.
|
||||||
|
|
||||||
- [GitHub Action Build](./action-build)
|
- [Build (local)](./manual-build)
|
||||||
- [Manual Build](./manual-build)
|
- [Build (GitHub Actions)](./action-build)
|
||||||
- [Supported Extensions](./extensions)
|
- [Supported Extensions](./extensions)
|
||||||
|
|
||||||
::: tip
|
|
||||||
If you are a native English speaker, some corrections to the documentation are welcome.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Compilation Environment
|
## Compilation Environment
|
||||||
|
|
||||||
The following is the architecture support situation, where :gear: represents support for GitHub Action build,
|
The following is the architecture support situation, where :gear: represents support for GitHub Action build,
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
---
|
||||||
|
outline: 'deep'
|
||||||
|
---
|
||||||
|
|
||||||
# Build (Linux, macOS, FreeBSD)
|
# Build (Linux, macOS, FreeBSD)
|
||||||
|
|
||||||
This section covers the build process for Linux, macOS, and FreeBSD. If you want to build on Windows,
|
This section covers the build process for Linux, macOS, and FreeBSD. If you want to build on Windows,
|
||||||
@@ -57,56 +61,6 @@ cd static-php-cli
|
|||||||
composer update
|
composer update
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use System PHP
|
|
||||||
|
|
||||||
Below are some example commands for installing PHP and Composer in the system.
|
|
||||||
It is recommended to search for the specific installation method yourself or ask the AI search engine to obtain the answer,
|
|
||||||
which will not be elaborated here.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# [macOS], need install Homebrew first. See https://brew.sh/
|
|
||||||
# Remember change your composer executable path. For M1/M2 Chip mac, "/opt/homebrew/bin/", for Intel mac, "/usr/local/bin/". Or add it to your own path.
|
|
||||||
brew install php wget
|
|
||||||
wget https://getcomposer.org/download/latest-stable/composer.phar -O /path/to/your/bin/composer && chmod +x /path/to/your/bin/composer
|
|
||||||
|
|
||||||
# [Debian], you need to make sure your php version >= 8.1 and composer >= 2.0
|
|
||||||
sudo apt install php-cli composer php-tokenizer
|
|
||||||
|
|
||||||
# [Alpine]
|
|
||||||
apk add bash file wget xz php81 php81-common php81-pcntl php81-tokenizer php81-phar php81-posix php81-xml composer
|
|
||||||
```
|
|
||||||
|
|
||||||
::: tip
|
|
||||||
Currently, some versions of Ubuntu install older PHP versions,
|
|
||||||
so no installation commands are provided. If necessary, it is recommended to add software sources such as ppa first,
|
|
||||||
and then install the latest version of PHP and tokenizer, XML, and phar extensions.
|
|
||||||
|
|
||||||
Older versions of Debian may have an older (<= 7.4) version of PHP installed by default, it is recommended to upgrade Debian first.
|
|
||||||
:::
|
|
||||||
|
|
||||||
### Use Docker
|
|
||||||
|
|
||||||
If you don't want to install PHP and Composer runtime environment on your system, you can use the built-in Docker environment build script.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# To use directly, replace `bin/spc` with `bin/spc-alpine-docker` in all used commands
|
|
||||||
bin/spc-alpine-docker
|
|
||||||
```
|
|
||||||
|
|
||||||
The first time the command is executed, `docker build` will be used to build a Docker image.
|
|
||||||
The default built Docker image is the `x86_64` architecture, and the image name is `cwcc-spc-x86_64`.
|
|
||||||
|
|
||||||
If you want to build `aarch64` static-php-cli in `x86_64` environment,
|
|
||||||
you can use qemu to emulate the arm image to run Docker, but the speed will be very slow.
|
|
||||||
Use command: `SPC_USE_ARCH=aarch64 bin/spc-alpine-docker`.
|
|
||||||
|
|
||||||
If it prompts that sudo is required to run after running,
|
|
||||||
execute the following command once to grant static-php-cli permission to execute sudo:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export SPC_USE_SUDO=yes
|
|
||||||
```
|
|
||||||
|
|
||||||
### Use Precompiled Static PHP Binaries
|
### Use Precompiled Static PHP Binaries
|
||||||
|
|
||||||
If you don't want to use Docker and install PHP in the system,
|
If you don't want to use Docker and install PHP in the system,
|
||||||
@@ -133,13 +87,103 @@ This script will download two files in total: `bin/php` and `bin/composer`. Afte
|
|||||||
it is equivalent to installing PHP in the system, you can directly Use commands such as `composer`, `php -v`, or directly use `bin/spc`.
|
it is equivalent to installing PHP in the system, you can directly Use commands such as `composer`, `php -v`, or directly use `bin/spc`.
|
||||||
2. Direct call, such as executing static-php-cli command: `bin/php bin/spc --help`, executing Composer: `bin/php bin/composer update`.
|
2. Direct call, such as executing static-php-cli command: `bin/php bin/spc --help`, executing Composer: `bin/php bin/composer update`.
|
||||||
|
|
||||||
## Command - download
|
### Use Docker
|
||||||
|
|
||||||
|
If you don't want to install PHP and Composer runtime environment on your system, you can use the built-in Docker environment build script.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# To use directly, replace `bin/spc` with `bin/spc-alpine-docker` in all used commands
|
||||||
|
bin/spc-alpine-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
The first time the command is executed, `docker build` will be used to build a Docker image.
|
||||||
|
The default built Docker image is the `x86_64` architecture, and the image name is `cwcc-spc-x86_64`.
|
||||||
|
|
||||||
|
If you want to build `aarch64` static-php-cli in `x86_64` environment,
|
||||||
|
you can use qemu to emulate the arm image to run Docker, but the speed will be very slow.
|
||||||
|
Use command: `SPC_USE_ARCH=aarch64 bin/spc-alpine-docker`.
|
||||||
|
|
||||||
|
If it prompts that sudo is required to run after running,
|
||||||
|
execute the following command once to grant static-php-cli permission to execute sudo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export SPC_USE_SUDO=yes
|
||||||
|
```
|
||||||
|
|
||||||
|
### Use System PHP
|
||||||
|
|
||||||
|
Below are some example commands for installing PHP and Composer in the system.
|
||||||
|
It is recommended to search for the specific installation method yourself or ask the AI search engine to obtain the answer,
|
||||||
|
which will not be elaborated here.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# [macOS], need install Homebrew first. See https://brew.sh/
|
||||||
|
# Remember change your composer executable path. For M1/M2 Chip mac, "/opt/homebrew/bin/", for Intel mac, "/usr/local/bin/". Or add it to your own path.
|
||||||
|
brew install php wget
|
||||||
|
wget https://getcomposer.org/download/latest-stable/composer.phar -O /path/to/your/bin/composer && chmod +x /path/to/your/bin/composer
|
||||||
|
|
||||||
|
# [Debian], you need to make sure your php version >= 8.1 and composer >= 2.0
|
||||||
|
sudo apt install php-cli composer php-tokenizer
|
||||||
|
|
||||||
|
# [Alpine]
|
||||||
|
apk add bash file wget xz php81 php81-common php81-pcntl php81-tokenizer php81-phar php81-posix php81-xml composer
|
||||||
|
```
|
||||||
|
|
||||||
|
::: tip
|
||||||
|
Currently, some versions of Ubuntu install older PHP versions,
|
||||||
|
so no installation commands are provided. If necessary, it is recommended to add software sources such as ppa first,
|
||||||
|
and then install the latest version of PHP and tokenizer, XML, and phar extensions.
|
||||||
|
|
||||||
|
Older versions of Debian may have an older (<= 7.4) version of PHP installed by default, it is recommended to upgrade Debian first.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## Build with craft (recommended)
|
||||||
|
|
||||||
|
Using `bin/spc craft`, you can use a configuration file and a command to automatically check the environment, download source code, build dependency libraries, build PHP and extensions, etc.
|
||||||
|
|
||||||
|
You need to write a `craft.yml` file and save it in the current working directory. `craft.yml` can be generated by [command generator](./cli-generator) or written manually.
|
||||||
|
|
||||||
|
For manual writing, please refer to the comments in [craft.yml configuration](../develop/craft-yml.md) to write it.
|
||||||
|
Let's assume that you compile an extension combination and choose PHP 8.4, outputting `cli` and `fpm`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# path/to/craft.yml
|
||||||
|
php-version: 8.4
|
||||||
|
extensions: bcmath,posix,phar,zlib,openssl,curl,fileinfo,tokenizer
|
||||||
|
sapi:
|
||||||
|
- cli
|
||||||
|
- fpm
|
||||||
|
```
|
||||||
|
|
||||||
|
Then use the `bin/spc craft` command to compile:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc craft --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
If the build is successful, you will see the `buildroot/bin` directory in the current directory, which contains the compiled PHP binary file, or the corresponding SAPI.
|
||||||
|
|
||||||
|
- cli: The build result is `buildroot/bin/php.exe` on Windows and `buildroot/bin/php` on other platforms.
|
||||||
|
- fpm: The build result is `buildroot/bin/php-fpm`.
|
||||||
|
- micro: The build result is `buildroot/bin/micro.sfx`. If you need to further package it with PHP code, please refer to [Packaging micro binary](./manual-build#command-micro-combine).
|
||||||
|
- embed: See [Using embed](./manual-build#embed-usage).
|
||||||
|
|
||||||
|
If the build fails, you can use the `--debug` parameter to view detailed error information,
|
||||||
|
or use the `--with-clean` to clear the old compilation results and recompile.
|
||||||
|
|
||||||
|
If the build still fails to use the above method, please submit an issue and attach your `craft.yml` and `craft.log`.
|
||||||
|
|
||||||
|
## Step-by-step build command
|
||||||
|
|
||||||
|
If you have customized requirements, or the need to download and compile PHP and dependent libraries separately, you can use the `bin/spc` command to execute step by step.
|
||||||
|
|
||||||
|
### Command download - Download dependency packages
|
||||||
|
|
||||||
Use the command `bin/spc download` to download the source code required for compilation,
|
Use the command `bin/spc download` to download the source code required for compilation,
|
||||||
including php-src and the source code of various dependent libraries.
|
including php-src and the source code of various dependent libraries.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download all dependencies
|
# Download all dependencies, defaults to php 8.4
|
||||||
bin/spc download --all
|
bin/spc download --all
|
||||||
|
|
||||||
# Download all dependent packages, and specify the main version of PHP to download, optional: 8.1, 8.2, 8.3, 8.4
|
# Download all dependent packages, and specify the main version of PHP to download, optional: 8.1, 8.2, 8.3, 8.4
|
||||||
@@ -217,7 +261,7 @@ bin/spc download --for-extensions=redis -G "php-src:master:https://github.com/ph
|
|||||||
bin/spc download --for-extensions=swoole -G "swoole:master:https://github.com/swoole/swoole-src.git"
|
bin/spc download --for-extensions=swoole -G "swoole:master:https://github.com/swoole/swoole-src.git"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Command - doctor
|
### Command - doctor
|
||||||
|
|
||||||
If you can run `bin/spc` normally but cannot compile static PHP or dependent libraries normally,
|
If you can run `bin/spc` normally but cannot compile static PHP or dependent libraries normally,
|
||||||
you can run `bin/spc doctor` first to check whether the system itself lacks dependencies.
|
you can run `bin/spc doctor` first to check whether the system itself lacks dependencies.
|
||||||
@@ -230,13 +274,13 @@ bin/spc doctor
|
|||||||
bin/spc doctor --auto-fix
|
bin/spc doctor --auto-fix
|
||||||
```
|
```
|
||||||
|
|
||||||
## Command - build
|
### Command - build
|
||||||
|
|
||||||
Use the build command to start building the static php binary.
|
Use the build command to start building the static php binary.
|
||||||
Before executing the `bin/spc build` command, be sure to use the `download` command to download sources.
|
Before executing the `bin/spc build` command, be sure to use the `download` command to download sources.
|
||||||
It is recommended to use `doctor` to check the environment.
|
It is recommended to use `doctor` to check the environment.
|
||||||
|
|
||||||
### Basic build
|
#### Basic build
|
||||||
|
|
||||||
You need to go to [Extension List](./extensions) or [Command Generator](./cli-generator) to select the extension you want to add,
|
You need to go to [Extension List](./extensions) or [Command Generator](./cli-generator) to select the extension you want to add,
|
||||||
and then use the command `bin/spc build` to compile.
|
and then use the command `bin/spc build` to compile.
|
||||||
@@ -283,16 +327,7 @@ bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
|
|||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### Debug
|
#### Build Options
|
||||||
|
|
||||||
If you encounter problems during the compilation process, or want to view each executing shell command,
|
|
||||||
you can use `--debug` to enable debug mode and view all terminal logs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bin/spc build mysqlnd,pdo_mysql --build-all --debug
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build Options
|
|
||||||
|
|
||||||
During the compilation process, in some special cases,
|
During the compilation process, in some special cases,
|
||||||
the compiler and the content of the compilation directory need to be intervened.
|
the compiler and the content of the compilation directory need to be intervened.
|
||||||
@@ -314,6 +349,7 @@ You can try to use the following commands:
|
|||||||
- `--with-suggested-exts`: Add `ext-suggests` as dependencies when compiling
|
- `--with-suggested-exts`: Add `ext-suggests` as dependencies when compiling
|
||||||
- `--with-suggested-libs`: Add `lib-suggests` as dependencies when compiling
|
- `--with-suggested-libs`: Add `lib-suggests` as dependencies when compiling
|
||||||
- `--with-upx-pack`: Use UPX to reduce the size of the binary file after compilation (you need to use `bin/spc install-pkg upx` to install upx first)
|
- `--with-upx-pack`: Use UPX to reduce the size of the binary file after compilation (you need to use `bin/spc install-pkg upx` to install upx first)
|
||||||
|
- `--build-shared=XXX,YYY`: compile the specified extension into a shared library (the default is to compile into a static library)
|
||||||
|
|
||||||
For hardcoding INI options, it works for cli, micro, embed sapi. Here is a simple example where we preset a larger `memory_limit` and disable the `system` function:
|
For hardcoding INI options, it works for cli, micro, embed sapi. Here is a simple example where we preset a larger `memory_limit` and disable the `system` function:
|
||||||
|
|
||||||
@@ -321,6 +357,15 @@ For hardcoding INI options, it works for cli, micro, embed sapi. Here is a simpl
|
|||||||
bin/spc build bcmath,pcntl,posix --build-all -I "memory_limit=4G" -I "disable_functions=system"
|
bin/spc build bcmath,pcntl,posix --build-all -I "memory_limit=4G" -I "disable_functions=system"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Debug
|
||||||
|
|
||||||
|
If you encounter problems during the compilation process, or want to view each executing shell command,
|
||||||
|
you can use `--debug` to enable debug mode and view all terminal logs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc build mysqlnd,pdo_mysql --build-all --debug
|
||||||
|
```
|
||||||
|
|
||||||
## Command - micro:combine
|
## Command - micro:combine
|
||||||
|
|
||||||
Use the `micro:combine` command to build the compiled `micro.sfx` and your code (`.php` or `.phar` file) into an executable binary.
|
Use the `micro:combine` command to build the compiled `micro.sfx` and your code (`.php` or `.phar` file) into an executable binary.
|
||||||
@@ -397,6 +442,31 @@ manually unpack and copy the package to a specified location, and we can use com
|
|||||||
bin/spc extract php-src,libxml2
|
bin/spc extract php-src,libxml2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Command - dump-extensions
|
||||||
|
|
||||||
|
Use the command `bin/spc dump-extensions` to export required extensions of the current project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Print the extension list of the project, pass in the root directory of the project containing composer.json
|
||||||
|
bin/spc dump-extensions /path/to/your/project/
|
||||||
|
|
||||||
|
# Print the extension list of the project, excluding development dependencies
|
||||||
|
bin/spc dump-extensions /path-to/tour/project/ --no-dev
|
||||||
|
|
||||||
|
# Output in the extension list format acceptable to the spc command (comma separated)
|
||||||
|
bin/spc dump-extensions /path-to/tour/project/ --format=text
|
||||||
|
|
||||||
|
# Output as a JSON list
|
||||||
|
bin/spc dump-extensions /path-to/tour/project/ --format=json
|
||||||
|
|
||||||
|
# When the project does not have any extensions, output the specified extension combination instead of returning failure
|
||||||
|
bin/spc dump-extensions /path-to/your/project/ --no-ext-output=mbstring,posix,pcntl,phar
|
||||||
|
|
||||||
|
# Do not exclude extensions not supported by spc when outputting
|
||||||
|
bin/spc dump-extensions /path/to/your/project/ --no-spc-filter
|
||||||
|
```
|
||||||
|
It should be noted that the project directory must contain the `vendor/installed.json` and `composer.lock` files, otherwise they cannot be found normally.
|
||||||
|
|
||||||
## Dev Command - dev
|
## Dev Command - dev
|
||||||
|
|
||||||
Debug commands refer to a collection of commands that can assist in outputting some information
|
Debug commands refer to a collection of commands that can assist in outputting some information
|
||||||
|
|||||||
@@ -8,8 +8,15 @@ here will describe how to check the errors by yourself and report Issue.
|
|||||||
Problems with downloading resources are one of the most common problems with spc.
|
Problems with downloading resources are one of the most common problems with spc.
|
||||||
The main reason is that the addresses used for SPC download resources are generally the official website of the corresponding project or GitHub, etc.,
|
The main reason is that the addresses used for SPC download resources are generally the official website of the corresponding project or GitHub, etc.,
|
||||||
and these websites may occasionally go down and block IP addresses.
|
and these websites may occasionally go down and block IP addresses.
|
||||||
Currently, version 2.0.0 has not added an automatic retry mechanism, so after encountering a download failure,
|
After encountering a download failure,
|
||||||
you can try to call the download command multiple times. If you confirm that the address is indeed inaccessible,
|
you can try to call the download command multiple times.
|
||||||
|
|
||||||
|
When downloading extensions, you may eventually see errors like `curl: (56) The requested URL returned error: 403` which are often caused by github rate limiting.
|
||||||
|
You can verify this by adding `--debug` to the command and will see something like `[DEBU] Running command (no output) : curl -sfSL "https://api.github.com/repos/openssl/openssl/releases"`.
|
||||||
|
|
||||||
|
To fix this, [create](https://github.com/settings/tokens) a personal access token on GitHub and set it as an environment variable `GITHUB_TOKEN=<XXX>`.
|
||||||
|
|
||||||
|
If you confirm that the address is indeed inaccessible,
|
||||||
you can submit an Issue or PR to update the url or download type.
|
you can submit an Issue or PR to update the url or download type.
|
||||||
|
|
||||||
## Doctor Can't Fix Something
|
## Doctor Can't Fix Something
|
||||||
@@ -31,3 +38,5 @@ and then determine the command that reported the error.
|
|||||||
The error terminal output is very important for fixing compilation errors.
|
The error terminal output is very important for fixing compilation errors.
|
||||||
When submitting an issue, please upload the last error fragment of the terminal log (or the entire terminal log output),
|
When submitting an issue, please upload the last error fragment of the terminal log (or the entire terminal log output),
|
||||||
and include the `spc` command and parameters used.
|
and include the `spc` command and parameters used.
|
||||||
|
|
||||||
|
If you are rebuilding, please refer to the [Local Build - Multiple Builds](./manual-build#multiple-builds) section.
|
||||||
|
|||||||
7
docs/zh/develop/craft-yml.md
Normal file
7
docs/zh/develop/craft-yml.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
aside: false
|
||||||
|
---
|
||||||
|
|
||||||
|
# craft.yml 配置
|
||||||
|
|
||||||
|
<!--@include: ../../deps-craft-yml.md-->
|
||||||
@@ -16,10 +16,26 @@ PHP 默认也会从 [其他标准位置](https://www.php.net/manual/zh/configura
|
|||||||
|
|
||||||
## 静态编译的 PHP 可以安装扩展吗
|
## 静态编译的 PHP 可以安装扩展吗
|
||||||
|
|
||||||
因为传统架构下的 PHP 安装扩展的原理是使用 `.so` 类型的动态链接的库方式安装新扩展,而使用本项目编译的静态链接的 PHP 无法**直接**使用动态链接库安装新扩展。
|
因为传统架构下的 PHP 安装扩展的原理是使用 `.so` 类型的动态链接的库方式安装新扩展,而使用本项目编译的静态链接的 PHP。但是静态链接在不同操作系统有不同的定义。
|
||||||
|
|
||||||
|
首先对于 Linux 系统来说,静态链接的二进制文件是不会链接系统的动态链接库的,纯静态链接的二进制无法加载动态库,所以无法添加新的扩展。
|
||||||
|
同时,在纯静态模式下你也不能使用 `ffi` 等扩展加载外部的 `.so` 模块。
|
||||||
|
|
||||||
|
你可以通过命令 `ldd buildroot/bin/php` 来查看你在 Linux 下构建的二进制是否为纯静态链接的。
|
||||||
|
|
||||||
|
如果你 [构建 GNU libc 兼容的 PHP](../guide/build-with-glibc),你可以使用 `ffi` 扩展加载外部的 `.so` 模块,并且加载具有相同 ABI 的 `.so` 扩展。
|
||||||
|
|
||||||
|
例如,你可以使用以下命令构建一个 glibc 动态链接的静态 PHP 二进制,同时支持 FFI 扩展和加载相同 PHP 版本和相同 TS 类型的 `xdebug.so` 扩展:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc-gnu-docker download --for-extensions=ffi,xml --with-php=8.4
|
||||||
|
bin/spc-gnu-docker build ffi,xml --build-cli --debug
|
||||||
|
|
||||||
|
buildroot/bin/php -d "zend_extension=/path/to/php{PHP_VER}-{ts/nts}/xdebug.so" --ri xdebug
|
||||||
|
```
|
||||||
|
|
||||||
对于 macOS 平台来说,macOS 下的几乎所有二进制文件都无法真正纯静态链接,几乎所有二进制文件都会链接 macOS 的系统库:`/usr/lib/libresolv.9.dylib` 和 `/usr/lib/libSystem.B.dylib`。
|
对于 macOS 平台来说,macOS 下的几乎所有二进制文件都无法真正纯静态链接,几乎所有二进制文件都会链接 macOS 的系统库:`/usr/lib/libresolv.9.dylib` 和 `/usr/lib/libSystem.B.dylib`。
|
||||||
所以在 macOS 系统下,在特定的编译条件下可以使用静态编译的 php 二进制文件,同时使用动态链接的扩展:
|
所以在 macOS 系统下,在特定的编译条件下可以使用静态编译的 php 二进制文件,可使用动态链接的扩展:
|
||||||
|
|
||||||
1. 使用 `--no-strip` 参数,将不会对二进制文件去除调试符号等信息,以供使用 `Xdebug` 等外部 Zend 扩展。
|
1. 使用 `--no-strip` 参数,将不会对二进制文件去除调试符号等信息,以供使用 `Xdebug` 等外部 Zend 扩展。
|
||||||
2. 如果要编译某些 Zend 扩展,使用 Homebrew、MacPorts、源码编译的形式,在所在的操作系统安装一个普通版本的 PHP。
|
2. 如果要编译某些 Zend 扩展,使用 Homebrew、MacPorts、源码编译的形式,在所在的操作系统安装一个普通版本的 PHP。
|
||||||
@@ -31,12 +47,10 @@ PHP 默认也会从 [其他标准位置](https://www.php.net/manual/zh/configura
|
|||||||
bin/spc build ffi --build-cli --no-strip
|
bin/spc build ffi --build-cli --no-strip
|
||||||
```
|
```
|
||||||
|
|
||||||
对于 Linux 平台来说,目前的编译结果为纯静态链接的二进制文件,无法使用动态链接库安装新扩展。
|
|
||||||
|
|
||||||
## 可以支持 Oracle 数据库扩展吗
|
## 可以支持 Oracle 数据库扩展吗
|
||||||
|
|
||||||
部分依赖库闭源的扩展,如 `oci8`、`sourceguardian` 等,它们没有提供纯静态编译的依赖库文件(`.a`),仅提供了动态依赖库文件(`.so`),
|
部分依赖库闭源的扩展,如 `oci8`、`sourceguardian` 等,它们没有提供纯静态编译的依赖库文件(`.a`),仅提供了动态依赖库文件(`.so`),
|
||||||
这些扩展无法使用源码的形式编译到 static-php-cli 中,所以本项目可能永远也不会支持这些扩展。不过,理论上你可以根据上面的问题在 macOS 下接入和使用这类扩展。
|
这些扩展无法使用源码的形式编译到 static-php-cli 中,所以本项目可能永远也不会支持这些扩展。不过,理论上你可以根据上面的问题在 macOS 和 Linux 下接入和使用这类扩展。
|
||||||
|
|
||||||
如果你对此类扩展有需求,或者大部分人都对这些闭源扩展使用有需求,
|
如果你对此类扩展有需求,或者大部分人都对这些闭源扩展使用有需求,
|
||||||
可以看看有关 [standalone-php-cli](https://github.com/crazywhalecc/static-php-cli/discussions/58) 的讨论。欢迎留言。
|
可以看看有关 [standalone-php-cli](https://github.com/crazywhalecc/static-php-cli/discussions/58) 的讨论。欢迎留言。
|
||||||
@@ -62,6 +76,8 @@ PHP 代码的编译器是完全不同的项目,因此不会考虑额外的情
|
|||||||
|
|
||||||
## 无法使用 ssl
|
## 无法使用 ssl
|
||||||
|
|
||||||
|
**更新:该问题已在最新版本的 static-php-cli 中修复,现在默认读取系统的证书文件。如果你仍然遇到问题,再尝试下方的解决方案。**
|
||||||
|
|
||||||
使用 curl、pgsql 等 请求 HTTPS 网站或建立 SSL 连接时,可能存在 `error:80000002:system library::No such file or directory` 错误,
|
使用 curl、pgsql 等 请求 HTTPS 网站或建立 SSL 连接时,可能存在 `error:80000002:system library::No such file or directory` 错误,
|
||||||
这个错误是由于静态编译的 PHP 未通过 `php.ini` 指定 `openssl.cafile` 导致的。
|
这个错误是由于静态编译的 PHP 未通过 `php.ini` 指定 `openssl.cafile` 导致的。
|
||||||
|
|
||||||
|
|||||||
54
docs/zh/guide/build-with-glibc.md
Normal file
54
docs/zh/guide/build-with-glibc.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# 构建 glibc 兼容的 Linux 二进制
|
||||||
|
|
||||||
|
## 为什么要构建 glibc 兼容的二进制
|
||||||
|
|
||||||
|
目前,static-php-cli 在默认条件下在 Linux 系统构建的二进制都是基于 musl-libc(静态链接)的。
|
||||||
|
musl-libc 是一个轻量级的 libc 实现,它的目标是与 glibc 兼容,并且提供良好的纯静态链接支持。
|
||||||
|
这意味着,编译出来的静态 PHP 可执行文件在几乎任何 Linux 发行版都可以使用,而不需要考虑 libc、libstdc++ 等库的版本问题。
|
||||||
|
|
||||||
|
但是,Linux 系统的纯静态链接 musl-libc 二进制文件存在以下问题:
|
||||||
|
|
||||||
|
- 无法使用 PHP 的 `dl()` 函数加载动态链接库和外部 PHP 扩展。
|
||||||
|
- 无法使用 PHP 的 FFI 扩展。
|
||||||
|
- 部分极端情况下,可能会出现性能问题,参见 [musl-libc 的性能问题](https://github.com/php/php-src/issues/13648)。
|
||||||
|
|
||||||
|
对于不同的 Linux 发行版,它们使用的默认 libc 可能不同,比如 Alpine Linux 使用 musl libc,而大多数 Linux 发行版使用 glibc。
|
||||||
|
但即便如此,我们也不能直接使用任意的发行版和 glibc 构建便携的静态二进制文件,因为 glibc 有一些问题:
|
||||||
|
|
||||||
|
- 基于新版本的发行版在使用 gcc 等工具构建的二进制,无法在旧版本的发行版上运行。
|
||||||
|
- glibc 不推荐被静态链接,因为它的一些特性需要动态链接库的支持。
|
||||||
|
|
||||||
|
但是,我们可以使用 Docker 容器来解决这个问题,最终输出的结果是一个动态链接 glibc 和一些必要库的二进制,但它静态链接所有其他依赖。
|
||||||
|
|
||||||
|
1. 使用一个旧版本的 Linux 发行版(如 CentOS 7.x),它的 glibc 版本比较旧,但是可以在大多数现代 Linux 发行版上运行。
|
||||||
|
2. 在这个容器中构建 PHP 的静态二进制文件,这样就可以在大多数现代 Linux 发行版上运行了。
|
||||||
|
|
||||||
|
> 使用 glibc 的静态二进制文件,可以在大多数现代 Linux 发行版上运行,但是不能在 musl libc 的发行版上运行,如 CentOS 6、Alpine Linux 等。
|
||||||
|
|
||||||
|
## 构建 glibc 兼容的 Linux 二进制
|
||||||
|
|
||||||
|
最新版的 static-php-cli 内置了 `bin/spc-gnu-docker` 脚本,可以一键创建一个 CentOS 7.x (glibc-2.17) 的 Docker 容器,并在容器中构建 glibc 兼容的 PHP 静态二进制文件。
|
||||||
|
|
||||||
|
然后,先运行一次以下命令。首次运行时时间较长,因为需要下载 CentOS 7.x 的镜像和一些编译工具。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc-gnu-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
构建镜像完成后,你将看到和 `bin/spc` 一样的命令帮助菜单,这时说明容器已经准备好了。
|
||||||
|
|
||||||
|
在容器准备好后,你可以参考 [本地构建](./manual-build) 章节的内容,构建你的 PHP 静态二进制文件。仅需要把 `bin/spc` 或 `./spc` 替换为 `bin/spc-gnu-docker` 即可。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc-gnu-docker build bcmath,ctype,openssl,pdo,phar,posix,session,tokenizer,xml,zip --build-cli --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
极少数情况下,基于 glibc 的静态 PHP 可能会出现 segment fault 等错误,但目前例子较少,如果遇到问题请提交 issue。
|
||||||
|
|
||||||
|
glibc 构建为扩展的特性,不属于默认 static-php 的支持范围。如果有相关问题或需求,请在提交 Issue 时注明你是基于 glibc 构建的。
|
||||||
|
|
||||||
|
如果你需要不使用 Docker 构建基于 glibc 的二进制,请参考 `bin/spc-gnu-docker` 脚本,手动构建一个类似的环境。
|
||||||
|
|
||||||
|
请注意,我们仅支持使用 bin/spc-gnu-docker 构建的 glibc 版本。已在 RHEL 9 和 10 上进行了编译测试并验证其稳定性,但如果您遇到问题,我们可能不会进行修复。
|
||||||
@@ -36,6 +36,19 @@ SPC_CONCURRENCY=4 bin/spc build mbstring,pcntl --build-cli
|
|||||||
|
|
||||||
例如,你需要修改编译 PHP 的 `./configure` 命令,你可以在 `config/env.ini` 文件中找到 `SPC_CMD_PREFIX_PHP_CONFIGURE` 环境变量,然后修改其值即可。
|
例如,你需要修改编译 PHP 的 `./configure` 命令,你可以在 `config/env.ini` 文件中找到 `SPC_CMD_PREFIX_PHP_CONFIGURE` 环境变量,然后修改其值即可。
|
||||||
|
|
||||||
|
但如果你的构建条件比较复杂,需要多种 env.ini 进行切换,我们推荐你使用 `config/env.custom.ini` 文件,这样你可以在不修改默认的 `config/env.ini` 文件的情况下,
|
||||||
|
通过写入额外的重载项目指定你的环境变量。
|
||||||
|
|
||||||
|
```ini
|
||||||
|
; This is an example of `config/env.custom.ini` file,
|
||||||
|
; we modify the `SPC_CONCURRENCY` and linux default CFLAGS passing to libs and PHP
|
||||||
|
[global]
|
||||||
|
SPC_CONCURRENCY=4
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
SPC_DEFAULT_C_FLAGS="-O3"
|
||||||
|
```
|
||||||
|
|
||||||
## 编译依赖库的环境变量(仅限 Unix 系统)
|
## 编译依赖库的环境变量(仅限 Unix 系统)
|
||||||
|
|
||||||
从 2.2.0 开始,static-php-cli 对所有 macOS、Linux、FreeBSD 等 Unix 系统的编译依赖库的命令均支持自定义环境变量。
|
从 2.2.0 开始,static-php-cli 对所有 macOS、Linux、FreeBSD 等 Unix 系统的编译依赖库的命令均支持自定义环境变量。
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
## curl
|
## curl
|
||||||
|
|
||||||
|
HTTP3 支持默认未启用,需在编译时添加 `--with-libs="nghttp2,nghttp3,ngtcp2"` 以启用 PHP 8.4 及以上版本的 HTTP3 支持。
|
||||||
|
|
||||||
使用 curl 请求 HTTPS 时,可能存在 `error:80000002:system library::No such file or directory` 错误,
|
使用 curl 请求 HTTPS 时,可能存在 `error:80000002:system library::No such file or directory` 错误,
|
||||||
解决办法详见 [FAQ - 无法使用 ssl](../faq/#无法使用-ssl)。
|
解决办法详见 [FAQ - 无法使用 ssl](../faq/#无法使用-ssl)。
|
||||||
|
|
||||||
@@ -45,6 +47,10 @@ swoole-hook-sqlite 与 `pdo_sqlite` 扩展冲突。如需使用 Swoole 和 `pdo_
|
|||||||
|
|
||||||
1. swow 仅支持 PHP 8.0 ~ 8.4 版本。
|
1. swow 仅支持 PHP 8.0 ~ 8.4 版本。
|
||||||
|
|
||||||
|
## imagick
|
||||||
|
|
||||||
|
imagick 扩展目前仅在 musl libc 上支持 OpenMP(libgomp)。使用 glibc 方式构建的 imagick 扩展无法支持多线程特性。
|
||||||
|
|
||||||
## imap
|
## imap
|
||||||
|
|
||||||
1. 该扩展目前不支持 Kerberos。
|
1. 该扩展目前不支持 Kerberos。
|
||||||
@@ -70,9 +76,9 @@ bin/spc build gd --with-libs=freetype,libjpeg,libavif,libwebp --build-cli
|
|||||||
|
|
||||||
## xdebug
|
## xdebug
|
||||||
|
|
||||||
1. Xdebug 是一个 Zend 扩展,Xdebug 的功能依赖于 PHP 的 Zend 引擎和底层代码,如果要将其静态编译到 PHP 中,可能需要巨量的 patch 代码,这是不可行的。
|
1. Xdebug 只能作为共享扩展进行构建。在 Linux 上,您需要使用 static-php-cli 并设置 SPC_LIBC=glibc。
|
||||||
2. macOS 平台可以通过在相同平台编译的 PHP 下编译一个 xdebug 扩展,并提取其中的 `xdebug.so` 文件,再在 static-php-cli 中使用 `--no-strip` 参数保留调试符号表,同时加入 `ffi` 扩展。
|
2. 使用 Linux/glibc 或 macOS 时,您可以使用 `--build-shared=xdebug` 将 Xdebug 编译为共享扩展。
|
||||||
编译的 `./php` 二进制可以通过指定 INI 配置并运行,例如`./php -d 'zend_extension=xdebug.so' your-code.php`。
|
编译后的 `./php` 二进制文件可以通过指定 INI 文件进行配置和运行,例如 `./php -d 'zend_extension=/path/to/xdebug.so' your-code.php`。
|
||||||
|
|
||||||
## xml
|
## xml
|
||||||
|
|
||||||
@@ -113,9 +119,10 @@ pgsql 16.2 修复了这个 Bug,现在正常工作了。
|
|||||||
|
|
||||||
## ffi
|
## ffi
|
||||||
|
|
||||||
1. 因为 Linux 系统的限制,虽然可以成功编译 ffi 扩展,但无法使用它加载其他 `so` 扩展。Linux 支持加载 so 扩展的前提是非静态编译,但动态编译和本项目的目的冲突。
|
1. 由于 musl libc 静态链接的限制,无法加载动态库,因此无法使用 ffi。
|
||||||
2. macOS 支持 ffi 扩展,但是部分内核下不包含调试符号时会出现错误。
|
如果您需要使用 ffi 扩展,请参阅 [使用 GNU libc 编译 PHP](./build-with-glibc)。
|
||||||
3. Windows 支持 ffi 扩展。
|
2. macOS 支持 ffi 扩展,但某些内核不包含调试符号时会出现错误。
|
||||||
|
3. Windows x64 支持 ffi 扩展。
|
||||||
|
|
||||||
## xhprof
|
## xhprof
|
||||||
|
|
||||||
@@ -134,5 +141,10 @@ parallel 扩展只支持 PHP 8.0 及以上版本,并只支持 ZTS 构建(`--
|
|||||||
|
|
||||||
## spx
|
## spx
|
||||||
|
|
||||||
1. [SPX 扩展](https://github.com/NoiseByNorthwest/php-spx) 只支持非线程模式。
|
1. SPX 目前不支持 Windows,且官方仓库也不支持静态编译,static-php-cli 使用了 [修改版本](https://github.com/static-php/php-spx)。
|
||||||
2. SPX 目前不支持 Windows,且官方仓库也不支持静态编译,static-php-cli 使用了 [修改版本](https://github.com/static-php/php-spx)。
|
|
||||||
|
## mimalloc
|
||||||
|
|
||||||
|
1. 从技术上讲,这不是扩展,而是一个库。
|
||||||
|
2. 在 Linux 或 macOS 上使用 `--with-libs="mimalloc"` 进行构建将覆盖默认分配器。
|
||||||
|
3. 目前,这还处于实验阶段,但建议在线程环境中使用。
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
---
|
||||||
|
outline: 'deep'
|
||||||
|
---
|
||||||
|
|
||||||
# 本地构建(Linux、macOS、FreeBSD)
|
# 本地构建(Linux、macOS、FreeBSD)
|
||||||
|
|
||||||
本章节为 Linux、macOS、FreeBSD 的构建过程,如果你要在 Windows 上构建,请到 [在 Windows 上构建](./build-on-windows)。
|
本章节为 Linux、macOS、FreeBSD 的构建过程,如果你要在 Windows 上构建,请到 [在 Windows 上构建](./build-on-windows)。
|
||||||
@@ -50,29 +54,29 @@ cd static-php-cli
|
|||||||
composer update
|
composer update
|
||||||
```
|
```
|
||||||
|
|
||||||
### 使用系统 PHP 环境
|
### 使用预编译静态 PHP 二进制运行 static-php-cli
|
||||||
|
|
||||||
下面是系统安装 PHP、Composer 的一些示例命令。具体安装方式建议自行搜索或询问 AI 搜索引擎获取答案,这里不多赘述。
|
如果你不想使用 Docker、在系统内安装 PHP,可以直接下载本项目自身编译好的 php 二进制 cli 程序。使用流程如下:
|
||||||
|
|
||||||
```bash
|
使用命令部署环境,此脚本会从 [自托管的服务器](https://dl.static-php.dev/static-php-cli/) 下载一个当前操作系统的 php-cli 包,
|
||||||
# [macOS], 需要先安装 Homebrew. See https://brew.sh/
|
并从 [getcomposer](https://getcomposer.org/download/latest-stable/composer.phar) 或 [Aliyun(镜像)](https://mirrors.aliyun.com/composer/composer.phar) 下载 Composer。
|
||||||
# Remember change your composer executable path. For M1/M2 Chip mac, "/opt/homebrew/bin/", for Intel mac, "/usr/local/bin/". Or add it to your own path.
|
|
||||||
brew install php wget
|
|
||||||
wget https://getcomposer.org/download/latest-stable/composer.phar -O /path/to/your/bin/composer && chmod +x /path/to/your/bin/composer
|
|
||||||
|
|
||||||
# [Debian], you need to make sure your php version >= 8.1 and composer >= 2.0
|
|
||||||
sudo apt install php-cli composer php-tokenizer
|
|
||||||
|
|
||||||
# [Alpine]
|
|
||||||
apk add bash file wget xz php81 php81-common php81-pcntl php81-tokenizer php81-phar php81-posix php81-xml composer
|
|
||||||
```
|
|
||||||
|
|
||||||
::: tip
|
::: tip
|
||||||
目前 Ubuntu 部分版本的 apt 安装的 php 版本较旧,故不提供安装命令。如有需要,建议先添加 ppa 等软件源后,安装最新版的 PHP 以及 tokenizer、xml、phar 扩展。
|
使用预编译静态 PHP 二进制目前仅支持 Linux 和 macOS。FreeBSD 环境因为缺少自动化构建环境,所以暂不支持。
|
||||||
|
|
||||||
较老版本的 Debian 默认安装的可能为旧版本(<= 7.4)版本的 PHP,建议先升级 Debian。
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/setup-runtime
|
||||||
|
|
||||||
|
# 对于中国大陆地区等网络环境特殊的用户,可使用镜像站加快下载速度
|
||||||
|
bin/setup-runtime --mirror china
|
||||||
|
```
|
||||||
|
|
||||||
|
此脚本总共会下载两个文件:`bin/php` 和 `bin/composer`,下载完成后,有两种使用方式:
|
||||||
|
|
||||||
|
1. 将 `bin/` 目录添加到 PATH 路径中:`export PATH="/path/to/your/static-php-cli/bin:$PATH"`,添加路径后,相当于系统安装了 PHP,可直接使用 `composer`、`php -v` 等命令,也可以直接使用 `bin/spc`。
|
||||||
|
2. 直接调用,比如执行 static-php-cli 命令:`bin/php bin/spc --help`,执行 Composer:`bin/php bin/composer update`。
|
||||||
|
|
||||||
### 使用 Docker 环境
|
### 使用 Docker 环境
|
||||||
|
|
||||||
如果你不愿意在系统安装 PHP 和 Composer 运行环境,可以使用内置的 Docker 环境构建脚本。
|
如果你不愿意在系统安装 PHP 和 Composer 运行环境,可以使用内置的 Docker 环境构建脚本。
|
||||||
@@ -92,30 +96,65 @@ bin/spc-alpine-docker
|
|||||||
export SPC_USE_SUDO=yes
|
export SPC_USE_SUDO=yes
|
||||||
```
|
```
|
||||||
|
|
||||||
### 使用预编译静态 PHP 二进制
|
### 使用系统 PHP 环境
|
||||||
|
|
||||||
如果你不想使用 Docker、在系统内安装 PHP,可以直接下载本项目自身编译好的 php 二进制 cli 程序。使用流程如下:
|
下面是系统安装 PHP、Composer 的一些示例命令。具体安装方式建议自行搜索或询问 AI 搜索引擎获取答案,这里不多赘述。
|
||||||
|
|
||||||
使用命令部署环境,此脚本会从 [自托管的服务器](https://dl.static-php.dev/static-php-cli/) 下载一个当前操作系统的 php-cli 包,
|
|
||||||
并从 [getcomposer](https://getcomposer.org/download/latest-stable/composer.phar) 或 [Aliyun(镜像)](https://mirrors.aliyun.com/composer/composer.phar) 下载 Composer。
|
|
||||||
|
|
||||||
::: tip
|
|
||||||
使用预编译静态 PHP 二进制目前仅支持 Linux 和 macOS。FreeBSD 环境因为缺少自动化构建环境,所以暂不支持。
|
|
||||||
:::
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bin/setup-runtime
|
# [macOS], 需要先安装 Homebrew. See https://brew.sh/
|
||||||
|
# Remember change your composer executable path. For M1/M2 Chip mac, "/opt/homebrew/bin/", for Intel mac, "/usr/local/bin/". Or add it to your own path.
|
||||||
|
brew install php wget
|
||||||
|
wget https://getcomposer.org/download/latest-stable/composer.phar -O /path/to/your/bin/composer && chmod +x /path/to/your/bin/composer
|
||||||
|
|
||||||
# 对于中国大陆地区等网络环境特殊的用户,可使用镜像站加快下载速度
|
# [Debian], you need to make sure your php version >= 8.4 and composer >= 2.0
|
||||||
bin/setup-runtime --mirror china
|
sudo apt install php-cli composer php-tokenizer
|
||||||
```
|
```
|
||||||
|
|
||||||
此脚本总共会下载两个文件:`bin/php` 和 `bin/composer`,下载完成后,有两种使用方式:
|
::: tip
|
||||||
|
目前 Ubuntu 部分版本的 apt 安装的 php 版本较旧,故不提供安装命令。如有需要,建议先添加 ppa 等软件源后,安装最新版的 PHP 以及 tokenizer、xml、phar 扩展。
|
||||||
|
|
||||||
1. 将 `bin/` 目录添加到 PATH 路径中:`export PATH="/path/to/your/static-php-cli/bin:$PATH"`,添加路径后,相当于系统安装了 PHP,可直接使用 `composer`、`php -v` 等命令,也可以直接使用 `bin/spc`。
|
较老版本的 Debian 默认安装的可能为旧版本(<= 8.3)版本的 PHP,建议先升级 Debian 或使用 Docker 或自带的静态二进制环境。
|
||||||
2. 直接调用,比如执行 static-php-cli 命令:`bin/php bin/spc --help`,执行 Composer:`bin/php bin/composer update`。
|
:::
|
||||||
|
|
||||||
## 命令 download - 下载依赖包
|
## 使用 craft 构建(推荐)
|
||||||
|
|
||||||
|
使用 `bin/spc craft` 可以使用一个配置文件,一个命令实现自动检查环境、下载源代码、构建依赖库、构建 PHP 及扩展等。
|
||||||
|
|
||||||
|
你需要编写一个 `craft.yml` 文件,存放在当前工作目录下。`craft.yml` 可以由 [命令生成器](./cli-generator) 生成,或者手动编写。
|
||||||
|
|
||||||
|
手动编写可参考 [craft.yml 配置](../develop/craft-yml.md) 中的注释来编写。我们下面假设你编译一个扩展组合,并选用 PHP 8.4,输出 `cli` 和 `fpm`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# path/to/craft.yml
|
||||||
|
php-version: 8.4
|
||||||
|
extensions: bcmath,posix,phar,zlib,openssl,curl,fileinfo,tokenizer
|
||||||
|
sapi:
|
||||||
|
- cli
|
||||||
|
- fpm
|
||||||
|
```
|
||||||
|
|
||||||
|
然后使用 `bin/spc craft` 命令来编译:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc craft --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
如果构建成功,你会在当前目录下看到 `buildroot/bin` 目录,里面包含了编译好的 PHP 二进制文件,或相应的 SAPI。
|
||||||
|
|
||||||
|
- cli: Windows 下构建结果为 `buildroot/bin/php.exe`,其他平台为 `buildroot/bin/php`。
|
||||||
|
- fpm: 构建结果为 `buildroot/bin/php-fpm`。
|
||||||
|
- micro: 构建结果为 `buildroot/bin/micro.sfx`,如需进一步与 PHP 代码打包,请查看 [打包 micro 二进制](./manual-build#命令-micro-combine-打包-micro-二进制)。
|
||||||
|
- embed: 参见 [embed 使用](./manual-build#embed-使用)。
|
||||||
|
|
||||||
|
如果中途构建出错,你可以使用 `--debug` 参数查看详细的错误信息,或者使用 `--with-clean` 参数清除旧的编译结果,重新编译。
|
||||||
|
|
||||||
|
如使用以上方式仍构建失败,请提交一个 issue,附上你的 `craft.yml`、`craft.log`。
|
||||||
|
|
||||||
|
## 分步构建命令
|
||||||
|
|
||||||
|
如果你有定制化需求,或分开下载、编译 PHP 和依赖库的需求,可以使用 `bin/spc` 命令分步执行。
|
||||||
|
|
||||||
|
### 命令 download - 下载依赖包
|
||||||
|
|
||||||
使用命令 `bin/spc download` 可以下载编译需要的源代码,包括 php-src 以及依赖的各种库的源码。
|
使用命令 `bin/spc download` 可以下载编译需要的源代码,包括 php-src 以及依赖的各种库的源码。
|
||||||
|
|
||||||
@@ -187,7 +226,7 @@ bin/spc download --for-extensions=redis,phar -G "php-src:master:https://github.c
|
|||||||
bin/spc download --for-extensions=swoole -G "swoole:master:https://github.com/swoole/swoole-src.git"
|
bin/spc download --for-extensions=swoole -G "swoole:master:https://github.com/swoole/swoole-src.git"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 命令 doctor - 环境检查
|
### 命令 doctor - 环境检查
|
||||||
|
|
||||||
如果你可以正常运行 `bin/spc` 但无法正常编译静态的 PHP 或依赖库,可以先运行 `bin/spc doctor` 检查系统自身是否缺少依赖。
|
如果你可以正常运行 `bin/spc` 但无法正常编译静态的 PHP 或依赖库,可以先运行 `bin/spc doctor` 检查系统自身是否缺少依赖。
|
||||||
|
|
||||||
@@ -199,11 +238,11 @@ bin/spc doctor
|
|||||||
bin/spc doctor --auto-fix
|
bin/spc doctor --auto-fix
|
||||||
```
|
```
|
||||||
|
|
||||||
## 命令 build - 编译 PHP
|
### 命令 build - 编译 PHP
|
||||||
|
|
||||||
使用 build 命令可以开始构建静态 php 二进制,在执行 `bin/spc build` 命令前,务必先使用 `download` 命令下载资源,建议使用 `doctor` 检查环境。
|
使用 build 命令可以开始构建静态 php 二进制,在执行 `bin/spc build` 命令前,务必先使用 `download` 命令下载资源,建议使用 `doctor` 检查环境。
|
||||||
|
|
||||||
### 基本用法
|
#### 基本用法
|
||||||
|
|
||||||
你需要先到 [扩展列表](./extensions) 或 [命令生成器](./cli-generator) 选择你要加入的扩展,然后使用命令 `bin/spc build` 进行编译。你需要指定一个编译目标,从如下参数中选择:
|
你需要先到 [扩展列表](./extensions) 或 [命令生成器](./cli-generator) 选择你要加入的扩展,然后使用命令 `bin/spc build` 进行编译。你需要指定一个编译目标,从如下参数中选择:
|
||||||
|
|
||||||
@@ -247,15 +286,7 @@ bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
|
|||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### 调试
|
#### 编译运行选项
|
||||||
|
|
||||||
如果你在编译过程中遇到了问题,或者想查看每个执行的 shell 命令,可以使用 `--debug` 开启 debug 模式,查看所有终端日志:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bin/spc build mysqlnd,pdo_mysql --build-all --debug
|
|
||||||
```
|
|
||||||
|
|
||||||
### 编译运行选项
|
|
||||||
|
|
||||||
在编译过程中,有些特殊情况需要对编译器、编译目录的内容进行干预,可以尝试使用以下命令:
|
在编译过程中,有些特殊情况需要对编译器、编译目录的内容进行干预,可以尝试使用以下命令:
|
||||||
|
|
||||||
@@ -275,6 +306,7 @@ bin/spc build mysqlnd,pdo_mysql --build-all --debug
|
|||||||
- `--with-suggested-exts`: 编译时将 `ext-suggests` 也作为编译依赖加入
|
- `--with-suggested-exts`: 编译时将 `ext-suggests` 也作为编译依赖加入
|
||||||
- `--with-suggested-libs`: 编译时将 `lib-suggests` 也作为编译依赖加入
|
- `--with-suggested-libs`: 编译时将 `lib-suggests` 也作为编译依赖加入
|
||||||
- `--with-upx-pack`: 编译后使用 UPX 减小二进制文件体积(需先使用 `bin/spc install-pkg upx` 安装 upx)
|
- `--with-upx-pack`: 编译后使用 UPX 减小二进制文件体积(需先使用 `bin/spc install-pkg upx` 安装 upx)
|
||||||
|
- `--build-shared=XXX,YYY`: 编译时将指定的扩展编译为共享库(默认编译为静态库)
|
||||||
|
|
||||||
硬编码 INI 选项适用于 cli、micro、embed。有关硬编码 INI 选项,下面是一个简单的例子,我们预设一个更大的 `memory_limit`,并且禁用 `system` 函数:
|
硬编码 INI 选项适用于 cli、micro、embed。有关硬编码 INI 选项,下面是一个简单的例子,我们预设一个更大的 `memory_limit`,并且禁用 `system` 函数:
|
||||||
|
|
||||||
@@ -342,6 +374,14 @@ memory_limit=1G
|
|||||||
|
|
||||||
如果要打包 phar,只需要将 `a.php` 替换为打包好的 phar 文件即可。但要注意,phar 下的 micro.sfx 需要额外注意路径问题,见 [Developing - Phar 路径问题](../develop/structure#phar-应用目录问题)
|
如果要打包 phar,只需要将 `a.php` 替换为打包好的 phar 文件即可。但要注意,phar 下的 micro.sfx 需要额外注意路径问题,见 [Developing - Phar 路径问题](../develop/structure#phar-应用目录问题)
|
||||||
|
|
||||||
|
## 调试
|
||||||
|
|
||||||
|
如果你在编译过程中遇到了问题,或者想查看每个执行的 shell 命令,可以使用 `--debug` 开启 debug 模式,查看所有终端日志:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bin/spc build mysqlnd,pdo_mysql --build-all --debug
|
||||||
|
```
|
||||||
|
|
||||||
## 命令 extract - 手动解压某个库
|
## 命令 extract - 手动解压某个库
|
||||||
|
|
||||||
使用命令 `bin/spc extract` 可以解包和拷贝编译需要的源代码,包括 php-src 以及依赖的各种库的源码(需要自己指定要解包的库名)。
|
使用命令 `bin/spc extract` 可以解包和拷贝编译需要的源代码,包括 php-src 以及依赖的各种库的源码(需要自己指定要解包的库名)。
|
||||||
@@ -353,6 +393,32 @@ memory_limit=1G
|
|||||||
bin/spc extract php-src,libxml2
|
bin/spc extract php-src,libxml2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 命令 dump-extensions - 导出项目扩展依赖
|
||||||
|
|
||||||
|
使用命令 `bin/spc dump-extensions` 可以导出当前项目的扩展依赖。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 打印项目的扩展列表,传入项目包含composer.json的根目录
|
||||||
|
bin/spc dump-extensions /path/to/your/project/
|
||||||
|
|
||||||
|
# 打印项目的扩展列表,不包含开发依赖
|
||||||
|
bin/spc dump-extensions /path-to/tour/project/ --no-dev
|
||||||
|
|
||||||
|
# 输出为 spc 命令可接受的扩展列表格式(逗号分割)
|
||||||
|
bin/spc dump-extensions /path-to/tour/project/ --format=text
|
||||||
|
|
||||||
|
# 输出为 JSON 列表
|
||||||
|
bin/spc dump-extensions /path-to/tour/project/ --format=json
|
||||||
|
|
||||||
|
# 当项目没有任何扩展时,输出指定扩展组合,而不是返回失败
|
||||||
|
bin/spc dump-extensions /path-to/your/project/ --no-ext-output=mbstring,posix,pcntl,phar
|
||||||
|
|
||||||
|
# 输出时不排除 spc 不支持的扩展
|
||||||
|
bin/spc dump-extensions /path/to/your/project/ --no-spc-filter
|
||||||
|
```
|
||||||
|
|
||||||
|
需要注意的是,项目的目录下必须包含 `vendor/installed.json` 和 `composer.lock` 文件,否则无法正常获取。
|
||||||
|
|
||||||
## 调试命令 dev - 调试命令集合
|
## 调试命令 dev - 调试命令集合
|
||||||
|
|
||||||
调试命令指的是你在使用 static-php-cli 构建 PHP 或改造、增强 static-php-cli 项目本身的时候,可以辅助输出一些信息的命令集合。
|
调试命令指的是你在使用 static-php-cli 构建 PHP 或改造、增强 static-php-cli 项目本身的时候,可以辅助输出一些信息的命令集合。
|
||||||
|
|||||||
@@ -5,7 +5,14 @@
|
|||||||
## 下载失败问题
|
## 下载失败问题
|
||||||
|
|
||||||
下载资源问题是 spc 最常见的问题之一。主要是由于 spc 下载资源使用的地址一般均为对应项目的官方网站或 GitHub 等,而这些网站可能偶尔会宕机、屏蔽 IP 地址。
|
下载资源问题是 spc 最常见的问题之一。主要是由于 spc 下载资源使用的地址一般均为对应项目的官方网站或 GitHub 等,而这些网站可能偶尔会宕机、屏蔽 IP 地址。
|
||||||
目前 2.0.0 版本还没有加入自动重试机制,所以在遇到下载失败后,可以多次尝试调用下载命令。如果确认地址确实无法正常访问,可以提交 Issue 或 PR 更新地址。
|
在遇到下载失败后,可以多次尝试调用下载命令。
|
||||||
|
|
||||||
|
当下载资源时,你可能最终会看到类似 `curl: (56) The requested URL returned error: 403` 的错误,这通常是由于 GitHub 限制导致的。
|
||||||
|
你可以通过在命令中添加 `--debug` 来验证,会看到类似 `[DEBU] Running command (no output) : curl -sfSL "https://api.github.com/repos/openssl/openssl/releases"` 的输出。
|
||||||
|
|
||||||
|
要解决这个问题,可以在 GitHub 上 [创建](https://github.com/settings/token) 一个个人访问令牌,并将其设置为环境变量 `GITHUB_TOKEN=<XXX>`。
|
||||||
|
|
||||||
|
如果确认地址确实无法正常访问,可以提交 Issue 或 PR 更新地址。
|
||||||
|
|
||||||
## doctor 无法修复
|
## doctor 无法修复
|
||||||
|
|
||||||
@@ -18,3 +25,5 @@
|
|||||||
|
|
||||||
遇到编译错误时,如果没有开启 `--debug` 日志,请先开启调试日志,然后确定报错的命令。
|
遇到编译错误时,如果没有开启 `--debug` 日志,请先开启调试日志,然后确定报错的命令。
|
||||||
报错的终端输出对于修复编译错误非常重要,请在提交 Issue 时一并将终端日志的最后报错片段(或整个终端日志输出)上传,并且包含使用的 `spc` 命令和参数。
|
报错的终端输出对于修复编译错误非常重要,请在提交 Issue 时一并将终端日志的最后报错片段(或整个终端日志输出)上传,并且包含使用的 `spc` 命令和参数。
|
||||||
|
|
||||||
|
如果你是重复构建,请参考 [本地构建 - 多次构建](./manual-build#多次构建) 章节,清理构建缓存后再次构建。
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"docs:preview": "vitepress preview docs"
|
"docs:preview": "vitepress preview docs"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitepress": "^1.0.0-rc.35",
|
"vitepress": "^2.0.0-alpha.5",
|
||||||
"vue": "^3.2.47"
|
"vue": "^3.2.47"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC;
|
namespace SPC;
|
||||||
|
|
||||||
use SPC\command\BuildCliCommand;
|
|
||||||
use SPC\command\BuildLibsCommand;
|
use SPC\command\BuildLibsCommand;
|
||||||
|
use SPC\command\BuildPHPCommand;
|
||||||
|
use SPC\command\CraftCommand;
|
||||||
use SPC\command\DeleteDownloadCommand;
|
use SPC\command\DeleteDownloadCommand;
|
||||||
use SPC\command\dev\AllExtCommand;
|
use SPC\command\dev\AllExtCommand;
|
||||||
use SPC\command\dev\ExtVerCommand;
|
use SPC\command\dev\ExtVerCommand;
|
||||||
@@ -18,6 +19,7 @@ use SPC\command\dev\PhpVerCommand;
|
|||||||
use SPC\command\dev\SortConfigCommand;
|
use SPC\command\dev\SortConfigCommand;
|
||||||
use SPC\command\DoctorCommand;
|
use SPC\command\DoctorCommand;
|
||||||
use SPC\command\DownloadCommand;
|
use SPC\command\DownloadCommand;
|
||||||
|
use SPC\command\DumpExtensionsCommand;
|
||||||
use SPC\command\DumpLicenseCommand;
|
use SPC\command\DumpLicenseCommand;
|
||||||
use SPC\command\ExtractCommand;
|
use SPC\command\ExtractCommand;
|
||||||
use SPC\command\InstallPkgCommand;
|
use SPC\command\InstallPkgCommand;
|
||||||
@@ -31,7 +33,7 @@ use Symfony\Component\Console\Application;
|
|||||||
*/
|
*/
|
||||||
final class ConsoleApplication extends Application
|
final class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION = '2.4.4';
|
public const VERSION = '2.6.0';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -42,8 +44,10 @@ final class ConsoleApplication extends Application
|
|||||||
|
|
||||||
$this->addCommands(
|
$this->addCommands(
|
||||||
[
|
[
|
||||||
|
// Craft command
|
||||||
|
new CraftCommand(),
|
||||||
// Common commands
|
// Common commands
|
||||||
new BuildCliCommand(),
|
new BuildPHPCommand(),
|
||||||
new BuildLibsCommand(),
|
new BuildLibsCommand(),
|
||||||
new DoctorCommand(),
|
new DoctorCommand(),
|
||||||
new DownloadCommand(),
|
new DownloadCommand(),
|
||||||
@@ -54,6 +58,7 @@ final class ConsoleApplication extends Application
|
|||||||
new MicroCombineCommand(),
|
new MicroCombineCommand(),
|
||||||
new SwitchPhpVersionCommand(),
|
new SwitchPhpVersionCommand(),
|
||||||
new SPCConfigCommand(),
|
new SPCConfigCommand(),
|
||||||
|
new DumpExtensionsCommand(),
|
||||||
|
|
||||||
// Dev commands
|
// Dev commands
|
||||||
new AllExtCommand(),
|
new AllExtCommand(),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder;
|
namespace SPC\builder;
|
||||||
|
|
||||||
|
use PharIo\FileSystem\File;
|
||||||
use SPC\exception\ExceptionHandler;
|
use SPC\exception\ExceptionHandler;
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\InterruptException;
|
use SPC\exception\InterruptException;
|
||||||
@@ -122,9 +123,12 @@ abstract class BuilderBase
|
|||||||
*
|
*
|
||||||
* @return Extension[]
|
* @return Extension[]
|
||||||
*/
|
*/
|
||||||
public function getExts(): array
|
public function getExts(bool $including_shared = true): array
|
||||||
{
|
{
|
||||||
return $this->exts;
|
if ($including_shared) {
|
||||||
|
return $this->exts;
|
||||||
|
}
|
||||||
|
return array_filter($this->exts, fn ($ext) => $ext->isBuildStatic());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,7 +140,7 @@ abstract class BuilderBase
|
|||||||
public function hasCpp(): bool
|
public function hasCpp(): bool
|
||||||
{
|
{
|
||||||
// judge cpp-extension
|
// judge cpp-extension
|
||||||
$exts = array_keys($this->getExts());
|
$exts = array_keys($this->getExts(false));
|
||||||
foreach ($exts as $ext) {
|
foreach ($exts as $ext) {
|
||||||
if (Config::getExt($ext, 'cpp-extension', false) === true) {
|
if (Config::getExt($ext, 'cpp-extension', false) === true) {
|
||||||
return true;
|
return true;
|
||||||
@@ -170,23 +174,46 @@ abstract class BuilderBase
|
|||||||
* @throws \Throwable|WrongUsageException
|
* @throws \Throwable|WrongUsageException
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public function proveExts(array $extensions, bool $skip_check_deps = false): void
|
public function proveExts(array $static_extensions, array $shared_extensions = [], bool $skip_check_deps = false, bool $skip_extract = false): void
|
||||||
{
|
{
|
||||||
CustomExt::loadCustomExt();
|
CustomExt::loadCustomExt();
|
||||||
$this->emitPatchPoint('before-php-extract');
|
// judge ext
|
||||||
SourceManager::initSource(sources: ['php-src']);
|
foreach ($static_extensions as $ext) {
|
||||||
$this->emitPatchPoint('after-php-extract');
|
// if extension does not support static build, throw exception
|
||||||
if ($this->getPHPVersionID() >= 80000) {
|
if (!in_array('static', Config::getExtTarget($ext))) {
|
||||||
$this->emitPatchPoint('before-micro-extract');
|
throw new WrongUsageException('Extension [' . $ext . '] does not support static build!');
|
||||||
SourceManager::initSource(sources: ['micro']);
|
}
|
||||||
$this->emitPatchPoint('after-micro-extract');
|
|
||||||
}
|
}
|
||||||
$this->emitPatchPoint('before-exts-extract');
|
foreach ($shared_extensions as $ext) {
|
||||||
SourceManager::initSource(exts: $extensions);
|
// if extension does not support shared build, throw exception
|
||||||
$this->emitPatchPoint('after-exts-extract');
|
if (!in_array('shared', Config::getExtTarget($ext)) && !in_array($ext, $shared_extensions)) {
|
||||||
foreach ($extensions as $extension) {
|
throw new WrongUsageException('Extension [' . $ext . '] does not support shared build!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$skip_extract) {
|
||||||
|
$this->emitPatchPoint('before-php-extract');
|
||||||
|
SourceManager::initSource(sources: ['php-src'], source_only: true);
|
||||||
|
$this->emitPatchPoint('after-php-extract');
|
||||||
|
if ($this->getPHPVersionID() >= 80000) {
|
||||||
|
$this->emitPatchPoint('before-micro-extract');
|
||||||
|
SourceManager::initSource(sources: ['micro'], source_only: true);
|
||||||
|
$this->emitPatchPoint('after-micro-extract');
|
||||||
|
}
|
||||||
|
$this->emitPatchPoint('before-exts-extract');
|
||||||
|
SourceManager::initSource(exts: [...$static_extensions, ...$shared_extensions]);
|
||||||
|
$this->emitPatchPoint('after-exts-extract');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ([...$static_extensions, ...$shared_extensions] as $extension) {
|
||||||
$class = CustomExt::getExtClass($extension);
|
$class = CustomExt::getExtClass($extension);
|
||||||
|
/** @var Extension $ext */
|
||||||
$ext = new $class($extension, $this);
|
$ext = new $class($extension, $this);
|
||||||
|
if (in_array($extension, $static_extensions)) {
|
||||||
|
$ext->setBuildStatic();
|
||||||
|
}
|
||||||
|
if (in_array($extension, $shared_extensions)) {
|
||||||
|
$ext->setBuildShared();
|
||||||
|
}
|
||||||
$this->addExt($ext);
|
$this->addExt($ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,10 +221,10 @@ abstract class BuilderBase
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->exts as $ext) {
|
foreach ($this->getExts() as $ext) {
|
||||||
$ext->checkDependency();
|
$ext->checkDependency();
|
||||||
}
|
}
|
||||||
$this->ext_list = $extensions;
|
$this->ext_list = [...$static_extensions, ...$shared_extensions];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,6 +234,54 @@ abstract class BuilderBase
|
|||||||
*/
|
*/
|
||||||
abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE);
|
abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test PHP
|
||||||
|
*/
|
||||||
|
abstract public function testPHP(int $build_target = BUILD_TARGET_NONE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws WrongUsageException
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
public function buildSharedExts(): void
|
||||||
|
{
|
||||||
|
$lines = file(BUILD_BIN_PATH . '/php-config');
|
||||||
|
$extension_dir_line = null;
|
||||||
|
foreach ($lines as $key => $value) {
|
||||||
|
if (str_starts_with($value, 'extension_dir=')) {
|
||||||
|
$lines[$key] = 'extension_dir="' . BUILD_MODULES_PATH . '"' . PHP_EOL;
|
||||||
|
$extension_dir_line = $value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_put_contents(BUILD_BIN_PATH . '/php-config', implode('', $lines));
|
||||||
|
FileSystem::createDir(BUILD_MODULES_PATH);
|
||||||
|
try {
|
||||||
|
foreach ($this->getExts() as $ext) {
|
||||||
|
if (!$ext->isBuildShared()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (Config::getExt($ext->getName(), 'type') === 'builtin' || Config::getExt($ext->getName(), 'build-with-php') === true) {
|
||||||
|
if (file_exists(BUILD_MODULES_PATH . '/' . $ext->getName() . '.so')) {
|
||||||
|
logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (Config::getExt($ext->getName(), 'build-with-php') === true) {
|
||||||
|
logger()->warning('Shared extension [' . $ext->getName() . '] did not build with php-src/configure (' . $ext->getName() . '.so)');
|
||||||
|
logger()->warning('Try deleting your build and source folders and running `spc build`` again.');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ext->buildShared();
|
||||||
|
}
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir=', $extension_dir_line);
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir=', $extension_dir_line);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate extension enable arguments for configure.
|
* Generate extension enable arguments for configure.
|
||||||
* e.g. --enable-mbstring
|
* e.g. --enable-mbstring
|
||||||
@@ -214,12 +289,24 @@ abstract class BuilderBase
|
|||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
public function makeExtensionArgs(): string
|
public function makeStaticExtensionArgs(): string
|
||||||
{
|
{
|
||||||
$ret = [];
|
$ret = [];
|
||||||
foreach ($this->exts as $ext) {
|
foreach ($this->getExts() as $ext) {
|
||||||
logger()->info($ext->getName() . ' is using ' . $ext->getConfigureArg());
|
$arg = $ext->getConfigureArg();
|
||||||
$ret[] = trim($ext->getConfigureArg());
|
if ($ext->isBuildShared() && !$ext->isBuildStatic()) {
|
||||||
|
if (
|
||||||
|
(Config::getExt($ext->getName(), 'type') === 'builtin' &&
|
||||||
|
!file_exists(SOURCE_PATH . '/php-src/ext/' . $ext->getName() . '/config.m4')) ||
|
||||||
|
Config::getExt($ext->getName(), 'build-with-php') === true
|
||||||
|
) {
|
||||||
|
$arg = $ext->getConfigureArg(true);
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger()->info($ext->getName() . ' is using ' . $arg);
|
||||||
|
$ret[] = trim($arg);
|
||||||
}
|
}
|
||||||
logger()->debug('Using configure: ' . implode(' ', $ret));
|
logger()->debug('Using configure: ' . implode(' ', $ret));
|
||||||
return implode(' ', $ret);
|
return implode(' ', $ret);
|
||||||
@@ -396,7 +483,7 @@ abstract class BuilderBase
|
|||||||
foreach ($this->libs as $lib) {
|
foreach ($this->libs as $lib) {
|
||||||
$lib->validate();
|
$lib->validate();
|
||||||
}
|
}
|
||||||
foreach ($this->exts as $ext) {
|
foreach ($this->getExts() as $ext) {
|
||||||
$ext->validate();
|
$ext->validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -441,7 +528,7 @@ abstract class BuilderBase
|
|||||||
{
|
{
|
||||||
$php = "<?php\n\necho '[micro-test-start]' . PHP_EOL;\n";
|
$php = "<?php\n\necho '[micro-test-start]' . PHP_EOL;\n";
|
||||||
|
|
||||||
foreach ($this->getExts() as $ext) {
|
foreach ($this->getExts(false) as $ext) {
|
||||||
$ext_name = $ext->getDistName();
|
$ext_name = $ext->getDistName();
|
||||||
if (!empty($ext_name)) {
|
if (!empty($ext_name)) {
|
||||||
$php .= "echo 'Running micro with {$ext_name} test' . PHP_EOL;\n";
|
$php .= "echo 'Running micro with {$ext_name} test' . PHP_EOL;\n";
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ use SPC\exception\RuntimeException;
|
|||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\Config;
|
use SPC\store\Config;
|
||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\SPCConfigUtil;
|
||||||
|
|
||||||
class Extension
|
class Extension
|
||||||
{
|
{
|
||||||
protected array $dependencies = [];
|
protected array $dependencies = [];
|
||||||
|
|
||||||
|
protected bool $build_shared = false;
|
||||||
|
|
||||||
|
protected bool $build_static = false;
|
||||||
|
|
||||||
|
protected string $source_dir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
@@ -30,6 +37,25 @@ class Extension
|
|||||||
if (PHP_OS_FAMILY === 'Windows' && $unix_only) {
|
if (PHP_OS_FAMILY === 'Windows' && $unix_only) {
|
||||||
throw new RuntimeException("{$ext_type} extension {$name} is not supported on Windows platform");
|
throw new RuntimeException("{$ext_type} extension {$name} is not supported on Windows platform");
|
||||||
}
|
}
|
||||||
|
// set source_dir for builtin
|
||||||
|
if ($ext_type === 'builtin') {
|
||||||
|
$this->source_dir = SOURCE_PATH . '/php-src/ext/' . $this->name;
|
||||||
|
} elseif ($ext_type === 'external') {
|
||||||
|
$source = Config::getExt($this->name, 'source');
|
||||||
|
if ($source === null) {
|
||||||
|
throw new RuntimeException("{$ext_type} extension {$name} source not found");
|
||||||
|
}
|
||||||
|
$source_path = Config::getSource($source)['path'] ?? null;
|
||||||
|
$source_path = $source_path === null ? SOURCE_PATH . '/' . $source : SOURCE_PATH . '/' . $source_path;
|
||||||
|
$this->source_dir = $source_path;
|
||||||
|
} else {
|
||||||
|
$this->source_dir = SOURCE_PATH . '/php-src';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFrameworks(): array
|
||||||
|
{
|
||||||
|
return Config::getExt($this->getName(), 'frameworks', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,20 +64,15 @@ class Extension
|
|||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
public function getConfigureArg(): string
|
public function getConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = $this->getEnableArg();
|
return match (PHP_OS_FAMILY) {
|
||||||
switch (PHP_OS_FAMILY) {
|
'Windows' => $this->getWindowsConfigureArg($shared),
|
||||||
case 'Windows':
|
'Darwin',
|
||||||
$arg .= $this->getWindowsConfigureArg();
|
'Linux',
|
||||||
break;
|
'BSD' => $this->getUnixConfigureArg($shared),
|
||||||
case 'Darwin':
|
default => throw new WrongUsageException(PHP_OS_FAMILY . ' build is not supported yet'),
|
||||||
case 'Linux':
|
};
|
||||||
case 'BSD':
|
|
||||||
$arg .= $this->getUnixConfigureArg();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $arg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,13 +81,13 @@ class Extension
|
|||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
public function getEnableArg(): string
|
public function getEnableArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$_name = str_replace('_', '-', $this->name);
|
$_name = str_replace('_', '-', $this->name);
|
||||||
return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) {
|
return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) {
|
||||||
'enable' => '--enable-' . $_name . ' ',
|
'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ',
|
||||||
'with' => '--with-' . $_name . ' ',
|
'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ',
|
||||||
'with-prefix' => '--with-' . $_name . '="' . BUILD_ROOT_PATH . '" ',
|
'with-prefix' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . '"' . BUILD_ROOT_PATH . '" ',
|
||||||
'none', 'custom' => '',
|
'none', 'custom' => '',
|
||||||
default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-prefix] ."),
|
default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-prefix] ."),
|
||||||
};
|
};
|
||||||
@@ -126,20 +147,21 @@ class Extension
|
|||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '';
|
return $this->getEnableArg();
|
||||||
// Windows is not supported yet
|
// Windows is not supported yet
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '';
|
return $this->getEnableArg($shared);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch code before ./buildconf
|
* Patch code before ./buildconf
|
||||||
* If you need to patch some code, overwrite this and return true
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
*/
|
*/
|
||||||
public function patchBeforeBuildconf(): bool
|
public function patchBeforeBuildconf(): bool
|
||||||
{
|
{
|
||||||
@@ -148,7 +170,8 @@ class Extension
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch code before ./configure
|
* Patch code before ./configure
|
||||||
* If you need to patch some code, overwrite this and return true
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
*/
|
*/
|
||||||
public function patchBeforeConfigure(): bool
|
public function patchBeforeConfigure(): bool
|
||||||
{
|
{
|
||||||
@@ -157,13 +180,81 @@ class Extension
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch code before make
|
* Patch code before make
|
||||||
* If you need to patch some code, overwrite this and return true
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
*/
|
*/
|
||||||
public function patchBeforeMake(): bool
|
public function patchBeforeMake(): bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch code before shared extension phpize
|
||||||
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
|
*/
|
||||||
|
public function patchBeforeSharedBuild(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch code before shared extension ./configure
|
||||||
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
|
*/
|
||||||
|
public function patchBeforeSharedConfigure(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
* returns a command line string with all required shared extensions to load
|
||||||
|
* i.e.; pdo_pgsql would return:
|
||||||
|
*
|
||||||
|
* `-d "extension=pgsql" -d "extension=pdo_pgsql"`
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws WrongUsageException
|
||||||
|
*/
|
||||||
|
public function getSharedExtensionLoadString(): string
|
||||||
|
{
|
||||||
|
$loaded = [];
|
||||||
|
$order = [];
|
||||||
|
|
||||||
|
$resolve = function ($extension) use (&$resolve, &$loaded, &$order) {
|
||||||
|
if (isset($loaded[$extension->getName()])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$loaded[$extension->getName()] = true;
|
||||||
|
|
||||||
|
foreach ($this->dependencies as $dependency) {
|
||||||
|
$resolve($dependency);
|
||||||
|
}
|
||||||
|
|
||||||
|
$order[] = $extension;
|
||||||
|
};
|
||||||
|
|
||||||
|
$resolve($this);
|
||||||
|
|
||||||
|
$ret = '';
|
||||||
|
foreach ($order as $ext) {
|
||||||
|
if ($ext instanceof Extension && $ext->isBuildShared()) {
|
||||||
|
if (Config::getExt($ext->getName(), 'zend-extension', false) === true) {
|
||||||
|
$ret .= " -d \"zend_extension={$ext->getName()}\"";
|
||||||
|
} else {
|
||||||
|
$ret .= " -d \"extension={$ext->getName()}\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ret !== '') {
|
||||||
|
$ret = ' -d "extension_dir=' . BUILD_MODULES_PATH . '"' . $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
@@ -172,7 +263,8 @@ class Extension
|
|||||||
// Run compile check if build target is cli
|
// 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
|
// If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php
|
||||||
// If check failed, throw RuntimeException
|
// If check failed, throw RuntimeException
|
||||||
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "' . $this->getDistName() . '"', false);
|
$sharedExtensions = $this->getSharedExtensionLoadString();
|
||||||
|
[$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
}
|
}
|
||||||
@@ -185,7 +277,7 @@ class Extension
|
|||||||
file_get_contents(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')
|
file_get_contents(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')
|
||||||
);
|
);
|
||||||
|
|
||||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -r "' . trim($test) . '"');
|
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' -r "' . trim($test) . '"');
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
if ($this->builder->getOption('debug')) {
|
if ($this->builder->getOption('debug')) {
|
||||||
var_dump($out);
|
var_dump($out);
|
||||||
@@ -203,7 +295,7 @@ class Extension
|
|||||||
// Run compile check if build target is cli
|
// 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
|
// If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php
|
||||||
// If check failed, throw RuntimeException
|
// If check failed, throw RuntimeException
|
||||||
[$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe --ri "' . $this->getDistName() . '"', false);
|
[$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -n --ri "' . $this->getDistName() . '"', false);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
}
|
}
|
||||||
@@ -216,7 +308,7 @@ class Extension
|
|||||||
file_get_contents(FileSystem::convertPath(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php'))
|
file_get_contents(FileSystem::convertPath(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php'))
|
||||||
);
|
);
|
||||||
|
|
||||||
[$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -r "' . trim($test) . '"');
|
[$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -n -r "' . trim($test) . '"');
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
|
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
|
||||||
}
|
}
|
||||||
@@ -228,6 +320,85 @@ class Extension
|
|||||||
// do nothing, just throw wrong usage exception if not valid
|
// do nothing, just throw wrong usage exception if not valid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build shared extension
|
||||||
|
*
|
||||||
|
* @throws WrongUsageException
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
public function buildShared(): void
|
||||||
|
{
|
||||||
|
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
|
||||||
|
if (file_exists(BUILD_MODULES_PATH . '/' . $this->getName() . '.so')) {
|
||||||
|
logger()->info('extension ' . $this->getName() . ' already built, skipping');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($this->dependencies as $dependency) {
|
||||||
|
if (!$dependency instanceof Extension) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$dependency->isBuildStatic()) {
|
||||||
|
logger()->info('extension ' . $this->getName() . ' requires extension ' . $dependency->getName());
|
||||||
|
$dependency->buildShared();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
match (PHP_OS_FAMILY) {
|
||||||
|
'Darwin', 'Linux' => $this->buildUnixShared(),
|
||||||
|
default => throw new WrongUsageException(PHP_OS_FAMILY . ' build shared extensions is not supported yet'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build shared extension for Unix
|
||||||
|
*
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws WrongUsageException
|
||||||
|
* @throws \ReflectionException
|
||||||
|
* @throws \Throwable
|
||||||
|
*/
|
||||||
|
public function buildUnixShared(): void
|
||||||
|
{
|
||||||
|
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true);
|
||||||
|
[$staticLibString, $sharedLibString] = $this->getStaticAndSharedLibs();
|
||||||
|
$env = [
|
||||||
|
'CFLAGS' => $config['cflags'],
|
||||||
|
'CXXFLAGS' => $config['cflags'],
|
||||||
|
'LDFLAGS' => $config['ldflags'],
|
||||||
|
'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibString . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString,
|
||||||
|
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||||
|
];
|
||||||
|
|
||||||
|
// prepare configure args
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->setEnv($env)
|
||||||
|
->exec(BUILD_BIN_PATH . '/phpize');
|
||||||
|
|
||||||
|
if ($this->patchBeforeSharedConfigure()) {
|
||||||
|
logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure');
|
||||||
|
}
|
||||||
|
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->setEnv($env)
|
||||||
|
->exec(
|
||||||
|
'./configure ' . $this->getUnixConfigureArg(true) .
|
||||||
|
' --with-php-config=' . BUILD_BIN_PATH . '/php-config ' .
|
||||||
|
'--enable-shared --disable-static'
|
||||||
|
);
|
||||||
|
|
||||||
|
FileSystem::replaceFileRegex(
|
||||||
|
$this->source_dir . '/Makefile',
|
||||||
|
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
|
||||||
|
'$1 ' . $staticLibString
|
||||||
|
);
|
||||||
|
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->setEnv($env)
|
||||||
|
->exec('make clean')
|
||||||
|
->exec('make -j' . $this->builder->concurrency)
|
||||||
|
->exec('make install');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current extension version
|
* Get current extension version
|
||||||
*
|
*
|
||||||
@@ -238,6 +409,32 @@ class Extension
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setBuildStatic(): void
|
||||||
|
{
|
||||||
|
if (!in_array('static', Config::getExtTarget($this->name))) {
|
||||||
|
throw new WrongUsageException("Extension [{$this->name}] does not support static build!");
|
||||||
|
}
|
||||||
|
$this->build_static = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBuildShared(): void
|
||||||
|
{
|
||||||
|
if (!in_array('shared', Config::getExtTarget($this->name))) {
|
||||||
|
throw new WrongUsageException("Extension [{$this->name}] does not support shared build!");
|
||||||
|
}
|
||||||
|
$this->build_shared = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBuildShared(): bool
|
||||||
|
{
|
||||||
|
return $this->build_shared;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBuildStatic(): bool
|
||||||
|
{
|
||||||
|
return $this->build_static;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
@@ -270,6 +467,37 @@ class Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get required static and shared libraries as a pair of strings in format -l{libname} -l{libname2}
|
||||||
|
*
|
||||||
|
* @return array [staticLibString, sharedLibString]
|
||||||
|
*/
|
||||||
|
private function getStaticAndSharedLibs(): array
|
||||||
|
{
|
||||||
|
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true);
|
||||||
|
$sharedLibString = '';
|
||||||
|
$staticLibString = '';
|
||||||
|
$staticLibs = $this->getLibFilesString();
|
||||||
|
$staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs);
|
||||||
|
$staticLibs = str_replace('.a', '', $staticLibs);
|
||||||
|
$staticLibs = explode('-l', $staticLibs . ' ' . $config['libs']);
|
||||||
|
foreach ($staticLibs as $lib) {
|
||||||
|
$lib = trim($lib);
|
||||||
|
if ($lib === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$static_lib = 'lib' . $lib . '.a';
|
||||||
|
if (file_exists(BUILD_LIB_PATH . '/' . $static_lib)) {
|
||||||
|
if (!str_contains($staticLibString, '-l' . $lib . ' ')) {
|
||||||
|
$staticLibString .= '-l' . $lib . ' ';
|
||||||
|
}
|
||||||
|
} elseif (!str_contains($sharedLibString, '-l' . $lib . ' ')) {
|
||||||
|
$sharedLibString .= '-l' . $lib . ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [trim($staticLibString), trim($sharedLibString)];
|
||||||
|
}
|
||||||
|
|
||||||
private function getLibraryDependencies(bool $recursive = false): array
|
private function getLibraryDependencies(bool $recursive = false): array
|
||||||
{
|
{
|
||||||
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
||||||
@@ -295,6 +523,11 @@ class Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists(0, $deps)) {
|
||||||
|
$zero = [0 => $deps[0]];
|
||||||
|
unset($deps[0]);
|
||||||
|
return $zero + $deps;
|
||||||
|
}
|
||||||
return $deps;
|
return $deps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,15 @@ use SPC\exception\FileSystemException;
|
|||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\Config;
|
use SPC\store\Config;
|
||||||
|
use SPC\store\Downloader;
|
||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
use SPC\store\SourceManager;
|
use SPC\store\SourceManager;
|
||||||
|
use SPC\util\GlobalValueTrait;
|
||||||
|
|
||||||
abstract class LibraryBase
|
abstract class LibraryBase
|
||||||
{
|
{
|
||||||
|
use GlobalValueTrait;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public const NAME = 'unknown';
|
public const NAME = 'unknown';
|
||||||
|
|
||||||
@@ -30,7 +34,7 @@ abstract class LibraryBase
|
|||||||
if (static::NAME === 'unknown') {
|
if (static::NAME === 'unknown') {
|
||||||
throw new RuntimeException('no unknown!!!!!');
|
throw new RuntimeException('no unknown!!!!!');
|
||||||
}
|
}
|
||||||
$this->source_dir = $source_dir ?? (SOURCE_PATH . '/' . static::NAME);
|
$this->source_dir = $source_dir ?? (SOURCE_PATH . '/' . Config::getLib(static::NAME, 'source'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,8 +49,9 @@ abstract class LibraryBase
|
|||||||
$lock = json_decode(FileSystem::readFile(DOWNLOAD_PATH . '/.lock.json'), true) ?? [];
|
$lock = json_decode(FileSystem::readFile(DOWNLOAD_PATH . '/.lock.json'), true) ?? [];
|
||||||
$source = Config::getLib(static::NAME, 'source');
|
$source = Config::getLib(static::NAME, 'source');
|
||||||
// if source is locked as pre-built, we just tryInstall it
|
// if source is locked as pre-built, we just tryInstall it
|
||||||
if (isset($lock[$source]) && ($lock[$source]['lock_as'] ?? SPC_LOCK_SOURCE) === SPC_LOCK_PRE_BUILT) {
|
$pre_built_name = Downloader::getPreBuiltLockName($source);
|
||||||
return $this->tryInstall($lock[$source]['filename'], $force);
|
if (isset($lock[$pre_built_name]) && ($lock[$pre_built_name]['lock_as'] ?? SPC_DOWNLOAD_SOURCE) === SPC_DOWNLOAD_PRE_BUILT) {
|
||||||
|
return $this->tryInstall($lock[$pre_built_name]['filename'], $force);
|
||||||
}
|
}
|
||||||
return $this->tryBuild($force);
|
return $this->tryBuild($force);
|
||||||
}
|
}
|
||||||
@@ -113,7 +118,7 @@ abstract class LibraryBase
|
|||||||
/*
|
/*
|
||||||
Rules:
|
Rules:
|
||||||
If it is a Windows system, try the following dependencies in order: lib-depends-windows, lib-depends-win, lib-depends.
|
If it is a Windows system, try the following dependencies in order: lib-depends-windows, lib-depends-win, lib-depends.
|
||||||
If it is a macOS system, try the following dependencies in order: lib-depends-darwin, lib-depends-unix, lib-depends.
|
If it is a macOS system, try the following dependencies in order: lib-depends-macos, lib-depends-unix, lib-depends.
|
||||||
If it is a Linux system, try the following dependencies in order: lib-depends-linux, lib-depends-unix, lib-depends.
|
If it is a Linux system, try the following dependencies in order: lib-depends-linux, lib-depends-unix, lib-depends.
|
||||||
*/
|
*/
|
||||||
foreach (Config::getLib(static::NAME, 'lib-depends', []) as $dep_name) {
|
foreach (Config::getLib(static::NAME, 'lib-depends', []) as $dep_name) {
|
||||||
@@ -146,6 +151,17 @@ abstract class LibraryBase
|
|||||||
return Config::getLib(static::NAME, 'headers', []);
|
return Config::getLib(static::NAME, 'headers', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get binary files.
|
||||||
|
*
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws WrongUsageException
|
||||||
|
*/
|
||||||
|
public function getBinaryFiles(): array
|
||||||
|
{
|
||||||
|
return Config::getLib(static::NAME, 'bin', []);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
@@ -203,12 +219,13 @@ abstract class LibraryBase
|
|||||||
}
|
}
|
||||||
// force means just build
|
// force means just build
|
||||||
if ($force_build) {
|
if ($force_build) {
|
||||||
logger()->info('Building required library [' . static::NAME . ']');
|
$type = Config::getLib(static::NAME, 'type', 'lib');
|
||||||
|
logger()->info('Building required ' . $type . ' [' . static::NAME . ']');
|
||||||
|
|
||||||
// extract first if not exists
|
// extract first if not exists
|
||||||
if (!is_dir($this->source_dir)) {
|
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]);
|
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
||||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-extract');
|
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-extract');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,23 +253,19 @@ abstract class LibraryBase
|
|||||||
return LIB_STATUS_OK;
|
return LIB_STATUS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// pkg-config is treated specially. If it is pkg-config, check if the pkg-config binary exists
|
// current library is package and binary file is not exists
|
||||||
if (static::NAME === 'pkg-config' && !file_exists(BUILD_ROOT_PATH . '/bin/pkg-config')) {
|
if (Config::getLib(static::NAME, 'type', 'lib') === 'package') {
|
||||||
$this->tryBuild(true);
|
foreach ($this->getBinaryFiles() as $name) {
|
||||||
return LIB_STATUS_OK;
|
if (!file_exists(BUILD_BIN_PATH . "/{$name}")) {
|
||||||
|
$this->tryBuild(true);
|
||||||
|
return LIB_STATUS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if all the files exist at this point, skip the compilation process
|
// if all the files exist at this point, skip the compilation process
|
||||||
return LIB_STATUS_ALREADY;
|
return LIB_STATUS_ALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Patch before build, overwrite this and return true to patch libs.
|
|
||||||
*/
|
|
||||||
public function patchBeforeBuild(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function validate(): void
|
public function validate(): void
|
||||||
{
|
{
|
||||||
// do nothing, just throw wrong usage exception if not valid
|
// do nothing, just throw wrong usage exception if not valid
|
||||||
@@ -278,6 +291,46 @@ abstract class LibraryBase
|
|||||||
// do something before pack, default do nothing. overwrite this method to do something (e.g. modify pkg-config file)
|
// do something before pack, default do nothing. overwrite this method to do something (e.g. modify pkg-config file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch code before build
|
||||||
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
|
*/
|
||||||
|
public function patchBeforeBuild(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch code before ./buildconf
|
||||||
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
|
*/
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch code before ./configure
|
||||||
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
|
*/
|
||||||
|
public function patchBeforeConfigure(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch code before make
|
||||||
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
|
*/
|
||||||
|
public function patchBeforeMake(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build this library.
|
* Build this library.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ class amqp extends Extension
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--with-amqp --with-librabbitmq-dir=' . BUILD_ROOT_PATH;
|
return '--with-amqp' . ($shared ? '=shared' : '') . ' --with-librabbitmq-dir=' . BUILD_ROOT_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
public function getWindowsConfigureArg($shared = false): string
|
||||||
{
|
{
|
||||||
return '--with-amqp';
|
return '--with-amqp';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
|
use SPC\builder\linux\LinuxBuilder;
|
||||||
use SPC\builder\macos\MacOSBuilder;
|
use SPC\builder\macos\MacOSBuilder;
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
@@ -21,7 +22,7 @@ class curl extends Extension
|
|||||||
{
|
{
|
||||||
logger()->info('patching before-configure for curl checks');
|
logger()->info('patching before-configure for curl checks');
|
||||||
$file1 = "AC_DEFUN([PHP_CHECK_LIBRARY], [\n $3\n])";
|
$file1 = "AC_DEFUN([PHP_CHECK_LIBRARY], [\n $3\n])";
|
||||||
$files = FileSystem::readFile(SOURCE_PATH . '/php-src/ext/curl/config.m4');
|
$files = FileSystem::readFile($this->source_dir . '/config.m4');
|
||||||
$file2 = 'AC_DEFUN([PHP_CHECK_LIBRARY], [
|
$file2 = 'AC_DEFUN([PHP_CHECK_LIBRARY], [
|
||||||
save_old_LDFLAGS=$LDFLAGS
|
save_old_LDFLAGS=$LDFLAGS
|
||||||
ac_stuff="$5"
|
ac_stuff="$5"
|
||||||
@@ -40,7 +41,7 @@ class curl extends Extension
|
|||||||
$4
|
$4
|
||||||
])dnl
|
])dnl
|
||||||
])';
|
])';
|
||||||
file_put_contents(SOURCE_PATH . '/php-src/ext/curl/config.m4', $file1 . "\n" . $files . "\n" . $file2);
|
file_put_contents($this->source_dir . '/config.m4', $file1 . "\n" . $files . "\n" . $file2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +53,72 @@ class curl extends Extension
|
|||||||
{
|
{
|
||||||
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';
|
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';
|
||||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lcurl/', $this->getLibFilesString() . $frameworks);
|
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lcurl/', $this->getLibFilesString() . $frameworks);
|
||||||
|
$this->patchBeforeSharedConfigure();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function patchBeforeSharedConfigure(): bool
|
||||||
|
{
|
||||||
|
$file = $this->source_dir . '/config.m4';
|
||||||
|
$content = FileSystem::readFile($file);
|
||||||
|
|
||||||
|
// Inject patch before it
|
||||||
|
$patch = ' save_LIBS="$LIBS"
|
||||||
|
LIBS="$LIBS $CURL_LIBS"
|
||||||
|
';
|
||||||
|
// Check if already patched
|
||||||
|
if (str_contains($content, $patch)) {
|
||||||
|
return false; // Already patched
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match the line containing PHP_CHECK_LIBRARY for curl
|
||||||
|
$pattern = '/(PHP_CHECK_LIBRARY\(\[curl],\s*\[curl_easy_perform],)/';
|
||||||
|
|
||||||
|
// Restore LIBS after the check — append this just after the macro block
|
||||||
|
$restore = '
|
||||||
|
LIBS="$save_LIBS"';
|
||||||
|
|
||||||
|
// Apply patch
|
||||||
|
$patched = preg_replace_callback($pattern, function ($matches) use ($patch) {
|
||||||
|
return $patch . $matches[1];
|
||||||
|
}, $content, 1);
|
||||||
|
|
||||||
|
// Inject restore after the matching PHP_CHECK_LIBRARY block
|
||||||
|
$patched = preg_replace(
|
||||||
|
'/(PHP_CHECK_LIBRARY\(\[curl],\s*\[curl_easy_perform],.*?\)\n)/s',
|
||||||
|
"$1{$restore}\n",
|
||||||
|
$patched,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($patched === null) {
|
||||||
|
throw new \RuntimeException('Failed to patch config.m4 due to a regex error');
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystem::writeFile($file, $patched);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildUnixShared(): void
|
||||||
|
{
|
||||||
|
if (!$this->builder instanceof LinuxBuilder) {
|
||||||
|
parent::buildUnixShared();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/config.m4',
|
||||||
|
['$ext_dir/phar.1', '$ext_dir/phar.phar.1'],
|
||||||
|
['${ext_dir}phar.1', '${ext_dir}phar.phar.1']
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
parent::buildUnixShared();
|
||||||
|
} finally {
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/config.m4',
|
||||||
|
['${ext_dir}phar.1', '${ext_dir}phar.phar.1'],
|
||||||
|
['$ext_dir/phar.1', '$ext_dir/phar.phar.1']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('dba')]
|
#[CustomExt('dba')]
|
||||||
class dba extends Extension
|
class dba extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . BUILD_ROOT_PATH) : '';
|
$qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH) : '';
|
||||||
return '--enable-dba' . $qdbm;
|
return '--enable-dba' . ($shared ? '=shared' : '') . $qdbm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$qdbm = $this->builder->getLib('qdbm') ? ' --with-qdbm' : '';
|
$qdbm = $this->builder->getLib('qdbm') ? ' --with-qdbm' : '';
|
||||||
return '--with-dba' . $qdbm;
|
return '--with-dba' . $qdbm;
|
||||||
|
|||||||
22
src/SPC/builder/extension/dio.php
Normal file
22
src/SPC/builder/extension/dio.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('dio')]
|
||||||
|
class dio extends Extension
|
||||||
|
{
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
if (!file_exists(SOURCE_PATH . '/php-src/ext/dio/php_dio.h')) {
|
||||||
|
FileSystem::writeFile(SOURCE_PATH . '/php-src/ext/dio/php_dio.h', FileSystem::readFile(SOURCE_PATH . '/php-src/ext/dio/src/php_dio.h'));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
src/SPC/builder/extension/dom.php
Normal file
35
src/SPC/builder/extension/dom.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('dom')]
|
||||||
|
class dom extends Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
$arg = '--enable-dom' . ($shared ? '=shared' : '');
|
||||||
|
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/win32/build/config.w32', 'dllmain.c ', '');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWindowsConfigureArg($shared = false): string
|
||||||
|
{
|
||||||
|
return '--with-dom';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('enchant')]
|
#[CustomExt('enchant')]
|
||||||
class enchant extends Extension
|
class enchant extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$glibs = [
|
$glibs = [
|
||||||
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgio-2.0.a',
|
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgio-2.0.a',
|
||||||
|
|||||||
31
src/SPC/builder/extension/ev.php
Normal file
31
src/SPC/builder/extension/ev.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('ev')]
|
||||||
|
class ev extends Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* replace EXTENSION('ev', php_ev_sources, true, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
|
||||||
|
* to EXTENSION('ev', php_ev_sources, PHP_EV_SHARED, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
|
||||||
|
*/
|
||||||
|
FileSystem::replaceFileLineContainsString(
|
||||||
|
$this->source_dir . '/config.w32',
|
||||||
|
'EXTENSION(\'ev\'',
|
||||||
|
" EXTENSION('ev', php_ev_sources, PHP_EV_SHARED, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');"
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('event')]
|
#[CustomExt('event')]
|
||||||
class event extends Extension
|
class event extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--with-event-core --with-event-extra --with-event-libevent-dir=' . BUILD_ROOT_PATH;
|
$arg = '--with-event-core --with-event-extra --with-event-libevent-dir=' . BUILD_ROOT_PATH;
|
||||||
if ($this->builder->getLib('openssl')) {
|
if ($this->builder->getLib('openssl')) {
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('ffi')]
|
#[CustomExt('ffi')]
|
||||||
class ffi extends Extension
|
class ffi extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--with-ffi --enable-zend-signals';
|
return '--with-ffi' . ($shared ? '=shared' : '') . ' --enable-zend-signals';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--with-ffi';
|
return '--with-ffi';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('gd')]
|
#[CustomExt('gd')]
|
||||||
class gd extends Extension
|
class gd extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--enable-gd';
|
$arg = '--enable-gd' . ($shared ? '=shared' : '');
|
||||||
$arg .= $this->builder->getLib('freetype') ? ' --with-freetype' : '';
|
$arg .= $this->builder->getLib('freetype') ? ' --with-freetype' : '';
|
||||||
$arg .= $this->builder->getLib('libjpeg') ? ' --with-jpeg' : '';
|
$arg .= $this->builder->getLib('libjpeg') ? ' --with-jpeg' : '';
|
||||||
$arg .= $this->builder->getLib('libwebp') ? ' --with-webp' : '';
|
$arg .= $this->builder->getLib('libwebp') ? ' --with-webp' : '';
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ class glfw extends Extension
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-glfw --with-glfw-dir=' . BUILD_ROOT_PATH;
|
return '--enable-glfw --with-glfw-dir=' . BUILD_ROOT_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-glfw=static';
|
return '--enable-glfw=static';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,13 @@ class grpc extends Extension
|
|||||||
throw new \RuntimeException('grpc extension does not support windows yet');
|
throw new \RuntimeException('grpc extension does not support windows yet');
|
||||||
}
|
}
|
||||||
if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) {
|
if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) {
|
||||||
shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc');
|
if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) {
|
||||||
|
shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc');
|
||||||
|
} elseif (is_dir(BUILD_ROOT_PATH . '/grpc_php_ext_src')) {
|
||||||
|
shell()->exec('ln -s ' . BUILD_ROOT_PATH . '/grpc_php_ext_src ' . SOURCE_PATH . '/php-src/ext/grpc');
|
||||||
|
} else {
|
||||||
|
throw new \RuntimeException('Cannot find grpc source code');
|
||||||
|
}
|
||||||
$macos = $this->builder instanceof MacOSBuilder ? "\n" . ' LDFLAGS="$LDFLAGS -framework CoreFoundation"' : '';
|
$macos = $this->builder instanceof MacOSBuilder ? "\n" . ' LDFLAGS="$LDFLAGS -framework CoreFoundation"' : '';
|
||||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/GRPC_LIBDIR=.*$/m', 'GRPC_LIBDIR=' . BUILD_LIB_PATH . $macos);
|
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/GRPC_LIBDIR=.*$/m', 'GRPC_LIBDIR=' . BUILD_LIB_PATH . $macos);
|
||||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/SEARCH_PATH=.*$/m', 'SEARCH_PATH="' . BUILD_ROOT_PATH . '"');
|
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/SEARCH_PATH=.*$/m', 'SEARCH_PATH="' . BUILD_ROOT_PATH . '"');
|
||||||
@@ -38,7 +44,7 @@ class grpc extends Extension
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-grpc=' . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH;
|
return '--enable-grpc=' . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
use SPC\builder\linux\LinuxBuilder;
|
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('imagick')]
|
#[CustomExt('imagick')]
|
||||||
@@ -13,17 +12,21 @@ class imagick extends Extension
|
|||||||
{
|
{
|
||||||
public function patchBeforeMake(): bool
|
public function patchBeforeMake(): bool
|
||||||
{
|
{
|
||||||
// imagick may call omp_pause_all which requires -lgomp
|
if (PHP_OS_FAMILY !== 'Linux') {
|
||||||
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
return false;
|
||||||
if ($this->builder instanceof LinuxBuilder) {
|
|
||||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . '-lgomp ';
|
|
||||||
}
|
}
|
||||||
|
if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// imagick with calls omp_pause_all, which requires openmp, on non-musl we build imagick without openmp
|
||||||
|
$extra_libs = trim(getenv('SPC_EXTRA_LIBS') . ' -lgomp');
|
||||||
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
|
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--with-imagick=' . BUILD_ROOT_PATH;
|
$disable_omp = !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) ? '' : ' ac_cv_func_omp_pause_resource_all=no';
|
||||||
|
return '--with-imagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class imap extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--with-imap=' . BUILD_ROOT_PATH;
|
$arg = '--with-imap=' . BUILD_ROOT_PATH;
|
||||||
if ($this->builder->getLib('openssl') !== null) {
|
if ($this->builder->getLib('openssl') !== null) {
|
||||||
|
|||||||
@@ -18,9 +18,12 @@ class intl extends Extension
|
|||||||
// Also need to use clang++ -std=c++17 to force override the default C++ standard
|
// Also need to use clang++ -std=c++17 to force override the default C++ standard
|
||||||
if (is_string($env = getenv('CXX')) && !str_contains($env, 'std=c++17')) {
|
if (is_string($env = getenv('CXX')) && !str_contains($env, 'std=c++17')) {
|
||||||
f_putenv('CXX=' . $env . ' -std=c++17');
|
f_putenv('CXX=' . $env . ' -std=c++17');
|
||||||
} else {
|
|
||||||
f_putenv('CXX=clang++ -std=c++17');
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function patchBeforeSharedBuild(): bool
|
||||||
|
{
|
||||||
|
return $this->patchBeforeBuildconf();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
src/SPC/builder/extension/lz4.php
Normal file
22
src/SPC/builder/extension/lz4.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('lz4')]
|
||||||
|
class lz4 extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--enable-lz4' . ($shared ? '=shared' : '') . ' --with-lz4-includedir=' . BUILD_ROOT_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--enable-lz4';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ class mbregex extends Extension
|
|||||||
return 'mbstring';
|
return 'mbstring';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigureArg(): string
|
public function getConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,8 @@ class mbregex extends Extension
|
|||||||
*/
|
*/
|
||||||
public function runCliCheckUnix(): void
|
public function runCliCheckUnix(): void
|
||||||
{
|
{
|
||||||
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "mbstring" | grep regex', false);
|
$sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? '-d "extension_dir=' . BUILD_MODULES_PATH . '" -d "extension=mbstring"' : '';
|
||||||
|
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedext . ' --ri "mbstring" | grep regex', false);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !');
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !');
|
||||||
}
|
}
|
||||||
@@ -34,7 +35,7 @@ class mbregex extends Extension
|
|||||||
|
|
||||||
public function runCliCheckWindows(): void
|
public function runCliCheckWindows(): void
|
||||||
{
|
{
|
||||||
[$ret, $out] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "mbstring"', false);
|
[$ret, $out] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n --ri "mbstring"', false);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli does not contain mbstring !');
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli does not contain mbstring !');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,20 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('mbstring')]
|
#[CustomExt('mbstring')]
|
||||||
class mbstring extends Extension
|
class mbstring extends Extension
|
||||||
{
|
{
|
||||||
public function getConfigureArg(): string
|
public function getConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--enable-mbstring';
|
$arg = '--enable-mbstring' . ($shared ? '=shared' : '');
|
||||||
|
if ($this->builder->getExt('mbregex') === null) {
|
||||||
|
$arg .= ' --disable-mbregex';
|
||||||
|
} else {
|
||||||
|
$arg .= ' --enable-mbregex';
|
||||||
|
}
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
$arg = '--enable-mbstring' . ($shared ? '=shared' : '');
|
||||||
if ($this->builder->getExt('mbregex') === null) {
|
if ($this->builder->getExt('mbregex') === null) {
|
||||||
$arg .= ' --disable-mbregex';
|
$arg .= ' --disable-mbregex';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('memcache')]
|
#[CustomExt('memcache')]
|
||||||
class memcache extends Extension
|
class memcache extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-memcache --with-zlib-dir=' . BUILD_ROOT_PATH;
|
return '--enable-memcache' . ($shared ? '=shared' : '') . ' --with-zlib-dir=' . BUILD_ROOT_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,9 +10,13 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('memcached')]
|
#[CustomExt('memcached')]
|
||||||
class memcached extends Extension
|
class memcached extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$rootdir = BUILD_ROOT_PATH;
|
return '--enable-memcached' . ($shared ? '=shared' : '') . ' ' .
|
||||||
return "--enable-memcached --with-zlib-dir={$rootdir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json";
|
'--with-zlib-dir=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
'--with-libmemcached-dir=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
'--disable-memcached-sasl ' .
|
||||||
|
'--enable-memcached-json ' .
|
||||||
|
'--with-system-fastlz';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('mongodb')]
|
#[CustomExt('mongodb')]
|
||||||
class mongodb extends Extension
|
class mongodb extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = ' --enable-mongodb ';
|
$arg = ' --enable-mongodb ';
|
||||||
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
||||||
|
|||||||
17
src/SPC/builder/extension/odbc.php
Normal file
17
src/SPC/builder/extension/odbc.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('odbc')]
|
||||||
|
class odbc extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--with-unixODBC=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ class opcache extends Extension
|
|||||||
return file_put_contents(SOURCE_PATH . '/php-src/.opcache_patched', '1') !== false;
|
return file_put_contents(SOURCE_PATH . '/php-src/.opcache_patched', '1') !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-opcache';
|
return '--enable-opcache';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ class openssl extends Extension
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--with-openssl=' . BUILD_ROOT_PATH . ' --with-openssl-dir=' . BUILD_ROOT_PATH;
|
$openssl_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : ' --with-openssl-dir=' . BUILD_ROOT_PATH;
|
||||||
|
return '--with-openssl=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $openssl_dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
41
src/SPC/builder/extension/opentelemetry.php
Normal file
41
src/SPC/builder/extension/opentelemetry.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
use SPC\util\GlobalEnvManager;
|
||||||
|
|
||||||
|
#[CustomExt('opentelemetry')]
|
||||||
|
class opentelemetry extends Extension
|
||||||
|
{
|
||||||
|
public function validate(): void
|
||||||
|
{
|
||||||
|
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||||
|
throw new \RuntimeException('The opentelemetry extension requires PHP 8.0 or later');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
SOURCE_PATH . '/php-src/ext/opentelemetry/config.w32',
|
||||||
|
"EXTENSION('opentelemetry', 'opentelemetry.c otel_observer.c', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');",
|
||||||
|
"EXTENSION('opentelemetry', 'opentelemetry.c otel_observer.c', PHP_OPENTELEMETRY_SHARED, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');"
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function patchBeforeMake(): bool
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ class password_argon2 extends Extension
|
|||||||
|
|
||||||
public function runCliCheckUnix(): void
|
public function runCliCheckUnix(): void
|
||||||
{
|
{
|
||||||
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -r "assert(defined(\'PASSWORD_ARGON2I\'));"');
|
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n -r "assert(defined(\'PASSWORD_ARGON2I\'));"');
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
|
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/SPC/builder/extension/pdo_odbc.php
Normal file
29
src/SPC/builder/extension/pdo_odbc.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;
|
||||||
|
|
||||||
|
#[CustomExt('pdo_odbc')]
|
||||||
|
class pdo_odbc extends Extension
|
||||||
|
{
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/pdo_odbc/config.m4', 'PDO_ODBC_LDFLAGS="$pdo_odbc_def_ldflags', 'PDO_ODBC_LDFLAGS="-liconv $pdo_odbc_def_ldflags');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--with-pdo-odbc=' . ($shared ? 'shared,' : '') . 'unixODBC,' . BUILD_ROOT_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--with-pdo-odbc';
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/SPC/builder/extension/pdo_pgsql.php
Normal file
17
src/SPC/builder/extension/pdo_pgsql.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('pdo_pgsql')]
|
||||||
|
class pdo_pgsql extends Extension
|
||||||
|
{
|
||||||
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--with-pdo-pgsql=yes';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,10 +33,27 @@ class pgsql extends Extension
|
|||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
if ($this->builder->getPHPVersionID() >= 80400) {
|
if ($this->builder->getPHPVersionID() >= 80400) {
|
||||||
return '--with-pgsql PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon"';
|
$libfiles = $this->getLibFilesString();
|
||||||
|
$libfiles = str_replace(BUILD_LIB_PATH . '/lib', '-l', $libfiles);
|
||||||
|
$libfiles = str_replace('.a', '', $libfiles);
|
||||||
|
return '--with-pgsql' . ($shared ? '=shared' : '') .
|
||||||
|
' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH .
|
||||||
|
' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' ' . $libfiles . '"';
|
||||||
|
}
|
||||||
|
return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws WrongUsageException
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
if ($this->builder->getPHPVersionID() >= 80400) {
|
||||||
|
return '--with-pgsql';
|
||||||
}
|
}
|
||||||
return '--with-pgsql=' . BUILD_ROOT_PATH;
|
return '--with-pgsql=' . BUILD_ROOT_PATH;
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/SPC/builder/extension/phar.php
Normal file
37
src/SPC/builder/extension/phar.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\builder\linux\LinuxBuilder;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('phar')]
|
||||||
|
class phar extends Extension
|
||||||
|
{
|
||||||
|
public function buildUnixShared(): void
|
||||||
|
{
|
||||||
|
if (!$this->builder instanceof LinuxBuilder) {
|
||||||
|
parent::buildUnixShared();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/config.m4',
|
||||||
|
['$ext_dir/phar.1', '$ext_dir/phar.phar.1'],
|
||||||
|
['${ext_dir}phar.1', '${ext_dir}phar.phar.1']
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
parent::buildUnixShared();
|
||||||
|
} finally {
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/config.m4',
|
||||||
|
['${ext_dir}phar.1', '${ext_dir}phar.phar.1'],
|
||||||
|
['$ext_dir/phar.1', '$ext_dir/phar.phar.1']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,5 +15,9 @@ class protobuf extends Extension
|
|||||||
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||||
throw new \RuntimeException('The latest protobuf extension requires PHP 8.0 or later');
|
throw new \RuntimeException('The latest protobuf extension requires PHP 8.0 or later');
|
||||||
}
|
}
|
||||||
|
// protobuf conflicts with grpc
|
||||||
|
if ($this->builder->getExt('grpc') !== null) {
|
||||||
|
throw new \RuntimeException('protobuf conflicts with grpc, please remove grpc or protobuf extension');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('rdkafka')]
|
#[CustomExt('rdkafka')]
|
||||||
class rdkafka extends Extension
|
class rdkafka extends Extension
|
||||||
{
|
{
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
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"');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function patchBeforeMake(): bool
|
public function patchBeforeMake(): bool
|
||||||
{
|
{
|
||||||
// when compiling rdkafka with inline builds, it shows some errors, I don't know why.
|
// when compiling rdkafka with inline builds, it shows some errors, I don't know why.
|
||||||
@@ -27,10 +34,10 @@ class rdkafka extends Extension
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1];
|
$pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1];
|
||||||
$pkgconf_libs = trim(implode('', $pkgconf_libs));
|
$pkgconf_libs = trim(implode('', $pkgconf_libs));
|
||||||
return '--with-rdkafka=' . BUILD_ROOT_PATH . ' LIBS="' . $pkgconf_libs . '"';
|
return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' RDKAFKA_LIBS="' . $pkgconf_libs . '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,18 @@ class readline extends Extension
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--without-libedit --with-readline=' . BUILD_ROOT_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildUnixShared(): void
|
||||||
|
{
|
||||||
|
if (!file_exists(BUILD_BIN_PATH . '/php') || !file_exists(BUILD_INCLUDE_PATH . '/php/sapi/cli/cli.h')) {
|
||||||
|
logger()->warning('CLI mode is not enabled, skipping readline build');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parent::buildUnixShared();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('redis')]
|
#[CustomExt('redis')]
|
||||||
class redis extends Extension
|
class redis extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--enable-redis';
|
$arg = '--enable-redis';
|
||||||
$arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
$arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
||||||
@@ -24,7 +24,7 @@ class redis extends Extension
|
|||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--enable-redis';
|
$arg = '--enable-redis';
|
||||||
$arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
$arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class snappy extends Extension
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-snappy --with-snappy-includedir="' . BUILD_ROOT_PATH . '"';
|
return '--enable-snappy --with-snappy-includedir="' . BUILD_ROOT_PATH . '"';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,28 +5,28 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('spx')]
|
#[CustomExt('spx')]
|
||||||
class spx extends Extension
|
class spx extends Extension
|
||||||
{
|
{
|
||||||
/**
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
* @throws WrongUsageException
|
|
||||||
*/
|
|
||||||
public function validate(): void
|
|
||||||
{
|
{
|
||||||
if ($this->builder->getOption('enable-zts')) {
|
$arg = '--enable-spx' . ($shared ? '=shared' : '');
|
||||||
throw new WrongUsageException('ext-spx is not thread safe, do not build it with ZTS builds');
|
if ($this->builder->getLib('zlib') !== null) {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
|
||||||
{
|
|
||||||
$arg = '--enable-spx';
|
|
||||||
if ($this->builder->getExt('zlib') === null) {
|
|
||||||
$arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH;
|
$arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH;
|
||||||
}
|
}
|
||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function patchBeforeConfigure(): bool
|
||||||
|
{
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/Makefile.frag',
|
||||||
|
'@cp -r assets/web-ui/*',
|
||||||
|
'@cp -r ' . $this->source_dir . '/assets/web-ui/*',
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class swoole extends Extension
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
// enable swoole
|
// enable swoole
|
||||||
$arg = '--enable-swoole';
|
$arg = '--enable-swoole';
|
||||||
@@ -49,7 +49,9 @@ class swoole extends Extension
|
|||||||
|
|
||||||
// additional feature: c-ares, brotli, nghttp2 (can be disabled, but we enable it by default in config to support full network feature)
|
// additional feature: c-ares, brotli, nghttp2 (can be disabled, but we enable it by default in config to support full network feature)
|
||||||
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
|
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
|
||||||
$arg .= $this->builder->getLib('brotli') ? (' --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
|
if (!$shared) {
|
||||||
|
$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('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
|
||||||
|
|
||||||
// additional feature: swoole-pgsql, it should depend on lib [postgresql], but it will lack of CFLAGS etc.
|
// additional feature: swoole-pgsql, it should depend on lib [postgresql], but it will lack of CFLAGS etc.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class swoole_hook_mysql extends Extension
|
|||||||
return 'swoole';
|
return 'swoole';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
// pdo_mysql doesn't need to be disabled
|
// pdo_mysql doesn't need to be disabled
|
||||||
// enable swoole-hook-mysql will enable mysqli, pdo, pdo_mysql, we don't need to add any additional options
|
// enable swoole-hook-mysql will enable mysqli, pdo, pdo_mysql, we don't need to add any additional options
|
||||||
@@ -29,7 +29,7 @@ class swoole_hook_mysql extends Extension
|
|||||||
if ($this->builder->getExt('swoole') === null) {
|
if ($this->builder->getExt('swoole') === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $this->getSharedExtensionLoadString() . ' --ri "swoole"', false);
|
||||||
$out = implode('', $out);
|
$out = implode('', $out);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class swoole_hook_pgsql extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
// enable swoole pgsql hook
|
// enable swoole pgsql hook
|
||||||
return '--enable-swoole-pgsql';
|
return '--enable-swoole-pgsql';
|
||||||
@@ -37,7 +37,8 @@ class swoole_hook_pgsql extends Extension
|
|||||||
if ($this->builder->getExt('swoole') === null) {
|
if ($this->builder->getExt('swoole') === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
$sharedExtensions = $this->getSharedExtensionLoadString();
|
||||||
|
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
|
||||||
$out = implode('', $out);
|
$out = implode('', $out);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class swoole_hook_sqlite extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
// enable swoole pgsql hook
|
// enable swoole pgsql hook
|
||||||
return '--enable-swoole-sqlite';
|
return '--enable-swoole-sqlite';
|
||||||
@@ -37,7 +37,8 @@ class swoole_hook_sqlite extends Extension
|
|||||||
if ($this->builder->getExt('swoole') === null) {
|
if ($this->builder->getExt('swoole') === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
$sharedExtensions = $this->getSharedExtensionLoadString();
|
||||||
|
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
|
||||||
$out = implode('', $out);
|
$out = implode('', $out);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class swow extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigureArg(): string
|
public function getConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--enable-swow';
|
$arg = '--enable-swow';
|
||||||
$arg .= $this->builder->getLib('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
$arg .= $this->builder->getLib('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\SourcePatcher;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('xlswriter')]
|
#[CustomExt('xlswriter')]
|
||||||
class xlswriter extends Extension
|
class xlswriter extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = '--with-xlswriter --enable-reader';
|
$arg = '--with-xlswriter --enable-reader';
|
||||||
if ($this->builder->getLib('openssl')) {
|
if ($this->builder->getLib('openssl')) {
|
||||||
@@ -18,4 +19,24 @@ class xlswriter extends Extension
|
|||||||
}
|
}
|
||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--with-xlswriter';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function patchBeforeMake(): bool
|
||||||
|
{
|
||||||
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
|
// fix windows build with openssl extension duplicate symbol bug
|
||||||
|
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir);
|
||||||
|
$content = file_get_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c');
|
||||||
|
$bom = pack('CCC', 0xEF, 0xBB, 0xBF);
|
||||||
|
if (substr($content, 0, 3) !== $bom) {
|
||||||
|
file_put_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c', $bom . $content);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,25 +13,23 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('soap')]
|
#[CustomExt('soap')]
|
||||||
#[CustomExt('xmlreader')]
|
#[CustomExt('xmlreader')]
|
||||||
#[CustomExt('xmlwriter')]
|
#[CustomExt('xmlwriter')]
|
||||||
#[CustomExt('dom')]
|
|
||||||
#[CustomExt('simplexml')]
|
#[CustomExt('simplexml')]
|
||||||
class xml extends Extension
|
class xml extends Extension
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = match ($this->name) {
|
$arg = match ($this->name) {
|
||||||
'xml' => '--enable-xml',
|
'xml' => '--enable-xml',
|
||||||
'soap' => '--enable-soap',
|
'soap' => '--enable-soap',
|
||||||
'xmlreader' => '--enable-xmlreader',
|
'xmlreader' => '--enable-xmlreader',
|
||||||
'xmlwriter' => '--enable-xmlwriter',
|
'xmlwriter' => '--enable-xmlwriter',
|
||||||
'dom' => '--enable-dom',
|
|
||||||
'simplexml' => '--enable-simplexml',
|
'simplexml' => '--enable-simplexml',
|
||||||
default => throw new RuntimeException('Not accept non-xml extension'),
|
default => throw new RuntimeException('Not accept non-xml extension'),
|
||||||
};
|
};
|
||||||
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
$arg .= ($shared ? '=shared' : '') . ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,14 +39,13 @@ class xml extends Extension
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = match ($this->name) {
|
$arg = match ($this->name) {
|
||||||
'xml' => '--with-xml',
|
'xml' => '--with-xml',
|
||||||
'soap' => '--enable-soap',
|
'soap' => '--enable-soap',
|
||||||
'xmlreader' => '--enable-xmlreader',
|
'xmlreader' => '--enable-xmlreader',
|
||||||
'xmlwriter' => '--enable-xmlwriter',
|
'xmlwriter' => '--enable-xmlwriter',
|
||||||
'dom' => '--with-dom',
|
|
||||||
'simplexml' => '--with-simplexml',
|
'simplexml' => '--with-simplexml',
|
||||||
default => throw new RuntimeException('Not accept non-xml extension'),
|
default => throw new RuntimeException('Not accept non-xml extension'),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ class yac extends Extension
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-yac --enable-igbinary --enable-json';
|
return '--enable-yac ' . ($shared ? '=shared' : '') . ' --enable-igbinary --enable-json --with-system-fastlz';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,9 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('zlib')]
|
#[CustomExt('zlib')]
|
||||||
class zlib extends Extension
|
class zlib extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
if ($this->builder->getPHPVersionID() >= 80400) {
|
$zlib_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : ' --with-zlib-dir=' . BUILD_ROOT_PATH;
|
||||||
return '--with-zlib';
|
return '--with-zlib' . $zlib_dir;
|
||||||
}
|
|
||||||
return '--with-zlib --with-zlib-dir="' . BUILD_ROOT_PATH . '"';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('zstd')]
|
#[CustomExt('zstd')]
|
||||||
class zstd extends Extension
|
class zstd extends Extension
|
||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"';
|
return '--enable-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"';
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user