mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 22:35:43 +08:00
Compare commits
1010 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ae1c81f9c | ||
|
|
eff698cbe8 | ||
|
|
036e4f52b7 | ||
|
|
d258417afb | ||
|
|
3057d02e37 | ||
|
|
af8204fbf0 | ||
|
|
968b3acbce | ||
|
|
5d2bd93bd7 | ||
|
|
4ba92b08ca | ||
|
|
11076b1355 | ||
|
|
71770a0a5f | ||
|
|
98d3766fe8 | ||
|
|
1fdb6b439e | ||
|
|
3136d6edc1 | ||
|
|
3e84becf77 | ||
|
|
1632c25223 | ||
|
|
e6c308c242 | ||
|
|
3fcb7ebf03 | ||
|
|
7416b8079b | ||
|
|
bde18054e5 | ||
|
|
954f8f4ddc | ||
|
|
0fee628842 | ||
|
|
69e6d82e83 | ||
|
|
e1e6270d86 | ||
|
|
30af182aff | ||
|
|
3ecc603770 | ||
|
|
15c2935d48 | ||
|
|
7a8e0a7e67 | ||
|
|
d98d6aeffb | ||
|
|
aaa4510f25 | ||
|
|
b14894fab7 | ||
|
|
1a87ce4194 | ||
|
|
6b96feb538 | ||
|
|
21dbb8af46 | ||
|
|
4d227ca7ef | ||
|
|
3a2683bb0c | ||
|
|
bd8f91d466 | ||
|
|
254844b5ec | ||
|
|
4cb1764439 | ||
|
|
847535721c | ||
|
|
e3c542d9df | ||
|
|
b4ed4ea956 | ||
|
|
99aadd3e73 | ||
|
|
c77dc1af6c | ||
|
|
9fd56987ef | ||
|
|
1e494a2213 | ||
|
|
da6d9ffb4b | ||
|
|
d3a001d808 | ||
|
|
d445668d9f | ||
|
|
32f14e16c8 | ||
|
|
46984b6df1 | ||
|
|
96c3e6b935 | ||
|
|
8092f1e481 | ||
|
|
632f904f30 | ||
|
|
8358a985b3 | ||
|
|
e21b5676e7 | ||
|
|
94b3afe6bc | ||
|
|
e4d8e5e4d2 | ||
|
|
88796bc017 | ||
|
|
e23daaa355 | ||
|
|
71017361b5 | ||
|
|
d202de3f50 | ||
|
|
03510073c6 | ||
|
|
8e58592a6e | ||
|
|
96dd5ba87b | ||
|
|
d4c0290195 | ||
|
|
f5d1df5407 | ||
|
|
9664709f21 | ||
|
|
b46655ecfe | ||
|
|
842e0add29 | ||
|
|
254764761d | ||
|
|
5f6c1a0f40 | ||
|
|
d5dcd193cf | ||
|
|
5012da96be | ||
|
|
df0e37cd0f | ||
|
|
4ab7b6bfdc | ||
|
|
f498250001 | ||
|
|
3945ac037b | ||
|
|
b0d8b00fcc | ||
|
|
62b0bf8af0 | ||
|
|
905e080770 | ||
|
|
097ecd3fb0 | ||
|
|
b9359759dd | ||
|
|
50fe366c42 | ||
|
|
9dd89e6b02 | ||
|
|
c03220d1ee | ||
|
|
9db843ab66 | ||
|
|
304973d9bc | ||
|
|
ab386f820c | ||
|
|
4adf1f5e2e | ||
|
|
b4ae87585c | ||
|
|
ae3298472d | ||
|
|
d241cb993e | ||
|
|
8376122634 | ||
|
|
a30e054d7d | ||
|
|
78f4317660 | ||
|
|
3ac3dab6c8 | ||
|
|
1a7e436ee1 | ||
|
|
f11b36ab3c | ||
|
|
e2ef195a84 | ||
|
|
645e2a9fc2 | ||
|
|
d59b8457c6 | ||
|
|
a2d1262cbf | ||
|
|
2f9a1e8601 | ||
|
|
b239f60fe4 | ||
|
|
983521e225 | ||
|
|
aeed04a5ec | ||
|
|
faed569e8a | ||
|
|
49ddb3ec13 | ||
|
|
71c0387ab0 | ||
|
|
e5d2d5e689 | ||
|
|
be2394b39b | ||
|
|
158298b96c | ||
|
|
ffa84f8b91 | ||
|
|
0954ddcc96 | ||
|
|
d9bd96af71 | ||
|
|
2649dcd05c | ||
|
|
939db75268 | ||
|
|
227bf73870 | ||
|
|
05e3898e7a | ||
|
|
9777c9aa93 | ||
|
|
b8d8461e61 | ||
|
|
b977543c72 | ||
|
|
4d87cd11cc | ||
|
|
957daf0547 | ||
|
|
3dae904122 | ||
|
|
e835196972 | ||
|
|
52ed0e2cee | ||
|
|
1e898d271d | ||
|
|
39754cde59 | ||
|
|
a6f7b938e1 | ||
|
|
0ad501af9a | ||
|
|
73035067e3 | ||
|
|
421b3830b6 | ||
|
|
59dcb905fe | ||
|
|
d222190fc7 | ||
|
|
06e9864d19 | ||
|
|
0b1a321615 | ||
|
|
9ee7d7769a | ||
|
|
2440a65d8e | ||
|
|
839931d65f | ||
|
|
2591b48abe | ||
|
|
2549597871 | ||
|
|
2064172bed | ||
|
|
dc19d0c61d | ||
|
|
05c6dc6dab | ||
|
|
4b653bc293 | ||
|
|
1c3476b8e9 | ||
|
|
61ca501c2a | ||
|
|
d916feec62 | ||
|
|
0dcecf6ca4 | ||
|
|
a04deb458f | ||
|
|
34f810571e | ||
|
|
5ab4d140d5 | ||
|
|
104778d17a | ||
|
|
5f8641f417 | ||
|
|
17b69ec1e9 | ||
|
|
8de942c274 | ||
|
|
a7d5a48b48 | ||
|
|
fdc00301c0 | ||
|
|
7620d5900e | ||
|
|
e973fe743e | ||
|
|
149e844d59 | ||
|
|
12ea3218e8 | ||
|
|
f9e7af1c9a | ||
|
|
8d2f6baaa2 | ||
|
|
25a2684e5a | ||
|
|
13e0e12181 | ||
|
|
81df124b42 | ||
|
|
d3d8230a09 | ||
|
|
d4eb199504 | ||
|
|
6562bc200c | ||
|
|
0b322f494b | ||
|
|
ceed1005cc | ||
|
|
6efcb75224 | ||
|
|
a45f2f357d | ||
|
|
0c2de9f936 | ||
|
|
ac005d1e0f | ||
|
|
fce0c2f896 | ||
|
|
a0a0b01cc3 | ||
|
|
450ec21c90 | ||
|
|
7b2c3ac12d | ||
|
|
8d4a375400 | ||
|
|
eda3a9b486 | ||
|
|
5b581a54aa | ||
|
|
5549068275 | ||
|
|
daf0d2eb32 | ||
|
|
bff1a6168f | ||
|
|
54ba41d1b3 | ||
|
|
cb5e13e39a | ||
|
|
269e95e0fe | ||
|
|
dabdb518ce | ||
|
|
eac4763d82 | ||
|
|
fa0ea5443d | ||
|
|
31c71f180b | ||
|
|
5c7552f826 | ||
|
|
fa1bd340f1 | ||
|
|
539aaefd72 | ||
|
|
d54bf42ba8 | ||
|
|
cbfbec41b4 | ||
|
|
db7532cad3 | ||
|
|
6b8df97282 | ||
|
|
584f96484c | ||
|
|
e1e5515694 | ||
|
|
d3ff6fd8c0 | ||
|
|
6bcda6a5a0 | ||
|
|
3828ba7c77 | ||
|
|
a632caed54 | ||
|
|
1e0265e673 | ||
|
|
a39cd9a238 | ||
|
|
2d437952f2 | ||
|
|
7e5b0d6f43 | ||
|
|
cf198e0f0a | ||
|
|
248918e458 | ||
|
|
c4cfc01b88 | ||
|
|
339c03adb2 | ||
|
|
48551cc602 | ||
|
|
e0550b4a45 | ||
|
|
93a55e87d5 | ||
|
|
e68f1ce3fe | ||
|
|
3573007485 | ||
|
|
b961c34d9a | ||
|
|
33e1759caa | ||
|
|
d72ee53cb4 | ||
|
|
a5fa46b82d | ||
|
|
bc15de0dfb | ||
|
|
1f7bdb94fb | ||
|
|
ea64e50ce5 | ||
|
|
ed8b606761 | ||
|
|
b722b3edd4 | ||
|
|
9266a4c504 | ||
|
|
d8ce5f69f4 | ||
|
|
0cfac49560 | ||
|
|
3e9ddc8e01 | ||
|
|
83dd1bd5c3 | ||
|
|
42f448cf17 | ||
|
|
f0319de93e | ||
|
|
c7e9294908 | ||
|
|
c1758bd754 | ||
|
|
bba2d0dbf7 | ||
|
|
00689b951b | ||
|
|
98b7164de3 | ||
|
|
d3e4470e1f | ||
|
|
433c91b68d | ||
|
|
3185d98b1a | ||
|
|
e603e441e7 | ||
|
|
b1bf8bb848 | ||
|
|
b1958ea0c4 | ||
|
|
930849758c | ||
|
|
7ee431725c | ||
|
|
7c866cb0e3 | ||
|
|
266108b25f | ||
|
|
82e3a86f17 | ||
|
|
ba18819b41 | ||
|
|
6b23c90bba | ||
|
|
edfd371973 | ||
|
|
8ed95602e2 | ||
|
|
cee1346bec | ||
|
|
400007c206 | ||
|
|
443e615066 | ||
|
|
ed22945ae2 | ||
|
|
5db084ba0e | ||
|
|
c7b3275a72 | ||
|
|
41cd319d4e | ||
|
|
1c307d0d59 | ||
|
|
9dcda873f3 | ||
|
|
4400c6271e | ||
|
|
0589690eaa | ||
|
|
5449e05898 | ||
|
|
93e64e1d5a | ||
|
|
7a2e237069 | ||
|
|
c95da8c150 | ||
|
|
89afd44344 | ||
|
|
04f100da8b | ||
|
|
2e24976b71 | ||
|
|
36a30cc23b | ||
|
|
869130572f | ||
|
|
2bb08af89b | ||
|
|
b3d41ef969 | ||
|
|
9c904409cd | ||
|
|
859182abff | ||
|
|
c0e88bf4bd | ||
|
|
79bcd35c0e | ||
|
|
2e637524fc | ||
|
|
a2c687599f | ||
|
|
d09a3074ad | ||
|
|
5736964b2e | ||
|
|
edaa82b8c5 | ||
|
|
2a6441a500 | ||
|
|
3bd5a05725 | ||
|
|
a6fbcc954e | ||
|
|
66cebb5fe4 | ||
|
|
e3671387fc | ||
|
|
f7c73c00af | ||
|
|
74536bd2e1 | ||
|
|
a8f2b0096b | ||
|
|
2d192fc390 | ||
|
|
031da802f3 | ||
|
|
5fdeb33031 | ||
|
|
347da67b71 | ||
|
|
65ef9ab20c | ||
|
|
3d64c6349e | ||
|
|
31cf9bb5b7 | ||
|
|
7c4a991c0e | ||
|
|
07f943af7e | ||
|
|
fbf5c958d0 | ||
|
|
672a4102cd | ||
|
|
52d61365b7 | ||
|
|
ff74f0cdaf | ||
|
|
dccfde9f39 | ||
|
|
5db23e1db7 | ||
|
|
b1ae48a209 | ||
|
|
3604ea6d67 | ||
|
|
967292be5c | ||
|
|
4f5335bba4 | ||
|
|
ac7a236763 | ||
|
|
1bf39c1f06 | ||
|
|
678283cd98 | ||
|
|
97a76aba8a | ||
|
|
af464e7b3d | ||
|
|
5ee7dd9200 | ||
|
|
9e1c2c6dd5 | ||
|
|
d29ba16cbc | ||
|
|
7bef45eb32 | ||
|
|
772ab77d2e | ||
|
|
58897c6941 | ||
|
|
8230e1bcec | ||
|
|
279a1dab4b | ||
|
|
9fb5173e3e | ||
|
|
0b37080cdd | ||
|
|
8747266df6 | ||
|
|
12cc422d5b | ||
|
|
bfc56cff72 | ||
|
|
d5405ce436 | ||
|
|
e158cc5886 | ||
|
|
aee040d6a4 | ||
|
|
e637cce6f2 | ||
|
|
98b906db40 | ||
|
|
7625f585d2 | ||
|
|
ed8837fe9f | ||
|
|
a5754125a8 | ||
|
|
6b848da4dd | ||
|
|
2768dc0c40 | ||
|
|
90b2e5568c | ||
|
|
b4f9235cb6 | ||
|
|
86ce7e9d25 | ||
|
|
2e47e8af6b | ||
|
|
d40f2cafec | ||
|
|
e84a246dd2 | ||
|
|
98f32ae0f0 | ||
|
|
5499109278 | ||
|
|
9a5b02692d | ||
|
|
970a74896a | ||
|
|
29179ecb84 | ||
|
|
5e0cccfe3d | ||
|
|
ed52ec9ee1 | ||
|
|
f25d2d5db4 | ||
|
|
e00908d8cb | ||
|
|
c24dc8f518 | ||
|
|
d381e48605 | ||
|
|
8dcec73929 | ||
|
|
9b9644fe63 | ||
|
|
8a70da6291 | ||
|
|
c84eb723ec | ||
|
|
5934e5e881 | ||
|
|
99150e2cef | ||
|
|
8191444fe9 | ||
|
|
5cfba6e83b | ||
|
|
4e9b8980d0 | ||
|
|
c800a53f77 | ||
|
|
6cc7e6cff6 | ||
|
|
d56c060863 | ||
|
|
b6409bded4 | ||
|
|
ca1189b6ca | ||
|
|
75b9d66698 | ||
|
|
6dfd35348f | ||
|
|
0007043f4a | ||
|
|
da1cbeb79c | ||
|
|
a83a457905 | ||
|
|
a4dc177621 | ||
|
|
a7265bf624 | ||
|
|
64dfb57366 | ||
|
|
658e8e74bd | ||
|
|
46b0ecf3fa | ||
|
|
830f379bf6 | ||
|
|
c9b544f8c4 | ||
|
|
11af370fe1 | ||
|
|
1e11559c4b | ||
|
|
8b188bd1b9 | ||
|
|
e0e3bc6d97 | ||
|
|
dbb566ac7c | ||
|
|
37b9704fbb | ||
|
|
c225aeffed | ||
|
|
2e3544f296 | ||
|
|
ce60a9c804 | ||
|
|
b6c0b998b3 | ||
|
|
6277539a79 | ||
|
|
9520d68cda | ||
|
|
812c71f31f | ||
|
|
b3cc360eeb | ||
|
|
39fe6fa081 | ||
|
|
243ee63283 | ||
|
|
24c946d687 | ||
|
|
84d1c789bd | ||
|
|
a983667b90 | ||
|
|
8d9cace469 | ||
|
|
e9d3e48f90 | ||
|
|
ed53394389 | ||
|
|
8893d08ba9 | ||
|
|
5a13daee39 | ||
|
|
c1e9cd2ea3 | ||
|
|
30213da70a | ||
|
|
5d363bdb0b | ||
|
|
630c0d3a5d | ||
|
|
56caef78e3 | ||
|
|
29be3a2e39 | ||
|
|
fbe149bcac | ||
|
|
92cafb36f6 | ||
|
|
8636f2e7c9 | ||
|
|
8f43a09533 | ||
|
|
654c5cba0c | ||
|
|
f9685b82a1 | ||
|
|
f2371d3702 | ||
|
|
fe39aecd72 | ||
|
|
68d176ad26 | ||
|
|
d7627dd81a | ||
|
|
a4e173f16d | ||
|
|
1437be3a9d | ||
|
|
059c32e59c | ||
|
|
e3a4cd6e1d | ||
|
|
dd9a5d8316 | ||
|
|
3b83c1fa7b | ||
|
|
ff128df76b | ||
|
|
cd04a9ea4f | ||
|
|
3b793005fe | ||
|
|
87e073a0b9 | ||
|
|
db8aa15677 | ||
|
|
6ed9749732 | ||
|
|
4e99211bc3 | ||
|
|
824748c2a7 | ||
|
|
fe6a98b30d | ||
|
|
49149cebf1 | ||
|
|
7b6a1b4212 | ||
|
|
965e7a25e2 | ||
|
|
0c3885c33d | ||
|
|
be32190829 | ||
|
|
f1d5916090 | ||
|
|
b2ea479fac | ||
|
|
16cc5df66d | ||
|
|
a63e3f4575 | ||
|
|
6b061e6332 | ||
|
|
4a17491aaa | ||
|
|
06f29712e2 | ||
|
|
4b1d59c5a9 | ||
|
|
1a81fe6a0d | ||
|
|
c63136d484 | ||
|
|
4b500f2dd8 | ||
|
|
9da20497cc | ||
|
|
5efc15b404 | ||
|
|
fa0740f216 | ||
|
|
52430cbdde | ||
|
|
01c4538ce0 | ||
|
|
3183ecceaf | ||
|
|
dd2e7cc129 | ||
|
|
adfa620ef4 | ||
|
|
1a32ddc70a | ||
|
|
4bfca6fe93 | ||
|
|
dbec043894 | ||
|
|
727d78a689 | ||
|
|
9b1e784604 | ||
|
|
50d44d8310 | ||
|
|
3b300698f3 | ||
|
|
899eb94b8b | ||
|
|
451a0c0e34 | ||
|
|
085c1a159c | ||
|
|
ca3f8a350d | ||
|
|
5025850f71 | ||
|
|
fe2f658e08 | ||
|
|
00a49c662b | ||
|
|
be8eb90b86 | ||
|
|
54e98666e7 | ||
|
|
e8b277ad0d | ||
|
|
3bd037f48f | ||
|
|
4d0e825b43 | ||
|
|
b14179a8de | ||
|
|
01111c51ee | ||
|
|
e7230d9f50 | ||
|
|
c22c5617ad | ||
|
|
cae7bb1dda | ||
|
|
c0830a9e1f | ||
|
|
33798ff108 | ||
|
|
8d348b9e14 | ||
|
|
3d2f6e4c3a | ||
|
|
88e9639482 | ||
|
|
0381a1c412 | ||
|
|
fdc3a7a04b | ||
|
|
6de5c1dab0 | ||
|
|
dc28ce0899 | ||
|
|
9286153742 | ||
|
|
f90892c92f | ||
|
|
5359f3a79a | ||
|
|
42fbf18bba | ||
|
|
ed227ce00e | ||
|
|
6c49d35aec | ||
|
|
238fd7fc74 | ||
|
|
1ebc58664e | ||
|
|
bcf64cbeef | ||
|
|
dc12d4d982 | ||
|
|
42e5877a7f | ||
|
|
a8924ac4fe | ||
|
|
7fb27c0c29 | ||
|
|
3d9a3194b2 | ||
|
|
e7e0ac006f | ||
|
|
cf35a270bb | ||
|
|
3e7ef49bde | ||
|
|
100d31791a | ||
|
|
15905c063a | ||
|
|
4c46f6a762 | ||
|
|
f4327c8c81 | ||
|
|
4a4b0e209c | ||
|
|
60e06737d7 | ||
|
|
d326154241 | ||
|
|
4766ae146f | ||
|
|
21a4ba7478 | ||
|
|
dfdeab70f1 | ||
|
|
c8fa767576 | ||
|
|
9c57ed6439 | ||
|
|
585826b438 | ||
|
|
cf22949f3b | ||
|
|
a00f8945ba | ||
|
|
2bc02bdaac | ||
|
|
b97327d6d7 | ||
|
|
61d1507a4d | ||
|
|
a6f07051c3 | ||
|
|
75417d15b7 | ||
|
|
4bab7ecfab | ||
|
|
7298e2441b | ||
|
|
1ed104d2f6 | ||
|
|
cf6125b9cc | ||
|
|
f2cfe33cdd | ||
|
|
a1e4125ded | ||
|
|
7a1433a994 | ||
|
|
460238a6b0 | ||
|
|
2a197487d5 | ||
|
|
51ce2befd8 | ||
|
|
e909dd15b0 | ||
|
|
aaf712be3c | ||
|
|
725e6b25dc | ||
|
|
ea322c0d3b | ||
|
|
f7730735c0 | ||
|
|
752b88f62d | ||
|
|
6131e1881b | ||
|
|
980da4ea0f | ||
|
|
b698ae2f50 | ||
|
|
50632f6527 | ||
|
|
6d4755d8c9 | ||
|
|
75b85c26dc | ||
|
|
1c8bbfbbdf | ||
|
|
c5a70f101a | ||
|
|
956c87a657 | ||
|
|
778b0eadcd | ||
|
|
b8e6f9d1be | ||
|
|
0e024a8c43 | ||
|
|
65b0bd01c8 | ||
|
|
3745dfc931 | ||
|
|
0186ae5ff2 | ||
|
|
f1eacac4fd | ||
|
|
4abe0064e6 | ||
|
|
cbc3adbec0 | ||
|
|
0902f80b46 | ||
|
|
47101d058b | ||
|
|
bc978ecbde | ||
|
|
a2cb5165d3 | ||
|
|
e582fa8b22 | ||
|
|
8ec8838634 | ||
|
|
8f259ffed9 | ||
|
|
74c2cf824b | ||
|
|
9ea3b04e82 | ||
|
|
99cb8c77b7 | ||
|
|
7056280c57 | ||
|
|
c14421c9ca | ||
|
|
97eff64b5b | ||
|
|
e522258693 | ||
|
|
b84c68fe11 | ||
|
|
8505feaa66 | ||
|
|
41f49c20ff | ||
|
|
1912ae36e6 | ||
|
|
08efc81cf0 | ||
|
|
a3b09c69cc | ||
|
|
5cf105c3a5 | ||
|
|
7408781d13 | ||
|
|
0afc8ea2c3 | ||
|
|
67b073776c | ||
|
|
8b48cf7f70 | ||
|
|
63287dd9c4 | ||
|
|
fc7ac921e2 | ||
|
|
57e3193a2a | ||
|
|
388f547878 | ||
|
|
f2e483540b | ||
|
|
7d31c371e0 | ||
|
|
bc750733d5 | ||
|
|
a66e22d9ed | ||
|
|
cc5974d07d | ||
|
|
085437e925 | ||
|
|
fa17a48483 | ||
|
|
78c1484570 | ||
|
|
9c2ea79bec | ||
|
|
b7ffe3fd1f | ||
|
|
dac14ae16e | ||
|
|
4872ff58bb | ||
|
|
755246cb6a | ||
|
|
9806422279 | ||
|
|
d5aea9f7d6 | ||
|
|
b852471596 | ||
|
|
fdf36ad726 | ||
|
|
c49e6ba0a2 | ||
|
|
0569c69634 | ||
|
|
1b734073b0 | ||
|
|
47d068e6d3 | ||
|
|
74a34362c3 | ||
|
|
0e33380df5 | ||
|
|
3db9c70e1b | ||
|
|
b2f3ffcc00 | ||
|
|
aa9ec6e50e | ||
|
|
dcb3d91610 | ||
|
|
9e71a98eda | ||
|
|
f2ef783b13 | ||
|
|
874e104570 | ||
|
|
1398086c38 | ||
|
|
db1586e2ec | ||
|
|
1158931d91 | ||
|
|
ee1b03b060 | ||
|
|
b99378ea38 | ||
|
|
c9692d502c | ||
|
|
3f6e659c6a | ||
|
|
4537bfb247 | ||
|
|
37556c9e02 | ||
|
|
34cd9d7cc1 | ||
|
|
030ac531a6 | ||
|
|
e19bd39fea | ||
|
|
0fe432dd8e | ||
|
|
c5b24ab136 | ||
|
|
fb06cc1e1a | ||
|
|
71e4ea166c | ||
|
|
fdf8834163 | ||
|
|
1fd70c9a99 | ||
|
|
7c3826f4a4 | ||
|
|
7fb3d05b2c | ||
|
|
f831b4d61d | ||
|
|
56b5c1b138 | ||
|
|
1cca826e8a | ||
|
|
41aa129b97 | ||
|
|
09ba11affb | ||
|
|
c9b47c392e | ||
|
|
4a9b171bb4 | ||
|
|
1b6d0e35ea | ||
|
|
6d638f3721 | ||
|
|
125556b73b | ||
|
|
db3728bc00 | ||
|
|
f002c8021c | ||
|
|
e47bd8ae3c | ||
|
|
0b3aefaefe | ||
|
|
f281d5eeb7 | ||
|
|
89ad11ebb6 | ||
|
|
2e50ee37a9 | ||
|
|
a4204347c1 | ||
|
|
afe81c4306 | ||
|
|
f0e431dd63 | ||
|
|
09f1574264 | ||
|
|
b7f64e46c2 | ||
|
|
a329445701 | ||
|
|
7527f9f099 | ||
|
|
9daa10e939 | ||
|
|
a59e338438 | ||
|
|
2767ac524f | ||
|
|
a714482cfb | ||
|
|
0138ab3934 | ||
|
|
a294671cf1 | ||
|
|
a8825c1f22 | ||
|
|
9abf696725 | ||
|
|
a1f34a7df9 | ||
|
|
c83e8eb787 | ||
|
|
4ec9f9b6cd | ||
|
|
0a1f200c69 | ||
|
|
67e9cba399 | ||
|
|
8065b30ba0 | ||
|
|
6af1ba6284 | ||
|
|
a0d817803e | ||
|
|
669c7b188b | ||
|
|
1c2343f740 | ||
|
|
280284e4c2 | ||
|
|
85ac553ded | ||
|
|
5bda711500 | ||
|
|
399835e7d1 | ||
|
|
75bb66776c | ||
|
|
7f952804d0 | ||
|
|
289645caa0 | ||
|
|
b280c0abd8 | ||
|
|
2d597ed690 | ||
|
|
b3296842b7 | ||
|
|
d73cefc280 | ||
|
|
6f4aebfc4c | ||
|
|
cac3ffc7d7 | ||
|
|
893fa5bfd6 | ||
|
|
40102a661d | ||
|
|
d7305c434e | ||
|
|
0bed76da11 | ||
|
|
117cd93e8f | ||
|
|
0bd62b0d5f | ||
|
|
8df4ade754 | ||
|
|
ea055afd3c | ||
|
|
9e92b1844a | ||
|
|
297b3a61a0 | ||
|
|
4b7b2291aa | ||
|
|
65d66c6073 | ||
|
|
7df46be6eb | ||
|
|
5ce9229e7d | ||
|
|
e6c9112575 | ||
|
|
f0a987ba3a | ||
|
|
42b2d36319 | ||
|
|
5d5ffe8866 | ||
|
|
8cd45e3f3f | ||
|
|
baf513bd56 | ||
|
|
5333da35cb | ||
|
|
fe85f138df | ||
|
|
684149eb50 | ||
|
|
8018f2c570 | ||
|
|
2fdbe6ba8c | ||
|
|
018c76ba41 | ||
|
|
48f40b4304 | ||
|
|
528ad1199a | ||
|
|
4c0d35c723 | ||
|
|
1540af266b | ||
|
|
8fb8b34239 | ||
|
|
4b7c2fe84f | ||
|
|
61a76dc0c9 | ||
|
|
e4de37708b | ||
|
|
ea40d25125 | ||
|
|
eacb24a482 | ||
|
|
65a32a977f | ||
|
|
40d09bc82e | ||
|
|
fa437644f5 | ||
|
|
762f6043c5 | ||
|
|
ab1109df90 | ||
|
|
c40da1a71a | ||
|
|
05490c1785 | ||
|
|
103f76e190 | ||
|
|
01bf2ae63b | ||
|
|
03b987c78e | ||
|
|
960addc8f2 | ||
|
|
5b09e95e51 | ||
|
|
2bbb66f844 | ||
|
|
4777f86f7e | ||
|
|
f95b3bcd4b | ||
|
|
6de0d81ea3 | ||
|
|
31fee5645d | ||
|
|
651bb747f1 | ||
|
|
52d787c903 | ||
|
|
0b4253090d | ||
|
|
50a1fcfc20 | ||
|
|
e2aa21fbea | ||
|
|
62aeb6dc7b | ||
|
|
a7d500422d | ||
|
|
76e95b8c55 | ||
|
|
9970986a52 | ||
|
|
abfc60511d | ||
|
|
663d0c05c7 | ||
|
|
76c39ef08a | ||
|
|
bcd45e87c8 | ||
|
|
5c54434300 | ||
|
|
feb20fad83 | ||
|
|
bb52b87d2f | ||
|
|
40b6980cdc | ||
|
|
bbeb399004 | ||
|
|
bdf99ba9f1 | ||
|
|
9161aff942 | ||
|
|
298a758166 | ||
|
|
000ebef28b | ||
|
|
54efec60b8 | ||
|
|
7f5f15a41d | ||
|
|
2766450696 | ||
|
|
24c6a3a637 | ||
|
|
d3b8baa5e7 | ||
|
|
fd57d40ca9 | ||
|
|
feae9b59f5 | ||
|
|
24ce235ed4 | ||
|
|
31a02082de | ||
|
|
f4ebca927b | ||
|
|
84daa9b151 | ||
|
|
213a6680dc | ||
|
|
978b59c0dc | ||
|
|
4063b8454b | ||
|
|
29e0269588 | ||
|
|
1731cc1202 | ||
|
|
09e5c16570 | ||
|
|
3709bcc5e4 | ||
|
|
b9b686b9cf | ||
|
|
b0ac50941f | ||
|
|
b8a58b270c | ||
|
|
a20cc5bd26 | ||
|
|
d31e1b00e8 | ||
|
|
1f11e25593 | ||
|
|
6af40cd92d | ||
|
|
84b1732683 | ||
|
|
17e0265ed0 | ||
|
|
da03db051d | ||
|
|
357b25905b | ||
|
|
e62cefa9e5 | ||
|
|
fd835deb8d | ||
|
|
063b55ae0d | ||
|
|
79efecb5a9 | ||
|
|
4fb6d8cafd | ||
|
|
3a5ccb7f8d | ||
|
|
e7c1345dcb | ||
|
|
e4b37b9f9a | ||
|
|
f06736315d | ||
|
|
3c438914c2 | ||
|
|
d8a1a3c838 | ||
|
|
6b0baa8365 | ||
|
|
c93a4e843f | ||
|
|
3daafa0b0e | ||
|
|
9ce92e39d5 | ||
|
|
4edd05f4df | ||
|
|
3af2811951 | ||
|
|
cfa89e3003 | ||
|
|
b87a633496 | ||
|
|
880242ed93 | ||
|
|
3d33c75a05 | ||
|
|
65d38d5efc | ||
|
|
db75b18da4 | ||
|
|
7b8b829c21 | ||
|
|
4eee09c390 | ||
|
|
64054f16c5 | ||
|
|
ae66327e98 | ||
|
|
d00e3d3129 | ||
|
|
df609e28ca | ||
|
|
21c582d309 | ||
|
|
3488bce63d | ||
|
|
5d347adbcf | ||
|
|
36ce06c3ca | ||
|
|
3071297bd5 | ||
|
|
0707bcab68 | ||
|
|
fe7196f2aa | ||
|
|
220252da74 | ||
|
|
65ebe4dfa6 | ||
|
|
580565de23 | ||
|
|
9e8af298d4 | ||
|
|
1ca64d6626 | ||
|
|
1b38f23268 | ||
|
|
1b2ed00cbb | ||
|
|
14a3c28044 | ||
|
|
5767d9a275 | ||
|
|
da802d5e70 | ||
|
|
50b6f5244d | ||
|
|
7f860e46f3 | ||
|
|
5a354d58fa | ||
|
|
f186c4572b | ||
|
|
fb592bf103 | ||
|
|
195c922f4e | ||
|
|
464eca3588 | ||
|
|
0fbef677ca | ||
|
|
99bdb1fec1 | ||
|
|
f6d777a668 | ||
|
|
1515e9d9d5 | ||
|
|
d164b567bf | ||
|
|
38baa371ca | ||
|
|
6c62d032fe | ||
|
|
10541ddcc7 | ||
|
|
f73a02b9a9 | ||
|
|
d755803e90 | ||
|
|
23d8a014ce | ||
|
|
09c5cdae11 | ||
|
|
1b88682fcb | ||
|
|
9cc703d424 | ||
|
|
8fd3cab450 | ||
|
|
b2a4fb115c | ||
|
|
ace647d6c4 | ||
|
|
5048fb5b48 | ||
|
|
4c55f4a22b | ||
|
|
96bc62b2a9 | ||
|
|
c5fc6fa9dc | ||
|
|
ed2b320271 | ||
|
|
1dd4ad9cc1 | ||
|
|
265fac3ca1 | ||
|
|
09437d3e91 | ||
|
|
1f2be3b484 | ||
|
|
87ce77cf25 | ||
|
|
dc5bac99b0 | ||
|
|
6fab3e789d | ||
|
|
b02fa68683 | ||
|
|
a07ba59b0f | ||
|
|
8f978dd187 | ||
|
|
a72ed9ca16 | ||
|
|
4b750825e9 | ||
|
|
7f04a27f41 | ||
|
|
6b3f973a61 | ||
|
|
e3ccf916bf | ||
|
|
de1302c6af | ||
|
|
8055816683 | ||
|
|
7e2b390963 | ||
|
|
fbf4016965 | ||
|
|
2b802c710f | ||
|
|
f7162cbc79 | ||
|
|
347419ee53 | ||
|
|
e4c8815ba7 | ||
|
|
09095f48a7 | ||
|
|
e573f446a5 | ||
|
|
b936730e51 | ||
|
|
6e1c7a09cc | ||
|
|
74060cbf27 | ||
|
|
4cba2cb8c1 | ||
|
|
67ae206b0e | ||
|
|
dfc6694dce | ||
|
|
82170b8d50 | ||
|
|
523aa0a6d3 | ||
|
|
de2a38b5a2 | ||
|
|
212f1de3ae | ||
|
|
6f7f2f75b0 | ||
|
|
7a5612ec2b | ||
|
|
f8a16ce6c0 | ||
|
|
a14d494bba | ||
|
|
e240183fa0 | ||
|
|
d4b6dbfba3 | ||
|
|
0986665d53 | ||
|
|
e6f4c5e41f | ||
|
|
0e9c8ebf61 | ||
|
|
cab1f16734 | ||
|
|
4c56797d14 | ||
|
|
247da4010a | ||
|
|
6f078b6865 | ||
|
|
bfe986e62a | ||
|
|
e3bc589d4b | ||
|
|
b6d1ecf0e5 | ||
|
|
6151fcfda0 | ||
|
|
0c210d088f | ||
|
|
36132012db | ||
|
|
3c96621af4 | ||
|
|
da0b052cc2 | ||
|
|
7fae0f3fe9 | ||
|
|
6970500f85 | ||
|
|
1286a9e237 | ||
|
|
bf085706b0 | ||
|
|
cb1d1cdc5e | ||
|
|
90c6aebac6 | ||
|
|
84ed82d896 | ||
|
|
da6c2a88b1 | ||
|
|
f87f3c2736 | ||
|
|
c41ca40337 | ||
|
|
f9f27045ee | ||
|
|
3496c3a2e8 | ||
|
|
23d7af5a30 | ||
|
|
01a51c58d8 | ||
|
|
be777dc848 | ||
|
|
55f866e5c5 | ||
|
|
94f915d36a | ||
|
|
23aebace18 | ||
|
|
fb2ce8708f | ||
|
|
ac5fb5e763 | ||
|
|
c93fb71709 | ||
|
|
2df9cf2f5f | ||
|
|
7153bd8a57 | ||
|
|
337a8ca820 | ||
|
|
f47c97eb17 | ||
|
|
8dd87eda01 | ||
|
|
cae4e23872 | ||
|
|
8b9251bb3a | ||
|
|
96e25d2ff7 | ||
|
|
7d4e95a742 | ||
|
|
ac35981e0e | ||
|
|
d04cecc733 | ||
|
|
c2876f28a8 | ||
|
|
05f33ded14 | ||
|
|
02c85139b4 | ||
|
|
8ed1945667 | ||
|
|
85c54d46b0 | ||
|
|
31e3788ead | ||
|
|
cd460dd352 | ||
|
|
8667351378 | ||
|
|
e2f5593d91 | ||
|
|
27d255bc40 | ||
|
|
753ae2de39 | ||
| 9c10e4401f | |||
| b57bdaacc6 | |||
| 851b35ea4f | |||
|
|
5c981172de | ||
| 0635341f43 | |||
|
|
65a5cad9cf | ||
|
|
5aa4c0ea67 | ||
|
|
839adb9751 | ||
|
|
f8ab590356 | ||
|
|
282470ad96 | ||
|
|
4488ef397b | ||
|
|
69dd9f124d | ||
|
|
2d3eec300f | ||
|
|
3de37e8e4e | ||
|
|
8e6cd15101 | ||
|
|
2f186e5db9 | ||
|
|
b52c3a5597 | ||
|
|
e29de024d2 | ||
|
|
5f9c65156d | ||
|
|
19b29b4aad | ||
|
|
02b2f14e6d | ||
|
|
8a3df3a2a6 | ||
|
|
5e33b0d84a | ||
|
|
5a47243022 | ||
|
|
d67f765d31 | ||
|
|
294e25bf12 | ||
|
|
0f99625334 | ||
|
|
918546a090 | ||
|
|
1c8e652797 |
15
.github/FUNDING.yml
vendored
Normal file
15
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
# noinspection YAMLSchemaValidation
|
||||
buy_me_a_coffee: crazywhalecc
|
||||
custom: 'https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md' # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
12
.github/pull_request_template.md
vendored
Normal file
12
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
## What does this PR do?
|
||||
|
||||
|
||||
|
||||
## Checklist before merging
|
||||
|
||||
> 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 it's a extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`.
|
||||
- [ ] If you changed the behavior of static-php-cli, add docs in [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs) .
|
||||
- [ ] If you updated `config/xxxx.json` content, run `bin/spc dev:sort-config xxx`.
|
||||
123
.github/workflows/build-linux-arm.yml
vendored
Normal file
123
.github/workflows/build-linux-arm.yml
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
name: CI on arm linux
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
operating-system:
|
||||
required: true
|
||||
description: Compile target arch (Linux only)
|
||||
type: choice
|
||||
options:
|
||||
- aarch64
|
||||
version:
|
||||
required: true
|
||||
description: php version to compile
|
||||
default: '8.2'
|
||||
type: choice
|
||||
options:
|
||||
- '8.3'
|
||||
- '8.2'
|
||||
- '8.1'
|
||||
- '8.0'
|
||||
- '7.4'
|
||||
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
|
||||
extensions:
|
||||
description: extensions to compile (comma separated)
|
||||
required: true
|
||||
type: string
|
||||
debug:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build ${{ inputs.version }} on ${{ inputs.operating-system }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: composer-dependencies
|
||||
|
||||
# If there's no Composer cache, install dependencies
|
||||
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
||||
run: composer update --no-dev --classmap-authoritative
|
||||
|
||||
- name: Generate hashed key for download cache
|
||||
run: |
|
||||
INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
|
||||
echo "INPUT_HASH=${INPUT_HASH}" >> $GITHUB_ENV
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ env.INPUT_HASH }}
|
||||
|
||||
# With or without debug
|
||||
- if: inputs.debug == true
|
||||
run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
|
||||
|
||||
# With target select: cli, micro or both
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV
|
||||
|
||||
# If there's no dependencies cache, fetch sources, with or without debug
|
||||
- if: steps.cache-download.outputs.cache-hit != 'true'
|
||||
run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
|
||||
|
||||
# Run build command
|
||||
- run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
|
||||
|
||||
# Upload cli executable
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-${{ inputs.version }}-linux-${{ inputs.operating-system }}
|
||||
path: buildroot/bin/php
|
||||
|
||||
# Upload micro self-extracted executable
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: micro-${{ inputs.version }}-linux-${{ inputs.operating-system }}
|
||||
path: buildroot/bin/micro.sfx
|
||||
|
||||
# Upload fpm executable
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-fpm-${{ inputs.version }}-linux-${{ inputs.operating-system }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
118
.github/workflows/build-linux-x86_64.yml
vendored
Normal file
118
.github/workflows/build-linux-x86_64.yml
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
name: CI on x86_64 linux
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
description: php version to compile
|
||||
default: '8.2'
|
||||
type: choice
|
||||
options:
|
||||
- '8.3'
|
||||
- '8.2'
|
||||
- '8.1'
|
||||
- '8.0'
|
||||
- '7.4'
|
||||
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
|
||||
extensions:
|
||||
description: extensions to compile (comma separated)
|
||||
required: true
|
||||
type: string
|
||||
debug:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build ${{ inputs.version }} on Linux x86_64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: composer-dependencies
|
||||
|
||||
# If there's no Composer cache, install dependencies
|
||||
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
||||
run: composer update --no-dev --classmap-authoritative
|
||||
|
||||
- name: Generate hashed key for download cache
|
||||
run: |
|
||||
INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
|
||||
echo "INPUT_HASH=${INPUT_HASH}" >> $GITHUB_ENV
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ env.INPUT_HASH }}
|
||||
|
||||
# With or without debug
|
||||
- if: inputs.debug == true
|
||||
run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
|
||||
|
||||
# With target select: cli, micro or both
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV
|
||||
|
||||
# If there's no dependencies cache, fetch sources, with or without debug
|
||||
- if: steps.cache-download.outputs.cache-hit != 'true'
|
||||
run: CACHE_API_EXEC=yes ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
|
||||
|
||||
# Run build command
|
||||
- run: ./bin/spc-alpine-docker build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
|
||||
|
||||
# Upload cli executable
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php
|
||||
|
||||
# Upload micro self-extracted executable
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/micro.sfx
|
||||
|
||||
# Upload fpm executable
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
|
||||
132
.github/workflows/build-macos-aarch64.yml
vendored
Normal file
132
.github/workflows/build-macos-aarch64.yml
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
name: CI on arm64 macOS
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
description: php version to compile
|
||||
default: '8.2'
|
||||
type: choice
|
||||
options:
|
||||
- '8.3'
|
||||
- '8.2'
|
||||
- '8.1'
|
||||
- '8.0'
|
||||
- '7.4'
|
||||
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
|
||||
extensions:
|
||||
description: extensions to compile (comma separated)
|
||||
required: true
|
||||
type: string
|
||||
debug:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build ${{ inputs.version }} on macOS arm64
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Install macOS missing packages and mark os suffix
|
||||
- run: |
|
||||
brew install automake gzip
|
||||
echo "SPC_BUILD_OS=macos" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.1
|
||||
tools: pecl, composer
|
||||
extensions: curl, openssl, mbstring, tokenizer
|
||||
ini-values: memory_limit=-1
|
||||
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: composer-dependencies
|
||||
|
||||
# If there's no Composer cache, install dependencies
|
||||
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
||||
run: composer update --no-dev --classmap-authoritative
|
||||
|
||||
- name: Generate hashed key for download cache
|
||||
run: |
|
||||
INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
|
||||
echo "INPUT_HASH=${INPUT_HASH}" >> $GITHUB_ENV
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ env.INPUT_HASH }}
|
||||
|
||||
# With or without debug
|
||||
- if: inputs.debug == true
|
||||
run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
|
||||
|
||||
# With target select: cli, micro or both
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV
|
||||
|
||||
# If there's no dependencies cache, fetch sources, with or without debug
|
||||
- if: steps.cache-download.outputs.cache-hit != 'true'
|
||||
run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
|
||||
|
||||
# Run build command
|
||||
- run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
|
||||
|
||||
# Upload cli executable
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php
|
||||
|
||||
# Upload micro self-extracted executable
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/micro.sfx
|
||||
|
||||
# Upload fpm executable
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
131
.github/workflows/build-macos-x86_64.yml
vendored
Normal file
131
.github/workflows/build-macos-x86_64.yml
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
name: CI on x86_64 macOS
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
description: php version to compile
|
||||
default: '8.2'
|
||||
type: choice
|
||||
options:
|
||||
- '8.3'
|
||||
- '8.2'
|
||||
- '8.1'
|
||||
- '8.0'
|
||||
- '7.4'
|
||||
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
|
||||
extensions:
|
||||
description: extensions to compile (comma separated)
|
||||
required: true
|
||||
type: string
|
||||
debug:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build ${{ inputs.version }} on macOS x86_64
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Install macOS missing packages and mark os suffix
|
||||
- run: |
|
||||
brew install automake gzip
|
||||
echo "SPC_BUILD_OS=macos" >> $GITHUB_ENV
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.1
|
||||
tools: pecl, composer
|
||||
extensions: curl, openssl, mbstring, tokenizer
|
||||
ini-values: memory_limit=-1
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: composer-dependencies
|
||||
|
||||
# If there's no Composer cache, install dependencies
|
||||
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
||||
run: composer update --no-dev --classmap-authoritative
|
||||
|
||||
- name: Generate hashed key for download cache
|
||||
run: |
|
||||
INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
|
||||
echo "INPUT_HASH=${INPUT_HASH}" >> $GITHUB_ENV
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ env.INPUT_HASH }}
|
||||
|
||||
# With or without debug
|
||||
- if: inputs.debug == true
|
||||
run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
|
||||
|
||||
# With target select: cli, micro or both
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV
|
||||
|
||||
# If there's no dependencies cache, fetch sources, with or without debug
|
||||
- if: steps.cache-download.outputs.cache-hit != 'true'
|
||||
run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
|
||||
|
||||
# Run build command
|
||||
- run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
|
||||
|
||||
# Upload cli executable
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php
|
||||
|
||||
# Upload micro self-extracted executable
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/micro.sfx
|
||||
|
||||
# Upload fpm executable
|
||||
- if: ${{ inputs.build-fpm == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
|
||||
108
.github/workflows/build-windows-x86_64.yml
vendored
Normal file
108
.github/workflows/build-windows-x86_64.yml
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
name: CI on x86_64 Windows
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
description: php version to compile
|
||||
default: '8.2'
|
||||
type: choice
|
||||
options:
|
||||
- '8.3'
|
||||
- '8.2'
|
||||
- '8.1'
|
||||
- '8.0'
|
||||
- '7.4'
|
||||
build-cli:
|
||||
description: build cli binary
|
||||
default: true
|
||||
type: boolean
|
||||
build-micro:
|
||||
description: build phpmicro binary
|
||||
type: boolean
|
||||
extensions:
|
||||
description: extensions to compile (comma separated)
|
||||
required: true
|
||||
type: string
|
||||
debug:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build ${{ inputs.version }} on Windows x86_64
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: composer-dependencies
|
||||
|
||||
# If there's no Composer cache, install dependencies
|
||||
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
||||
run: composer update --no-dev --classmap-authoritative
|
||||
|
||||
- name: Generate hashed key for download cache
|
||||
shell: bash
|
||||
run: |
|
||||
INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
|
||||
echo "INPUT_HASH=${INPUT_HASH}" >> "$GITHUB_ENV"
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ env.INPUT_HASH }}
|
||||
|
||||
# With or without debug
|
||||
- if: inputs.debug == true
|
||||
run: echo "SPC_BUILD_DEBUG=--debug" >> $env:GITHUB_ENV
|
||||
|
||||
# With target select: cli, micro or both
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
run: echo "SPC_BUILD_CLI=--build-cli" >> $env:GITHUB_ENV
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
run: echo "SPC_BUILD_MICRO=--build-micro" >> $env:GITHUB_ENV
|
||||
|
||||
- run: ./bin/spc doctor
|
||||
|
||||
# If there's no dependencies cache, fetch sources, with or without debug
|
||||
- if: steps.cache-download.outputs.cache-hit != 'true'
|
||||
run: ./bin/spc download --with-php="${{ inputs.version }}" --for-extensions="${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }}
|
||||
|
||||
# Run build command
|
||||
- run: ./bin/spc build "${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
|
||||
|
||||
# Upload cli executable
|
||||
- if: ${{ inputs.build-cli == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-${{ inputs.version }}
|
||||
path: buildroot/bin/php.exe
|
||||
|
||||
# Upload micro self-extracted executable
|
||||
- if: ${{ inputs.build-micro == true }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: micro-${{ inputs.version }}
|
||||
path: buildroot/bin/micro.sfx
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
128
.github/workflows/release-build.yml
vendored
Normal file
128
.github/workflows/release-build.yml
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
name: Build SPC Binary
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-release-artifacts:
|
||||
name: "Build SPC Binary"
|
||||
runs-on: macos-14
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "8.2"
|
||||
micro-version:
|
||||
- "8.2.18"
|
||||
operating-system:
|
||||
- "linux-x86_64"
|
||||
- "macos-x86_64"
|
||||
- "linux-aarch64"
|
||||
- "macos-aarch64"
|
||||
- "windows-x64"
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v4"
|
||||
|
||||
- if: inputs.debug == true
|
||||
run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
|
||||
|
||||
- name: "Install PHP for official runners"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
ini-values: memory_limit=-1
|
||||
|
||||
- name: "Get Composer Cache Directory"
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: "Cache Composer dependencies"
|
||||
uses: "actions/cache@v4"
|
||||
with:
|
||||
path: "${{ steps.composer-cache.outputs.dir }}"
|
||||
key: "php-${{ matrix.php-version }}-locked-composer-${{ hashFiles('**/composer.lock') }}"
|
||||
restore-keys: |
|
||||
php-${{ matrix.php-version }}-locked-composer
|
||||
|
||||
- name: "Install Locked Dependencies"
|
||||
run: "composer install --no-interaction --no-progress"
|
||||
|
||||
- name: "Build PHAR File"
|
||||
run: "composer build:phar"
|
||||
|
||||
- name: "Download minimal combination"
|
||||
run: |
|
||||
if [ "${{ matrix.operating-system }}" = "windows-x64" ]; then
|
||||
curl https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ matrix.micro-version }}-micro-win.zip -o tmp.zip
|
||||
unzip tmp.zip
|
||||
else
|
||||
curl https://dl.static-php.dev/static-php-cli/minimal/php-${{ matrix.micro-version }}-micro-${{ matrix.operating-system }}.tar.gz -o tmp.tgz
|
||||
tar -zxvf tmp.tgz
|
||||
fi
|
||||
|
||||
- name: "Generate Executable"
|
||||
run: |
|
||||
bin/spc micro:combine spc.phar -M micro.sfx -O spc -I "memory_limit=2G"
|
||||
if [ "${{ matrix.operating-system }}" = "windows-x64" ]; then
|
||||
mv spc spc.exe
|
||||
else
|
||||
chmod +x spc
|
||||
fi
|
||||
if [ "${{ matrix.operating-system }}" = "macos-aarch64" ] || [ "${{ matrix.operating-system }}" = "macos-x86_64" ]; then
|
||||
sudo xattr -cr ./spc
|
||||
fi
|
||||
|
||||
- name: "Archive Executable"
|
||||
run: |
|
||||
if [ "${{ matrix.operating-system }}" != "windows-x64" ]; then
|
||||
tar -czf spc-${{ matrix.operating-system }}.tar.gz spc
|
||||
echo "filename=spc-${{ matrix.operating-system }}.tar.gz" >> $GITHUB_ENV
|
||||
echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV
|
||||
if [ "${{ matrix.operating-system }}" == "macos-aarch64" ]; then
|
||||
./spc dev:extensions
|
||||
fi
|
||||
else
|
||||
echo "filename=spc-${{ matrix.operating-system }}.exe" >> $GITHUB_ENV
|
||||
echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: "Copy file"
|
||||
run: |
|
||||
if [ "${{ matrix.operating-system }}" != "windows-x64" ]; then
|
||||
mkdir dist/ && cp ${{ env.filename }} dist/ && cp spc dist/spc-$OS
|
||||
else
|
||||
mkdir dist/ && cp spc.exe dist/${{ env.filename }}
|
||||
echo "SUFFIX=.exe" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: upload binaries to release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: ${{startsWith(github.ref, 'refs/tags/') }}
|
||||
with:
|
||||
files: dist/${{ env.filename }}
|
||||
|
||||
- name: "Deploy to Self-Hosted Server"
|
||||
if: github.repository == 'crazywhalecc/static-php-cli'
|
||||
uses: easingthemes/ssh-deploy@main
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
|
||||
ARGS: "-rltgoDzvO"
|
||||
SOURCE: "dist/"
|
||||
REMOTE_HOST: ${{ secrets.DEPLOY_SERVER_HOST }}
|
||||
REMOTE_PORT: ${{ secrets.DEPLOY_SERVER_PORT }}
|
||||
REMOTE_USER: ${{ secrets.DEPLOY_SERVER_USER }}
|
||||
TARGET: ${{ secrets.DEPLOY_SERVER_TARGET_SPC_NIGHTLY }}
|
||||
|
||||
- name: "Upload Artifact"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: spc${{ env.SUFFIX }}
|
||||
name: spc-${{ matrix.operating-system }}${{ env.SUFFIX }}
|
||||
189
.github/workflows/tests.yml
vendored
Normal file
189
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'src/globals/test-extensions.php'
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
php-cs-fixer:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
extensions: curl, openssl, mbstring
|
||||
ini-values: memory_limit=-1
|
||||
tools: pecl, composer, php-cs-fixer
|
||||
|
||||
- name: Run PHP-CS-Fixer fix
|
||||
run: php-cs-fixer fix --dry-run --diff --ansi
|
||||
|
||||
phpstan:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
extensions: curl, openssl, mbstring
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer
|
||||
|
||||
- name: "Cache Composer packages"
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-phpstan-
|
||||
|
||||
- name: "Install Dependencies"
|
||||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||
|
||||
- name: "Run phpstan"
|
||||
run: vendor/bin/phpstan analyse
|
||||
|
||||
phpunit:
|
||||
name: "PHPUnit (PHP ${{ matrix.php }})"
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- php: '8.1'
|
||||
- php: '8.2'
|
||||
- php: '8.3'
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "${{ matrix.php }}"
|
||||
tools: pecl, composer
|
||||
extensions: curl, openssl, mbstring
|
||||
ini-values: memory_limit=-1
|
||||
|
||||
- name: "Cache Composer packages"
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: "Install Dependencies"
|
||||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||
|
||||
- name: "Run PHPUnit Tests"
|
||||
run: |
|
||||
vendor/bin/phpunit tests/ --no-coverage
|
||||
|
||||
build:
|
||||
name: "Build PHP Test (PHP ${{ matrix.php }} ${{ matrix.os }})"
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 120
|
||||
strategy:
|
||||
matrix:
|
||||
php:
|
||||
- "8.0"
|
||||
- "8.1"
|
||||
- "8.2"
|
||||
- "8.3"
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-13
|
||||
- windows-latest
|
||||
- macos-14
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.2
|
||||
tools: pecl, composer
|
||||
extensions: curl, openssl, mbstring
|
||||
ini-values: memory_limit=-1
|
||||
|
||||
- name: "Use test token if exists"
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: |
|
||||
if [ "${{ secrets.TEST_GH_TOKEN }}" != "" ]; then
|
||||
echo "GITHUB_TOKEN=${{ secrets.TEST_GH_TOKEN }}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: "Cache composer packages"
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ matrix.php }}-dependencies
|
||||
|
||||
- name: "Install Dependencies"
|
||||
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||
|
||||
- name: "Run Build Tests (doctor)"
|
||||
run: bin/spc doctor --auto-fix
|
||||
|
||||
- name: "Prepare UPX for Windows"
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
bin/spc install-pkg upx
|
||||
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $env:GITHUB_ENV
|
||||
|
||||
- name: "Prepare UPX for Linux"
|
||||
if: matrix.os == 'ubunut-latest'
|
||||
run: |
|
||||
bin/spc install-pkg upx
|
||||
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- name: "Run Build Tests (download)"
|
||||
uses: nick-fields/retry@v3
|
||||
with:
|
||||
timeout_minutes: 10
|
||||
max_attempts: 3
|
||||
retry_on: error
|
||||
command: |
|
||||
bin/spc download --for-extensions="$(php src/globals/test-extensions.php extensions)" --for-libs="$(php src/globals/test-extensions.php libs)" --with-php=${{ matrix.php }} --ignore-cache-sources=php-src,libcares --debug --retry=3
|
||||
|
||||
- name: "Run Build Tests (build, *nix)"
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" $(php src/globals/test-extensions.php zts) $(php src/globals/test-extensions.php no_strip) $UPX_CMD --with-libs="$(php src/globals/test-extensions.php libs)" --build-cli --build-micro --build-fpm --debug
|
||||
|
||||
- name: "Run Build Tests (build, windows)"
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" $(php src/globals/test-extensions.php zts) $(php src/globals/test-extensions.php no_strip) $env:UPX_CMD --with-libs="$(php src/globals/test-extensions.php libs)" --build-cli --build-micro --build-fpm --debug
|
||||
68
.github/workflows/update-docs-config.yml
vendored
Normal file
68
.github/workflows/update-docs-config.yml
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
name: Update Docs Config
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'config/**.json'
|
||||
|
||||
jobs:
|
||||
update-docs-config:
|
||||
name: "Update Docs Config"
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'crazywhalecc/static-php-cli'
|
||||
steps:
|
||||
- name: "Checkout static-php-cli"
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Checkout static-php-cli-docs"
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: static-php/static-php-cli-docs
|
||||
ref: master
|
||||
token: ${{ secrets.DOCS_REPO_TOKEN }}
|
||||
path: static-php-cli-docs
|
||||
|
||||
- name: "Set up Git"
|
||||
run: |
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
|
||||
- name: "Copy Config Files"
|
||||
run: cp -r config/* static-php-cli-docs/docs/.vitepress/config/
|
||||
|
||||
- name: "Install PHP for official runners"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
php-version: 8.2
|
||||
ini-values: memory_limit=-1
|
||||
|
||||
- name: "Get Composer Cache Directory"
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: "Cache Composer dependencies"
|
||||
uses: "actions/cache@v4"
|
||||
with:
|
||||
path: "${{ steps.composer-cache.outputs.dir }}"
|
||||
key: "php-8.2-locked-composer-${{ hashFiles('**/composer.lock') }}"
|
||||
restore-keys: |
|
||||
php-8.2-locked-composer
|
||||
|
||||
- name: "Install Locked Dependencies"
|
||||
run: "composer install --no-interaction --no-progress"
|
||||
|
||||
- name: "Generate Extension Support List"
|
||||
run: |
|
||||
bin/spc dev:gen-ext-docs > static-php-cli-docs/docs/extensions.md
|
||||
|
||||
- name: "Commit and Push Changes"
|
||||
run: |
|
||||
cd static-php-cli-docs
|
||||
git add -A
|
||||
git commit -m "Sync config files from main"
|
||||
git push origin master
|
||||
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
.idea
|
||||
runtime/
|
||||
docker/libraries/
|
||||
docker/extensions/
|
||||
docker/source/
|
||||
|
||||
# Vendor files
|
||||
/vendor/
|
||||
|
||||
# default source extract directory
|
||||
/source/
|
||||
|
||||
# default source download directory
|
||||
/downloads/
|
||||
|
||||
# default source build root directory
|
||||
/buildroot/
|
||||
|
||||
# default package root directory
|
||||
/pkgroot/
|
||||
|
||||
# tools cache files
|
||||
.php-cs-fixer.cache
|
||||
.phpunit.result.cache
|
||||
|
||||
# exclude self-runtime
|
||||
/bin/*
|
||||
!/bin/spc*
|
||||
!/bin/setup-runtime*
|
||||
!/bin/spc-alpine-docker
|
||||
|
||||
# exclude windows build tools
|
||||
/php-sdk-binary-tools/
|
||||
|
||||
# default test directory
|
||||
/tests/var/
|
||||
70
.php-cs-fixer.php
Normal file
70
.php-cs-fixer.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
return (new PhpCsFixer\Config())
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@PSR12' => true,
|
||||
'@Symfony' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'array_syntax' => [
|
||||
'syntax' => 'short',
|
||||
],
|
||||
'list_syntax' => [
|
||||
'syntax' => 'short',
|
||||
],
|
||||
'concat_space' => [
|
||||
'spacing' => 'one',
|
||||
],
|
||||
'blank_line_before_statement' => [
|
||||
'statements' => [
|
||||
'declare',
|
||||
],
|
||||
],
|
||||
'ordered_imports' => [
|
||||
'imports_order' => [
|
||||
'class',
|
||||
'function',
|
||||
'const',
|
||||
],
|
||||
'sort_algorithm' => 'alpha',
|
||||
],
|
||||
'single_line_comment_style' => [
|
||||
'comment_types' => [
|
||||
],
|
||||
],
|
||||
'yoda_style' => [
|
||||
'always_move_variable' => false,
|
||||
'equal' => false,
|
||||
'identical' => false,
|
||||
],
|
||||
'multiline_whitespace_before_semicolons' => [
|
||||
'strategy' => 'no_multi_line',
|
||||
],
|
||||
'constant_case' => [
|
||||
'case' => 'lower',
|
||||
],
|
||||
'class_attributes_separation' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'declare_strict_types' => true,
|
||||
'linebreak_after_opening_tag' => true,
|
||||
'lowercase_static_reference' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_unused_imports' => true,
|
||||
'not_operator_with_successor_space' => false,
|
||||
'not_operator_with_space' => false,
|
||||
'ordered_class_elements' => true,
|
||||
'php_unit_strict' => false,
|
||||
'phpdoc_separation' => false,
|
||||
'single_quote' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
'phpdoc_summary' => false,
|
||||
'php_unit_test_class_requires_covers' => false,
|
||||
'phpdoc_var_without_name' => false,
|
||||
'fully_qualified_strict_types' => false,
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests/SPC'])
|
||||
);
|
||||
695
LICENSE
695
LICENSE
@@ -1,674 +1,21 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022-2023 Jerry Ma
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
102
README-en.md
102
README-en.md
@@ -1,103 +1,3 @@
|
||||
# static-php-cli
|
||||
Compile A Statically Linked PHP With Swoole and other Extensions.
|
||||
|
||||
BTW, It's only for CLI mode.
|
||||
|
||||
[]()
|
||||
|
||||
## Requirements
|
||||
- Tested on `x86_64` and `aarch64` platform, others have not tested.
|
||||
- Docker required (or alpine linux when I write single script file)
|
||||
- Supporting PHP version from 7.2 to 8.0
|
||||
|
||||
## Start
|
||||
You can directly download static binary in Release.
|
||||
|
||||
Here's help command to compile it yourself:
|
||||
```bash
|
||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||
cd static-php-cli/docker
|
||||
docker build -t static-php .
|
||||
```
|
||||
|
||||
After compilation you can use command to get static php binary file:
|
||||
```bash
|
||||
mkdir dist
|
||||
docker run --rm -v $(pwd)/dist:/dist/ -it static-php cp php-dist/bin/php /dist/
|
||||
cd dist
|
||||
file ./php
|
||||
```
|
||||
|
||||
To customize PHP extensions, edit `docker/extensions.txt` file, and rules below:
|
||||
- Use `#` as comment, to mark not install
|
||||
- extensions name uses lower case, and default file contains all supported extensions, if u need other extensions, consider write an Issue
|
||||
|
||||
## Supported PHP extensions
|
||||
| Support | PHP Ext Name | Version | Comments |
|
||||
| ------- | ------------ | ------- | ---------------------------------------- |
|
||||
| yes | bcmath | * | |
|
||||
| yes | calendar | * | |
|
||||
| yes | ctype | * | |
|
||||
| yes | curl | * | |
|
||||
| yes | dom | * | |
|
||||
| | event | | |
|
||||
| yes | filter | * | |
|
||||
| yes | gd | * | |
|
||||
| yes | hash | * | PHP7.3 or older uses `--enable-hash` |
|
||||
| yes | iconv | * | |
|
||||
| yes | inotify | 3.0.0 | |
|
||||
| yes | json | * | |
|
||||
| yes | libxml | * | |
|
||||
| yes | mbstring | * | |
|
||||
| yes | mongodb | >=1.9.1 | not tested |
|
||||
| | mysqli | | |
|
||||
| yes | mysqlnd | * | |
|
||||
| yes | openssl | * | |
|
||||
| yes | pcntl | * | |
|
||||
| yes | pdo | * | |
|
||||
| yes | pdo_mysql | * | |
|
||||
| | pdo_pgsql | * | |
|
||||
| yes | phar | * | |
|
||||
| yes | posix | * | |
|
||||
| yes | redis | * | |
|
||||
| yes | simplexml | * | |
|
||||
| yes | sockets | * | |
|
||||
| yes | sqlite3 | * | not tested |
|
||||
| yes | swoole | >=4.6.6 | support mysqlnd, sockets, openssl, redis |
|
||||
| yes | tokenizer | * | |
|
||||
| yes | xml | * | |
|
||||
| yes | xmlreader | * | |
|
||||
| yes | xmlwriter | * | |
|
||||
| | zip | | |
|
||||
| yes | zlib | * | |
|
||||
|
||||
## Customization
|
||||
- `docker/Dockerfile` edit `VER_PHP=x.x.x` to switch PHP version.
|
||||
- `docker/Dockerfile` edit `USE_BACKUP=yes` to use backup download address (download faster if you are not in mainland China).
|
||||
- `docker/extensions.txt` edit extensions.
|
||||
- `docker/compile-php.sh` file `php_compile_args` function to adjust PHP configure arguments.
|
||||
- `docker/check-extensions.sh` file `check_in_configure` function to adjust extensions' configure arguments.
|
||||
- `docker/config.json` edit extensions and dependencies version and download links.
|
||||
|
||||
## Current Issue
|
||||
- [ ] Not support event(libevent), because of its `config.m4` and code.
|
||||
- [ ] Swoole not support `--enable-swoole-curl`.
|
||||
- [ ] Not support readline, maybe caused by ncurses library.
|
||||
- [X] Not support curl (solved)
|
||||
- [X] Customize extensions to compile
|
||||
- [ ] php.ini integration
|
||||
- [X] i18n (including README and scripts)
|
||||
|
||||
## Running preview
|
||||
After-compile status
|
||||
|
||||

|
||||
|
||||
Run Workerman directly
|
||||
|
||||

|
||||
|
||||
## References
|
||||
- <https://blog.terrywh.net/post/2019/php-static-openssl/>
|
||||
- <https://stackoverflow.com/a/37245653>
|
||||
- <http://blog.gaoyuan.xyz/2014/04/09/statically-compile-php/>
|
||||
English README has been moved to [README.md](README.md).
|
||||
|
||||
294
README-zh.md
Executable file
294
README-zh.md
Executable file
@@ -0,0 +1,294 @@
|
||||
# static-php-cli
|
||||
|
||||
[](README.md)
|
||||
[](README-zh.md)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/releases)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/blob/main/LICENSE)
|
||||
[](https://static-php.dev/zh/guide/extensions.html)
|
||||
|
||||
**static-php-cli**是一个用于静态编译、构建 PHP 解释器的工具,支持众多流行扩展。
|
||||
|
||||
目前 static-php-cli 支持 `cli`、`fpm`、`embed` 和 `micro` SAPI。
|
||||
|
||||
**static-php-cli**也支持将 PHP 代码和 PHP 运行时打包为一个文件并运行。
|
||||
|
||||
## 特性
|
||||
|
||||
static-php-cli(简称 `spc`)有许多特性:
|
||||
|
||||
- :handbag: 构建独立的单文件 PHP 解释器,无需任何依赖
|
||||
- :hamburger: 构建 **[phpmicro](https://github.com/dixyes/phpmicro)** 自执行二进制(将 PHP 代码和 PHP 解释器打包为一个文件)
|
||||
- :pill: 提供一键检查和修复编译环境的 Doctor 模块
|
||||
- :zap: 支持多个系统:`Linux`、`macOS`、`FreeBSD`、`Windows`
|
||||
- :wrench: 高度自定义的代码 patch 功能
|
||||
- :books: 自带编译依赖管理
|
||||
- 📦 提供由自身编译的独立 `spc` 二进制(使用 spc 和 [box](https://github.com/box-project/box) 构建)
|
||||
- :fire: 支持大量 [扩展](https://static-php.dev/zh/guide/extensions.html)
|
||||
- :floppy_disk: 整合 UPX 工具(减小二进制文件体积)
|
||||
|
||||
**静态 php-cli:**
|
||||
|
||||
<img width="700" alt="out1" src="https://github.com/crazywhalecc/static-php-cli/assets/20330940/01a2e60f-13b0-4242-a645-f7afa4936396">
|
||||
|
||||
**使用 phpmicro 打包 PHP 代码:**
|
||||
|
||||
<img width="700" alt="out2" src="https://github.com/crazywhalecc/static-php-cli/assets/20330940/46b7128d-fb72-4169-957e-48564c3ff3e2">
|
||||
|
||||
## 文档
|
||||
|
||||
目前 README 编写了基本用法。有关 static-php-cli 所有的功能,请点击这里查看文档:<https://static-php.dev>。
|
||||
|
||||
## 直接下载
|
||||
|
||||
如果你不想自行编译 PHP,可以从本项目现有的示例 Action 下载 Artifact,也可以从自托管的服务器下载。
|
||||
|
||||
- [扩展组合 - common](https://dl.static-php.dev/static-php-cli/common/):common 组合包含了约 [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) 个常用扩展,体积为 7.5MB 左右。
|
||||
- [扩展组合 - bulk](https://dl.static-php.dev/static-php-cli/bulk/):bulk 组合包含了 [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) 个扩展,体积为 25MB 左右。
|
||||
- [扩展组合 - minimal](https://dl.static-php.dev/static-php-cli/minimal/):minimal 组合包含了 [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) 个扩展,体积为 3MB 左右。
|
||||
|
||||
> Linux 和 Windows 默认启用了 UPX 压缩,可减小 30~50% 的 PHP 二进制体积。
|
||||
> macOS 当前不支持 UPX,所以上述预编译的 macOS 版本体积可能较大。
|
||||
|
||||
对于 Windows 系统,目前支持的扩展较少,故仅提供 SPC 自身运行的最小扩展组合的 `cli` 和 `micro`:[扩展组合 - spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/)。
|
||||
|
||||
## 使用 static-php-cli 构建 PHP
|
||||
|
||||
### 编译环境需求
|
||||
|
||||
- PHP >= 8.1(这是 spc 自身需要的版本,不是支持的构建版本)
|
||||
- 扩展:`mbstring,tokenizer,phar`
|
||||
- 系统安装了 `curl` 和 `git`
|
||||
|
||||
是的,本项目采用 PHP 编写,编译前需要一个 PHP 环境,比较滑稽。
|
||||
但本项目默认可通过自身构建的 micro 和 static-php 二进制运行,其他只需要包含上面提到的扩展和 PHP 版本大于等于 8.1 即可。
|
||||
|
||||
下面是架构支持情况,:octocat: 代表支持 GitHub Action 构建,:computer: 代表支持本地构建,空 代表暂不支持。
|
||||
|
||||
| | x86_64 | aarch64 |
|
||||
|---------|----------------------|----------------------|
|
||||
| macOS | :octocat: :computer: | :octocat: :computer: |
|
||||
| Linux | :octocat: :computer: | :octocat: :computer: |
|
||||
| Windows | :octocat: :computer: | |
|
||||
| FreeBSD | :computer: | :computer: |
|
||||
|
||||
当前支持编译的 PHP 版本:
|
||||
|
||||
> :warning: 支持,但 static-php-cli 作者可能不再提供补丁修复
|
||||
>
|
||||
> :heavy_check_mark: 支持
|
||||
>
|
||||
> :x: 不支持
|
||||
|
||||
| PHP Version | Status | Comment |
|
||||
|-------------|--------------------|------------------------------|
|
||||
| 7.2 | :x: | |
|
||||
| 7.3 | :warning: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
|
||||
| 7.4 | :warning: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
|
||||
| 8.0 | :heavy_check_mark: | PHP 官方已停止 8.0 的维护 |
|
||||
| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新 |
|
||||
| 8.2 | :heavy_check_mark: | |
|
||||
| 8.3 | :heavy_check_mark: | |
|
||||
|
||||
### 支持的扩展
|
||||
|
||||
请先根据下方扩展列表选择你要编译的扩展。
|
||||
|
||||
- [扩展支持列表](https://static-php.dev/zh/guide/extensions.html)
|
||||
- [编译命令生成器](https://static-php.dev/zh/guide/cli-generator.html)
|
||||
|
||||
> 如果这里没有你需要的扩展,可以提交 Issue。
|
||||
|
||||
### 在线构建(使用 GitHub Actions)
|
||||
|
||||
使用 GitHub Action 可以方便地构建一个静态编译的 PHP,同时可以自行定义要编译的扩展。
|
||||
|
||||
1. Fork 本项目。
|
||||
2. 进入项目的 Actions,选择 CI。
|
||||
3. 选择 `Run workflow`,填入你要编译的 PHP 版本、目标类型、扩展列表。(扩展列表使用英文逗号分割,例如 `bcmath,curl,mbstring`)
|
||||
4. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
|
||||
|
||||
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
||||
|
||||
### 本地构建(使用 spc 二进制)
|
||||
|
||||
该项目提供了 static-php-cli 的二进制文件:`spc`。
|
||||
您可以使用 `spc` 二进制文件,无需安装任何运行时(用起来就像 golang 程序)。
|
||||
目前,`spc` 二进制文件提供的平台有 Linux 和 macOS。
|
||||
|
||||
使用以下命令从自托管服务器下载:
|
||||
|
||||
```bash
|
||||
# Download from self-hosted nightly builds (sync with main branch)
|
||||
# For Linux x86_64
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||
# For Linux aarch64
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||
# macOS x86_64 (Intel)
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||
# macOS aarch64 (Apple)
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||
# Windows (x86_64, win10 build 17063 or later)
|
||||
curl.exe -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||
|
||||
# Add execute perm (Linux and macOS only)
|
||||
chmod +x ./spc
|
||||
|
||||
# Run (Linux and macOS)
|
||||
./spc --version
|
||||
# Run (Windows powershell)
|
||||
.\spc.exe --version
|
||||
```
|
||||
|
||||
自托管 `spc` 由 GitHub Actions 构建,你也可以从 Actions 直接下载:[此处](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml)。
|
||||
|
||||
### 本地构建(使用 git 源码)
|
||||
|
||||
```bash
|
||||
# clone 仓库即可
|
||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||
```
|
||||
|
||||
如果您的系统上尚未安装 php,我们建议你使用内置的 setup-runtime 自动安装 PHP 和 Composer。
|
||||
|
||||
```bash
|
||||
cd static-php-cli
|
||||
chmod +x bin/setup-runtime
|
||||
# it will download static php (from self-hosted server) and composer (from getcomposer)
|
||||
bin/setup-runtime
|
||||
# initialize composer deps
|
||||
bin/composer install
|
||||
# chmod
|
||||
chmod +x bin/spc
|
||||
bin/spc --version
|
||||
```
|
||||
|
||||
### 开始构建 PHP
|
||||
|
||||
下面是使用 static-php-cli 的基础用法:
|
||||
|
||||
> 如果你使用的是打包好的 `spc` 二进制,你需要将下列命令的 `./bin/spc` 替换为 `./spc`。
|
||||
|
||||
```bash
|
||||
# 检查环境依赖,并根据尝试自动安装缺失的编译工具
|
||||
./bin/spc doctor --auto-fix
|
||||
|
||||
# 拉取所有依赖库
|
||||
./bin/spc download --all
|
||||
# 只拉取编译指定扩展需要的所有依赖(推荐)
|
||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||
# 下载编译不同版本的 PHP (--with-php=x.y,推荐 7.3 ~ 8.3)
|
||||
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
||||
|
||||
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
||||
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
||||
# 编译线程安全版本 (--enable-zts)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli
|
||||
# 编译后使用 UPX 减小可执行文件体积 (--with-upx-pack) (至少压缩至原来的 30~50%)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
||||
```
|
||||
|
||||
其中,目前支持构建 cli,micro,fpm 和 embed,使用以下参数的一个或多个来指定编译的 SAPI:
|
||||
|
||||
- `--build-cli`:构建 cli 二进制
|
||||
- `--build-micro`:构建 phpmicro 自执行二进制
|
||||
- `--build-fpm`:构建 fpm
|
||||
- `--build-embed`:构建 embed(libphp)
|
||||
- `--build-all`:构建所有
|
||||
|
||||
如果出现了任何错误,可以使用 `--debug` 参数来展示完整的输出日志,以供排查错误:
|
||||
|
||||
```bash
|
||||
./bin/spc build "openssl,pcntl,mbstring" --debug --build-all
|
||||
./bin/spc download --all --debug
|
||||
```
|
||||
|
||||
## 不同 SAPI 的使用
|
||||
|
||||
### 使用 cli
|
||||
|
||||
> php-cli 是一个静态的二进制文件,类似 Go、Rust 语言编译后的单个可移植的二进制文件。
|
||||
|
||||
采用参数 `--build-cli` 或`--build-all` 参数时,最后编译结果会输出一个 `./php` 的二进制文件,此文件可分发、可直接使用。
|
||||
该文件编译后会存放在 `buildroot/bin/` 目录中,名称为 `php`,拷贝出来即可。
|
||||
|
||||
```bash
|
||||
cd buildroot/bin/
|
||||
./php -v # 检查版本
|
||||
./php -m # 检查编译的扩展
|
||||
./php your_code.php # 运行代码
|
||||
./php your_project.phar # 运行打包为 phar 单文件的项目
|
||||
```
|
||||
|
||||
### 使用 micro
|
||||
|
||||
> phpmicro 是一个提供自执行二进制 PHP 的项目,本项目依赖 phpmicro 进行编译自执行二进制。详见 [dixyes/phpmicro](https://github.com/dixyes/phpmicro)。
|
||||
|
||||
采用项目参数 `--build-micro` 或 `--build-all` 时,最后编译结果会输出一个 `./micro.sfx` 的文件,此文件需要配合你的 PHP 源码使用。
|
||||
该文件编译后会存放在 `buildroot/bin/` 目录中,拷贝出来即可。
|
||||
|
||||
使用时应准备好你的项目源码文件,可以是单个 PHP 文件,也可以是 Phar 文件。
|
||||
|
||||
```bash
|
||||
echo "<?php echo 'Hello world' . PHP_EOL;" > code.php
|
||||
cat micro.sfx code.php > single-app && chmod +x single-app
|
||||
./single-app
|
||||
```
|
||||
|
||||
如果打包 PHAR 文件,仅需把 code.php 更换为 phar 文件路径即可。
|
||||
你可以使用 [box-project/box](https://github.com/box-project/box) 将你的 CLI 项目打包为 Phar,
|
||||
然后将它与 phpmicro 结合,生成独立可执行的二进制文件。
|
||||
|
||||
```bash
|
||||
# 使用 static-php-cli 生成的 micro.sfx 结合,也可以直接使用 cat 命令结合它们
|
||||
bin/spc micro:combine my-app.phar
|
||||
cat buildroot/bin/micro.sfx my-app.phar > my-app && chmod +x my-app
|
||||
|
||||
# 使用 micro:combine 结合可以将 INI 选项注入到二进制中
|
||||
bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=system" --output my-app-2
|
||||
```
|
||||
|
||||
> 有些情况下的 phar 文件或 PHP 项目可能无法在 micro 环境下运行。
|
||||
|
||||
### 使用 fpm
|
||||
|
||||
采用项目参数 `--build-fpm` 或 `--build-all` 时,最后编译结果会输出一个 `./php-fpm` 的文件。
|
||||
该文件存放在 `buildroot/bin/` 目录,拷贝出来即可使用。
|
||||
|
||||
在正常的 Linux 发行版和 macOS 系统中,安装 php-fpm 后包管理会自动生成默认的 fpm 配置文件。
|
||||
因为 php-fpm 必须指定配置文件才可启动,本项目编译的 php-fpm 不会带任何配置文件,所以需自行编写 `php-fpm.conf` 和 `pool.conf` 配置文件。
|
||||
|
||||
指定 `php-fpm.conf` 可以使用命令参数 `-y`,例如:`./php-fpm -y php-fpm.conf`。
|
||||
|
||||
### 使用 embed
|
||||
|
||||
采用项目参数 `--build-embed` 或 `--build-all` 时,最后编译结果会输出一个 `libphp.a`、`php-config` 以及一系列头文件,存放在 `buildroot/`,你可以在你的其他代码中引入它们。
|
||||
|
||||
如果你知道 [embed SAPI](https://github.com/php/php-src/tree/master/sapi/embed),你应该知道如何使用它。对于有可能编译用到引入其他库的问题,你可以使用 `buildroot/bin/php-config` 来获取编译时的配置。
|
||||
|
||||
另外,有关如何使用此功能的高级示例,请查看[如何使用它构建 FrankenPHP 的静态版本](https://github.com/dunglas/frankenphp/blob/main/docs/static.md)。
|
||||
|
||||
## 贡献
|
||||
|
||||
如果缺少你需要的扩展,可发起 Issue。如果你对本项目较熟悉,也欢迎为本项目发起 Pull Request。
|
||||
|
||||
另外,添加新扩展的贡献方式,可以参考下方 `进阶`。
|
||||
|
||||
如果你想贡献文档内容,请到项目仓库 [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs) 贡献。
|
||||
|
||||
## 赞助本项目
|
||||
|
||||
你可以在 [我的个人赞助页](https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md) 支持我和我的项目。你捐赠的一部分将会被用于维护 **static-php.dev** 服务器。
|
||||
|
||||
## 开源协议
|
||||
|
||||
本项目采用 MIT License 许可开源,下面是类似的项目:
|
||||
|
||||
- [dixyes/lwmbs](https://github.com/dixyes/lwmbs)
|
||||
- [swoole/swoole-cli](https://github.com/swoole/swoole-cli)
|
||||
|
||||
该项目使用了 [dixyes/lwmbs](https://github.com/dixyes/lwmbs) 中的一些代码,例如 Windows 静态构建目标和 libiconv 库支持。
|
||||
lwmbs 使用 [Mulan PSL 2](http://license.coscl.org.cn/MulanPSL2) 许可进行分发。对应文件有关于作者和许可的特殊说明,除此之外,均使用 MIT 授权许可。
|
||||
|
||||
因本项目的特殊性,使用项目编译过程中会使用很多其他开源项目,例如 curl、protobuf 等,它们都有各自的开源协议。
|
||||
请在编译完成后,使用命令 `bin/spc dump-license` 导出项目使用项目的开源协议,并遵守对应项目的 LICENSE。
|
||||
388
README.md
388
README.md
@@ -1,107 +1,327 @@
|
||||
# static-php-cli
|
||||
Compile A Statically Linked PHP With Swoole and other Extensions. [English README](/README-en.md)
|
||||
|
||||
编译纯静态的 PHP Binary 二进制文件,带有各种扩展,让 PHP-cli 应用变得更便携!
|
||||
[](README-zh.md)
|
||||
[](README.md)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/releases)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/blob/main/LICENSE)
|
||||
[](https://static-php.dev/en/guide/extensions.html)
|
||||
|
||||
注:只能编译 CLI 模式,暂不支持 CGI 和 FPM 模式
|
||||
**static-php-cli** is a powerful tool designed for building static, standalone PHP runtime
|
||||
with popular extensions.
|
||||
|
||||
[]()
|
||||
Static PHP built by **static-php-cli** supports `cli`, `fpm`, `embed` and `micro` SAPI.
|
||||
|
||||
## 环境需求
|
||||
- 目前在 x86_64 和 aarch64(arm64) 架构上编译成功,其他架构需自行测试
|
||||
- 需要 Docker(或等我将脚本提出来也可以直接在 Alpine Linux 上使用)
|
||||
- 脚本支持编译的 PHP 版本(7.2 ~ 8.0)
|
||||
**static-php-cli** also has the ability to package PHP projects
|
||||
along with the PHP interpreter into one single executable file.
|
||||
|
||||
## 开始
|
||||
可以直接在旁边的 Release 中下载编译好的二进制。
|
||||
## Features
|
||||
|
||||
static-php-cli (you can call it `spc`) has a lot of features:
|
||||
|
||||
- :handbag: Build single-file php executable, without any dependencies
|
||||
- :hamburger: Build **[phpmicro](https://github.com/dixyes/phpmicro)** self-extracted executable (glue php binary and php source code into one file)
|
||||
- :pill: Automatic build environment checker (Doctor module)
|
||||
- :zap: `Linux`, `macOS`, `FreeBSD`, `Windows` support
|
||||
- :wrench: Configurable source code patches
|
||||
- :books: Build dependency management
|
||||
- 📦 Provide `spc` own standalone executable (built by spc and [box](https://github.com/box-project/box))
|
||||
- :fire: Support many popular [extensions](https://static-php.dev/en/guide/extensions.html)
|
||||
- :floppy_disk: UPX integration (significantly reduces binary size)
|
||||
|
||||
**Single-file standalone php-cli:**
|
||||
|
||||
<img width="700" alt="out1" src="https://github.com/crazywhalecc/static-php-cli/assets/20330940/01a2e60f-13b0-4242-a645-f7afa4936396">
|
||||
|
||||
**Combine PHP code with PHP interpreter using phpmicro:**
|
||||
|
||||
<img width="700" alt="out2" src="https://github.com/crazywhalecc/static-php-cli/assets/20330940/46b7128d-fb72-4169-957e-48564c3ff3e2">
|
||||
|
||||
## Documentation
|
||||
|
||||
The current README contains basic usage. For all the features of static-php-cli,
|
||||
see <https://static-php.dev> .
|
||||
|
||||
## Direct Download
|
||||
|
||||
If you don't want to build or want to test first, you can download example pre-compiled artifact from [Actions](https://github.com/static-php/static-php-cli-hosted/actions/workflows/build-php-bulk.yml), or from self-hosted server.
|
||||
|
||||
Below are several precompiled static-php binaries with different extension combinations,
|
||||
which can be downloaded directly according to your needs.
|
||||
|
||||
- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 7.5MB.
|
||||
- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 25MB in size.
|
||||
- [Extension-Combination - minimal](https://dl.static-php.dev/static-php-cli/minimal/): `minimal` contains [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) extensions and is about 3MB in size.
|
||||
|
||||
> Linux and Windows supports UPX compression for binaries, which can reduce the size of the binary by 30% to 50%.
|
||||
> macOS does not support UPX compression, so the size of the pre-built binaries for mac is larger.
|
||||
|
||||
For Windows systems, there are currently fewer extensions supported,
|
||||
so only `cli` and `micro` that run the minimum extension combination of SPC itself are provided: [Extension-Combination - spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/).
|
||||
|
||||
## Build
|
||||
|
||||
### Compilation Requirements
|
||||
|
||||
You can say I made a PHP builder written in PHP, pretty funny.
|
||||
But static-php-cli runtime only requires an environment above PHP 8.1 and extensions mentioned below.
|
||||
|
||||
- PHP >= 8.1 (This is the version required by spc itself, not the build version)
|
||||
- Extension: `mbstring,tokenizer,phar`
|
||||
- Supported OS with `curl` and `git` installed
|
||||
|
||||
Here is the supported OS and arch, where :octocat: represents support for GitHub Action builds,
|
||||
:computer: represents support for local manual builds, and blank represents not currently supported.
|
||||
|
||||
| | x86_64 | aarch64 |
|
||||
|---------|----------------------|----------------------|
|
||||
| macOS | :octocat: :computer: | :octocat: :computer: |
|
||||
| Linux | :octocat: :computer: | :octocat: :computer: |
|
||||
| Windows | :octocat: :computer: | |
|
||||
| FreeBSD | :computer: | :computer: |
|
||||
|
||||
Currently supported PHP versions for compilation:
|
||||
|
||||
> :warning: supported but not maintained by static-php-cli authors
|
||||
>
|
||||
> :heavy_check_mark: supported
|
||||
>
|
||||
> :x: not supported
|
||||
|
||||
| PHP Version | Status | Comment |
|
||||
|-------------|--------------------|---------------------------------------------------|
|
||||
| 7.2 | :x: | |
|
||||
| 7.3 | :warning: | phpmicro and some extensions not supported on 7.x |
|
||||
| 7.4 | :warning: | phpmicro and some extensions not supported on 7.x |
|
||||
| 8.0 | :heavy_check_mark: | PHP official has stopped maintenance of 8.0 |
|
||||
| 8.1 | :heavy_check_mark: | PHP official has security fixes only |
|
||||
| 8.2 | :heavy_check_mark: | |
|
||||
| 8.3 | :heavy_check_mark: | |
|
||||
|
||||
### Supported Extensions
|
||||
|
||||
Please first select the extension you want to compile based on the extension list below.
|
||||
|
||||
- [Supported Extension List](https://static-php.dev/en/guide/extensions.html)
|
||||
- [Command Generator](https://static-php.dev/en/guide/cli-generator.html)
|
||||
|
||||
> If an extension you need is missing, you can submit an issue.
|
||||
|
||||
Here is the current planned roadmap for extension support: [#152](https://github.com/crazywhalecc/static-php-cli/issues/152) .
|
||||
|
||||
### Build Online (using GitHub Actions)
|
||||
|
||||
Use GitHub Action to easily build a statically compiled PHP,
|
||||
and at the same time define the extensions to be compiled by yourself.
|
||||
|
||||
1. Fork me.
|
||||
2. Go to the Actions of the project and select `CI`.
|
||||
3. Select `Run workflow`, fill in the PHP version you want to compile, the target type, and the list of extensions. (extensions comma separated, e.g. `bcmath,curl,mbstring`)
|
||||
4. After waiting for about a period of time, enter the corresponding task and get `Artifacts`.
|
||||
|
||||
If you enable `debug`, all logs will be output at build time, including compiled logs, for troubleshooting.
|
||||
|
||||
### Build Locally (using SPC binary)
|
||||
|
||||
This project provides a binary file of static-php-cli: `spc`.
|
||||
You can use `spc` binary instead of installing any runtime like golang app.
|
||||
Currently, the platforms supported by `spc` binary are Linux and macOS.
|
||||
|
||||
Download from self-hosted nightly builds using commands below:
|
||||
|
||||
也可以自己使用 Dockerfile 进行编译构建:
|
||||
```bash
|
||||
# Download from self-hosted nightly builds (sync with main branch)
|
||||
# For Linux x86_64
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||
# For Linux aarch64
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||
# macOS x86_64 (Intel)
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||
# macOS aarch64 (Apple)
|
||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||
# Windows (x86_64, win10 build 17063 or later)
|
||||
curl.exe -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||
|
||||
# Add execute perm (Linux and macOS only)
|
||||
chmod +x ./spc
|
||||
|
||||
# Run (Linux and macOS)
|
||||
./spc --version
|
||||
# Run (Windows powershell)
|
||||
.\spc.exe --version
|
||||
```
|
||||
|
||||
Self-hosted `spc` is built by GitHub Actions, you can also download from Actions artifacts [here](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml).
|
||||
|
||||
### Build Locally (using git source)
|
||||
|
||||
```bash
|
||||
# just clone me!
|
||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||
cd static-php-cli/docker
|
||||
docker build -t static-php .
|
||||
```
|
||||
|
||||
编译之后可以使用下方命令将二进制 PHP 提取出来,用以下方式:
|
||||
If you have not installed php on your system, we recommend that you use the built-in setup-runtime to install PHP and Composer automatically.
|
||||
|
||||
```bash
|
||||
mkdir dist
|
||||
docker run --rm -v $(pwd)/dist:/dist/ -it static-php cp php-dist/bin/php /dist/
|
||||
cd dist
|
||||
file ./php
|
||||
cd static-php-cli
|
||||
chmod +x bin/setup-runtime
|
||||
# it will download static php (from self-hosted server) and composer (from getcomposer)
|
||||
bin/setup-runtime
|
||||
# initialize composer deps
|
||||
bin/composer install
|
||||
# chmod
|
||||
chmod +x bin/spc
|
||||
bin/spc --version
|
||||
```
|
||||
|
||||
如果要选择安装的扩展,可以修改 `docker/extensions.txt` 文件,具体规则如下:
|
||||
- 文件内使用 `#` 可以注释,表示不安装
|
||||
- 扩展名一律使用小写,目前默认状态下文件内所列的扩展为支持的扩展,其他扩展暂不支持,如有需求请提 Issue 添加
|
||||
### Start Building PHP
|
||||
|
||||
## 支持的扩展表
|
||||
| 是否支持 | PHP 扩展名称 | 支持版本 | 备注 |
|
||||
| -------- | ------------ | -------- | ------------------------------------------------------- |
|
||||
| yes | bcmath | * | |
|
||||
| yes | calendar | * | |
|
||||
| yes | ctype | * | |
|
||||
| yes | curl | * | |
|
||||
| yes | dom | * | |
|
||||
| | event | | |
|
||||
| yes | filter | * | |
|
||||
| yes | gd | * | |
|
||||
| yes | hash | * | PHP7.3及以下版本需指定 `--enable-hash`,7.4以上默认开启 |
|
||||
| yes | iconv | * | |
|
||||
| yes | inotify | 3.0.0 | |
|
||||
| yes | json | * | |
|
||||
| yes | libxml | * | |
|
||||
| yes | mbstring | * | |
|
||||
| yes | mongodb | >=1.9.1 | not tested |
|
||||
| | mysqli | | |
|
||||
| yes | mysqlnd | * | |
|
||||
| yes | openssl | * | |
|
||||
| yes | pcntl | * | |
|
||||
| yes | pdo | * | |
|
||||
| yes | pdo_mysql | * | |
|
||||
| | pdo_pgsql | * | |
|
||||
| yes | phar | * | |
|
||||
| yes | posix | * | |
|
||||
| yes | redis | * | |
|
||||
| yes | simplexml | * | |
|
||||
| yes | sockets | * | |
|
||||
| yes | sqlite3 | * | |
|
||||
| yes | swoole | >=4.6.6 | 默认支持mysqlnd, sockets, openssl, redis |
|
||||
| yes | tokenizer | * | |
|
||||
| yes | xml | * | |
|
||||
| yes | xmlreader | * | |
|
||||
| yes | xmlwriter | * | |
|
||||
| | zip | | |
|
||||
| yes | zlib | * | |
|
||||
Basic usage for building php with some extensions:
|
||||
|
||||
## 自定义
|
||||
- `docker/Dockerfile` 中修改 `VER_PHP=x.x.x` 来更换 PHP 版本。
|
||||
- `docker/Dockerfile` 中修改 `USE_BACKUP=yes` 使用备用下载源码地址(不在中国大陆可以使用备用地址)。
|
||||
- `docker/extensions.txt` 指定要编译安装的扩展。
|
||||
- `docker/compile-php.sh` 中的 `php_compile_args` 函数来调整 PHP 编译参数。
|
||||
- `docker/check-extensions.sh` 中的 `check_in_configure` 函数可调整 PHP 扩展编译的参数 。
|
||||
- `docker/config.json` 可调整要下载的扩展和依赖库版本和链接。
|
||||
> If you are using the packaged standalone `spc` binary, you need to replace `bin/spc` with `./spc` or `.\spc.exe` in the following commands.
|
||||
|
||||
## 目前的问题(对勾为已解决)
|
||||
- [ ] 不支持 event(libevent) 扩展,event 扩展的 sockets 支持不能在静态编译中使用,因为静态内嵌编译暂时没办法调整扩展编译顺序,同时其本身也不支持静态编译。
|
||||
- [ ] Swoole 扩展不支持 `--enable-swoole-curl`,也是因为编译顺序和加载顺序的问题。
|
||||
- [ ] 不支持 readline 扩展,readline 扩展安装后无法正常使用 `php -a`,原因还没有弄清楚,可能是静态编译造成的 ncurses 库出现了问题。
|
||||
- [X] curl/libcurl 扩展静态编译
|
||||
- [X] 可自行选择不需要编译进入的扩展
|
||||
- [ ] php.ini 内嵌或分发
|
||||
- [ ] i18n(国际化脚本本身和 README)
|
||||
```bash
|
||||
# Check system tool dependencies, auto-fix them if possible
|
||||
./bin/spc doctor --auto-fix
|
||||
|
||||
如果你对以上问题有解决方案,请提出 Issue 或 PR!
|
||||
# fetch all libraries
|
||||
./bin/spc download --all
|
||||
# only fetch necessary sources by needed extensions (recommended)
|
||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||
# download different PHP version (--with-php=x.y, recommend 7.3 ~ 8.3)
|
||||
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
||||
|
||||
## 运行示例
|
||||
编译后的状态
|
||||
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
||||
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
||||
# build thread-safe (ZTS) version (--enable-zts)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli
|
||||
# build, pack executable with UPX (--with-upx-pack) (reduce binary size for 30~50%)
|
||||
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
||||
```
|
||||
|
||||

|
||||
Now we support `cli`, `micro`, `fpm` and `embed` SAPI. You can use one or more of the following parameters to specify the compiled SAPI:
|
||||
|
||||
直接运行 Workerman
|
||||
- `--build-cli`: build static cli executable
|
||||
- `--build-micro`: build static phpmicro self-extracted executable
|
||||
- `--build-fpm`: build static fpm binary
|
||||
- `--build-embed`: build embed (libphp)
|
||||
- `--build-all`: build all
|
||||
|
||||

|
||||
If anything goes wrong, use `--debug` option to display full terminal output:
|
||||
|
||||
## 参考资料
|
||||
- <https://blog.terrywh.net/post/2019/php-static-openssl/>
|
||||
- <https://stackoverflow.com/a/37245653>
|
||||
- <http://blog.gaoyuan.xyz/2014/04/09/statically-compile-php/>
|
||||
```bash
|
||||
./bin/spc build "openssl,pcntl,mbstring" --debug --build-all
|
||||
./bin/spc download --all --debug
|
||||
```
|
||||
|
||||
## Different SAPI Usage
|
||||
|
||||
### Use cli
|
||||
|
||||
> php-cli is a single static binary, you can use it like normal php installed on your system.
|
||||
|
||||
When using the parameter `--build-cli` or `--build-all`,
|
||||
the final compilation result will output a binary file named `./php`,
|
||||
which can be distributed and used directly.
|
||||
This file will be located in the directory `buildroot/bin/`, copy it out for use.
|
||||
|
||||
```bash
|
||||
cd buildroot/bin/
|
||||
./php -v # check version
|
||||
./php -m # check extensions
|
||||
./php your_code.php # run your php code
|
||||
./php your_project.phar # run your phar (project archive)
|
||||
```
|
||||
|
||||
### Use micro
|
||||
|
||||
> phpmicro is a SelF-extracted eXecutable SAPI module,
|
||||
> provided by [phpmicro](https://github.com/dixyes/phpmicro) project.
|
||||
> But this project is using a [fork](https://github.com/static-php/phpmicro) of phpmicro, because we need to add some features to it.
|
||||
> It can put php runtime and your source code together.
|
||||
|
||||
When using the parameter `--build-all` or `--build-micro`,
|
||||
the final compilation result will output a file named `./micro.sfx`,
|
||||
which needs to be used with your PHP source code like `code.php`.
|
||||
This file will be located in the path `buildroot/bin/micro.sfx`, simply copy it out for use.
|
||||
|
||||
Prepare your project source code, which can be a single PHP file or a Phar file, for use.
|
||||
|
||||
```bash
|
||||
echo "<?php echo 'Hello world' . PHP_EOL;" > code.php
|
||||
cat micro.sfx code.php > single-app && chmod +x single-app
|
||||
./single-app
|
||||
```
|
||||
|
||||
If you package a PHAR file, just replace `code.php` with the phar file path.
|
||||
You can use [box-project/box](https://github.com/box-project/box) to package your CLI project as Phar,
|
||||
It is then combined with phpmicro to produce a standalone executable binary.
|
||||
|
||||
```bash
|
||||
# Use the micro.sfx generated by static-php-cli to combine,
|
||||
bin/spc micro:combine my-app.phar
|
||||
# or you can directly use the cat command to combine them.
|
||||
cat buildroot/bin/micro.sfx my-app.phar > my-app && chmod +x my-app
|
||||
|
||||
# Use micro:combine combination to inject INI options into the binary.
|
||||
bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=system" --output my-app-2
|
||||
```
|
||||
|
||||
> In some cases, PHAR files may not run in a micro environment. Overall, micro is not production ready.
|
||||
|
||||
### Use fpm
|
||||
|
||||
When using the parameter `--build-all` or `--build-fpm`,
|
||||
the final compilation result will output a file named `./php-fpm`,
|
||||
This file will be located in the path `buildroot/bin/`, simply copy it out for use.
|
||||
|
||||
In common Linux distributions and macOS systems, the package manager will automatically generate a default fpm configuration file after installing php-fpm.
|
||||
Because php-fpm must specify a configuration file before running, the php-fpm compiled by this project will not have any configuration files, so you need to write `php-fpm.conf` and `pool.conf` configuration files yourself.
|
||||
|
||||
Specifying `php-fpm.conf` can use the command parameter `-y`, for example: `./php-fpm -y php-fpm.conf`.
|
||||
|
||||
### Use embed
|
||||
|
||||
When using the project parameters `--build-embed` or `--build-all`,
|
||||
the final compilation result will output a `libphp.a`, `php-config` and a series of header files,
|
||||
stored in `buildroot/`. You can introduce them in your other projects.
|
||||
|
||||
If you know [embed SAPI](https://github.com/php/php-src/tree/master/sapi/embed), you should know how to use it.
|
||||
You may require the introduction of other libraries during compilation,
|
||||
you can use `buildroot/bin/php-config` to obtain the compile-time configuration.
|
||||
|
||||
For an advanced example of how to use this feature, take a look at [how to use it to build a static version of FrankenPHP](https://github.com/dunglas/frankenphp/blob/main/docs/static.md).
|
||||
|
||||
## Contribution
|
||||
|
||||
If the extension you need is missing, you can create an issue.
|
||||
If you are familiar with this project, you are also welcome to initiate a pull request.
|
||||
|
||||
If you want to contribute documentation, please go to [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs).
|
||||
|
||||
Now there is a [static-php](https://github.com/static-php) organization, which is used to store the repo related to the project.
|
||||
|
||||
## Sponsor this project
|
||||
|
||||
You can sponsor my project on [this page](https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md). A portion of your donation will be used to maintain the **static-php.dev** server.
|
||||
|
||||
## Open-Source License
|
||||
|
||||
This project itself is based on MIT License,
|
||||
some newly added extensions and dependencies may originate from the the other projects,
|
||||
and the headers of these code files will also be given additional instructions LICENSE and AUTHOR.
|
||||
|
||||
These are similar projects:
|
||||
|
||||
- [dixyes/lwmbs](https://github.com/dixyes/lwmbs)
|
||||
- [swoole/swoole-cli](https://github.com/swoole/swoole-cli)
|
||||
|
||||
The project uses some code from [dixyes/lwmbs](https://github.com/dixyes/lwmbs), such as windows static build target and libiconv support.
|
||||
lwmbs is licensed under the [Mulan PSL 2](http://license.coscl.org.cn/MulanPSL2).
|
||||
|
||||
Due to the special nature of this project,
|
||||
many other open source projects such as curl and protobuf will be used during the project compilation process,
|
||||
and they all have their own open source licenses.
|
||||
|
||||
Please use the `bin/spc dump-license` command to export the open source licenses used in the project after compilation,
|
||||
and comply with the corresponding project's LICENSE.
|
||||
|
||||
74
bin/setup-runtime
Executable file
74
bin/setup-runtime
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# set error-quit, verbose, non-variable-quit
|
||||
set -eu
|
||||
# see what system used
|
||||
__OS__=$(uname -s)
|
||||
# see what arch used
|
||||
__ARCH__=$(uname -m)
|
||||
# format arch name
|
||||
case $__ARCH__ in
|
||||
arm64 | aarch64) __ARCH__=aarch64 ;;
|
||||
x86_64|x64) __ARCH__=x86_64 ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
# format uname
|
||||
case $__OS__ in
|
||||
Darwin) __OS_FIXED__=macos ;;
|
||||
Linux) __OS_FIXED__=linux ;;
|
||||
*) echo "Current OS is not supported" && exit 1 ;;
|
||||
esac
|
||||
|
||||
# set project dir
|
||||
__DIR__=$(cd "$(dirname "$0")" && pwd)
|
||||
__PROJECT__=$(cd "${__DIR__}"/../ && pwd)
|
||||
|
||||
# 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"
|
||||
__COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar"
|
||||
|
||||
# use china mirror
|
||||
# bash bin/setup-runtime --mirror china
|
||||
mirror=''
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--mirror)
|
||||
mirror="$2"
|
||||
;;
|
||||
--*)
|
||||
echo "Illegal option $1"
|
||||
;;
|
||||
esac
|
||||
shift $(($# > 0 ? 1 : 0))
|
||||
done
|
||||
|
||||
case "$mirror" in
|
||||
china)
|
||||
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
||||
__COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
if ! command -v curl > /dev/null && command -v apk > /dev/null; then
|
||||
apk add --no-cache curl
|
||||
fi
|
||||
|
||||
test -d "${__PROJECT__}"/downloads || mkdir "${__PROJECT__}"/downloads
|
||||
# download static php binary
|
||||
test -f "${__PROJECT__}"/downloads/runtime.tar.gz || { echo "Downloading $__PHP_RUNTIME_URL__ ..." && curl -#fSL -o "${__PROJECT__}"/downloads/runtime.tar.gz "$__PHP_RUNTIME_URL__" ; }
|
||||
test -f "${__DIR__}"/php || { tar -xf "${__PROJECT__}"/downloads/runtime.tar.gz -C "${__DIR__}"/ ; }
|
||||
chmod +x "${__DIR__}"/php
|
||||
# download composer
|
||||
test -f "${__DIR__}"/composer || curl -#fSL -o "${__DIR__}"/composer "$__COMPOSER_URL__"
|
||||
chmod +x "${__DIR__}"/composer
|
||||
# sanity check for php and composer
|
||||
"${__DIR__}"/php -v >/dev/null || { echo "Failed to run php" && exit 1; }
|
||||
"${__DIR__}"/php "${__DIR__}"/composer --version >/dev/null || { echo "Failed to run composer" && exit 1; }
|
||||
|
||||
echo "Setup runtime OK!"
|
||||
echo "runtime bin path needs to add manually by command below:"
|
||||
echo ""
|
||||
echo " export PATH=\"${__DIR__}:\$PATH\""
|
||||
echo ""
|
||||
115
bin/setup-runtime.ps1
Normal file
115
bin/setup-runtime.ps1
Normal file
@@ -0,0 +1,115 @@
|
||||
param (
|
||||
[string] ${action}
|
||||
)
|
||||
|
||||
function AddToPath {
|
||||
param (
|
||||
[string]$pathToAdd
|
||||
)
|
||||
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')
|
||||
|
||||
if ($currentPath -notlike "*$pathToAdd*") {
|
||||
$newPath = $currentPath + ";$pathToAdd"
|
||||
[System.Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
|
||||
Write-Host "Added '$pathToAdd' to Path."
|
||||
Write-Host "To remove path, use: " -NoNewline
|
||||
Write-Host "bin/setup-runtime remove-path" -ForegroundColor Cyan
|
||||
} else {
|
||||
Write-Host "Path already exists."
|
||||
}
|
||||
}
|
||||
|
||||
function RemoveFromPath {
|
||||
param (
|
||||
[string]$pathToRemove
|
||||
)
|
||||
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')
|
||||
|
||||
if ($currentPath -like "*$pathToRemove*") {
|
||||
$newPath = $currentPath -replace [regex]::Escape(';' + $pathToRemove), ''
|
||||
[System.Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
|
||||
Write-Host "Removed Path '$pathToRemove'"
|
||||
} else {
|
||||
Write-Host "Path '$pathToRemove' not in Path"
|
||||
}
|
||||
}
|
||||
|
||||
# working dir
|
||||
$WorkingDir = (Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Definition))
|
||||
|
||||
if ($action -eq 'add-path') {
|
||||
AddToPath ($WorkingDir + '\runtime')
|
||||
exit 0
|
||||
} elseif ($action -eq 'remove-path') {
|
||||
RemoveFromPath ($WorkingDir + '\runtime')
|
||||
exit 0
|
||||
} elseif (-not($action -eq '')) {
|
||||
Write-Host ("Invalid action: " + $action) -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# get php 8.1 specific version
|
||||
$API = (Invoke-WebRequest -Uri "https://www.php.net/releases/index.php?json&version=8.1") | ConvertFrom-Json
|
||||
|
||||
# php windows download
|
||||
$PHPRuntimeUrl = "https://windows.php.net/downloads/releases/php-" + $API.version + "-Win32-vs16-x64.zip"
|
||||
$ComposerUrl = "https://getcomposer.org/download/latest-stable/composer.phar"
|
||||
|
||||
# create dir
|
||||
New-Item -Path "downloads" -ItemType Directory -Force | Out-Null
|
||||
|
||||
# download php
|
||||
if (-not(Test-Path "downloads\php.zip"))
|
||||
{
|
||||
Write-Host "Downloading PHP ..."
|
||||
Invoke-WebRequest $PHPRuntimeUrl -OutFile "downloads\php.zip"
|
||||
}
|
||||
|
||||
# extract php
|
||||
New-Item -Path "runtime" -ItemType Directory -Force | Out-Null
|
||||
Write-Host "Extracting php.zip ..."
|
||||
Expand-Archive -Path "downloads/php.zip" -DestinationPath "runtime" -Force
|
||||
# make php.ini
|
||||
Move-Item -Path "runtime\php.ini-production" -Destination "runtime\php.ini" -Force
|
||||
$OriginINI = Get-Content -Path "runtime\php.ini" -Raw
|
||||
$OriginINI = $OriginINI -replace ';extension=openssl', 'extension=openssl'
|
||||
$OriginINI = $OriginINI -replace ';extension=curl', 'extension=curl'
|
||||
$OriginINI = $OriginINI -replace ';extension=mbstring', 'extension=mbstring'
|
||||
$OriginINI = $OriginINI -replace ';extension=sodium', 'extension=sodium'
|
||||
$OriginINI = $OriginINI -replace ';extension_dir = "./"', ('extension_dir = "' + (Split-Path -Parent $MyInvocation.MyCommand.Definition) + '\..\runtime\ext"')
|
||||
$OriginINI | Set-Content -Path "runtime\php.ini"
|
||||
|
||||
# download composer
|
||||
if (-not(Test-Path "runtime\composer.phar"))
|
||||
{
|
||||
Write-Host "Downloading composer ..."
|
||||
Invoke-WebRequest $ComposerUrl -OutFile "downloads\composer.phar"
|
||||
Move-Item -Path "downloads\composer.phar" -Destination "runtime\composer.phar" -Force
|
||||
}
|
||||
|
||||
# create runtime\composer.ps1
|
||||
$ComposerContent = '
|
||||
$WorkingDir = (Split-Path -Parent $MyInvocation.MyCommand.Definition)
|
||||
& ($WorkingDir + "\php.exe") (Join-Path $WorkingDir "\composer.phar") @args
|
||||
'
|
||||
$ComposerContent | Set-Content -Path 'runtime\composer.ps1' -Encoding UTF8
|
||||
|
||||
Write-Host "Successfully downloaded PHP and Composer !" -ForegroundColor Green
|
||||
Write-Host "Use static-php-cli: " -NoNewline
|
||||
Write-Host "bin/spc" -ForegroundColor Cyan
|
||||
Write-Host "Use php: " -NoNewline
|
||||
Write-Host "runtime/php" -ForegroundColor Cyan
|
||||
Write-Host "Use composer: " -NoNewline
|
||||
Write-Host "runtime/composer" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Don't forget installing composer dependencies '" -NoNewline
|
||||
Write-Host "runtime/composer install" -ForegroundColor Cyan -NoNewline
|
||||
Write-Host "' before using static-php-cli !"
|
||||
Write-Host ""
|
||||
Write-Host "If you want to use this PHP for quality tools (like phpstan, php-cs-fixer) or other project,"
|
||||
Write-Host "or use PHP, Composer as system executable,"
|
||||
Write-Host "use '" -NoNewline
|
||||
Write-Host "bin/setup-runtime add-path" -ForegroundColor Cyan -NoNewline
|
||||
Write-Host "' to add runtime dir in Path."
|
||||
25
bin/spc
Executable file
25
bin/spc
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use SPC\ConsoleApplication;
|
||||
use SPC\exception\ExceptionHandler;
|
||||
|
||||
if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
|
||||
// Current: ./bin (git/project mode)
|
||||
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||
} else {
|
||||
// Current: ./vendor/crazywhalecc/static-php-cli/bin (composer library mode)
|
||||
require_once dirname(__DIR__, 3) . '/autoload.php';
|
||||
}
|
||||
|
||||
// 防止 Micro 打包状态下不支持中文的显示(虽然这个项目目前好像没输出过中文?)
|
||||
if (PHP_OS_FAMILY === 'Windows' && Phar::running()) {
|
||||
exec('CHCP 65001');
|
||||
}
|
||||
|
||||
try {
|
||||
(new ConsoleApplication())->run();
|
||||
} catch (Exception $e) {
|
||||
ExceptionHandler::getInstance()->handle($e);
|
||||
exit(1);
|
||||
}
|
||||
113
bin/spc-alpine-docker
Executable file
113
bin/spc-alpine-docker
Executable file
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# This file is using docker to run commands
|
||||
|
||||
# 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=x86_64
|
||||
fi
|
||||
case $SPC_USE_ARCH in
|
||||
x86_64)
|
||||
ALPINE_FROM=alpine:edge
|
||||
;;
|
||||
aarch64)
|
||||
ALPINE_FROM=multiarch/alpine:aarch64-edge
|
||||
# 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
|
||||
|
||||
if [ "$SPC_USE_MIRROR" = "yes" ]; then
|
||||
SPC_USE_MIRROR="RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories"
|
||||
else
|
||||
SPC_USE_MIRROR="RUN echo 'Using original repo'"
|
||||
fi
|
||||
|
||||
# Detect docker env is setup
|
||||
if ! $DOCKER_EXECUTABLE images | grep -q cwcc-spc-$SPC_USE_ARCH; then
|
||||
echo "Docker container does not exist. Building docker image ..."
|
||||
$DOCKER_EXECUTABLE build -t cwcc-spc-$SPC_USE_ARCH -f- . <<EOF
|
||||
FROM $ALPINE_FROM
|
||||
$SPC_USE_MIRROR
|
||||
RUN apk update; \
|
||||
apk add --no-cache \
|
||||
autoconf \
|
||||
automake \
|
||||
gettext \
|
||||
bash \
|
||||
binutils \
|
||||
bison \
|
||||
build-base \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gcc \
|
||||
git \
|
||||
jq \
|
||||
libgcc \
|
||||
libtool \
|
||||
libstdc++ \
|
||||
linux-headers \
|
||||
m4 \
|
||||
make \
|
||||
php82 \
|
||||
php82-common \
|
||||
php82-pcntl \
|
||||
php82-phar \
|
||||
php82-posix \
|
||||
php82-sodium \
|
||||
php82-tokenizer \
|
||||
php82-dom \
|
||||
php82-xml \
|
||||
php82-xmlwriter \
|
||||
composer \
|
||||
pkgconfig \
|
||||
wget \
|
||||
xz
|
||||
|
||||
WORKDIR /app
|
||||
ADD ./src /app/src
|
||||
COPY ./composer.* /app/
|
||||
ADD ./bin /app/bin
|
||||
RUN composer install --no-dev --classmap-authoritative
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Check if in ci (local terminal can execute with -it)
|
||||
if [ -t 0 ]; then
|
||||
INTERACT=-it
|
||||
else
|
||||
INTERACT=''
|
||||
fi
|
||||
|
||||
# Run docker
|
||||
# shellcheck disable=SC2068
|
||||
$DOCKER_EXECUTABLE run --rm $INTERACT -e SPC_FIX_DEPLOY_ROOT="$(pwd)" -v "$(pwd)"/config:/app/config -v "$(pwd)"/src:/app/src -v "$(pwd)"/buildroot:/app/buildroot -v "$(pwd)"/source:/app/source -v "$(pwd)"/downloads:/app/downloads cwcc-spc-$SPC_USE_ARCH bin/spc $@
|
||||
12
bin/spc.ps1
Normal file
12
bin/spc.ps1
Normal file
@@ -0,0 +1,12 @@
|
||||
$PHP_Exec = ".\runtime\php.exe"
|
||||
|
||||
if (-not(Test-Path $PHP_Exec)) {
|
||||
$PHP_Exec = Get-Command php.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||
if (-not $PHP_Exec) {
|
||||
Write-Host "Error: PHP not found, you need to install PHP on your system or use 'bin/setup-runtime'." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
& "$PHP_Exec" ("bin/spc") @args
|
||||
exit $LASTEXITCODE
|
||||
19
box.json
Normal file
19
box.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"alias": "spc-php.phar",
|
||||
"banner": false,
|
||||
"blacklist": [
|
||||
".github"
|
||||
],
|
||||
"compression": "GZ",
|
||||
"directories": [
|
||||
"config",
|
||||
"src",
|
||||
"vendor/psr",
|
||||
"vendor/laravel/prompts",
|
||||
"vendor/illuminate",
|
||||
"vendor/symfony",
|
||||
"vendor/zhamao"
|
||||
],
|
||||
"git-commit-short": "git_commit_short",
|
||||
"output": "spc.phar"
|
||||
}
|
||||
44
captainhook.json
Normal file
44
captainhook.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"pre-push": {
|
||||
"enabled": true,
|
||||
"actions": [
|
||||
{
|
||||
"action": "composer analyse"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pre-commit": {
|
||||
"enabled": true,
|
||||
"actions": [
|
||||
{
|
||||
"action": "composer cs-fix -- --config=.php-cs-fixer.php --dry-run --diff {$STAGED_FILES|of-type:php}",
|
||||
"conditions": [
|
||||
{
|
||||
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
|
||||
"args": ["php"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"post-change": {
|
||||
"enabled": true,
|
||||
"actions": [
|
||||
{
|
||||
"action": "composer install",
|
||||
"options": [],
|
||||
"conditions": [
|
||||
{
|
||||
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\Any",
|
||||
"args": [
|
||||
[
|
||||
"composer.json",
|
||||
"composer.lock"
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
66
composer.json
Normal file
66
composer.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "crazywhalecc/static-php-cli",
|
||||
"description": "Build single static PHP binary, with PHP project together, with popular extensions included.",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "jerry",
|
||||
"email": "admin@zhamao.me"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">= 8.1",
|
||||
"ext-mbstring": "*",
|
||||
"laravel/prompts": "^0.1.12",
|
||||
"symfony/console": "^5.4 || ^6 || ^7",
|
||||
"zhamao/logger": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"captainhook/captainhook-phar": "^5.23",
|
||||
"captainhook/hook-installer": "^1.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.25",
|
||||
"humbug/box": "^4.5",
|
||||
"nunomaduro/collision": "^7.8",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^10.3 || ^9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"SPC\\": "src/SPC"
|
||||
},
|
||||
"files": [
|
||||
"src/globals/defines.php",
|
||||
"src/globals/functions.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"SPC\\Tests\\": "tests/SPC"
|
||||
}
|
||||
},
|
||||
"bin": [
|
||||
"bin/spc"
|
||||
],
|
||||
"scripts": {
|
||||
"analyse": "phpstan analyse --memory-limit 300M",
|
||||
"cs-fix": "php-cs-fixer fix",
|
||||
"test": "vendor/bin/phpunit tests/ --no-coverage",
|
||||
"build:phar": "vendor/bin/box compile"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"phpstan/extension-installer": true,
|
||||
"captainhook/hook-installer": true,
|
||||
"captainhook/plugin-composer": true,
|
||||
"captainhook/captainhook-phar": true
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "other",
|
||||
"url": "https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
6955
composer.lock
generated
Normal file
6955
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
970
config/ext.json
Normal file
970
config/ext.json
Normal file
@@ -0,0 +1,970 @@
|
||||
{
|
||||
"amqp": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"arg-type": "custom",
|
||||
"source": "amqp",
|
||||
"lib-depends": [
|
||||
"librabbitmq"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"apcu": {
|
||||
"type": "external",
|
||||
"source": "apcu"
|
||||
},
|
||||
"bcmath": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"bz2": {
|
||||
"support": {
|
||||
"Windows": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"bzip2"
|
||||
]
|
||||
},
|
||||
"calendar": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"ctype": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"curl": {
|
||||
"notes": true,
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"lib-depends": [
|
||||
"curl"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"zlib",
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"dba": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-suggests": [
|
||||
"qdbm"
|
||||
]
|
||||
},
|
||||
"dom": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"libxml2",
|
||||
"zlib"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"xml"
|
||||
]
|
||||
},
|
||||
"ds": {
|
||||
"type": "external",
|
||||
"source": "ext-ds"
|
||||
},
|
||||
"enchant": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip",
|
||||
"Darwin": "wip",
|
||||
"Linux": "wip"
|
||||
},
|
||||
"type": "wip"
|
||||
},
|
||||
"event": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "ext-event",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libevent"
|
||||
],
|
||||
"ext-depends": [
|
||||
"openssl"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"sockets"
|
||||
]
|
||||
},
|
||||
"exif": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"ffi": {
|
||||
"support": {
|
||||
"Linux": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"arg-type": "custom",
|
||||
"type": "builtin",
|
||||
"lib-depends-unix": [
|
||||
"libffi"
|
||||
],
|
||||
"lib-depends-windows": [
|
||||
"libffi-win"
|
||||
]
|
||||
},
|
||||
"fileinfo": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"filter": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"ftp": {
|
||||
"type": "builtin",
|
||||
"lib-suggests": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"gd": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"zlib",
|
||||
"libpng"
|
||||
],
|
||||
"ext-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libavif",
|
||||
"libwebp",
|
||||
"libjpeg",
|
||||
"freetype"
|
||||
]
|
||||
},
|
||||
"gettext": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"gettext"
|
||||
]
|
||||
},
|
||||
"glfw": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "no",
|
||||
"Linux": "no"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"arg-type": "custom",
|
||||
"source": "ext-glfw",
|
||||
"lib-depends": [
|
||||
"glfw"
|
||||
],
|
||||
"lib-depends-windows": []
|
||||
},
|
||||
"gmp": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"gmp"
|
||||
]
|
||||
},
|
||||
"iconv": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends-unix": [
|
||||
"libiconv"
|
||||
],
|
||||
"lib-depends-windows": [
|
||||
"libiconv-win"
|
||||
]
|
||||
},
|
||||
"igbinary": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "igbinary"
|
||||
},
|
||||
"imagick": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-imagick",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"imagemagick"
|
||||
]
|
||||
},
|
||||
"imap": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"imap"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"inotify": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip",
|
||||
"Darwin": "no"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "inotify"
|
||||
},
|
||||
"intl": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"lib-depends": [
|
||||
"icu"
|
||||
]
|
||||
},
|
||||
"ldap": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"ldap"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"gmp",
|
||||
"libsodium"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"libxml": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "none",
|
||||
"ext-depends": [
|
||||
"xml"
|
||||
]
|
||||
},
|
||||
"mbregex": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"ext-depends": [
|
||||
"mbstring"
|
||||
],
|
||||
"lib-depends": [
|
||||
"onig"
|
||||
]
|
||||
},
|
||||
"mbstring": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom"
|
||||
},
|
||||
"mcrypt": {
|
||||
"type": "wip",
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "no",
|
||||
"Darwin": "no",
|
||||
"Linux": "no"
|
||||
},
|
||||
"notes": true
|
||||
},
|
||||
"memcache": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-memcache",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"ext-depends": [
|
||||
"session"
|
||||
]
|
||||
},
|
||||
"memcached": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip",
|
||||
"Linux": "no"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "memcached",
|
||||
"arg-type": "custom",
|
||||
"cpp-extension": true,
|
||||
"lib-depends": [
|
||||
"libmemcached"
|
||||
],
|
||||
"ext-depends": [
|
||||
"session",
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"mongodb": {
|
||||
"support": {
|
||||
"Darwin": "no",
|
||||
"BSD": "wip",
|
||||
"Windows": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "mongodb",
|
||||
"arg-type": "custom",
|
||||
"lib-suggests": [
|
||||
"icu",
|
||||
"openssl",
|
||||
"zstd",
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"mysqli": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"ext-depends": [
|
||||
"mysqlnd"
|
||||
]
|
||||
},
|
||||
"mysqlnd": {
|
||||
"type": "builtin",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"oci8": {
|
||||
"type": "wip",
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "no",
|
||||
"Darwin": "no",
|
||||
"Linux": "no"
|
||||
},
|
||||
"notes": true
|
||||
},
|
||||
"opcache": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom"
|
||||
},
|
||||
"openssl": {
|
||||
"notes": true,
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"openssl",
|
||||
"zlib"
|
||||
],
|
||||
"ext-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"parallel": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "parallel",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends-windows": [
|
||||
"pthreads4w"
|
||||
]
|
||||
},
|
||||
"password-argon2": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"libargon2"
|
||||
]
|
||||
},
|
||||
"pcntl": {
|
||||
"support": {
|
||||
"Windows": "no"
|
||||
},
|
||||
"type": "builtin",
|
||||
"unix-only": true
|
||||
},
|
||||
"pdo": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"pdo_mysql": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"ext-depends": [
|
||||
"pdo",
|
||||
"mysqlnd"
|
||||
]
|
||||
},
|
||||
"pdo_pgsql": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"ext-depends": [
|
||||
"pdo",
|
||||
"pgsql"
|
||||
],
|
||||
"lib-depends": [
|
||||
"postgresql"
|
||||
]
|
||||
},
|
||||
"pdo_sqlite": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"ext-depends": [
|
||||
"pdo",
|
||||
"sqlite3"
|
||||
],
|
||||
"lib-depends": [
|
||||
"sqlite"
|
||||
]
|
||||
},
|
||||
"pdo_sqlsrv": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "pdo_sqlsrv",
|
||||
"arg-type": "with",
|
||||
"ext-depends": [
|
||||
"pdo",
|
||||
"sqlsrv"
|
||||
]
|
||||
},
|
||||
"pgsql": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"postgresql"
|
||||
]
|
||||
},
|
||||
"phar": {
|
||||
"type": "builtin",
|
||||
"ext-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"posix": {
|
||||
"support": {
|
||||
"Windows": "no"
|
||||
},
|
||||
"type": "builtin",
|
||||
"unix-only": true
|
||||
},
|
||||
"protobuf": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "protobuf"
|
||||
},
|
||||
"rar": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip",
|
||||
"Darwin": "partial"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "rar",
|
||||
"cpp-extension": true
|
||||
},
|
||||
"readline": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"readline"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "redis",
|
||||
"arg-type": "custom",
|
||||
"ext-suggests": [
|
||||
"session",
|
||||
"igbinary"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"zstd",
|
||||
"liblz4"
|
||||
]
|
||||
},
|
||||
"session": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"shmop": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"simdjson": {
|
||||
"type": "external",
|
||||
"source": "ext-simdjson",
|
||||
"cpp-extension": true
|
||||
},
|
||||
"simplexml": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"xml"
|
||||
]
|
||||
},
|
||||
"snappy": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-snappy",
|
||||
"cpp-extension": true,
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"snappy"
|
||||
],
|
||||
"ext-suggest": [
|
||||
"apcu"
|
||||
]
|
||||
},
|
||||
"soap": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"xml"
|
||||
]
|
||||
},
|
||||
"sockets": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"sodium": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"lib-depends": [
|
||||
"libsodium"
|
||||
]
|
||||
},
|
||||
"sqlite3": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"sqlite"
|
||||
]
|
||||
},
|
||||
"sqlsrv": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "sqlsrv",
|
||||
"lib-depends": [
|
||||
"unixodbc"
|
||||
],
|
||||
"ext-depends-linux": [
|
||||
"pcntl"
|
||||
],
|
||||
"cpp-extension": true
|
||||
},
|
||||
"ssh2": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-ssh2",
|
||||
"arg-type": "with-prefix",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"libssh2"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"openssl",
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"swoole": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "swoole",
|
||||
"arg-type": "custom",
|
||||
"cpp-extension": true,
|
||||
"unix-only": true,
|
||||
"lib-depends": [
|
||||
"libcares",
|
||||
"brotli",
|
||||
"nghttp2",
|
||||
"zlib"
|
||||
],
|
||||
"ext-depends": [
|
||||
"openssl",
|
||||
"curl"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"swoole-hook-pgsql",
|
||||
"swoole-hook-mysql",
|
||||
"swoole-hook-sqlite"
|
||||
]
|
||||
},
|
||||
"swoole-hook-mysql": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "addon",
|
||||
"arg-type": "custom",
|
||||
"ext-depends": [
|
||||
"mysqlnd",
|
||||
"pdo",
|
||||
"pdo_mysql"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"mysqli"
|
||||
]
|
||||
},
|
||||
"swoole-hook-pgsql": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip",
|
||||
"Darwin": "partial"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "addon",
|
||||
"arg-type": "custom",
|
||||
"ext-depends": [
|
||||
"pgsql",
|
||||
"pdo"
|
||||
]
|
||||
},
|
||||
"swoole-hook-sqlite": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "addon",
|
||||
"arg-type": "custom",
|
||||
"ext-depends": [
|
||||
"sqlite3",
|
||||
"pdo"
|
||||
]
|
||||
},
|
||||
"swow": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "swow",
|
||||
"arg-type": "custom",
|
||||
"lib-suggests": [
|
||||
"openssl",
|
||||
"curl"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"openssl",
|
||||
"curl"
|
||||
]
|
||||
},
|
||||
"sysvmsg": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"unix-only": true
|
||||
},
|
||||
"sysvsem": {
|
||||
"support": {
|
||||
"Windows": "no",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"unix-only": true
|
||||
},
|
||||
"sysvshm": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin"
|
||||
},
|
||||
"tidy": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"tidy"
|
||||
]
|
||||
},
|
||||
"tokenizer": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"uuid": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-uuid",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"libuuid"
|
||||
]
|
||||
},
|
||||
"uv": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-uv",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"libuv"
|
||||
],
|
||||
"ext-depends": [
|
||||
"sockets"
|
||||
]
|
||||
},
|
||||
"xdebug": {
|
||||
"type": "builtin",
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "no",
|
||||
"Darwin": "no",
|
||||
"Linux": "no"
|
||||
},
|
||||
"notes": true
|
||||
},
|
||||
"xhprof": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "external",
|
||||
"source": "xhprof",
|
||||
"ext-depends": [
|
||||
"ctype"
|
||||
]
|
||||
},
|
||||
"xlswriter": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "xlswriter",
|
||||
"arg-type": "custom",
|
||||
"ext-depends": [
|
||||
"zlib",
|
||||
"zip"
|
||||
]
|
||||
},
|
||||
"xml": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"notes": true,
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"iconv"
|
||||
]
|
||||
},
|
||||
"xmlreader": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"xml",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"xmlwriter": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
],
|
||||
"ext-depends-windows": [
|
||||
"xml"
|
||||
]
|
||||
},
|
||||
"xsl": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"libxslt"
|
||||
],
|
||||
"ext-depends": [
|
||||
"xml",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"yac": {
|
||||
"support": {
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "yac",
|
||||
"arg-type-unix": "custom",
|
||||
"ext-depends-unix": [
|
||||
"igbinary"
|
||||
]
|
||||
},
|
||||
"yaml": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "yaml",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"libyaml"
|
||||
]
|
||||
},
|
||||
"zip": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"arg-type-windows": "enable",
|
||||
"lib-depends": [
|
||||
"libzip"
|
||||
]
|
||||
},
|
||||
"zlib": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "enable",
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"zstd": {
|
||||
"support": {
|
||||
"Windows": "wip",
|
||||
"BSD": "wip"
|
||||
},
|
||||
"type": "external",
|
||||
"source": "ext-zstd",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"zstd"
|
||||
]
|
||||
}
|
||||
}
|
||||
659
config/lib.json
Normal file
659
config/lib.json
Normal file
@@ -0,0 +1,659 @@
|
||||
{
|
||||
"brotli": {
|
||||
"source": "brotli",
|
||||
"static-libs-unix": [
|
||||
"libbrotlidec.a",
|
||||
"libbrotlienc.a",
|
||||
"libbrotlicommon.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"brotlicommon.lib",
|
||||
"brotlienc.lib",
|
||||
"brotlidec.lib"
|
||||
],
|
||||
"headers": [
|
||||
"brotli"
|
||||
]
|
||||
},
|
||||
"bzip2": {
|
||||
"source": "bzip2",
|
||||
"static-libs-unix": [
|
||||
"libbz2.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
[
|
||||
"libbz2.lib",
|
||||
"libbz2_a.lib"
|
||||
]
|
||||
],
|
||||
"headers": [
|
||||
"bzlib.h"
|
||||
]
|
||||
},
|
||||
"curl": {
|
||||
"source": "curl",
|
||||
"static-libs-unix": [
|
||||
"libcurl.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libcurl_a.lib"
|
||||
],
|
||||
"headers": [
|
||||
"curl"
|
||||
],
|
||||
"lib-depends-unix": [
|
||||
"openssl",
|
||||
"zlib"
|
||||
],
|
||||
"lib-depends-windows": [
|
||||
"openssl",
|
||||
"zlib",
|
||||
"libssh2",
|
||||
"nghttp2"
|
||||
],
|
||||
"lib-suggests-unix": [
|
||||
"libssh2",
|
||||
"brotli",
|
||||
"nghttp2",
|
||||
"zstd"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"brotli",
|
||||
"zstd"
|
||||
],
|
||||
"frameworks": [
|
||||
"CoreFoundation",
|
||||
"CoreServices",
|
||||
"SystemConfiguration"
|
||||
]
|
||||
},
|
||||
"freetype": {
|
||||
"source": "freetype",
|
||||
"static-libs-unix": [
|
||||
"libfreetype.a"
|
||||
],
|
||||
"headers-unix": [
|
||||
"freetype2/freetype/freetype.h",
|
||||
"freetype2/ft2build.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libpng",
|
||||
"bzip2",
|
||||
"brotli"
|
||||
]
|
||||
},
|
||||
"gettext": {
|
||||
"source": "gettext",
|
||||
"static-libs-unix": [
|
||||
"libintl.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libiconv"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"ncurses",
|
||||
"libxml2"
|
||||
],
|
||||
"frameworks": [
|
||||
"CoreFoundation"
|
||||
]
|
||||
},
|
||||
"glfw": {
|
||||
"source": "ext-glfw",
|
||||
"static-libs-unix": [
|
||||
"libglfw3.a"
|
||||
],
|
||||
"frameworks": [
|
||||
"CoreVideo",
|
||||
"OpenGL",
|
||||
"Cocoa",
|
||||
"IOKit"
|
||||
]
|
||||
},
|
||||
"gmp": {
|
||||
"source": "gmp",
|
||||
"static-libs-unix": [
|
||||
"libgmp.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libgmp.lib"
|
||||
],
|
||||
"headers": [
|
||||
"gmp.h"
|
||||
]
|
||||
},
|
||||
"icu": {
|
||||
"source": "icu",
|
||||
"cpp-library": true,
|
||||
"static-libs-unix": [
|
||||
"libicui18n.a",
|
||||
"libicuio.a",
|
||||
"libicuuc.a",
|
||||
"libicudata.a"
|
||||
]
|
||||
},
|
||||
"imagemagick": {
|
||||
"source": "imagemagick",
|
||||
"static-libs-unix": [
|
||||
"libMagick++-7.Q16HDRI.a",
|
||||
"libMagickWand-7.Q16HDRI.a",
|
||||
"libMagickCore-7.Q16HDRI.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib",
|
||||
"libpng",
|
||||
"libjpeg",
|
||||
"libwebp",
|
||||
"freetype",
|
||||
"libtiff"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"zstd",
|
||||
"xz",
|
||||
"bzip2",
|
||||
"libzip",
|
||||
"libxml2"
|
||||
]
|
||||
},
|
||||
"imap": {
|
||||
"source": "imap",
|
||||
"static-libs-unix": [
|
||||
"libc-client.a"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"ldap": {
|
||||
"source": "ldap",
|
||||
"static-libs-unix": [
|
||||
"liblber.a",
|
||||
"libldap.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"openssl",
|
||||
"zlib",
|
||||
"gmp",
|
||||
"libsodium"
|
||||
]
|
||||
},
|
||||
"libargon2": {
|
||||
"source": "libargon2",
|
||||
"static-libs-unix": [
|
||||
"libargon2.a"
|
||||
]
|
||||
},
|
||||
"libavif": {
|
||||
"source": "libavif",
|
||||
"static-libs-unix": [
|
||||
"libavif.a"
|
||||
]
|
||||
},
|
||||
"libcares": {
|
||||
"source": "libcares",
|
||||
"static-libs-unix": [
|
||||
"libcares.a"
|
||||
],
|
||||
"headers-unix": [
|
||||
"ares.h",
|
||||
"ares_dns.h",
|
||||
"ares_nameser.h",
|
||||
"ares_rules.h"
|
||||
]
|
||||
},
|
||||
"libevent": {
|
||||
"source": "libevent",
|
||||
"static-libs-unix": [
|
||||
"libevent.a",
|
||||
"libevent_core.a",
|
||||
"libevent_extra.a",
|
||||
"libevent_openssl.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"libffi": {
|
||||
"source": "libffi",
|
||||
"static-libs-unix": [
|
||||
"libffi.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libffi.lib"
|
||||
],
|
||||
"headers-unix": [
|
||||
"ffi.h",
|
||||
"ffitarget.h"
|
||||
],
|
||||
"headers-windows": [
|
||||
"ffi.h",
|
||||
"fficonfig.h",
|
||||
"ffitarget.h"
|
||||
]
|
||||
},
|
||||
"libffi-win": {
|
||||
"source": "libffi-win",
|
||||
"static-libs-windows": [
|
||||
"libffi.lib"
|
||||
],
|
||||
"headers-windows": [
|
||||
"ffi.h",
|
||||
"ffitarget.h",
|
||||
"fficonfig.h"
|
||||
]
|
||||
},
|
||||
"libiconv": {
|
||||
"source": "libiconv",
|
||||
"static-libs-unix": [
|
||||
"libiconv.a",
|
||||
"libcharset.a"
|
||||
],
|
||||
"headers": [
|
||||
"iconv.h",
|
||||
"libcharset.h",
|
||||
"localcharset.h"
|
||||
]
|
||||
},
|
||||
"libiconv-win": {
|
||||
"source": "libiconv-win",
|
||||
"static-libs-windows": [
|
||||
"libiconv.lib",
|
||||
"libiconv_a.lib"
|
||||
]
|
||||
},
|
||||
"libjpeg": {
|
||||
"source": "libjpeg",
|
||||
"static-libs-unix": [
|
||||
"libjpeg.a",
|
||||
"libturbojpeg.a"
|
||||
]
|
||||
},
|
||||
"liblz4": {
|
||||
"source": "liblz4",
|
||||
"static-libs-unix": [
|
||||
"liblz4.a"
|
||||
]
|
||||
},
|
||||
"libmemcached": {
|
||||
"source": "libmemcached",
|
||||
"static-libs-unix": [
|
||||
"libmemcached.a",
|
||||
"libmemcachedutil.a"
|
||||
]
|
||||
},
|
||||
"libpng": {
|
||||
"source": "libpng",
|
||||
"static-libs-unix": [
|
||||
"libpng16.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libpng16_static.lib"
|
||||
],
|
||||
"headers-unix": [
|
||||
"png.h",
|
||||
"pngconf.h",
|
||||
"pnglibconf.h"
|
||||
],
|
||||
"headers-windows": [
|
||||
"png.h",
|
||||
"pngconf.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"librabbitmq": {
|
||||
"source": "librabbitmq",
|
||||
"static-libs-unix": [
|
||||
"librabbitmq.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"rabbitmq.4.lib"
|
||||
],
|
||||
"lib-depends": [
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"libsodium": {
|
||||
"source": "libsodium",
|
||||
"static-libs-unix": [
|
||||
"libsodium.a"
|
||||
]
|
||||
},
|
||||
"libssh2": {
|
||||
"source": "libssh2",
|
||||
"static-libs-unix": [
|
||||
"libssh2.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libssh2.lib"
|
||||
],
|
||||
"headers": [
|
||||
"libssh2.h",
|
||||
"libssh2_publickey.h",
|
||||
"libssh2_sftp.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"openssl"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"libtiff": {
|
||||
"source": "libtiff",
|
||||
"static-libs-unix": [
|
||||
"libtiff.a"
|
||||
]
|
||||
},
|
||||
"libuuid": {
|
||||
"source": "libuuid",
|
||||
"static-libs-unix": [
|
||||
"libuuid.a"
|
||||
],
|
||||
"headers": [
|
||||
"uuid/uuid.h"
|
||||
]
|
||||
},
|
||||
"libuv": {
|
||||
"source": "libuv",
|
||||
"static-libs-unix": [
|
||||
"libuv.a"
|
||||
]
|
||||
},
|
||||
"libwebp": {
|
||||
"source": "libwebp",
|
||||
"static-libs-unix": [
|
||||
"libwebp.a",
|
||||
"libwebpdecoder.a",
|
||||
"libwebpdemux.a",
|
||||
"libwebpmux.a",
|
||||
"libsharpyuv.a"
|
||||
]
|
||||
},
|
||||
"libxml2": {
|
||||
"source": "libxml2",
|
||||
"static-libs-unix": [
|
||||
"libxml2.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libxml2s.lib",
|
||||
"libxml2_a.lib"
|
||||
],
|
||||
"headers": [
|
||||
"libxml2"
|
||||
],
|
||||
"lib-depends-unix": [
|
||||
"libiconv"
|
||||
],
|
||||
"lib-suggests-unix": [
|
||||
"xz",
|
||||
"icu",
|
||||
"zlib"
|
||||
],
|
||||
"lib-depends-windows": [
|
||||
"libiconv-win"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"libxslt": {
|
||||
"source": "libxslt",
|
||||
"static-libs-unix": [
|
||||
"libxslt.a",
|
||||
"libexslt.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
]
|
||||
},
|
||||
"libyaml": {
|
||||
"source": "libyaml",
|
||||
"static-libs-unix": [
|
||||
"libyaml.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"yaml.lib"
|
||||
],
|
||||
"headers": [
|
||||
"yaml.h"
|
||||
]
|
||||
},
|
||||
"libzip": {
|
||||
"source": "libzip",
|
||||
"static-libs-unix": [
|
||||
"libzip.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
[
|
||||
"zip.lib",
|
||||
"libzip_a.lib"
|
||||
]
|
||||
],
|
||||
"headers": [
|
||||
"zip.h",
|
||||
"zipconf.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"bzip2",
|
||||
"xz",
|
||||
"zstd",
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"ncurses": {
|
||||
"source": "ncurses",
|
||||
"static-libs-unix": [
|
||||
"libncurses.a"
|
||||
]
|
||||
},
|
||||
"nghttp2": {
|
||||
"source": "nghttp2",
|
||||
"static-libs-unix": [
|
||||
"libnghttp2.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"nghttp2.lib"
|
||||
],
|
||||
"headers": [
|
||||
"nghttp2"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib",
|
||||
"openssl"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libxml2"
|
||||
]
|
||||
},
|
||||
"onig": {
|
||||
"source": "onig",
|
||||
"static-libs-unix": [
|
||||
"libonig.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"onig.lib",
|
||||
"onig_a.lib"
|
||||
],
|
||||
"headers": [
|
||||
"oniggnu.h",
|
||||
"oniguruma.h"
|
||||
]
|
||||
},
|
||||
"openssl": {
|
||||
"source": "openssl",
|
||||
"static-libs-unix": [
|
||||
"libssl.a",
|
||||
"libcrypto.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libssl.lib",
|
||||
"libcrypto.lib"
|
||||
],
|
||||
"headers": [
|
||||
"openssl"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"pkg-config": {
|
||||
"source": "pkg-config"
|
||||
},
|
||||
"postgresql": {
|
||||
"source": "postgresql",
|
||||
"static-libs-unix": [
|
||||
"libpq.a",
|
||||
"libpgport.a",
|
||||
"libpgcommon.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libiconv",
|
||||
"libxml2",
|
||||
"openssl",
|
||||
"zlib",
|
||||
"readline"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"icu",
|
||||
"libxslt",
|
||||
"ldap",
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
"pthreads4w": {
|
||||
"source": "pthreads4w",
|
||||
"static-libs-windows": [
|
||||
"libpthreadVC3.lib"
|
||||
]
|
||||
},
|
||||
"qdbm": {
|
||||
"source": "qdbm",
|
||||
"static-libs-unix": [
|
||||
"libqdbm.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"qdbm_a.lib"
|
||||
],
|
||||
"headers-windows": [
|
||||
"depot.h"
|
||||
]
|
||||
},
|
||||
"readline": {
|
||||
"source": "readline",
|
||||
"static-libs-unix": [
|
||||
"libreadline.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"ncurses"
|
||||
]
|
||||
},
|
||||
"snappy": {
|
||||
"source": "snappy",
|
||||
"static-libs-unix": [
|
||||
"libsnappy.a"
|
||||
],
|
||||
"headers-unix": [
|
||||
"snappy.h",
|
||||
"snappy-c.h",
|
||||
"snappy-sinksource.h",
|
||||
"snappy-stubs-public.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"sqlite": {
|
||||
"source": "sqlite",
|
||||
"static-libs-unix": [
|
||||
"libsqlite3.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"libsqlite3_a.lib"
|
||||
],
|
||||
"headers": [
|
||||
"sqlite3.h",
|
||||
"sqlite3ext.h"
|
||||
]
|
||||
},
|
||||
"tidy": {
|
||||
"source": "tidy",
|
||||
"static-libs-unix": [
|
||||
"libtidy.a"
|
||||
]
|
||||
},
|
||||
"unixodbc": {
|
||||
"source": "unixodbc",
|
||||
"static-libs-unix": [
|
||||
"libodbc.a",
|
||||
"libodbccr.a",
|
||||
"libodbcinst.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libiconv"
|
||||
]
|
||||
},
|
||||
"xz": {
|
||||
"source": "xz",
|
||||
"static-libs-unix": [
|
||||
"liblzma.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
[
|
||||
"liblzma.lib",
|
||||
"liblzma_a.lib"
|
||||
]
|
||||
],
|
||||
"headers-unix": [
|
||||
"lzma"
|
||||
],
|
||||
"headers-windows": [
|
||||
"lzma",
|
||||
"lzma.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libiconv"
|
||||
]
|
||||
},
|
||||
"zlib": {
|
||||
"source": "zlib",
|
||||
"static-libs-unix": [
|
||||
"libz.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"zlib_a.lib"
|
||||
],
|
||||
"headers": [
|
||||
"zlib.h",
|
||||
"zconf.h"
|
||||
]
|
||||
},
|
||||
"zstd": {
|
||||
"source": "zstd",
|
||||
"static-libs-unix": [
|
||||
"libzstd.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
[
|
||||
"zstd.lib",
|
||||
"zstd_static.lib"
|
||||
]
|
||||
],
|
||||
"headers-unix": [
|
||||
"zdict.h",
|
||||
"zstd.h",
|
||||
"zstd_errors.h"
|
||||
],
|
||||
"headers-windows": [
|
||||
"zstd.h",
|
||||
"zstd_errors.h"
|
||||
]
|
||||
}
|
||||
}
|
||||
46
config/pkg.json
Normal file
46
config/pkg.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"musl-toolchain-aarch64-linux": {
|
||||
"type": "url",
|
||||
"url": "https://dl.static-php.dev/static-php-cli/deps/musl-toolchain/aarch64-musl-toolchain.tgz"
|
||||
},
|
||||
"musl-toolchain-x86_64-linux": {
|
||||
"type": "url",
|
||||
"url": "https://dl.static-php.dev/static-php-cli/deps/musl-toolchain/x86_64-musl-toolchain.tgz"
|
||||
},
|
||||
"nasm-x86_64-win": {
|
||||
"type": "url",
|
||||
"url": "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip",
|
||||
"extract-files": {
|
||||
"nasm-2.16.01/nasm.exe": "{php_sdk_path}/bin/nasm.exe",
|
||||
"nasm-2.16.01/ndisasm.exe": "{php_sdk_path}/bin/ndisasm.exe"
|
||||
}
|
||||
},
|
||||
"strawberry-perl-x86_64-win": {
|
||||
"type": "url",
|
||||
"url": "https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_5380_5361/strawberry-perl-5.38.0.1-64bit-portable.zip"
|
||||
},
|
||||
"upx-aarch64-linux": {
|
||||
"type": "ghrel",
|
||||
"repo": "upx/upx",
|
||||
"match": "upx.+-arm64_linux\\.tar\\.xz",
|
||||
"extract-files": {
|
||||
"upx": "{pkg_root_path}/bin/upx"
|
||||
}
|
||||
},
|
||||
"upx-x86_64-linux": {
|
||||
"type": "ghrel",
|
||||
"repo": "upx/upx",
|
||||
"match": "upx.+-amd64_linux\\.tar\\.xz",
|
||||
"extract-files": {
|
||||
"upx": "{pkg_root_path}/bin/upx"
|
||||
}
|
||||
},
|
||||
"upx-x86_64-win": {
|
||||
"type": "ghrel",
|
||||
"repo": "upx/upx",
|
||||
"match": "upx.+-win64\\.zip",
|
||||
"extract-files": {
|
||||
"upx-*-win64/upx.exe": "{pkg_root_path}/bin/upx.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
747
config/source.json
Normal file
747
config/source.json
Normal file
@@ -0,0 +1,747 @@
|
||||
{
|
||||
"php-src": {
|
||||
"type": "custom",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"amqp": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/amqp",
|
||||
"path": "php-src/ext/amqp",
|
||||
"filename": "amqp.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"apcu": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/APCu",
|
||||
"path": "php-src/ext/apcu",
|
||||
"filename": "apcu.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"brotli": {
|
||||
"type": "ghtar",
|
||||
"repo": "google/brotli",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"bzip2": {
|
||||
"type": "filelist",
|
||||
"url": "https://sourceware.org/pub/bzip2/",
|
||||
"regex": "/href=\"(?<file>bzip2-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "text",
|
||||
"text": "This program, \"bzip2\", the associated library \"libbzip2\", and all documentation, are copyright (C) 1996-2010 Julian R Seward. All rights reserved. \n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n 2. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.\n 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.\n 4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nJulian Seward, jseward@bzip.org bzip2/libbzip2 version 1.0.6 of 6 September 2010\n\nPATENTS: To the best of my knowledge, bzip2 and libbzip2 do not use any patented algorithms. However, I do not have the resources to carry out a patent search. Therefore I cannot give any guarantee of the above statement."
|
||||
}
|
||||
},
|
||||
"curl": {
|
||||
"type": "ghrel",
|
||||
"repo": "curl/curl",
|
||||
"match": "curl.+\\.tar\\.xz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"ext-ds": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ds",
|
||||
"path": "php-src/ext/ds",
|
||||
"filename": "ds.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-event": {
|
||||
"type": "url",
|
||||
"url": "https://bitbucket.org/osmanov/pecl-event/get/3.0.8.tar.gz",
|
||||
"path": "php-src/ext/event",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-glfw": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mario-deluna/php-glfw",
|
||||
"rev": "master",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-imagick": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/imagick",
|
||||
"path": "php-src/ext/imagick",
|
||||
"filename": "imagick.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-memcache": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/memcache",
|
||||
"path": "php-src/ext/memcache",
|
||||
"filename": "memcache.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-simdjson": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/simdjson",
|
||||
"path": "php-src/ext/simdjson",
|
||||
"filename": "simdjson.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-snappy": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/snappy",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/kjdev/php-ext-snappy",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-ssh2": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ssh2",
|
||||
"path": "php-src/ext/ssh2",
|
||||
"filename": "ssh2.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-uuid": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/uuid",
|
||||
"path": "php-src/ext/uuid",
|
||||
"filename": "uuid.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-uv": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/uv",
|
||||
"path": "php-src/ext/uv",
|
||||
"filename": "uv.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-zstd": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/zstd",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/kjdev/php-ext-zstd",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"freetype": {
|
||||
"type": "git",
|
||||
"rev": "VER-2-13-2",
|
||||
"url": "https://github.com/freetype/freetype",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.TXT"
|
||||
}
|
||||
},
|
||||
"gettext": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/pub/gnu/gettext/",
|
||||
"regex": "/href=\"(?<file>gettext-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"gmp": {
|
||||
"type": "ghtagtar",
|
||||
"repo": "alisw/GMP",
|
||||
"license": {
|
||||
"type": "text",
|
||||
"text": "Since version 6, GMP is distributed under the dual licenses, GNU LGPL v3 and GNU GPL v2. These licenses make the library free to use, share, and improve, and allow you to pass on the result. The GNU licenses give freedoms, but also set firm restrictions on the use with non-free programs."
|
||||
}
|
||||
},
|
||||
"icu": {
|
||||
"type": "ghrel",
|
||||
"repo": "unicode-org/icu",
|
||||
"match": "icu4c.+-src\\.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"igbinary": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/igbinary",
|
||||
"path": "php-src/ext/igbinary",
|
||||
"filename": "igbinary.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"imagemagick": {
|
||||
"type": "ghtar",
|
||||
"repo": "ImageMagick/ImageMagick",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"imap": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/imap.git",
|
||||
"rev": "master",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"inotify": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/inotify",
|
||||
"path": "php-src/ext/inotify",
|
||||
"filename": "inotify.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ldap": {
|
||||
"type": "filelist",
|
||||
"url": "https://www.openldap.org/software/download/OpenLDAP/openldap-release/",
|
||||
"regex": "/href=\"(?<file>openldap-(?<version>[^\"]+)\\.tgz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libargon2": {
|
||||
"type": "git",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/static-php/phc-winner-argon2",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libavif": {
|
||||
"type": "ghtar",
|
||||
"repo": "AOMediaCodec/libavif",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libcares": {
|
||||
"type": "ghrel",
|
||||
"repo": "c-ares/c-ares",
|
||||
"match": "c-ares-.+\\.tar\\.gz",
|
||||
"alt": {
|
||||
"type": "filelist",
|
||||
"url": "https://c-ares.org/download/",
|
||||
"regex": "/href=\"\\/download\\/(?<file>c-ares-(?<version>[^\"]+)\\.tar\\.gz)\"/"
|
||||
},
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.md"
|
||||
}
|
||||
},
|
||||
"libevent": {
|
||||
"type": "ghrel",
|
||||
"repo": "libevent/libevent",
|
||||
"match": "libevent.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libffi": {
|
||||
"type": "ghrel",
|
||||
"repo": "libffi/libffi",
|
||||
"match": "libffi.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libffi-win": {
|
||||
"type": "git",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/static-php/libffi-win.git",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libiconv": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/gnu/libiconv/",
|
||||
"regex": "/href=\"(?<file>libiconv-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libiconv-win": {
|
||||
"type": "git",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/static-php/libiconv-win.git",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "source/COPYING"
|
||||
}
|
||||
},
|
||||
"libjpeg": {
|
||||
"type": "ghtar",
|
||||
"repo": "libjpeg-turbo/libjpeg-turbo",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.md"
|
||||
}
|
||||
},
|
||||
"liblz4": {
|
||||
"type": "ghrel",
|
||||
"repo": "lz4/lz4",
|
||||
"match": "lz4-.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libmemcached": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/libmemcached-macos.git",
|
||||
"rev": "master",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libpng": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/glennrp/libpng.git",
|
||||
"rev": "libpng16",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"librabbitmq": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alanxz/rabbitmq-c.git",
|
||||
"rev": "master",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libsodium": {
|
||||
"type": "ghrel",
|
||||
"repo": "jedisct1/libsodium",
|
||||
"match": "libsodium-\\d+(\\.\\d+)*\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libssh2": {
|
||||
"type": "ghrel",
|
||||
"repo": "libssh2/libssh2",
|
||||
"match": "libssh2.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libtiff": {
|
||||
"type": "filelist",
|
||||
"url": "https://download.osgeo.org/libtiff/",
|
||||
"regex": "/href=\"(?<file>tiff-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.md"
|
||||
}
|
||||
},
|
||||
"libuuid": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/libuuid.git",
|
||||
"rev": "master",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libuv": {
|
||||
"type": "ghtar",
|
||||
"repo": "libuv/libuv",
|
||||
"license": [
|
||||
{
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"path": "LICENSE-extra"
|
||||
}
|
||||
]
|
||||
},
|
||||
"libwebp": {
|
||||
"type": "url",
|
||||
"url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libxml2": {
|
||||
"type": "url",
|
||||
"url": "https://github.com/GNOME/libxml2/archive/refs/tags/v2.12.5.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "Copyright"
|
||||
}
|
||||
},
|
||||
"libxslt": {
|
||||
"type": "filelist",
|
||||
"url": "https://download.gnome.org/sources/libxslt/1.1/",
|
||||
"regex": "/href=\"(?<file>libxslt-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libyaml": {
|
||||
"type": "ghrel",
|
||||
"repo": "yaml/libyaml",
|
||||
"match": "yaml-.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "License"
|
||||
}
|
||||
},
|
||||
"libzip": {
|
||||
"type": "ghrel",
|
||||
"repo": "nih-at/libzip",
|
||||
"match": "libzip.+\\.tar\\.xz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"memcached": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/memcached",
|
||||
"path": "php-src/ext/memcached",
|
||||
"filename": "memcached.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"micro": {
|
||||
"type": "git",
|
||||
"path": "php-src/sapi/micro",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/easysoft/phpmicro",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"mongodb": {
|
||||
"type": "ghrel",
|
||||
"repo": "mongodb/mongo-php-driver",
|
||||
"path": "php-src/ext/mongodb",
|
||||
"match": "mongodb.+\\.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ncurses": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/pub/gnu/ncurses/",
|
||||
"regex": "/href=\"(?<file>ncurses-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"nghttp2": {
|
||||
"type": "ghrel",
|
||||
"repo": "nghttp2/nghttp2",
|
||||
"match": "nghttp2.+\\.tar\\.xz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"onig": {
|
||||
"type": "ghrel",
|
||||
"repo": "kkos/oniguruma",
|
||||
"match": "onig-.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"openssl": {
|
||||
"type": "filelist",
|
||||
"url": "https://www.openssl.org/source/",
|
||||
"regex": "/href=\"(?<file>openssl-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.txt"
|
||||
}
|
||||
},
|
||||
"parallel": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/parallel",
|
||||
"path": "php-src/ext/parallel",
|
||||
"filename": "parallel.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"pdo_sqlsrv": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/pdo_sqlsrv",
|
||||
"path": "php-src/ext/pdo_sqlsrv",
|
||||
"filename": "pdo_sqlsrv.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"pkg-config": {
|
||||
"type": "url",
|
||||
"url": "https://dl.static-php.dev/static-php-cli/deps/pkg-config/pkg-config-0.29.2.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"postgresql": {
|
||||
"type": "url",
|
||||
"url": "https://ftp.postgresql.org/pub/source/v16.2/postgresql-16.2.tar.bz2",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYRIGHT"
|
||||
}
|
||||
},
|
||||
"protobuf": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/protobuf",
|
||||
"path": "php-src/ext/protobuf",
|
||||
"filename": "protobuf.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"pthreads4w": {
|
||||
"type": "git",
|
||||
"rev": "master",
|
||||
"url": "https://git.code.sf.net/p/pthreads4w/code",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"qdbm": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/qdbm.git",
|
||||
"rev": "main",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"rar": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/php-rar.git",
|
||||
"path": "php-src/ext/rar",
|
||||
"rev": "issue-php82",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"readline": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/pub/gnu/readline/",
|
||||
"regex": "/href=\"(?<file>readline-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"redis": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/redis",
|
||||
"rev": "5.3.7",
|
||||
"url": "https://github.com/phpredis/phpredis",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"snappy": {
|
||||
"type": "git",
|
||||
"repo": "google/snappy",
|
||||
"rev": "main",
|
||||
"url": "https://github.com/google/snappy",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"sqlite": {
|
||||
"type": "url",
|
||||
"url": "https://www.sqlite.org/2023/sqlite-autoconf-3430200.tar.gz",
|
||||
"license": {
|
||||
"type": "text",
|
||||
"text": "The author disclaims copyright to this source code. In place of\na legal notice, here is a blessing:\n\n * May you do good and not evil.\n * May you find forgiveness for yourself and forgive others.\n * May you share freely, never taking more than you give."
|
||||
}
|
||||
},
|
||||
"sqlsrv": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/sqlsrv",
|
||||
"path": "php-src/ext/sqlsrv",
|
||||
"filename": "sqlsrv.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"swoole": {
|
||||
"type": "ghtar",
|
||||
"path": "php-src/ext/swoole",
|
||||
"repo": "swoole/swoole-src",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"swow": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/swow-src",
|
||||
"rev": "ci",
|
||||
"url": "https://github.com/swow/swow",
|
||||
"patch": "patchSwow",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"tidy": {
|
||||
"type": "url",
|
||||
"url": "https://github.com/htacg/tidy-html5/archive/refs/tags/5.8.0.tar.gz",
|
||||
"filename": "tidy-html5.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "README/LICENSE.md"
|
||||
}
|
||||
},
|
||||
"unixodbc": {
|
||||
"type": "url",
|
||||
"url": "https://www.unixodbc.org/unixODBC-2.3.12.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"xhprof": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/xhprof",
|
||||
"path": "php-src/ext/xhprof-src",
|
||||
"filename": "xhprof.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"xlswriter": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/xlswriter",
|
||||
"path": "php-src/ext/xlswriter",
|
||||
"filename": "xlswriter.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"xz": {
|
||||
"type": "url",
|
||||
"url": "https://fossies.org/linux/misc/xz-5.4.6.tar.xz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"yac": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/yac",
|
||||
"path": "php-src/ext/yac",
|
||||
"filename": "yac.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"yaml": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/yaml",
|
||||
"rev": "php7",
|
||||
"url": "https://github.com/php/pecl-file_formats-yaml",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"zlib": {
|
||||
"type": "ghrel",
|
||||
"repo": "madler/zlib",
|
||||
"match": "zlib.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "text",
|
||||
"text": "(C) 1995-2022 Jean-loup Gailly and Mark Adler\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n claim that you wrote the original software. If you use this software\n in a product, an acknowledgment in the product documentation would be\n appreciated but is not required.\n2. Altered source versions must be plainly marked as such, and must not be\n misrepresented as being the original software.\n3. This notice may not be removed or altered from any source distribution.\n\nJean-loup Gailly Mark Adler\njloup@gzip.org madler@alumni.caltech.edu"
|
||||
}
|
||||
},
|
||||
"zstd": {
|
||||
"type": "ghrel",
|
||||
"repo": "facebook/zstd",
|
||||
"match": "zstd.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# define script basic information
|
||||
# Version of this Dockerfile
|
||||
ENV SCRIPT_VERSION=1.3.3
|
||||
# Download address uses backup address
|
||||
# (if downloading slowly, consider set it to yes)
|
||||
ENV USE_BACKUP=no
|
||||
|
||||
# Version of some manually-installed package
|
||||
ENV VER_PHP=7.4.21
|
||||
|
||||
# APK repositories mirror address, if u r not in China, consider set USE_BACKUP=yes to boost
|
||||
ENV LINK_APK_REPO='mirrors.ustc.edu.cn'
|
||||
ENV LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
|
||||
|
||||
RUN if [ "${USE_BACKUP}" = "yes" ]; then \
|
||||
echo "Using backup address..." && sleep 3s; \
|
||||
else \
|
||||
echo "Using original address..." && sleep 3s; \
|
||||
fi
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories
|
||||
|
||||
# build requirements
|
||||
RUN apk add bash wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses
|
||||
# php zlib dependencies
|
||||
RUN apk add zlib-dev zlib-static
|
||||
# php mbstring dependencies
|
||||
RUN apk add oniguruma-dev
|
||||
# php openssl dependencies
|
||||
RUN apk add openssl-libs-static openssl-dev openssl
|
||||
# php gd dependencies
|
||||
RUN apk add libpng-dev libpng-static
|
||||
# curl c-ares dependencies
|
||||
RUN apk add c-ares-static c-ares-dev
|
||||
# php event dependencies
|
||||
RUN apk add libevent libevent-dev libevent-static
|
||||
# php sqlite3 dependencies
|
||||
RUN apk add sqlite sqlite-dev sqlite-libs sqlite-static
|
||||
|
||||
RUN mkdir /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ac_override_1 /app/
|
||||
COPY ac_override_2 /app/
|
||||
COPY download.sh /app/
|
||||
COPY config.json /app/
|
||||
|
||||
RUN chmod +x /app/download.sh
|
||||
|
||||
RUN ./download.sh swoole ${USE_BACKUP} && \
|
||||
./download.sh inotify ${USE_BACKUP} && \
|
||||
./download.sh mongodb ${USE_BACKUP} && \
|
||||
./download.sh event ${USE_BACKUP} && \
|
||||
./download.sh redis ${USE_BACKUP} && \
|
||||
./download.sh libxml2 ${USE_BACKUP} && \
|
||||
./download.sh liblzma ${USE_BACKUP} && \
|
||||
./download.sh curl ${USE_BACKUP}
|
||||
|
||||
RUN ./download.sh php ${USE_BACKUP} ${VER_PHP}
|
||||
|
||||
COPY extensions.txt /app/
|
||||
COPY check-extensions.sh /app/
|
||||
COPY compile-php.sh /app/
|
||||
|
||||
RUN chmod +x ./check-extensions.sh && \
|
||||
chmod +x ./compile-php.sh
|
||||
|
||||
RUN ./check-extensions.sh check_before_configure
|
||||
|
||||
RUN ./compile-php.sh ${VER_PHP}
|
||||
@@ -1,3 +0,0 @@
|
||||
AC_DEFUN([PHP_CHECK_LIBRARY], [
|
||||
$3
|
||||
])
|
||||
@@ -1,18 +0,0 @@
|
||||
AC_DEFUN([PHP_CHECK_LIBRARY], [
|
||||
save_old_LDFLAGS=$LDFLAGS
|
||||
ac_stuff="$5"
|
||||
|
||||
save_ext_shared=$ext_shared
|
||||
ext_shared=yes
|
||||
PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS)
|
||||
AC_CHECK_LIB([$1],[$2],[
|
||||
LDFLAGS=$save_old_LDFLAGS
|
||||
ext_shared=$save_ext_shared
|
||||
$3
|
||||
],[
|
||||
LDFLAGS=$save_old_LDFLAGS
|
||||
ext_shared=$save_ext_shared
|
||||
unset ac_cv_lib_$1[]_$2
|
||||
$4
|
||||
])dnl
|
||||
])
|
||||
@@ -1,232 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Here are 3 steps in configuration of extensions
|
||||
# before_configure
|
||||
# in_configure
|
||||
# after_configure
|
||||
|
||||
self_dir=$(cd "$(dirname "$0")";pwd)
|
||||
php_dir=$(find $self_dir/source -name "php-*" -type d | tail -n1)
|
||||
|
||||
function do_xml_compiler() {
|
||||
cd $self_dir/source/liblzma-* && \
|
||||
./configure && \
|
||||
make -j4 && \
|
||||
make install && \
|
||||
echo "liblzma compiled!" && sleep 2s && \
|
||||
cd ../libxml2-* && \
|
||||
./configure --prefix=/usr --with-lzma --without-python && \
|
||||
make -j4 && \
|
||||
make install && \
|
||||
echo "libxml2 compiled!" && sleep 2s
|
||||
}
|
||||
|
||||
function do_curl_compiler() {
|
||||
cd $self_dir/source/curl-* && \
|
||||
CC=gcc CXX=g++ CFLAGS=-fPIC CPPFLAGS=-fPIC ./configure \
|
||||
--without-nghttp2 \
|
||||
--with-ssl=/usr \
|
||||
--with-pic=pic \
|
||||
--enable-ipv6 \
|
||||
--enable-shared=no \
|
||||
--without-libidn2 \
|
||||
--disable-ldap \
|
||||
--without-libpsl \
|
||||
--without-lber \
|
||||
--enable-ares && \
|
||||
make -j4 && \
|
||||
make install && \
|
||||
echo "curl compiled!" && \
|
||||
cat "$self_dir/ac_override_1" "$php_dir/ext/curl/config.m4" "$self_dir/ac_override_2" > /tmp/aa && \
|
||||
mv /tmp/aa "$php_dir/ext/curl/config.m4"
|
||||
}
|
||||
|
||||
function do_copy_extension() {
|
||||
ext_dir=$(find $self_dir/source -name "$1-*" -type d | tail -n1)
|
||||
mv $ext_dir $php_dir/ext/$1
|
||||
if [ $? != 0 ]; then
|
||||
echo "Compile error! ext: $1, ext_dir=$ext_dir"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function check_before_configure() {
|
||||
list=$(cat "$self_dir/extensions.txt" | grep -v "^#" | grep -v "^$")
|
||||
xml_sign="no"
|
||||
for loop in $list
|
||||
do
|
||||
case $loop in
|
||||
bcmath) ;;
|
||||
calendar) ;;
|
||||
ctype) ;;
|
||||
filter) ;;
|
||||
gd) ;;
|
||||
hash) ;;
|
||||
iconv) ;;
|
||||
json) ;;
|
||||
mbstring) ;;
|
||||
mysqlnd) ;;
|
||||
openssl) ;;
|
||||
pcntl) ;;
|
||||
pdo) ;;
|
||||
pdo_mysql) ;;
|
||||
phar) ;;
|
||||
posix) ;;
|
||||
sockets) ;;
|
||||
sqlite3) ;;
|
||||
tokenizer) ;;
|
||||
zlib) ;;
|
||||
curl)
|
||||
do_curl_compiler
|
||||
if [ $? != 0 ]; then
|
||||
echo "Compile curl error!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
dom|xml|libxml|xmlreader|xmlwriter|simplexml)
|
||||
if [ "$xml_sign" = "no" ]; then
|
||||
do_xml_compiler
|
||||
if [ $? != 0 ]; then
|
||||
echo "Compile curl error!"
|
||||
exit 1
|
||||
fi
|
||||
xml_sign="yes"
|
||||
fi
|
||||
;;
|
||||
inotify) do_copy_extension inotify ;;
|
||||
redis) do_copy_extension redis ;;
|
||||
swoole) do_copy_extension swoole ;;
|
||||
mongodb) do_copy_extension mongodb ;;
|
||||
event)
|
||||
PHP_EVENT=' PHP_EVENT_PHP_VERSION=$PHP_VERSION '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_EVENT_PHP_VERSION_ID=$PHP_VERSION_ID '
|
||||
PHP_EVENT="$PHP_EVENT"'\n if test -z "$PHP_EVENT_PHP_VERSION"; then '
|
||||
PHP_EVENT="$PHP_EVENT"'\n AC_MSG_ERROR(\[unknown source with no php version\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_EVENT_SUBDIR="." '
|
||||
PHP_EVENT="$PHP_EVENT"'\n fi '
|
||||
PHP_EVENT="$PHP_EVENT"'\n if test "$PHP_EVENT_PHP_VERSION_ID" -ge "80000"; then '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_EVENT_SUBDIR=php8 '
|
||||
PHP_EVENT="$PHP_EVENT"'\n AC_MSG_RESULT(\[PHP 8.x\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n elif test "$PHP_EVENT_PHP_VERSION_ID" -ge "70000"; then '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_EVENT_SUBDIR=php7 '
|
||||
PHP_EVENT="$PHP_EVENT"'\n AC_MSG_RESULT(\[PHP 7.x\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n elif test "$PHP_EVENT_PHP_VERSION_ID" -ge "50000"; then '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_EVENT_SUBDIR=php5 '
|
||||
PHP_EVENT="$PHP_EVENT"'\n AC_MSG_RESULT(\[PHP 5.x\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n else '
|
||||
PHP_EVENT="$PHP_EVENT"'\n AC_MSG_ERROR(\[unknown source lol\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_EVENT_SUBDIR="." '
|
||||
PHP_EVENT="$PHP_EVENT"'\n fi '
|
||||
PHP_EVENT="$PHP_EVENT"'\n echo PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR '
|
||||
PHP_EVENT="$PHP_EVENT"'\n echo PHP_EXT_BUILDDIR(event)\/$PHP_EVENT_SUBDIR '
|
||||
PHP_EVENT="$PHP_EVENT"'\n if test "$PHP_EVENT_SUBDIR" -ne "."; then '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_ADD_BUILD_DIR(PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR, 1) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_ADD_BUILD_DIR(PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR\/classes, 1) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_ADD_BUILD_DIR(PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR\/src, 1) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(event)\/\[$PHP_EVENT_SUBDIR\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(event)\/\[$PHP_EVENT_SUBDIR\/classes\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(event)\/\[$PHP_EVENT_SUBDIR\/src\]) '
|
||||
PHP_EVENT="$PHP_EVENT"'\n fi '
|
||||
|
||||
do_copy_extension event && \
|
||||
sed -ie 's/PHP_EVENT_SUBDIR="."//g' $php_dir/ext/event/config.m4 && \
|
||||
sed -ie 's/AC_MSG_ERROR(\[unknown source\])/'"$PHP_EVENT"'/g' $php_dir/ext/event/config.m4
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function check_in_configure() {
|
||||
php_configure=""
|
||||
list=$(cat "$self_dir/extensions.txt" | sed 's/#.*//g' | sed -e 's/[ ]*$//g' | grep -v "^\s*$")
|
||||
for loop in $list
|
||||
do
|
||||
case $loop in
|
||||
bcmath) php_configure="$php_configure --enable-bcmath" ;;
|
||||
calendar) php_configure="$php_configure --enable-calendar" ;;
|
||||
ctype) php_configure="$php_configure --enable-ctype" ;;
|
||||
curl) php_configure="$php_configure --with-curl" ;;
|
||||
dom) php_configure="$php_configure --enable-dom" ;;
|
||||
event) php_configure="$php_configure --with-event-core --with-event-extra --with-event-openssl --with-event-extra --disable-event-sockets" ;;
|
||||
filter) php_configure="$php_configure --enable-filter" ;;
|
||||
gd)
|
||||
case $1 in
|
||||
7.3.*|7.2.*) php_configure="$php_configure --with-gd" ;;
|
||||
7.4.*|8.*) php_configure="$php_configure --enable-gd" ;;
|
||||
esac
|
||||
;;
|
||||
hash)
|
||||
case $1 in
|
||||
7.3.*|7.2.*) php_configure="$php_configure --enable-hash" ;;
|
||||
esac
|
||||
;;
|
||||
iconv) php_configure="$php_configure --with-iconv" ;;
|
||||
inotify) php_configure="$php_configure --enable-inotify" ;;
|
||||
json)
|
||||
case $1 in
|
||||
7.*) php_configure="$php_configure --enable-json" ;;
|
||||
esac
|
||||
;;
|
||||
libxml)
|
||||
case $1 in
|
||||
7.3.*|7.2.*) php_configure="$php_configure --enable-libxml" ;;
|
||||
7.4.*|8.*) php_configure="$php_configure --with-libxml" ;;
|
||||
esac
|
||||
;;
|
||||
mbstring) php_configure="$php_configure --enable-mbstring" ;;
|
||||
mongodb) php_configure="$php_configure --enable-mongodb" ;;
|
||||
mysqlnd) php_configure="$php_configure --enable-mysqlnd" ;;
|
||||
openssl) php_configure="$php_configure --with-openssl --with-openssl-dir=/usr" ;;
|
||||
pcntl) php_configure="$php_configure --enable-pcntl" ;;
|
||||
pdo) php_configure="$php_configure --enable-pdo" ;;
|
||||
pdo_mysql) php_configure="$php_configure --with-pdo-mysql=mysqlnd" ;;
|
||||
phar) php_configure="$php_configure --enable-phar" ;;
|
||||
posix) php_configure="$php_configure --enable-posix" ;;
|
||||
redis) php_configure="$php_configure --enable-redis --disable-redis-session" ;;
|
||||
simplexml) php_configure="$php_configure --enable-simplexml" ;;
|
||||
sockets) php_configure="$php_configure --enable-sockets" ;;
|
||||
sqlite3) php_configure="$php_configure --with-sqlite3" ;;
|
||||
|
||||
swoole)
|
||||
php_configure="$php_configure --enable-swoole"
|
||||
have_openssl=$(echo $list | grep openssl)
|
||||
if [ "$have_openssl" != "" ]; then
|
||||
php_configure="$php_configure --enable-openssl --with-openssl --with-openssl-dir=/usr"
|
||||
fi
|
||||
have_hash=$(echo $list | grep hash)
|
||||
if [ "$have_hash" = "" ]; then
|
||||
case $1 in
|
||||
7.3.*|7.2.*) php_configure="$php_configure --enable-hash" ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
tokenizer) php_configure="$php_configure --enable-tokenizer" ;;
|
||||
xml) php_configure="$php_configure --enable-xml" ;;
|
||||
xmlreader) php_configure="$php_configure --enable-xmlreader" ;;
|
||||
xmlwriter) php_configure="$php_configure --enable-xmlwriter" ;;
|
||||
zlib) php_configure="$php_configure --with-zlib" ;;
|
||||
*)
|
||||
echo "Unsupported extension '$loop' !" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo $php_configure
|
||||
}
|
||||
|
||||
function check_after_configure() {
|
||||
list=$(cat "$self_dir/extensions.txt" | grep -v "^#" | grep -v "^$")
|
||||
for loop in $list
|
||||
do
|
||||
case $loop in
|
||||
swoole)
|
||||
sed -ie 's/swoole_clock_gettime(CLOCK_REALTIME/clock_gettime(CLOCK_REALTIME/g' "$php_dir/ext/swoole/include/swoole.h"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
$1 $2
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
VER_PHP="$1"
|
||||
|
||||
self_dir=$(cd "$(dirname "$0")";pwd)
|
||||
php_dir=$(find $self_dir/source -name "php-$VER_PHP" -type d | tail -n1)
|
||||
|
||||
function php_compile_args() {
|
||||
_php_arg="--prefix=$self_dir/php-dist"
|
||||
_php_arg="$_php_arg --disable-all"
|
||||
_php_arg="$_php_arg --enable-shared=no"
|
||||
_php_arg="$_php_arg --enable-static=yes"
|
||||
_php_arg="$_php_arg --enable-inline-optimization"
|
||||
_php_arg="$_php_arg --with-layout=GNU"
|
||||
_php_arg="$_php_arg --with-pear=no"
|
||||
_php_arg="$_php_arg --disable-cgi"
|
||||
_php_arg="$_php_arg --disable-phpdbg"
|
||||
_php_arg="$_php_arg $($self_dir/check-extensions.sh check_in_configure $1)"
|
||||
echo $_php_arg
|
||||
}
|
||||
|
||||
php_compile_args && sleep 1s
|
||||
|
||||
cd $php_dir && \
|
||||
./buildconf --force && \
|
||||
./configure LDFLAGS=-static $(php_compile_args $VER_PHP) && \
|
||||
$self_dir/check-extensions.sh check_after_configure && \
|
||||
sed -ie 's/-export-dynamic//g' "Makefile" && \
|
||||
sed -ie 's/-o $(SAPI_CLI_PATH)/-all-static -o $(SAPI_CLI_PATH)/g' "Makefile" && \
|
||||
make LDFLAGS=-ldl -j4 && \
|
||||
make install && \
|
||||
strip $self_dir/php-dist/bin/php
|
||||
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"php": {
|
||||
"link": "http://mirrors.zhamao.xin/php/php-{version}.tar.gz",
|
||||
"link_2": "https://www.php.net/distributions/php-{version}.tar.gz"
|
||||
},
|
||||
"swoole": {
|
||||
"version": "4.7.0",
|
||||
"link": "http://mirrors.zhamao.xin/pecl/swoole-{version}.tgz",
|
||||
"link_2": "https://pecl.php.net/get/swoole-{version}.tgz"
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "1.9.1",
|
||||
"link": "http://mirrors.zhamao.xin/pecl/mongodb-{version}.tgz",
|
||||
"link_2": "https://pecl.php.net/get/mongodb-{version}.tgz"
|
||||
},
|
||||
"inotify": {
|
||||
"version": "3.0.0",
|
||||
"link": "http://mirrors.zhamao.xin/pecl/inotify-{version}.tgz",
|
||||
"link_2": "https://pecl.php.net/get/inotify-{version}.tgz"
|
||||
},
|
||||
"event": {
|
||||
"version": "3.0.4",
|
||||
"link": "http://mirrors.zhamao.xin/pecl/event-{version}.tgz",
|
||||
"link_2": "https://pecl.php.net/get/event-{version}.tgz"
|
||||
},
|
||||
"redis": {
|
||||
"version": "5.3.4",
|
||||
"link": "http://mirrors.zhamao.xin/pecl/redis-{version}.tgz",
|
||||
"link_2": "https://pecl.php.net/get/redis-{version}.tgz"
|
||||
},
|
||||
"libxml2": {
|
||||
"version": "2.9.10",
|
||||
"link": "https://dl.zhamao.me/libxml2/libxml2-{version}.tar.gz",
|
||||
"link_2": "http://xmlsoft.org/sources/libxml2-{version}.tar.gz"
|
||||
},
|
||||
"liblzma": {
|
||||
"version": "master",
|
||||
"link": "https://dl.zhamao.me/liblzma/liblzma.tar.gz",
|
||||
"link_2": "https://github.com/kobolabs/liblzma/archive/refs/heads/master.zip"
|
||||
},
|
||||
"curl": {
|
||||
"version": "7.78.0",
|
||||
"link": "https://dl.zhamao.me/curl/curl-{version}.tar.gz",
|
||||
"link_2": "https://curl.haxx.se/download/curl-{version}.tar.gz"
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
_use_backup="$2"
|
||||
|
||||
SELF_DIR=$(cd "$(dirname "$0")";pwd)
|
||||
|
||||
if [ ! -d "source" ]; then
|
||||
mkdir source
|
||||
fi
|
||||
|
||||
if [ ! -d "source/cache" ]; then
|
||||
mkdir source/cache
|
||||
fi
|
||||
|
||||
function readconf() {
|
||||
cat $SELF_DIR/config.json | jq $@ | sed 's/\"//g'
|
||||
}
|
||||
|
||||
cd source
|
||||
|
||||
if [ "$_use_backup" = "yes" ]; then
|
||||
_use_backup="_2"
|
||||
else
|
||||
_use_backup=""
|
||||
fi
|
||||
|
||||
archive_find_tar=$(find cache/ -name "$1.*" | grep -E ".tgz" | tail -n1)
|
||||
archive_find_zip=$(find cache/ -name "$1.*" | grep -E ".zip" | tail -n1)
|
||||
|
||||
if [ "$archive_find_tar" != "" ]; then
|
||||
echo "Using cache for $1 ($archive_find_tar)"
|
||||
tar -zxvf "$archive_find_tar"
|
||||
elif [ "$archive_find_zip" != "" ]; then
|
||||
echo "Using cache for $1 ($archive_find_zip)"
|
||||
unzip $archive_find_zip -d "$SELF_DIR/source"
|
||||
else
|
||||
if [ "$3" != "" ]; then
|
||||
wget -q --show-progress "$(readconf ".$1.link$_use_backup" | sed 's/{version}/'$3'/g')"
|
||||
else
|
||||
echo "Downloading"
|
||||
wget -q --show-progress "$(readconf ".$1.link$_use_backup" | sed 's/{version}/'$(readconf ".$1.version")'/g')"
|
||||
fi
|
||||
|
||||
if [ $? == 0 ]; then
|
||||
archive_file_tar=$(find . -name "$1*.*" | grep -E ".tar|.gz|.tgz" | tail -n1)
|
||||
archive_file_zip=$(find . -name "*.zip" | tail -n1)
|
||||
if [ "$archive_file_tar" != "" ]; then
|
||||
tar -zxvf $archive_file_tar && mv $archive_file_tar $SELF_DIR/source/cache/$1.tgz
|
||||
elif [ "$archive_file_zip" != "" ]; then
|
||||
unzip $archive_file_zip && mv $archive_file_zip $SELF_DIR/source/cache/$1.zip
|
||||
else
|
||||
echo "Unable to find downloaded file, only support '.tar.gz', '.tgz', '.zip' file!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Download $1 failed! (at $?)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -1,31 +0,0 @@
|
||||
bcmath
|
||||
calendar
|
||||
ctype
|
||||
curl
|
||||
dom
|
||||
filter
|
||||
gd
|
||||
hash
|
||||
iconv
|
||||
inotify
|
||||
json
|
||||
libxml
|
||||
mbstring
|
||||
#mongodb
|
||||
mysqlnd
|
||||
openssl
|
||||
pcntl
|
||||
pdo
|
||||
pdo_mysql
|
||||
phar
|
||||
posix
|
||||
redis
|
||||
simplexml
|
||||
sockets
|
||||
sqlite3
|
||||
swoole
|
||||
tokenizer
|
||||
xml
|
||||
xmlreader
|
||||
xmlwriter
|
||||
zlib
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script needs alpine linux system.
|
||||
|
||||
VER_PHP="7.4.21"
|
||||
USE_BACKUP="no"
|
||||
|
||||
LINK_APK_REPO='mirrors.ustc.edu.cn'
|
||||
LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
|
||||
|
||||
if [ "${USE_BACKUP}" = "yes" ]; then \
|
||||
echo "Using backup address..." && sleep 1s
|
||||
LINK_APK_REPO=${LINK_APK_REPO_BAK}
|
||||
else
|
||||
echo "Using original address..." && sleep 1s
|
||||
fi
|
||||
|
||||
sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories
|
||||
|
||||
# build requirements
|
||||
apk add bash wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses
|
||||
# php zlib dependencies
|
||||
apk add zlib-dev zlib-static
|
||||
# php mbstring dependencies
|
||||
apk add oniguruma-dev
|
||||
# php openssl dependencies
|
||||
apk add openssl-libs-static openssl-dev openssl
|
||||
# php gd dependencies
|
||||
apk add libpng-dev libpng-static
|
||||
# curl c-ares dependencies
|
||||
apk add c-ares-static c-ares-dev
|
||||
# php event dependencies
|
||||
apk add libevent libevent-dev libevent-static
|
||||
# php sqlite3 dependencies
|
||||
apk add sqlite sqlite-dev sqlite-libs sqlite-static
|
||||
|
||||
chmod +x download.sh check-extensions.sh compile-php.sh
|
||||
|
||||
./download.sh swoole ${USE_BACKUP} && \
|
||||
./download.sh inotify ${USE_BACKUP} && \
|
||||
./download.sh mongodb ${USE_BACKUP} && \
|
||||
./download.sh event ${USE_BACKUP} && \
|
||||
./download.sh redis ${USE_BACKUP} && \
|
||||
./download.sh libxml2 ${USE_BACKUP} && \
|
||||
./download.sh liblzma ${USE_BACKUP} && \
|
||||
./download.sh curl ${USE_BACKUP} && \
|
||||
./download.sh php ${USE_BACKUP} ${VER_PHP} && \
|
||||
./check-extensions.sh check_before_configure && \
|
||||
./compile-php.sh ${VER_PHP}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
USE_BACKUP="no"
|
||||
|
||||
LINK_APK_REPO='mirrors.ustc.edu.cn'
|
||||
LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
|
||||
|
||||
if [ "${USE_BACKUP}" = "yes" ]; then \
|
||||
echo "Using backup address..." && sleep 1s
|
||||
LINK_APK_REPO=${LINK_APK_REPO_BAK}
|
||||
else
|
||||
echo "Using original address..." && sleep 1s
|
||||
fi
|
||||
|
||||
sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories
|
||||
|
||||
# build requirements
|
||||
apk add bash wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses
|
||||
# php zlib dependencies
|
||||
apk add zlib-dev zlib-static
|
||||
# php mbstring dependencies
|
||||
apk add oniguruma-dev
|
||||
# php openssl dependencies
|
||||
apk add openssl-libs-static openssl-dev openssl
|
||||
# php gd dependencies
|
||||
apk add libpng-dev libpng-static
|
||||
# curl c-ares dependencies
|
||||
apk add c-ares-static c-ares-dev
|
||||
# php event dependencies
|
||||
apk add libevent libevent-dev libevent-static
|
||||
# php sqlite3 dependencies
|
||||
apk add sqlite sqlite-dev sqlite-libs sqlite-static
|
||||
|
||||
chmod +x download.sh check-extensions.sh compile-php.sh
|
||||
|
||||
./download.sh swoole ${USE_BACKUP} && \
|
||||
./download.sh inotify ${USE_BACKUP} && \
|
||||
./download.sh mongodb ${USE_BACKUP} && \
|
||||
./download.sh event ${USE_BACKUP} && \
|
||||
./download.sh redis ${USE_BACKUP} && \
|
||||
./download.sh libxml2 ${USE_BACKUP} && \
|
||||
./download.sh liblzma ${USE_BACKUP} && \
|
||||
./download.sh curl ${USE_BACKUP}
|
||||
|
||||
if [ ! -d "multi-build" ]; then
|
||||
mkdir ./multi-build
|
||||
fi
|
||||
|
||||
for VER_PHP in "7.2.34" "7.3.29" "7.4.21" "8.0.8"
|
||||
do
|
||||
./download.sh swoole ${USE_BACKUP} && \
|
||||
./download.sh inotify ${USE_BACKUP} && \
|
||||
./download.sh mongodb ${USE_BACKUP} && \
|
||||
./download.sh event ${USE_BACKUP} && \
|
||||
./download.sh redis ${USE_BACKUP} && \
|
||||
./download.sh libxml2 ${USE_BACKUP} && \
|
||||
./download.sh liblzma ${USE_BACKUP} && \
|
||||
./download.sh curl ${USE_BACKUP} && \
|
||||
./download.sh php ${USE_BACKUP} ${VER_PHP} && \
|
||||
./check-extensions.sh check_before_configure && \
|
||||
./compile-php.sh ${VER_PHP} && \
|
||||
cp ./php-dist/bin/php ./multi-build/php-${VER_PHP} && \
|
||||
rm -rf ./source
|
||||
done
|
||||
|
||||
|
||||
3
ext-support.md
Normal file
3
ext-support.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Extension List
|
||||
|
||||
See: [Docs - Extensions](https://static-php.dev/en/guide/extensions.html)
|
||||
18
phpstan.neon
Normal file
18
phpstan.neon
Normal file
@@ -0,0 +1,18 @@
|
||||
parameters:
|
||||
reportUnmatchedIgnoredErrors: false
|
||||
level: 4
|
||||
paths:
|
||||
- ./src/
|
||||
ignoreErrors:
|
||||
- '#Constant .* not found#'
|
||||
- '#Unsafe usage of new static#'
|
||||
- '#class Fiber#'
|
||||
- '#Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist#'
|
||||
- '#Function Swoole\\Coroutine\\run not found.#'
|
||||
dynamicConstantNames:
|
||||
- PHP_OS_FAMILY
|
||||
excludePaths:
|
||||
analyseAndScan:
|
||||
- ./src/globals/ext-tests/swoole.php
|
||||
- ./src/globals/ext-tests/swoole.phpt
|
||||
- ./src/globals/test-extensions.php
|
||||
56
src/SPC/ConsoleApplication.php
Normal file
56
src/SPC/ConsoleApplication.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC;
|
||||
|
||||
use SPC\command\BuildCliCommand;
|
||||
use SPC\command\BuildLibsCommand;
|
||||
use SPC\command\DeleteDownloadCommand;
|
||||
use SPC\command\dev\AllExtCommand;
|
||||
use SPC\command\dev\GenerateExtDocCommand;
|
||||
use SPC\command\dev\PhpVerCommand;
|
||||
use SPC\command\dev\SortConfigCommand;
|
||||
use SPC\command\DoctorCommand;
|
||||
use SPC\command\DownloadCommand;
|
||||
use SPC\command\DumpLicenseCommand;
|
||||
use SPC\command\ExtractCommand;
|
||||
use SPC\command\InstallPkgCommand;
|
||||
use SPC\command\MicroCombineCommand;
|
||||
use SPC\command\SwitchPhpVersionCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
/**
|
||||
* static-php-cli console app entry
|
||||
*/
|
||||
final class ConsoleApplication extends Application
|
||||
{
|
||||
public const VERSION = '2.2.2';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('static-php-cli', self::VERSION);
|
||||
|
||||
$this->addCommands(
|
||||
[
|
||||
// Common commands
|
||||
new BuildCliCommand(),
|
||||
new BuildLibsCommand(),
|
||||
new DoctorCommand(),
|
||||
new DownloadCommand(),
|
||||
new InstallPkgCommand(),
|
||||
new DeleteDownloadCommand(),
|
||||
new DumpLicenseCommand(),
|
||||
new ExtractCommand(),
|
||||
new MicroCombineCommand(),
|
||||
new SwitchPhpVersionCommand(),
|
||||
|
||||
// Dev commands
|
||||
new AllExtCommand(),
|
||||
new PhpVerCommand(),
|
||||
new SortConfigCommand(),
|
||||
new GenerateExtDocCommand(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
478
src/SPC/builder/BuilderBase.php
Normal file
478
src/SPC/builder/BuilderBase.php
Normal file
@@ -0,0 +1,478 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
use SPC\exception\ExceptionHandler;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\store\SourceManager;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
abstract class BuilderBase
|
||||
{
|
||||
/** @var int Concurrency */
|
||||
public int $concurrency = 1;
|
||||
|
||||
/** @var array<string, LibraryBase> libraries */
|
||||
protected array $libs = [];
|
||||
|
||||
/** @var array<string, Extension> extensions */
|
||||
protected array $exts = [];
|
||||
|
||||
/** @var bool compile libs only (just mark it) */
|
||||
protected bool $libs_only = false;
|
||||
|
||||
/** @var array<string, mixed> compile options */
|
||||
protected array $options = [];
|
||||
|
||||
/** @var string patch point name */
|
||||
protected string $patch_point = '';
|
||||
|
||||
/**
|
||||
* Convert libraries to class
|
||||
*
|
||||
* @param array<string> $sorted_libraries Libraries to build (if not empty, must sort first)
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
* @internal
|
||||
*/
|
||||
abstract public function proveLibs(array $sorted_libraries);
|
||||
|
||||
/**
|
||||
* Build libraries
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function buildLibs(): void
|
||||
{
|
||||
// build all libs
|
||||
foreach ($this->libs as $lib) {
|
||||
match ($lib->tryBuild($this->getOption('rebuild', false))) {
|
||||
BUILD_STATUS_OK => logger()->info('lib [' . $lib::NAME . '] build success'),
|
||||
BUILD_STATUS_ALREADY => logger()->notice('lib [' . $lib::NAME . '] already built'),
|
||||
BUILD_STATUS_FAILED => logger()->error('lib [' . $lib::NAME . '] build failed'),
|
||||
default => logger()->warning('lib [' . $lib::NAME . '] build status unknown'),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add library to build.
|
||||
*
|
||||
* @param LibraryBase $library Library object
|
||||
*/
|
||||
public function addLib(LibraryBase $library): void
|
||||
{
|
||||
$this->libs[$library::NAME] = $library;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get library object by name.
|
||||
*/
|
||||
public function getLib(string $name): ?LibraryBase
|
||||
{
|
||||
return $this->libs[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all library objects.
|
||||
*
|
||||
* @return LibraryBase[]
|
||||
*/
|
||||
public function getLibs(): array
|
||||
{
|
||||
return $this->libs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add extension to build.
|
||||
*/
|
||||
public function addExt(Extension $extension): void
|
||||
{
|
||||
$this->exts[$extension->getName()] = $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extension object by name.
|
||||
*/
|
||||
public function getExt(string $name): ?Extension
|
||||
{
|
||||
return $this->exts[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all extension objects.
|
||||
*
|
||||
* @return Extension[]
|
||||
*/
|
||||
public function getExts(): array
|
||||
{
|
||||
return $this->exts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is a cpp extensions or libraries.
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function hasCpp(): bool
|
||||
{
|
||||
// judge cpp-extension
|
||||
$exts = array_keys($this->getExts());
|
||||
foreach ($exts as $ext) {
|
||||
if (Config::getExt($ext, 'cpp-extension', false) === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$libs = array_keys($this->getLibs());
|
||||
foreach ($libs as $lib) {
|
||||
if (Config::getLib($lib, 'cpp-library', false) === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set libs only mode.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function setLibsOnly(bool $status = true): void
|
||||
{
|
||||
$this->libs_only = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the list of "ext" extensions for validity and declare an Extension object to check the dependencies of the extensions.
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws \ReflectionException
|
||||
* @throws WrongUsageException
|
||||
* @internal
|
||||
*/
|
||||
public function proveExts(array $extensions): void
|
||||
{
|
||||
CustomExt::loadCustomExt();
|
||||
$this->emitPatchPoint('before-php-extract');
|
||||
SourceManager::initSource(sources: ['php-src']);
|
||||
$this->emitPatchPoint('after-php-extract');
|
||||
if ($this->getPHPVersionID() >= 80000) {
|
||||
$this->emitPatchPoint('before-micro-extract');
|
||||
SourceManager::initSource(sources: ['micro']);
|
||||
$this->emitPatchPoint('after-micro-extract');
|
||||
}
|
||||
$this->emitPatchPoint('before-exts-extract');
|
||||
SourceManager::initSource(exts: $extensions);
|
||||
$this->emitPatchPoint('after-exts-extract');
|
||||
foreach ($extensions as $extension) {
|
||||
$class = CustomExt::getExtClass($extension);
|
||||
$ext = new $class($extension, $this);
|
||||
$this->addExt($ext);
|
||||
}
|
||||
|
||||
foreach ($this->exts as $ext) {
|
||||
$ext->checkDependency();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start to build PHP
|
||||
*
|
||||
* @param int $build_target Build target, see BUILD_TARGET_*
|
||||
*/
|
||||
abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE);
|
||||
|
||||
/**
|
||||
* Generate extension enable arguments for configure.
|
||||
* e.g. --enable-mbstring
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function makeExtensionArgs(): string
|
||||
{
|
||||
$ret = [];
|
||||
foreach ($this->exts as $ext) {
|
||||
logger()->info($ext->getName() . ' is using ' . $ext->getConfigureArg());
|
||||
$ret[] = trim($ext->getConfigureArg());
|
||||
}
|
||||
logger()->debug('Using configure: ' . implode(' ', $ret));
|
||||
return implode(' ', $ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get libs only mode.
|
||||
*/
|
||||
public function isLibsOnly(): bool
|
||||
{
|
||||
return $this->libs_only;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PHP Version ID from php-src/main/php_version.h
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function getPHPVersionID(): int
|
||||
{
|
||||
if (!file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) {
|
||||
throw new WrongUsageException('PHP source files are not available, you need to download them first');
|
||||
}
|
||||
|
||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||
if (preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0) {
|
||||
return intval($match[1]);
|
||||
}
|
||||
|
||||
throw new RuntimeException('PHP version file format is malformed, please remove it and download again');
|
||||
}
|
||||
|
||||
public function getPHPVersion(): string
|
||||
{
|
||||
if (!file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) {
|
||||
throw new WrongUsageException('PHP source files are not available, you need to download them first');
|
||||
}
|
||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||
if (preg_match('/PHP_VERSION "(.*)"/', $file, $match) !== 0) {
|
||||
return $match[1];
|
||||
}
|
||||
|
||||
throw new RuntimeException('PHP version file format is malformed, please remove it and download again');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PHP version from archive file name.
|
||||
*
|
||||
* @param null|string $file php-*.*.*.tar.gz filename, read from lockfile if empty
|
||||
*/
|
||||
public function getPHPVersionFromArchive(?string $file = null): false|string
|
||||
{
|
||||
if ($file === null) {
|
||||
$lock = file_exists(DOWNLOAD_PATH . '/.lock.json') ? file_get_contents(DOWNLOAD_PATH . '/.lock.json') : false;
|
||||
if ($lock === false) {
|
||||
return false;
|
||||
}
|
||||
$lock = json_decode($lock, true);
|
||||
$file = $lock['php-src']['filename'] ?? null;
|
||||
if ($file === null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (preg_match('/php-(\d+\.\d+\.\d+)/', $file, $match)) {
|
||||
return $match[1];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getMicroVersion(): false|string
|
||||
{
|
||||
$file = FileSystem::convertPath(SOURCE_PATH . '/php-src/sapi/micro/php_micro.h');
|
||||
if (!file_exists($file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$content = file_get_contents($file);
|
||||
$ver = '';
|
||||
preg_match('/#define PHP_MICRO_VER_MAJ (\d)/m', $content, $match);
|
||||
$ver .= $match[1] . '.';
|
||||
preg_match('/#define PHP_MICRO_VER_MIN (\d)/m', $content, $match);
|
||||
$ver .= $match[1] . '.';
|
||||
preg_match('/#define PHP_MICRO_VER_PAT (\d)/m', $content, $match);
|
||||
$ver .= $match[1];
|
||||
return $ver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get build type name string to display.
|
||||
*
|
||||
* @param int $type Build target type
|
||||
*/
|
||||
public function getBuildTypeName(int $type): string
|
||||
{
|
||||
$ls = [];
|
||||
if (($type & BUILD_TARGET_CLI) === BUILD_TARGET_CLI) {
|
||||
$ls[] = 'cli';
|
||||
}
|
||||
if (($type & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO) {
|
||||
$ls[] = 'micro';
|
||||
}
|
||||
if (($type & BUILD_TARGET_FPM) === BUILD_TARGET_FPM) {
|
||||
$ls[] = 'fpm';
|
||||
}
|
||||
if (($type & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED) {
|
||||
$ls[] = 'embed';
|
||||
}
|
||||
return implode(', ', $ls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builder options (maybe changed by user)
|
||||
*
|
||||
* @param string $key Option key
|
||||
* @param mixed $default If not exists, return this value
|
||||
*/
|
||||
public function getOption(string $key, mixed $default = null): mixed
|
||||
{
|
||||
return $this->options[$key] ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all builder options
|
||||
*/
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set builder options if not exists.
|
||||
*/
|
||||
public function setOptionIfNotExist(string $key, mixed $value): void
|
||||
{
|
||||
if (!isset($this->options[$key])) {
|
||||
$this->options[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set builder options.
|
||||
*/
|
||||
public function setOption(string $key, mixed $value): void
|
||||
{
|
||||
$this->options[$key] = $value;
|
||||
}
|
||||
|
||||
public function getEnvString(array $vars = ['cc', 'cxx', 'ar', 'ld']): string
|
||||
{
|
||||
$env = [];
|
||||
foreach ($vars as $var) {
|
||||
$var = strtoupper($var);
|
||||
if (getenv($var) !== false) {
|
||||
$env[] = "{$var}=" . getenv($var);
|
||||
}
|
||||
}
|
||||
return implode(' ', $env);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builder patch point name.
|
||||
*/
|
||||
public function getPatchPoint(): string
|
||||
{
|
||||
return $this->patch_point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate libs and exts can be compiled successfully in current environment
|
||||
*/
|
||||
public function validateLibsAndExts(): void
|
||||
{
|
||||
foreach ($this->libs as $lib) {
|
||||
$lib->validate();
|
||||
}
|
||||
foreach ($this->exts as $ext) {
|
||||
$ext->validate();
|
||||
}
|
||||
}
|
||||
|
||||
public function emitPatchPoint(string $point_name): void
|
||||
{
|
||||
$this->patch_point = $point_name;
|
||||
if (($patches = $this->getOption('with-added-patch', [])) === []) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($patches as $patch) {
|
||||
try {
|
||||
if (!file_exists($patch)) {
|
||||
throw new RuntimeException("Additional patch script file {$patch} not found!");
|
||||
}
|
||||
logger()->debug('Running additional patch script: ' . $patch);
|
||||
require $patch;
|
||||
} catch (\Throwable $e) {
|
||||
logger()->critical('Patch script ' . $patch . ' failed to run.');
|
||||
if ($this->getOption('debug')) {
|
||||
ExceptionHandler::getInstance()->handle($e);
|
||||
} else {
|
||||
logger()->critical('Please check with --debug option to see more details.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if all libs are downloaded.
|
||||
* If not, throw exception.
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function checkLibsSource(): void
|
||||
{
|
||||
$not_downloaded = [];
|
||||
foreach ($this->libs as $lib) {
|
||||
if (!file_exists($lib->getSourceDir())) {
|
||||
$not_downloaded[] = $lib::NAME;
|
||||
}
|
||||
}
|
||||
if ($not_downloaded !== []) {
|
||||
throw new RuntimeException(
|
||||
'"' . implode(', ', $not_downloaded) .
|
||||
'" totally ' . count($not_downloaded) .
|
||||
' source' . (count($not_downloaded) === 1 ? '' : 's') .
|
||||
' not downloaded, maybe you need to "fetch" ' . (count($not_downloaded) === 1 ? 'it' : 'them') . ' first?'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate micro extension test php code.
|
||||
*/
|
||||
protected function generateMicroExtTests(): string
|
||||
{
|
||||
$php = "<?php\n\necho '[micro-test-start]' . PHP_EOL;\n";
|
||||
|
||||
foreach ($this->getExts() as $ext) {
|
||||
$ext_name = $ext->getDistName();
|
||||
if (!empty($ext_name)) {
|
||||
$php .= "echo 'Running micro with {$ext_name} test' . PHP_EOL;\n";
|
||||
$php .= "assert(extension_loaded('{$ext_name}'));\n\n";
|
||||
}
|
||||
}
|
||||
$php .= "echo '[micro-test-end]';\n";
|
||||
return $php;
|
||||
}
|
||||
|
||||
protected function getMicroTestTasks(): array
|
||||
{
|
||||
return [
|
||||
'micro_ext_test' => [
|
||||
'content' => ($this->getOption('without-micro-ext-test') ? '<?php echo "[micro-test-start][micro-test-end]";' : $this->generateMicroExtTests()),
|
||||
'conditions' => [
|
||||
function ($ret) { return $ret === 0; },
|
||||
function ($ret, $out) {
|
||||
$raw_out = trim(implode('', $out));
|
||||
return str_starts_with($raw_out, '[micro-test-start]') && str_ends_with($raw_out, '[micro-test-end]');
|
||||
},
|
||||
],
|
||||
],
|
||||
'micro_zend_bug_test' => [
|
||||
'content' => ($this->getOption('without-micro-ext-test') ? '<?php echo "hello";' : file_get_contents(ROOT_DIR . '/src/globals/common-tests/micro_zend_mm_heap_corrupted.txt')),
|
||||
'conditions' => [
|
||||
function ($ret) { return $ret === 0; },
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
52
src/SPC/builder/BuilderProvider.php
Normal file
52
src/SPC/builder/BuilderProvider.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
use SPC\builder\freebsd\BSDBuilder;
|
||||
use SPC\builder\linux\LinuxBuilder;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\builder\windows\WindowsBuilder;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
||||
/**
|
||||
* 用于生成对应系统环境的 Builder 对象的类
|
||||
*/
|
||||
class BuilderProvider
|
||||
{
|
||||
private static ?BuilderBase $builder = null;
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public static function makeBuilderByInput(InputInterface $input): BuilderBase
|
||||
{
|
||||
ini_set('memory_limit', '2G');
|
||||
|
||||
self::$builder = match (PHP_OS_FAMILY) {
|
||||
'Windows' => new WindowsBuilder($input->getOptions()),
|
||||
'Darwin' => new MacOSBuilder($input->getOptions()),
|
||||
'Linux' => new LinuxBuilder($input->getOptions()),
|
||||
'BSD' => new BSDBuilder($input->getOptions()),
|
||||
default => throw new WrongUsageException('Current OS "' . PHP_OS_FAMILY . '" is not supported yet'),
|
||||
};
|
||||
return self::$builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public static function getBuilder(): BuilderBase
|
||||
{
|
||||
if (self::$builder === null) {
|
||||
throw new WrongUsageException('Builder has not been initialized');
|
||||
}
|
||||
return self::$builder;
|
||||
}
|
||||
}
|
||||
290
src/SPC/builder/Extension.php
Normal file
290
src/SPC/builder/Extension.php
Normal file
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
class Extension
|
||||
{
|
||||
protected array $dependencies = [];
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function __construct(protected string $name, protected BuilderBase $builder)
|
||||
{
|
||||
$ext_type = Config::getExt($this->name, 'type');
|
||||
$unix_only = Config::getExt($this->name, 'unix-only', false);
|
||||
$windows_only = Config::getExt($this->name, 'windows-only', false);
|
||||
if (PHP_OS_FAMILY !== 'Windows' && $windows_only) {
|
||||
throw new RuntimeException("{$ext_type} extension {$name} is not supported on Linux and macOS platform");
|
||||
}
|
||||
if (PHP_OS_FAMILY === 'Windows' && $unix_only) {
|
||||
throw new RuntimeException("{$ext_type} extension {$name} is not supported on Windows platform");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开启该扩展的 PHP 编译添加的参数
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function getConfigureArg(): string
|
||||
{
|
||||
$arg = $this->getEnableArg();
|
||||
switch (PHP_OS_FAMILY) {
|
||||
case 'Windows':
|
||||
$arg .= $this->getWindowsConfigureArg();
|
||||
break;
|
||||
case 'Darwin':
|
||||
case 'Linux':
|
||||
case 'BSD':
|
||||
$arg .= $this->getUnixConfigureArg();
|
||||
break;
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 ext 的 arg-type 获取对应开启的参数,一般都是 --enable-xxx 和 --with-xxx
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function getEnableArg(): string
|
||||
{
|
||||
$_name = str_replace('_', '-', $this->name);
|
||||
return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) {
|
||||
'enable' => '--enable-' . $_name . ' ',
|
||||
'with' => '--with-' . $_name . ' ',
|
||||
'with-prefix' => '--with-' . $_name . '="' . BUILD_ROOT_PATH . '" ',
|
||||
'none', 'custom' => '',
|
||||
default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-prefix] ."),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出当前扩展依赖的所有 lib 库生成的 .a 静态编译库文件,以字符串形式导出,用空格分割
|
||||
*/
|
||||
public function getLibFilesString(): string
|
||||
{
|
||||
$ret = array_map(
|
||||
fn ($x) => $x->getStaticLibFiles(),
|
||||
$this->getLibraryDependencies(recursive: true)
|
||||
);
|
||||
return implode(' ', $ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查下依赖就行了,作用是导入依赖给 Extension 对象,今后可以对库依赖进行选择性处理
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function checkDependency(): static
|
||||
{
|
||||
foreach (Config::getExt($this->name, 'lib-depends', []) as $name) {
|
||||
$this->addLibraryDependency($name);
|
||||
}
|
||||
foreach (Config::getExt($this->name, 'lib-suggests', []) as $name) {
|
||||
$this->addLibraryDependency($name, true);
|
||||
}
|
||||
foreach (Config::getExt($this->name, 'ext-depends', []) as $name) {
|
||||
$this->addExtensionDependency($name);
|
||||
}
|
||||
foreach (Config::getExt($this->name, 'ext-suggests', []) as $name) {
|
||||
$this->addExtensionDependency($name, true);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getExtensionDependency(): array
|
||||
{
|
||||
return array_filter($this->dependencies, fn ($x) => $x instanceof Extension);
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns extension dist name
|
||||
*/
|
||||
public function getDistName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getWindowsConfigureArg(): string
|
||||
{
|
||||
return '';
|
||||
// Windows is not supported yet
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch code before ./buildconf
|
||||
* If you need to patch some code, overwrite this and return true
|
||||
*/
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch code before ./configure
|
||||
* If you need to patch some code, overwrite this and return true
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch code before make
|
||||
* If you need to patch some code, overwrite this and return true
|
||||
*/
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function runCliCheckUnix(): void
|
||||
{
|
||||
// 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 check failed, throw RuntimeException
|
||||
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "' . $this->getDistName() . '"', false);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||
}
|
||||
|
||||
if (file_exists(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')) {
|
||||
// Trim additional content & escape special characters to allow inline usage
|
||||
$test = str_replace(
|
||||
['<?php', 'declare(strict_types=1);', "\n", '"', '$'],
|
||||
['', '', '', '\"', '\$'],
|
||||
file_get_contents(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')
|
||||
);
|
||||
|
||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -r "' . trim($test) . '"');
|
||||
if ($ret !== 0) {
|
||||
if ($this->builder->getOption('debug')) {
|
||||
var_dump($out);
|
||||
}
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function runCliCheckWindows(): void
|
||||
{
|
||||
// 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 check failed, throw RuntimeException
|
||||
[$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe --ri "' . $this->getDistName() . '"', false);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||
}
|
||||
|
||||
if (file_exists(FileSystem::convertPath(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php'))) {
|
||||
// Trim additional content & escape special characters to allow inline usage
|
||||
$test = str_replace(
|
||||
['<?php', 'declare(strict_types=1);', "\n", '"', '$'],
|
||||
['', '', '', '\"', '$'],
|
||||
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) . '"');
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function validate(): void
|
||||
{
|
||||
// do nothing, just throw wrong usage exception if not valid
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function addLibraryDependency(string $name, bool $optional = false): void
|
||||
{
|
||||
$depLib = $this->builder->getLib($name);
|
||||
if (!$depLib) {
|
||||
if (!$optional) {
|
||||
throw new RuntimeException("extension {$this->name} requires library {$name}");
|
||||
}
|
||||
logger()->info("enabling {$this->name} without library {$name}");
|
||||
} else {
|
||||
$this->dependencies[] = $depLib;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function addExtensionDependency(string $name, bool $optional = false): void
|
||||
{
|
||||
$depExt = $this->builder->getExt($name);
|
||||
if (!$depExt) {
|
||||
if (!$optional) {
|
||||
throw new RuntimeException("{$this->name} requires extension {$name}");
|
||||
}
|
||||
logger()->info("enabling {$this->name} without extension {$name}");
|
||||
} else {
|
||||
$this->dependencies[] = $depExt;
|
||||
}
|
||||
}
|
||||
|
||||
private function getLibraryDependencies(bool $recursive = false): array
|
||||
{
|
||||
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
||||
if (!$recursive) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$deps = [];
|
||||
|
||||
$added = 1;
|
||||
while ($added !== 0) {
|
||||
$added = 0;
|
||||
foreach ($ret as $depName => $dep) {
|
||||
foreach ($dep->getDependencies(true) as $depdepName => $depdep) {
|
||||
if (!in_array($depdepName, array_keys($deps), true)) {
|
||||
$deps[$depdepName] = $depdep;
|
||||
++$added;
|
||||
}
|
||||
}
|
||||
if (!in_array($depName, array_keys($deps), true)) {
|
||||
$deps[$depName] = $dep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $deps;
|
||||
}
|
||||
}
|
||||
219
src/SPC/builder/LibraryBase.php
Normal file
219
src/SPC/builder/LibraryBase.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
|
||||
abstract class LibraryBase
|
||||
{
|
||||
/** @var string */
|
||||
public const NAME = 'unknown';
|
||||
|
||||
protected string $source_dir;
|
||||
|
||||
protected array $dependencies = [];
|
||||
|
||||
protected bool $patched = false;
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function __construct(?string $source_dir = null)
|
||||
{
|
||||
if (static::NAME === 'unknown') {
|
||||
throw new RuntimeException('no unknown!!!!!');
|
||||
}
|
||||
$this->source_dir = $source_dir ?? (SOURCE_PATH . '/' . static::NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current lib source root dir.
|
||||
*/
|
||||
public function getSourceDir(): string
|
||||
{
|
||||
return $this->source_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current lib dependencies.
|
||||
*
|
||||
* @return array<string, LibraryBase>
|
||||
*/
|
||||
public function getDependencies(bool $recursive = false): array
|
||||
{
|
||||
// 非递归情况下直接返回通过 addLibraryDependency 方法添加的依赖
|
||||
if (!$recursive) {
|
||||
return $this->dependencies;
|
||||
}
|
||||
|
||||
$deps = [];
|
||||
|
||||
$added = 1;
|
||||
while ($added !== 0) {
|
||||
$added = 0;
|
||||
foreach ($this->dependencies as $depName => $dep) {
|
||||
foreach ($dep->getDependencies(true) as $depdepName => $depdep) {
|
||||
if (!in_array($depdepName, array_keys($deps), true)) {
|
||||
$deps[$depdepName] = $depdep;
|
||||
++$added;
|
||||
}
|
||||
}
|
||||
if (!in_array($depName, array_keys($deps), true)) {
|
||||
$deps[$depName] = $dep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $deps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate dependencies for current library.
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function calcDependency(): void
|
||||
{
|
||||
// Add dependencies from the configuration file. Here, choose different metadata based on the operating system.
|
||||
/*
|
||||
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 macOS system, try the following dependencies in order: lib-depends-darwin, 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) {
|
||||
$this->addLibraryDependency($dep_name);
|
||||
}
|
||||
foreach (Config::getLib(static::NAME, 'lib-suggests', []) as $dep_name) {
|
||||
$this->addLibraryDependency($dep_name, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config static libs.
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function getStaticLibs(): array
|
||||
{
|
||||
return Config::getLib(static::NAME, 'static-libs', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config headers.
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return Config::getLib(static::NAME, 'headers', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to build this library, before build, we check first.
|
||||
*
|
||||
* BUILD_STATUS_OK if build success
|
||||
* BUILD_STATUS_ALREADY if already built
|
||||
* BUILD_STATUS_FAILED if build failed
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function tryBuild(bool $force_build = false): int
|
||||
{
|
||||
if (file_exists($this->source_dir . '/.spc.patched')) {
|
||||
$this->patched = true;
|
||||
}
|
||||
// force means just build
|
||||
if ($force_build) {
|
||||
logger()->info('Building required library [' . static::NAME . ']');
|
||||
if (!$this->patched && $this->patchBeforeBuild()) {
|
||||
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
|
||||
}
|
||||
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-build');
|
||||
$this->build();
|
||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-build');
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
|
||||
// check if these libraries exist, if not, invoke compilation and return the result status
|
||||
foreach ($this->getStaticLibs() as $name) {
|
||||
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
||||
$this->tryBuild(true);
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
}
|
||||
// header files the same
|
||||
foreach ($this->getHeaders() as $name) {
|
||||
if (!file_exists(BUILD_INCLUDE_PATH . "/{$name}")) {
|
||||
$this->tryBuild(true);
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
}
|
||||
// pkg-config is treated specially. If it is pkg-config, check if the pkg-config binary exists
|
||||
if (static::NAME === 'pkg-config' && !file_exists(BUILD_ROOT_PATH . '/bin/pkg-config')) {
|
||||
$this->tryBuild(true);
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
// if all the files exist at this point, skip the compilation process
|
||||
return BUILD_STATUS_ALREADY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch before build, overwrite this and return true to patch libs.
|
||||
*/
|
||||
public function patchBeforeBuild(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function validate(): void
|
||||
{
|
||||
// do nothing, just throw wrong usage exception if not valid
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current builder object.
|
||||
*/
|
||||
abstract public function getBuilder(): BuilderBase;
|
||||
|
||||
/**
|
||||
* Build this library.
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
abstract protected function build();
|
||||
|
||||
/**
|
||||
* Add lib dependency
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function addLibraryDependency(string $name, bool $optional = false): void
|
||||
{
|
||||
$dep_lib = $this->getBuilder()->getLib($name);
|
||||
if ($dep_lib) {
|
||||
$this->dependencies[$name] = $dep_lib;
|
||||
return;
|
||||
}
|
||||
if (!$optional) {
|
||||
throw new RuntimeException(static::NAME . " requires library {$name}");
|
||||
}
|
||||
logger()->debug('enabling ' . static::NAME . " without {$name}");
|
||||
}
|
||||
|
||||
protected function getSnakeCaseName(): string
|
||||
{
|
||||
return str_replace('-', '_', static::NAME);
|
||||
}
|
||||
}
|
||||
10
src/SPC/builder/LibraryInterface.php
Normal file
10
src/SPC/builder/LibraryInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
interface LibraryInterface
|
||||
{
|
||||
public function getName(): string;
|
||||
}
|
||||
35
src/SPC/builder/extension/amqp.php
Normal file
35
src/SPC/builder/extension/amqp.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('amqp')]
|
||||
class amqp extends Extension
|
||||
{
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp.h', '/^#warning.*/m', '');
|
||||
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp_framing.h', '/^#warning.*/m', '');
|
||||
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp_ssl_socket.h', '/^#warning.*/m', '');
|
||||
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp_tcp_socket.h', '/^#warning.*/m', '');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-amqp --with-librabbitmq-dir=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
|
||||
public function getWindowsConfigureArg(): string
|
||||
{
|
||||
return '--with-amqp';
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/extension/bz2.php
Normal file
27
src/SPC/builder/extension/bz2.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('bz2')]
|
||||
class bz2 extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';
|
||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lbz2/', $this->getLibFilesString() . $frameworks);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
57
src/SPC/builder/extension/curl.php
Normal file
57
src/SPC/builder/extension/curl.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('curl')]
|
||||
class curl extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
logger()->info('patching before-configure for curl checks');
|
||||
$file1 = "AC_DEFUN([PHP_CHECK_LIBRARY], [\n $3\n])";
|
||||
$files = FileSystem::readFile(SOURCE_PATH . '/php-src/ext/curl/config.m4');
|
||||
$file2 = 'AC_DEFUN([PHP_CHECK_LIBRARY], [
|
||||
save_old_LDFLAGS=$LDFLAGS
|
||||
ac_stuff="$5"
|
||||
|
||||
save_ext_shared=$ext_shared
|
||||
ext_shared=yes
|
||||
PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS)
|
||||
AC_CHECK_LIB([$1],[$2],[
|
||||
LDFLAGS=$save_old_LDFLAGS
|
||||
ext_shared=$save_ext_shared
|
||||
$3
|
||||
],[
|
||||
LDFLAGS=$save_old_LDFLAGS
|
||||
ext_shared=$save_ext_shared
|
||||
unset ac_cv_lib_$1[]_$2
|
||||
$4
|
||||
])dnl
|
||||
])';
|
||||
file_put_contents(SOURCE_PATH . '/php-src/ext/curl/config.m4', $file1 . "\n" . $files . "\n" . $file2);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';
|
||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lcurl/', $this->getLibFilesString() . $frameworks);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
24
src/SPC/builder/extension/dba.php
Normal file
24
src/SPC/builder/extension/dba.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('dba')]
|
||||
class dba extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . BUILD_ROOT_PATH) : '';
|
||||
return '--enable-dba' . $qdbm;
|
||||
}
|
||||
|
||||
public function getWindowsConfigureArg(): string
|
||||
{
|
||||
$qdbm = $this->builder->getLib('qdbm') ? ' --with-qdbm' : '';
|
||||
return '--with-dba' . $qdbm;
|
||||
}
|
||||
}
|
||||
30
src/SPC/builder/extension/enchant.php
Normal file
30
src/SPC/builder/extension/enchant.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('enchant')]
|
||||
class enchant extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$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/libglib-2.0.a',
|
||||
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgmodule-2.0.a',
|
||||
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgobject-2.0.a',
|
||||
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgthread-2.0.a',
|
||||
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libintl.a',
|
||||
];
|
||||
$arg = '--with-enchant="' . BUILD_ROOT_PATH . '"';
|
||||
$arg .= ' ENCHANT2_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '/enchant-2"';
|
||||
$arg .= ' ENCHANT2_LIBS="' . $this->getLibFilesString() . '"';
|
||||
$arg .= ' GLIB_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '"';
|
||||
$arg .= ' GLIB_LIBS="' . implode(' ', $glibs) . '"';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
50
src/SPC/builder/extension/event.php
Normal file
50
src/SPC/builder/extension/event.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('event')]
|
||||
class event extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '--with-event-core --with-event-extra --with-event-libevent-dir=' . BUILD_ROOT_PATH;
|
||||
if ($this->builder->getLib('openssl')) {
|
||||
$arg .= ' --with-event-openssl=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
if ($this->builder->getExt('sockets')) {
|
||||
$arg .= ' --enable-event-sockets';
|
||||
} else {
|
||||
$arg .= ' --disable-event-sockets';
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-levent_openssl/', $this->getLibFilesString());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
// Prevent event extension compile error on macOS
|
||||
if ($this->builder instanceof MacOSBuilder) {
|
||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/main/php_config.h', '/^#define HAVE_OPENPTY 1$/m', '');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
22
src/SPC/builder/extension/ffi.php
Normal file
22
src/SPC/builder/extension/ffi.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('ffi')]
|
||||
class ffi extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-ffi --enable-zend-signals';
|
||||
}
|
||||
|
||||
public function getWindowsConfigureArg(): string
|
||||
{
|
||||
return '--with-ffi';
|
||||
}
|
||||
}
|
||||
22
src/SPC/builder/extension/gd.php
Normal file
22
src/SPC/builder/extension/gd.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('gd')]
|
||||
class gd extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '--enable-gd';
|
||||
$arg .= $this->builder->getLib('freetype') ? ' --with-freetype' : '';
|
||||
$arg .= $this->builder->getLib('libjpeg') ? ' --with-jpeg' : '';
|
||||
$arg .= $this->builder->getLib('libwebp') ? ' --with-webp' : '';
|
||||
$arg .= $this->builder->getLib('libavif') ? ' --with-avif' : '';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
40
src/SPC/builder/extension/gettext.php
Normal file
40
src/SPC/builder/extension/gettext.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('gettext')]
|
||||
class gettext extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if ($this->builder instanceof MacOSBuilder) {
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gettext/config.m4', 'AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB(intl');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WrongUsageException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
if ($this->builder instanceof MacOSBuilder) {
|
||||
$frameworks = ' ' . $this->builder->getFrameworks(true) . ' ';
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lintl', $this->getLibFilesString() . $frameworks);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
42
src/SPC/builder/extension/glfw.php
Normal file
42
src/SPC/builder/extension/glfw.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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('glfw')]
|
||||
class glfw extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if (file_exists(SOURCE_PATH . '/php-src/ext/glfw')) {
|
||||
return false;
|
||||
}
|
||||
FileSystem::copyDir(SOURCE_PATH . '/ext-glfw', SOURCE_PATH . '/php-src/ext/glfw');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lglfw ', '-lglfw3 ');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-glfw --with-glfw-dir=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
|
||||
public function getWindowsConfigureArg(): string
|
||||
{
|
||||
return '--enable-glfw=static';
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/extension/iconv.php
Normal file
27
src/SPC/builder/extension/iconv.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('iconv')]
|
||||
class iconv extends Extension
|
||||
{
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
// macOS need to link iconv dynamically, we add it to extra-libs
|
||||
if (!$this->builder instanceof MacOSBuilder) {
|
||||
return false;
|
||||
}
|
||||
$extra_libs = $this->builder->getOption('extra-libs', '');
|
||||
if (!str_contains($extra_libs, '-liconv')) {
|
||||
$extra_libs .= ' -liconv';
|
||||
}
|
||||
$this->builder->setOption('extra-libs', $extra_libs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
29
src/SPC/builder/extension/imagick.php
Normal file
29
src/SPC/builder/extension/imagick.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\linux\LinuxBuilder;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('imagick')]
|
||||
class imagick extends Extension
|
||||
{
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
// imagick may call omp_pause_all which requires -lgomp
|
||||
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
||||
if ($this->builder instanceof LinuxBuilder) {
|
||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . '-lgomp ';
|
||||
}
|
||||
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-imagick=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
32
src/SPC/builder/extension/imap.php
Normal file
32
src/SPC/builder/extension/imap.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('imap')]
|
||||
class imap extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function validate(): void
|
||||
{
|
||||
if ($this->builder->getOption('enable-zts')) {
|
||||
throw new WrongUsageException('ext-imap is not thread safe, do not build it with ZTS builds');
|
||||
}
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '--with-imap=' . BUILD_ROOT_PATH;
|
||||
if ($this->builder->getLib('openssl') !== null) {
|
||||
$arg .= ' --with-imap-ssl=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
26
src/SPC/builder/extension/intl.php
Normal file
26
src/SPC/builder/extension/intl.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('intl')]
|
||||
class intl extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
// TODO: remove the following line when https://github.com/php/php-src/pull/14002 will be released
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/intl/config.m4', 'PHP_CXX_COMPILE_STDCXX(11', 'PHP_CXX_COMPILE_STDCXX(17');
|
||||
// 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')) {
|
||||
f_putenv('CXX=' . $env . ' -std=c++17');
|
||||
} else {
|
||||
f_putenv('CXX=clang++ -std=c++17');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
23
src/SPC/builder/extension/ldap.php
Normal file
23
src/SPC/builder/extension/ldap.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('ldap')]
|
||||
class ldap extends Extension
|
||||
{
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
$output = shell()->execWithResult('$PKG_CONFIG --libs-only-l --static ldap');
|
||||
if (!empty($output[1][0])) {
|
||||
$libs = $output[1][0];
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lldap ', $libs . ' ');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
46
src/SPC/builder/extension/mbregex.php
Normal file
46
src/SPC/builder/extension/mbregex.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mbregex')]
|
||||
class mbregex extends Extension
|
||||
{
|
||||
public function getDistName(): string
|
||||
{
|
||||
return 'mbstring';
|
||||
}
|
||||
|
||||
public function getConfigureArg(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* mbregex is not an extension, we need to overwrite the default check.
|
||||
*/
|
||||
public function runCliCheckUnix(): void
|
||||
{
|
||||
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "mbstring" | grep regex', false);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !');
|
||||
}
|
||||
}
|
||||
|
||||
public function runCliCheckWindows(): void
|
||||
{
|
||||
[$ret, $out] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "mbstring"', false);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli does not contain mbstring !');
|
||||
}
|
||||
$out = implode("\n", $out);
|
||||
if (!str_contains($out, 'regex')) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !');
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/SPC/builder/extension/mbstring.php
Normal file
23
src/SPC/builder/extension/mbstring.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mbstring')]
|
||||
class mbstring extends Extension
|
||||
{
|
||||
public function getConfigureArg(): string
|
||||
{
|
||||
$arg = '--enable-mbstring';
|
||||
if ($this->builder->getExt('mbregex') === null) {
|
||||
$arg .= ' --disable-mbregex';
|
||||
} else {
|
||||
$arg .= ' --enable-mbregex';
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
50
src/SPC/builder/extension/memcache.php
Normal file
50
src/SPC/builder/extension/memcache.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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('memcache')]
|
||||
class memcache extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-memcache --with-zlib-dir=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/memcache/config9.m4',
|
||||
'if test -d $abs_srcdir/src ; then',
|
||||
'if test -d $abs_srcdir/main ; then'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/memcache/config9.m4',
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES"',
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir/main"'
|
||||
);
|
||||
// add for in-tree building
|
||||
file_put_contents(
|
||||
SOURCE_PATH . '/php-src/ext/memcache/php_memcache.h',
|
||||
<<<'EOF'
|
||||
#ifndef PHP_MEMCACHE_H
|
||||
#define PHP_MEMCACHE_H
|
||||
|
||||
extern zend_module_entry memcache_module_entry;
|
||||
#define phpext_memcache_ptr &memcache_module_entry
|
||||
|
||||
#endif
|
||||
EOF
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
18
src/SPC/builder/extension/memcached.php
Normal file
18
src/SPC/builder/extension/memcached.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('memcached')]
|
||||
class memcached extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$rootdir = BUILD_ROOT_PATH;
|
||||
return "--enable-memcached --with-zlib-dir={$rootdir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json";
|
||||
}
|
||||
}
|
||||
36
src/SPC/builder/extension/mongodb.php
Normal file
36
src/SPC/builder/extension/mongodb.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mongodb')]
|
||||
class mongodb extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'if test -z "$PHP_CONFIG"; then', 'if false; then');
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`', 'PHP_MONGODB_PHP_VERSION=' . $this->builder->getPHPVersion());
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'PHP_MONGODB_PHP_VERSION_ID=`${PHP_CONFIG} --vernum`', 'PHP_MONGODB_PHP_VERSION_ID=' . $this->builder->getPHPVersionID());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = ' --enable-mongodb ';
|
||||
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
||||
$arg .= ' --with-mongodb-sasl=no ';
|
||||
if ($this->builder->getLib('openssl')) {
|
||||
$arg .= '--with-mongodb-ssl=openssl';
|
||||
}
|
||||
$arg .= $this->builder->getLib('icu') ? ' --with-mongodb-icu=yes ' : ' --with-mongodb-icu=no ';
|
||||
$arg .= $this->builder->getLib('zstd') ? ' --with-mongodb-zstd=yes ' : ' --with-mongodb-zstd=no ';
|
||||
// $arg .= $this->builder->getLib('snappy') ? ' --with-mongodb-snappy=yes ' : ' --with-mongodb-snappy=no ';
|
||||
$arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
35
src/SPC/builder/extension/opcache.php
Normal file
35
src/SPC/builder/extension/opcache.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\exception\WrongUsageException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('opcache')]
|
||||
class opcache extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws WrongUsageException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function validate(): void
|
||||
{
|
||||
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||
throw new WrongUsageException('Statically compiled PHP with Zend Opcache only available for PHP >= 8.0 !');
|
||||
}
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-opcache';
|
||||
}
|
||||
|
||||
public function getDistName(): string
|
||||
{
|
||||
return 'Zend Opcache';
|
||||
}
|
||||
}
|
||||
30
src/SPC/builder/extension/openssl.php
Normal file
30
src/SPC/builder/extension/openssl.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('openssl')]
|
||||
class openssl extends Extension
|
||||
{
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
// patch openssl3 with php8.0 bug
|
||||
if (file_exists(SOURCE_PATH . '/openssl/VERSION.dat') && $this->builder->getPHPVersionID() < 80100) {
|
||||
$openssl_c = file_get_contents(SOURCE_PATH . '/php-src/ext/openssl/openssl.c');
|
||||
$openssl_c = preg_replace('/REGISTER_LONG_CONSTANT\s*\(\s*"OPENSSL_SSLV23_PADDING"\s*.+;/', '', $openssl_c);
|
||||
file_put_contents(SOURCE_PATH . '/php-src/ext/openssl/openssl.c', $openssl_c);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-openssl=' . BUILD_ROOT_PATH . ' --with-openssl-dir=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
20
src/SPC/builder/extension/parallel.php
Normal file
20
src/SPC/builder/extension/parallel.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('parallel')]
|
||||
class parallel extends Extension
|
||||
{
|
||||
public function validate(): void
|
||||
{
|
||||
if (!$this->builder->getOption('enable-zts')) {
|
||||
throw new WrongUsageException('ext-parallel must be built with ZTS builds. Use "--enable-zts" option!');
|
||||
}
|
||||
}
|
||||
}
|
||||
26
src/SPC/builder/extension/password_argon2.php
Normal file
26
src/SPC/builder/extension/password_argon2.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('password-argon2')]
|
||||
class password_argon2 extends Extension
|
||||
{
|
||||
public function getDistName(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function runCliCheckUnix(): void
|
||||
{
|
||||
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -r "assert(defined(\'PASSWORD_ARGON2I\'));"');
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/extension/pdo_sqlite.php
Normal file
27
src/SPC/builder/extension/pdo_sqlite.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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('pdo_sqlite')]
|
||||
class pdo_sqlite extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/configure',
|
||||
'/sqlite3_column_table_name=yes/',
|
||||
'sqlite3_column_table_name=no'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/extension/pgsql.php
Normal file
27
src/SPC/builder/extension/pgsql.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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('pgsql')]
|
||||
class pgsql extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/configure',
|
||||
'/-lpq/',
|
||||
$this->getLibFilesString()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
19
src/SPC/builder/extension/protobuf.php
Normal file
19
src/SPC/builder/extension/protobuf.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('protobuf')]
|
||||
class protobuf extends Extension
|
||||
{
|
||||
public function validate(): void
|
||||
{
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/extension/readline.php
Normal file
27
src/SPC/builder/extension/readline.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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('readline')]
|
||||
class readline extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/configure',
|
||||
'/-lncurses/',
|
||||
$this->getLibFilesString()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
26
src/SPC/builder/extension/redis.php
Normal file
26
src/SPC/builder/extension/redis.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('redis')]
|
||||
class redis extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '--enable-redis';
|
||||
$arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
||||
$arg .= $this->builder->getExt('igbinary') ? ' --enable-redis-igbinary' : ' --disable-redis-igbinary';
|
||||
if ($this->builder->getLib('zstd')) {
|
||||
$arg .= ' --enable-redis-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
if ($this->builder->getLib('liblz4')) {
|
||||
$arg .= ' --enable-redis-lz4 --with-liblz4="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
34
src/SPC/builder/extension/simdjson.php
Normal file
34
src/SPC/builder/extension/simdjson.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('simdjson')]
|
||||
class simdjson extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
$php_ver = $this->builder->getPHPVersionID();
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||
'/php_version=(`.*`)$/m',
|
||||
'php_version=' . strval($php_ver)
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||
'if test -z "$PHP_CONFIG"; then',
|
||||
'if false; then'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.w32',
|
||||
"'yes',",
|
||||
'PHP_SIMDJSON_SHARED,'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
33
src/SPC/builder/extension/snappy.php
Normal file
33
src/SPC/builder/extension/snappy.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('snappy')]
|
||||
class snappy extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/configure',
|
||||
'/-lsnappy/',
|
||||
$this->getLibFilesString() . ($this->builder instanceof MacOSBuilder ? ' -lc++' : ' -lstdc++')
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-snappy --with-snappy-includedir="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
}
|
||||
35
src/SPC/builder/extension/sodium.php
Normal file
35
src/SPC/builder/extension/sodium.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('sodium')]
|
||||
class sodium extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
// bypass error: unknown warning option '-Wno-logical-op' for macOS
|
||||
return $this->removeLineContainingString();
|
||||
}
|
||||
|
||||
private function removeLineContainingString(): bool
|
||||
{
|
||||
$path = SOURCE_PATH . '/php-src/ext/sodium/config.m4';
|
||||
$search = '-Wno-logical-op';
|
||||
if (!file_exists($path)) {
|
||||
return false;
|
||||
}
|
||||
$content = file_get_contents($path);
|
||||
$lines = preg_split('/\r\n|\n/', $content);
|
||||
$filteredLines = array_filter($lines, function ($line) use ($search) {
|
||||
return strpos($line, $search) === false;
|
||||
});
|
||||
$newContent = implode("\n", $filteredLines);
|
||||
file_put_contents($path, $newContent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/extension/ssh2.php
Normal file
27
src/SPC/builder/extension/ssh2.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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('ssh2')]
|
||||
class ssh2 extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function patchBeforeConfigure(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/configure',
|
||||
'/-lssh2/',
|
||||
$this->getLibFilesString()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
42
src/SPC/builder/extension/swoole.php
Normal file
42
src/SPC/builder/extension/swoole.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('swoole')]
|
||||
class swoole extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
// enable swoole
|
||||
$arg = '--enable-swoole';
|
||||
|
||||
// commonly-used feature: coroutine-time, disable-thread-context
|
||||
$arg .= ' --enable-swoole-coro-time --disable-thread-context';
|
||||
|
||||
// required feature: curl, openssl (but curl hook is buggy for php 8.0)
|
||||
$arg .= $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
|
||||
$arg .= ' --enable-openssl';
|
||||
|
||||
// additional 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('brotli') ? (' --with-brotli-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.
|
||||
// so this is a tricky way (enable ext [pgsql,pdo] to add postgresql hook and pdo_pgsql support)
|
||||
$arg .= $this->builder->getExt('swoole-hook-pgsql') ? '' : ' --disable-swoole-pgsql';
|
||||
|
||||
// enable this feature , need remove pdo_sqlite
|
||||
// more info : https://wenda.swoole.com/detail/109023
|
||||
$arg .= $this->builder->getExt('swoole-hook-sqlite') ? '' : ' --disable-swoole-sqlite';
|
||||
|
||||
// enable this feature , need stop pdo_*
|
||||
// $arg .= $this->builder->getLib('unixodbc') ? ' --with-swoole-odbc=unixODBC,' : ' ';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
41
src/SPC/builder/extension/swoole_hook_mysql.php
Normal file
41
src/SPC/builder/extension/swoole_hook_mysql.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('swoole-hook-mysql')]
|
||||
class swoole_hook_mysql extends Extension
|
||||
{
|
||||
public function getDistName(): string
|
||||
{
|
||||
return 'swoole';
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
// 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
|
||||
return '';
|
||||
}
|
||||
|
||||
public function runCliCheckUnix(): void
|
||||
{
|
||||
// skip if not enable swoole
|
||||
if ($this->builder->getExt('swoole') === null) {
|
||||
return;
|
||||
}
|
||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
||||
$out = implode('', $out);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||
}
|
||||
if (!str_contains($out, 'mysqlnd')) {
|
||||
throw new RuntimeException('swoole mysql hook is not enabled correctly.');
|
||||
}
|
||||
}
|
||||
}
|
||||
49
src/SPC/builder/extension/swoole_hook_pgsql.php
Normal file
49
src/SPC/builder/extension/swoole_hook_pgsql.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('swoole-hook-pgsql')]
|
||||
class swoole_hook_pgsql extends Extension
|
||||
{
|
||||
public function getDistName(): string
|
||||
{
|
||||
return 'swoole';
|
||||
}
|
||||
|
||||
public function validate(): void
|
||||
{
|
||||
// pdo_pgsql need to be disabled
|
||||
if ($this->builder->getExt('pdo_pgsql') !== null) {
|
||||
throw new WrongUsageException('swoole-hook-pgsql provides pdo_pgsql, if you enable pgsql hook for swoole, you must remove pdo_pgsql extension.');
|
||||
}
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
// enable swoole pgsql hook
|
||||
return '--enable-swoole-pgsql';
|
||||
}
|
||||
|
||||
public function runCliCheckUnix(): void
|
||||
{
|
||||
// skip if not enable swoole
|
||||
if ($this->builder->getExt('swoole') === null) {
|
||||
return;
|
||||
}
|
||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
||||
$out = implode('', $out);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||
}
|
||||
if (!str_contains($out, 'coroutine_pgsql')) {
|
||||
throw new RuntimeException('swoole pgsql hook is not enabled correctly.');
|
||||
}
|
||||
}
|
||||
}
|
||||
49
src/SPC/builder/extension/swoole_hook_sqlite.php
Normal file
49
src/SPC/builder/extension/swoole_hook_sqlite.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('swoole-hook-sqlite')]
|
||||
class swoole_hook_sqlite extends Extension
|
||||
{
|
||||
public function getDistName(): string
|
||||
{
|
||||
return 'swoole';
|
||||
}
|
||||
|
||||
public function validate(): void
|
||||
{
|
||||
// pdo_pgsql need to be disabled
|
||||
if ($this->builder->getExt('pdo_sqlite') !== null) {
|
||||
throw new WrongUsageException('swoole-hook-sqlite provides pdo_sqlite, if you enable sqlite hook for swoole, you must remove pdo_sqlite extension.');
|
||||
}
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
// enable swoole pgsql hook
|
||||
return '--enable-swoole-sqlite';
|
||||
}
|
||||
|
||||
public function runCliCheckUnix(): void
|
||||
{
|
||||
// skip if not enable swoole
|
||||
if ($this->builder->getExt('swoole') === null) {
|
||||
return;
|
||||
}
|
||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
||||
$out = implode('', $out);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||
}
|
||||
if (!str_contains($out, 'coroutine_sqlite')) {
|
||||
throw new RuntimeException('swoole sqlite hook is not enabled correctly.');
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/SPC/builder/extension/swow.php
Normal file
44
src/SPC/builder/extension/swow.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('swow')]
|
||||
class swow extends Extension
|
||||
{
|
||||
public function validate(): void
|
||||
{
|
||||
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||
throw new RuntimeException('The latest swow extension requires PHP 8.0 or later');
|
||||
}
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '--enable-swow';
|
||||
$arg .= $this->builder->getLib('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
||||
$arg .= $this->builder->getLib('curl') ? ' --enable-swow-curl' : ' --disable-swow-curl';
|
||||
return $arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if ($this->builder->getPHPVersionID() >= 80000 && !is_link(SOURCE_PATH . '/php-src/ext/swow')) {
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && mklink /D swow swow-src\ext');
|
||||
} else {
|
||||
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && ln -s swow-src/ext swow');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
19
src/SPC/builder/extension/uv.php
Normal file
19
src/SPC/builder/extension/uv.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('uv')]
|
||||
class uv extends Extension
|
||||
{
|
||||
public function validate(): void
|
||||
{
|
||||
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||
throw new \RuntimeException('The latest uv extension requires PHP 8.0 or later');
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/SPC/builder/extension/xhprof.php
Normal file
33
src/SPC/builder/extension/xhprof.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('xhprof')]
|
||||
class xhprof extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if (!is_link(SOURCE_PATH . '/php-src/ext/xhprof')) {
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && mklink /D xhprof xhprof-src\extension');
|
||||
} else {
|
||||
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && ln -s xhprof-src/extension xhprof');
|
||||
}
|
||||
|
||||
// patch config.m4
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/xhprof/config.m4',
|
||||
'if test -f $phpincludedir/ext/pcre/php_pcre.h; then',
|
||||
'if test -f $abs_srcdir/ext/pcre/php_pcre.h; then'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
17
src/SPC/builder/extension/xlswriter.php
Normal file
17
src/SPC/builder/extension/xlswriter.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('xlswriter')]
|
||||
class xlswriter extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-xlswriter --enable-reader';
|
||||
}
|
||||
}
|
||||
58
src/SPC/builder/extension/xml.php
Normal file
58
src/SPC/builder/extension/xml.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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('xml')]
|
||||
#[CustomExt('soap')]
|
||||
#[CustomExt('xmlreader')]
|
||||
#[CustomExt('xmlwriter')]
|
||||
#[CustomExt('dom')]
|
||||
#[CustomExt('simplexml')]
|
||||
class xml extends Extension
|
||||
{
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = match ($this->name) {
|
||||
'xml' => '--enable-xml',
|
||||
'soap' => '--enable-soap',
|
||||
'xmlreader' => '--enable-xmlreader',
|
||||
'xmlwriter' => '--enable-xmlwriter',
|
||||
'dom' => '--enable-dom',
|
||||
'simplexml' => '--enable-simplexml',
|
||||
default => throw new RuntimeException('Not accept non-xml extension'),
|
||||
};
|
||||
$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(): string
|
||||
{
|
||||
$arg = match ($this->name) {
|
||||
'xml' => '--with-xml',
|
||||
'soap' => '--enable-soap',
|
||||
'xmlreader' => '--enable-xmlreader',
|
||||
'xmlwriter' => '--enable-xmlwriter',
|
||||
'dom' => '--with-dom',
|
||||
'simplexml' => '--with-simplexml',
|
||||
default => throw new RuntimeException('Not accept non-xml extension'),
|
||||
};
|
||||
$arg .= ' --with-libxml';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
26
src/SPC/builder/extension/yac.php
Normal file
26
src/SPC/builder/extension/yac.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('yac')]
|
||||
class yac extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/storage/allocator/yac_allocator.h', 'defined(HAVE_SHM_MMAP_ANON)', 'defined(YAC_ALLOCATOR_H)');
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/igbinary.c', '#ifdef YAC_ENABLE_IGBINARY', '#if 1');
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/json.c', '#if YAC_ENABLE_JSON', '#if 1');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-yac --enable-igbinary --enable-json';
|
||||
}
|
||||
}
|
||||
17
src/SPC/builder/extension/zlib.php
Normal file
17
src/SPC/builder/extension/zlib.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('zlib')]
|
||||
class zlib extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-zlib --with-zlib-dir="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
}
|
||||
17
src/SPC/builder/extension/zstd.php
Normal file
17
src/SPC/builder/extension/zstd.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('zstd')]
|
||||
class zstd extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
}
|
||||
254
src/SPC/builder/freebsd/BSDBuilder.php
Normal file
254
src/SPC/builder/freebsd/BSDBuilder.php
Normal file
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd;
|
||||
|
||||
use SPC\builder\unix\UnixBuilderBase;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\store\SourcePatcher;
|
||||
|
||||
class BSDBuilder extends UnixBuilderBase
|
||||
{
|
||||
/** @var bool Micro patch phar flag */
|
||||
private bool $phar_patched = false;
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function __construct(array $options = [])
|
||||
{
|
||||
$this->options = $options;
|
||||
|
||||
// ---------- set necessary options ----------
|
||||
// set C Compiler (default: clang)
|
||||
f_putenv('CC=' . $this->getOption('cc', 'clang'));
|
||||
// set C++ Compiler (default: clang++)
|
||||
f_putenv('CXX=' . $this->getOption('cxx', 'clang++'));
|
||||
// set PATH
|
||||
f_putenv('PATH=' . BUILD_ROOT_PATH . '/bin:' . getenv('PATH'));
|
||||
// set PKG_CONFIG
|
||||
f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config');
|
||||
// set PKG_CONFIG_PATH
|
||||
f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig/');
|
||||
|
||||
// set arch (default: current)
|
||||
$this->setOptionIfNotExist('arch', php_uname('m'));
|
||||
$this->setOptionIfNotExist('gnu-arch', arch2gnu($this->getOption('arch')));
|
||||
|
||||
// ---------- set necessary compile environments ----------
|
||||
// concurrency
|
||||
$this->concurrency = SystemUtil::getCpuCount();
|
||||
// cflags
|
||||
$this->arch_c_flags = SystemUtil::getArchCFlags($this->getOption('arch'));
|
||||
$this->arch_cxx_flags = SystemUtil::getArchCFlags($this->getOption('arch'));
|
||||
// cmake toolchain
|
||||
$this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile('BSD', $this->getOption('arch'), $this->arch_c_flags);
|
||||
|
||||
// create pkgconfig and include dir (some libs cannot create them automatically)
|
||||
f_mkdir(BUILD_LIB_PATH . '/pkgconfig', recursive: true);
|
||||
f_mkdir(BUILD_INCLUDE_PATH, recursive: true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Just start to build statically linked php binary
|
||||
*
|
||||
* @param int $build_target build target
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
|
||||
{
|
||||
// ---------- Update extra-libs ----------
|
||||
$extra_libs = $this->getOption('extra-libs', '');
|
||||
// add libc++, some extensions or libraries need it (C++ cannot be linked statically)
|
||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lc++ ' : '');
|
||||
if (!$this->getOption('bloat', false)) {
|
||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', $this->getAllStaticLibFiles());
|
||||
} else {
|
||||
logger()->info('bloat linking');
|
||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', array_map(fn ($x) => "-Wl,-force_load,{$x}", array_filter($this->getAllStaticLibFiles())));
|
||||
}
|
||||
$this->setOption('extra-libs', $extra_libs);
|
||||
|
||||
$this->emitPatchPoint('before-php-buildconf');
|
||||
SourcePatcher::patchBeforeBuildconf($this);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')->exec('./buildconf --force');
|
||||
|
||||
$this->emitPatchPoint('before-php-configure');
|
||||
SourcePatcher::patchBeforeConfigure($this);
|
||||
|
||||
$json_74 = $this->getPHPVersionID() < 80000 ? '--enable-json ' : '';
|
||||
$zts_enable = $this->getPHPVersionID() < 80000 ? '--enable-maintainer-zts --disable-zend-signals' : '--enable-zts --disable-zend-signals';
|
||||
$zts = $this->getOption('enable-zts', false) ? $zts_enable : '';
|
||||
|
||||
$enableCli = ($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI;
|
||||
$enableFpm = ($build_target & BUILD_TARGET_FPM) === BUILD_TARGET_FPM;
|
||||
$enableMicro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO;
|
||||
$enableEmbed = ($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED;
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec(
|
||||
'./configure ' .
|
||||
'--prefix= ' .
|
||||
'--with-valgrind=no ' . // Not detect memory leak
|
||||
'--enable-shared=no ' .
|
||||
'--enable-static=yes ' .
|
||||
"CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " .
|
||||
'--disable-all ' .
|
||||
'--disable-cgi ' .
|
||||
'--disable-phpdbg ' .
|
||||
($enableCli ? '--enable-cli ' : '--disable-cli ') .
|
||||
($enableFpm ? '--enable-fpm ' : '--disable-fpm ') .
|
||||
($enableEmbed ? '--enable-embed=static ' : '--disable-embed ') .
|
||||
($enableMicro ? '--enable-micro ' : '--disable-micro ') .
|
||||
$json_74 .
|
||||
$zts .
|
||||
$this->makeExtensionArgs()
|
||||
);
|
||||
|
||||
$this->emitPatchPoint('before-php-make');
|
||||
SourcePatcher::patchBeforeMake($this);
|
||||
|
||||
$this->cleanMake();
|
||||
|
||||
if ($enableCli) {
|
||||
logger()->info('building cli');
|
||||
$this->buildCli();
|
||||
}
|
||||
if ($enableFpm) {
|
||||
logger()->info('building fpm');
|
||||
$this->buildFpm();
|
||||
}
|
||||
if ($enableMicro) {
|
||||
logger()->info('building micro');
|
||||
$this->buildMicro();
|
||||
}
|
||||
if ($enableEmbed) {
|
||||
logger()->info('building embed');
|
||||
if ($enableMicro) {
|
||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/Makefile', 'OVERALL_TARGET =', 'OVERALL_TARGET = libphp.la');
|
||||
}
|
||||
$this->buildEmbed();
|
||||
}
|
||||
|
||||
if (php_uname('m') === $this->getOption('arch')) {
|
||||
$this->emitPatchPoint('before-sanity-check');
|
||||
$this->sanityCheck($build_target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build cli sapi
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
protected function buildCli(): void
|
||||
{
|
||||
$vars = SystemUtil::makeEnvVarString([
|
||||
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
|
||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} /usr/lib/libm.a",
|
||||
]);
|
||||
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
$shell->exec('sed -ie "s|//lib|/lib|g" Makefile');
|
||||
$shell->exec("make -j{$this->concurrency} {$vars} cli");
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('strip sapi/cli/php');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_CLI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build phpmicro sapi
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
protected function buildMicro(): void
|
||||
{
|
||||
if ($this->getPHPVersionID() < 80000) {
|
||||
throw new WrongUsageException('phpmicro only support PHP >= 8.0!');
|
||||
}
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
SourcePatcher::patchMicroPhar($this->getPHPVersionID());
|
||||
}
|
||||
|
||||
$enable_fake_cli = $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '';
|
||||
$vars = [
|
||||
// with debug information, optimize for size, remove identifiers, patch fake cli for micro
|
||||
'EXTRA_CFLAGS' => '-g -Os' . $enable_fake_cli,
|
||||
// link resolv library (macOS needs it)
|
||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} /usr/lib/libm.a",
|
||||
];
|
||||
$vars = SystemUtil::makeEnvVarString($vars);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec("make -j{$this->concurrency} {$vars} micro");
|
||||
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/micro')->exec('strip --strip-all micro.sfx');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_MICRO);
|
||||
|
||||
if ($this->phar_patched) {
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build fpm sapi
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
protected function buildFpm(): void
|
||||
{
|
||||
$vars = SystemUtil::makeEnvVarString([
|
||||
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
|
||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} /usr/lib/libm.a", // link resolv library (macOS needs it)
|
||||
]);
|
||||
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
$shell->exec("make -j{$this->concurrency} {$vars} fpm");
|
||||
if (!$this->getOption('no-strip', false)) {
|
||||
$shell->exec('strip sapi/fpm/php-fpm');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_FPM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build embed sapi
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function buildEmbed(): void
|
||||
{
|
||||
$vars = SystemUtil::makeEnvVarString([
|
||||
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
|
||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} /usr/lib/libm.a", // link resolv library (macOS needs it)
|
||||
]);
|
||||
|
||||
shell()
|
||||
->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('make INSTALL_ROOT=' . BUILD_ROOT_PATH . " -j{$this->concurrency} {$vars} install")
|
||||
// Workaround for https://github.com/php/php-src/issues/12082
|
||||
->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o')
|
||||
->exec('mkdir ' . BUILD_ROOT_PATH . '/lib/php-o')
|
||||
->cd(BUILD_ROOT_PATH . '/lib/php-o')
|
||||
->exec('ar x ' . BUILD_ROOT_PATH . '/lib/libphp.a')
|
||||
->exec('rm ' . BUILD_ROOT_PATH . '/lib/libphp.a')
|
||||
->exec('ar rcs ' . BUILD_ROOT_PATH . '/lib/libphp.a *.o')
|
||||
->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o');
|
||||
}
|
||||
}
|
||||
46
src/SPC/builder/freebsd/SystemUtil.php
Normal file
46
src/SPC/builder/freebsd/SystemUtil.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd;
|
||||
|
||||
use SPC\builder\traits\UnixSystemUtilTrait;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
|
||||
class SystemUtil
|
||||
{
|
||||
/** Unix System Util Compatible */
|
||||
use UnixSystemUtilTrait;
|
||||
|
||||
/**
|
||||
* Get Logic CPU Count for macOS
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function getCpuCount(): int
|
||||
{
|
||||
[$ret, $output] = shell()->execWithResult('sysctl -n hw.ncpu');
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('Failed to get cpu count');
|
||||
}
|
||||
|
||||
return (int) $output[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Target Arch CFlags
|
||||
*
|
||||
* @param string $arch Arch Name
|
||||
* @return string return Arch CFlags string
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public static function getArchCFlags(string $arch): string
|
||||
{
|
||||
return match ($arch) {
|
||||
'amd64', 'x86_64' => '--target=x86_64-unknown-freebsd',
|
||||
'arm64','aarch64' => '--target=aarch-unknown-freebsd',
|
||||
default => throw new WrongUsageException('unsupported arch: ' . $arch),
|
||||
};
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/freebsd/library/BSDLibraryBase.php
Normal file
27
src/SPC/builder/freebsd/library/BSDLibraryBase.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd\library;
|
||||
|
||||
use SPC\builder\BuilderBase;
|
||||
use SPC\builder\freebsd\BSDBuilder;
|
||||
use SPC\builder\LibraryBase;
|
||||
use SPC\builder\traits\UnixLibraryTrait;
|
||||
|
||||
abstract class BSDLibraryBase extends LibraryBase
|
||||
{
|
||||
use UnixLibraryTrait;
|
||||
|
||||
protected array $headers;
|
||||
|
||||
public function __construct(protected BSDBuilder $builder)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getBuilder(): BuilderBase
|
||||
{
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/freebsd/library/bzip2.php
Normal file
12
src/SPC/builder/freebsd/library/bzip2.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd\library;
|
||||
|
||||
class bzip2 extends BSDLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\bzip2;
|
||||
|
||||
public const NAME = 'bzip2';
|
||||
}
|
||||
21
src/SPC/builder/freebsd/library/curl.php
Normal file
21
src/SPC/builder/freebsd/library/curl.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd\library;
|
||||
|
||||
class curl extends BSDLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\curl;
|
||||
|
||||
public const NAME = 'curl';
|
||||
|
||||
public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string
|
||||
{
|
||||
$libs = parent::getStaticLibFiles($style, $recursive);
|
||||
if ($this->builder->getLib('openssl')) {
|
||||
$this->builder->setOption('extra-libs', $this->builder->getOption('extra-libs') . ' /usr/lib/libpthread.a /usr/lib/libdl.a');
|
||||
}
|
||||
return $libs;
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/freebsd/library/onig.php
Normal file
12
src/SPC/builder/freebsd/library/onig.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd\library;
|
||||
|
||||
class onig extends BSDLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\onig;
|
||||
|
||||
public const NAME = 'onig';
|
||||
}
|
||||
63
src/SPC/builder/freebsd/library/openssl.php
Normal file
63
src/SPC/builder/freebsd/library/openssl.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
|
||||
*
|
||||
* lwmbs is licensed under Mulan PSL v2. You can use this
|
||||
* software according to the terms and conditions of the
|
||||
* Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at:
|
||||
*
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd\library;
|
||||
|
||||
use SPC\builder\macos\library\MacOSLibraryBase;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
|
||||
class openssl extends BSDLibraryBase
|
||||
{
|
||||
public const NAME = 'openssl';
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
[$lib,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
// lib:zlib
|
||||
$extra = '';
|
||||
$ex_lib = '';
|
||||
$zlib = $this->builder->getLib('zlib');
|
||||
if ($zlib instanceof MacOSLibraryBase) {
|
||||
$extra = 'zlib';
|
||||
$ex_lib = trim($zlib->getStaticLibFiles() . ' ' . $ex_lib);
|
||||
}
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"./Configure no-shared {$extra} " .
|
||||
'--prefix=/ ' . // use prefix=/
|
||||
"--libdir={$lib} " .
|
||||
'--openssldir=/etc/ssl ' .
|
||||
'BSD-' . arch2gnu($this->builder->getOption('arch'))
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
||||
->exec("make install_sw DESTDIR={$destdir}");
|
||||
$this->patchPkgconfPrefix(['libssl.pc', 'openssl.pc', 'libcrypto.pc']);
|
||||
}
|
||||
}
|
||||
15
src/SPC/builder/freebsd/library/pkgconfig.php
Normal file
15
src/SPC/builder/freebsd/library/pkgconfig.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\freebsd\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class pkgconfig extends BSDLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\pkgconfig;
|
||||
|
||||
public const NAME = 'pkg-config';
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user