mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Compare commits
258 Commits
4fb6d8cafd
...
2.0-rc3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
74a34362c3 | ||
|
|
0e33380df5 | ||
|
|
3db9c70e1b | ||
|
|
b2f3ffcc00 | ||
|
|
aa9ec6e50e | ||
|
|
dcb3d91610 | ||
|
|
9e71a98eda | ||
|
|
f2ef783b13 | ||
|
|
874e104570 | ||
|
|
1398086c38 | ||
|
|
db1586e2ec | ||
|
|
1158931d91 | ||
|
|
ee1b03b060 | ||
|
|
b99378ea38 | ||
|
|
c9692d502c | ||
|
|
3f6e659c6a | ||
|
|
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 |
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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
|
||||
custom: 'https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md' # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
106
.github/workflows/build-linux-arm.yml
vendored
Normal file
106
.github/workflows/build-linux-arm.yml
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
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.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@v3
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ inputs.version }}-dependencies
|
||||
|
||||
# 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 }} --all ${{ 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@v3
|
||||
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@v3
|
||||
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@v3
|
||||
with:
|
||||
name: php-fpm-${{ inputs.version }}-linux-${{ inputs.operating-system }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
117
.github/workflows/build-linux-x86_64.yml
vendored
Normal file
117
.github/workflows/build-linux-x86_64.yml
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
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.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@v3
|
||||
|
||||
# Install Ubuntu missing packages and mark os suffix
|
||||
- run: |
|
||||
sudo apt install musl-tools -y
|
||||
echo "SPC_BUILD_OS=linux" >> $GITHUB_ENV
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v3
|
||||
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
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ inputs.version }}-dependencies
|
||||
|
||||
# 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 }} --all ${{ 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@v3
|
||||
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@v3
|
||||
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@v3
|
||||
with:
|
||||
name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
|
||||
117
.github/workflows/build-macos-x86_64.yml
vendored
Normal file
117
.github/workflows/build-macos-x86_64.yml
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
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.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-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
# Install macOS missing packages and mark os suffix
|
||||
- run: |
|
||||
brew install automake gzip
|
||||
echo "SPC_BUILD_OS=macos" >> $GITHUB_ENV
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v3
|
||||
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
|
||||
|
||||
# Cache downloaded source
|
||||
- id: cache-download
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: downloads
|
||||
key: php-${{ inputs.version }}-dependencies
|
||||
|
||||
# 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 }} --all ${{ 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@v3
|
||||
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@v3
|
||||
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@v3
|
||||
with:
|
||||
name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
|
||||
path: buildroot/bin/php-fpm
|
||||
|
||||
# Upload extensions metadata
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: license-files
|
||||
path: buildroot/license/
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-meta
|
||||
path: |
|
||||
buildroot/build-extensions.json
|
||||
buildroot/build-libraries.json
|
||||
|
||||
40
.github/workflows/download-cache.yml
vendored
Normal file
40
.github/workflows/download-cache.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: archive download sources weekly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "* 14 * * 5"
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
download:
|
||||
name: cache download sources
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: [ "8.0", "8.1", "8.2" ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
# Cache composer dependencies
|
||||
- id: cache-composer-deps
|
||||
uses: actions/cache@v3
|
||||
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
|
||||
|
||||
# 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=${{ matrix.php-version }} --all --debug
|
||||
|
||||
# Upload downloaded files
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: download-files-${{ matrix.php-version }}
|
||||
path: downloads/
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -19,3 +19,9 @@ composer.lock
|
||||
|
||||
# php cs fixer cache file
|
||||
.php-cs-fixer.cache
|
||||
|
||||
# exclude self-runtime
|
||||
/bin/*
|
||||
!/bin/spc
|
||||
!/bin/setup-runtime
|
||||
!/bin/spc-alpine-docker
|
||||
|
||||
215
README-en.md
215
README-en.md
@@ -2,65 +2,174 @@
|
||||
|
||||
Compile A Statically Linked PHP With Swoole and other Extensions.
|
||||
|
||||
Compile a purely static PHP binary file with various extensions to make PHP-cli applications more portable!
|
||||
Compile a purely static php-cli binary file with various extensions to make PHP applications more portable! (cli SAPI)
|
||||
|
||||
You can also use the micro binary file to package PHP source code and binary files into one for distribution!
|
||||
<img width="600" alt="截屏2023-05-02 15 53 13" src="https://user-images.githubusercontent.com/20330940/235610282-23e58d68-bd35-4092-8465-171cff2d5ba8.png">
|
||||
|
||||
Note: only support cli SAPI, not support fpm, cgi.
|
||||
You can also use the micro binary file to combine php binary and php source code into one for distribution!
|
||||
This feature is provided by [dixyes/phpmicro](https://github.com/dixyes/phpmicro). (micro SAPI)
|
||||
|
||||
<img width="600" alt="截屏2023-05-02 15 52 33" src="https://user-images.githubusercontent.com/20330940/235610318-2ef4e3f1-278b-4ca4-99f4-b38120efc395.png">
|
||||
|
||||
[]()
|
||||
[]()
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build.yml)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build.yml)
|
||||
|
||||
[]()
|
||||
[]()
|
||||
|
||||
> The project has renamed the `refactor` branch to the `main` branch, please pay attention to changing the branch name for dependent projects.
|
||||
|
||||
## Compilation Requirements
|
||||
|
||||
Yes, this project is written in PHP, pretty funny.
|
||||
But php-static-cli only requires an environment above PHP 8.0.
|
||||
But static-php-cli runtime only requires an environment above PHP 8.0 and `tokenizer`, `iconv` extension.
|
||||
|
||||
- Linux
|
||||
- Supported arch: aarch64, amd64
|
||||
- Supported distributions: alpine, ubuntu, centos
|
||||
- Requirements: (TODO)
|
||||
- macOS
|
||||
- Supported arch: arm64, x86_64
|
||||
- Requirements: make, bison, flex, pkg-config, git, autoconf, automake, tar, unzip, xz, gzip, bzip2, cmake
|
||||
- Windows
|
||||
- Supported arch: x86_64
|
||||
- Requirements: (TODO)
|
||||
- PHP
|
||||
- Supported version: 8.0, 8.1, 8.2
|
||||
Here is the architecture support status, where `CI` represents support for GitHub Action builds,
|
||||
`Local` represents support for local builds, and blank represents not currently supported.
|
||||
|
||||
## Usage (WIP)
|
||||
| | x86_64 | aarch64 |
|
||||
|---------|-----------|-----------|
|
||||
| macOS | CI, Local | Local |
|
||||
| Linux | CI, Local | CI, Local |
|
||||
| Windows | | |
|
||||
|
||||
After stable release for this project, a single phar and single binary for this tool will be published.
|
||||
> macOS-arm64 is not supported for GitHub Actions, if you are going to build on arm, you can build it manually on your own machine.
|
||||
|
||||
And currently you may need to clone this branch and edit GitHub Action to build.
|
||||
Currently supported PHP versions for compilation are: `7.4`, `8.0`, `8.1`, `8.2`.
|
||||
|
||||
### Compilation
|
||||
## Docs
|
||||
|
||||
docs here: <https://static-php-cli.zhamao.me>.
|
||||
|
||||
## Simple Usage
|
||||
|
||||
Please first select the extension you want to compile based on the extension list below.
|
||||
|
||||
### Direct Download
|
||||
|
||||
If you don't compile yourself, you can download pre-compiled artifact from Actions, or from self-hosted server: [Here](https://dl.zhamao.xin/static-php-cli/)
|
||||
|
||||
> self-hosted server contains extensions: `bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip`
|
||||
|
||||
### Supported Extensions
|
||||
|
||||
[Supported Extension List](https://static-php-cli.zhamao.me/en/guide/extensions.html)
|
||||
|
||||
> If there is no extension you need here, you can submit an issue.
|
||||
|
||||
### GitHub Actions Build
|
||||
|
||||
Use GitHub Action to easily build a statically compiled PHP and phpmicro,
|
||||
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.
|
||||
|
||||
- When using ubuntu-latest, it will build linux-x86_64 binary.
|
||||
- When using macos-latest, it will build macOS-x86_64 binary.
|
||||
|
||||
### Manual Build
|
||||
|
||||
Clone repo first:
|
||||
|
||||
```bash
|
||||
chmod +x spc
|
||||
# fetch all libraries
|
||||
./spc fetch --all
|
||||
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
||||
./spc build bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl --build-all
|
||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||
```
|
||||
|
||||
If you have not installed php on your system, you can use package management to install PHP (such as brew, apt, yum, apk etc.).
|
||||
|
||||
And you can also download single-file php binary and composer using command `bin/setup-runtime`.
|
||||
The PHP runtime for static-php-cli itself will be downloaded at `bin/php`, and composer is at `bin/composer`.
|
||||
|
||||
```bash
|
||||
cd static-php-cli
|
||||
chmod +x bin/setup-runtime
|
||||
# It will download php-cli from self-hosted server and composer from getcomposer.org
|
||||
./bin/setup-runtime
|
||||
|
||||
# Use this php runtime to run static-php-cli compiler
|
||||
./bin/php bin/spc
|
||||
|
||||
# Use composer
|
||||
./bin/php bin/composer
|
||||
```
|
||||
|
||||
Basic usage for building php and micro with some extensions:
|
||||
|
||||
```bash
|
||||
cd static-php-cli
|
||||
composer update
|
||||
chmod +x bin/spc
|
||||
# Check system tool dependencies, fix them automatically
|
||||
./bin/spc doctor
|
||||
# fetch all libraries
|
||||
./bin/spc fetch --all
|
||||
# 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
|
||||
```
|
||||
|
||||
You can also use the parameter `--with-php=x.y` to specify the downloaded PHP version, currently supports 7.4 ~ 8.2:
|
||||
|
||||
```bash
|
||||
# Using PHP >= 8.0 is recommended, because 7.4 cannot use phpmicro
|
||||
./bin/spc fetch --with-php=8.2 --all
|
||||
```
|
||||
|
||||
Now we support `cli`, `micro`, `fpm`, you can use one or more of the following parameters to specify the compiled SAPI:
|
||||
|
||||
- `--build-cli`: build static cli executable
|
||||
- `--build-micro`: build static phpmicro self-extracted executable
|
||||
- `--build-fpm`: build static fpm binary
|
||||
- `--build-all`: build all
|
||||
|
||||
If anything goes wrong, use `--debug` option to display full terminal output:
|
||||
|
||||
```bash
|
||||
./bin/spc build openssl,pcntl,mbstring --debug --build-all
|
||||
./bin/spc fetch --all --debug
|
||||
```
|
||||
|
||||
In addition, we build NTS by default. If you are going to build ZTS version, just add `--enable-zts` option.
|
||||
|
||||
```bash
|
||||
./bin/spc build openssl,pcntl --build-all --enable-zts
|
||||
```
|
||||
|
||||
Adding option `--no-strip` can produce binaries with debug symbols, in order to debug (using gdb). Disabling strip will increase the size of static binary.
|
||||
|
||||
### php-cli Usage
|
||||
|
||||
When using the parameter `--build-all` or not adding the `--build-micro` parameter,
|
||||
> 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 `source/php-src/sapi/cli/`, simply copy it out for use.
|
||||
This file will be located in the directory `buildroot/bin/`, copy it out for use.
|
||||
|
||||
```bash
|
||||
./php -v
|
||||
./php -m
|
||||
./php your_code.php
|
||||
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)
|
||||
```
|
||||
|
||||
### micro.sfx Usage
|
||||
|
||||
> phpmicro is a SelF-extracted eXecutable SAPI module,
|
||||
> provided by [dixyes/phpmicro](https://github.com/dixyes/phpmicro).
|
||||
> 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 directory `source/php-src/sapi/micro/`, simply copy it out for use.
|
||||
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.
|
||||
|
||||
@@ -69,23 +178,33 @@ echo "<?php echo 'Hello world' . PHP_EOL;" > code.php
|
||||
cat micro.sfx code.php > single-app && chmod +x single-app
|
||||
./single-app
|
||||
|
||||
# If packing a PHAR file, simply replace code.php with the Phar file path.
|
||||
# If packing a PHAR file, replace code.php with the Phar file path.
|
||||
```
|
||||
|
||||
> In some cases, PHAR files may not run in a micro environment.
|
||||
|
||||
### php-fpm Usage
|
||||
|
||||
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 normal 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`.
|
||||
|
||||
## Current Status
|
||||
|
||||
- [X] Basic CLI framework (by symfony/console)
|
||||
- [ ] Linux support
|
||||
- [X] Basic CLI framework (by `symfony/console`)
|
||||
- [X] Linux support
|
||||
- [X] macOS support
|
||||
- [X] Exception handler
|
||||
- [ ] Windows support
|
||||
- [X] PHP 7.4 support
|
||||
- [X] fpm support
|
||||
|
||||
## Supported Extensions (WIP)
|
||||
|
||||
[Support Extension List](/ext-support.md)
|
||||
More functions and features are coming soon, Bugs and TODOs: https://github.com/crazywhalecc/static-php-cli/issues/32
|
||||
|
||||
## Contribution
|
||||
|
||||
@@ -104,11 +223,21 @@ The basic principles for contributing are as follows:
|
||||
camelCase and underscore formats should be followed, and mixing within the same module is prohibited.
|
||||
- When compiling external libraries and creating patches, compatibility with different operating systems should be considered.
|
||||
|
||||
If you want to contribute document content, please go to [crazywhalecc/static-php-cli-docs](https://github.com/crazywhalecc/static-php-cli-docs).
|
||||
|
||||
Part of the English document is written by me, and part is translated by Google,
|
||||
and there may be inaccurate descriptions, strange or offensive expressions.
|
||||
If you are a native English speaker, some corrections to the documentation are welcome.
|
||||
|
||||
|
||||
## Sponsor this project
|
||||
|
||||
You can sponsor my project on [this page](https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md).
|
||||
|
||||
## Open-Source License
|
||||
|
||||
This project is based on the tradition of using the MIT License for old versions,
|
||||
while the new version references source code from some other projects.
|
||||
Special thanks to:
|
||||
while the new version references source code from some other projects:
|
||||
|
||||
- [dixyes/lwmbs](https://github.com/dixyes/lwmbs) (Mulun Permissive License)
|
||||
- [swoole/swoole-cli](https://github.com/swoole/swoole-cli) (Apache 2.0 LICENSE+SWOOLE-CLI LICENSE)
|
||||
@@ -117,5 +246,11 @@ 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 `dump-license`(TODO) command to export the open source licenses used in the project after compilation,
|
||||
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.
|
||||
|
||||
## Advanced
|
||||
|
||||
The refactoring branch of this project is written modularly.
|
||||
If you are interested in this project and want to join the development,
|
||||
you can refer to the [Contribution Guide](https://static-php-cli.zhamao.me) of the documentation to contribute code or documentation. (TODO)
|
||||
|
||||
205
README.md
205
README.md
@@ -1,65 +1,163 @@
|
||||
# static-php-cli
|
||||
|
||||
Compile A Statically Linked PHP With Swoole and other Extensions. [English README](README-en.md)
|
||||
Compile A Statically Linked PHP With Swoole and other Extensions.
|
||||
|
||||
编译纯静态的 PHP Binary 二进制文件,带有各种扩展,让 PHP-cli 应用变得更便携!
|
||||
**If you are using English, see [English README](README-en.md).**
|
||||
|
||||
同时可以使用 micro 二进制文件,将 PHP 源码和 PHP 二进制构建为一个文件分发!
|
||||
编译纯静态的 PHP Binary 二进制文件,带有各种扩展,让 PHP-cli 应用变得更便携!(cli SAPI)
|
||||
|
||||
注:只能编译 CLI 模式,暂不支持 CGI 和 FPM 模式。
|
||||
<img width="600" alt="截屏2023-05-02 15 53 13" src="https://user-images.githubusercontent.com/20330940/235610282-23e58d68-bd35-4092-8465-171cff2d5ba8.png">
|
||||
|
||||
[]()
|
||||
同时可以使用 micro 二进制文件,将 PHP 源码和 PHP 二进制构建为一个文件分发!(由 [dixyes/phpmicro](https://github.com/dixyes/phpmicro) 提供支持)(micro SAPI)
|
||||
|
||||
<img width="600" alt="截屏2023-05-02 15 52 33" src="https://user-images.githubusercontent.com/20330940/235610318-2ef4e3f1-278b-4ca4-99f4-b38120efc395.png">
|
||||
|
||||
[]()
|
||||
[]()
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build.yml)
|
||||
[](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build.yml)
|
||||
[]()
|
||||
[]()
|
||||
|
||||
> 项目已重命名 `refactor` 分支为 `main` 分支,请依赖的项目注意更改分支名称。
|
||||
|
||||
## 编译环境需求
|
||||
|
||||
是的,本项目采用 PHP 编写,编译前需要一个 PHP 环境,比较滑稽。
|
||||
但本项目默认可通过自身构建的 micro 和 static-php 二进制运行,其他只需要包含 tokenizer 扩展和 PHP 版本大于等于 8.0 即可。
|
||||
|
||||
- Linux
|
||||
- 支持架构: aarch64, amd64
|
||||
- 支持发行版: alpine, ubuntu, centos
|
||||
- 依赖工具: make, bison, flex, pkg-config, git, autoconf, automake, tar, unzip, gzip, bzip2, cmake
|
||||
- macOS
|
||||
- 支持架构: arm64, x86_64
|
||||
- 依赖工具: make, bison, flex, pkg-config, git, autoconf, automake, tar, unzip, xz, gzip, bzip2, cmake
|
||||
- Windows
|
||||
- 支持架构: x86_64
|
||||
- 依赖工具: (TODO)
|
||||
- PHP
|
||||
- 支持版本: 8.0, 8.1, 8.2
|
||||
下面是架构支持情况,`CI` 代表支持 GitHub Action 构建,`Local` 代表支持本地构建,空 代表暂不支持。
|
||||
|
||||
## 使用(WIP)
|
||||
| | x86_64 | aarch64 |
|
||||
|---------|-----------|-----------|
|
||||
| macOS | CI, Local | Local |
|
||||
| Linux | CI, Local | CI, Local |
|
||||
| Windows | | |
|
||||
|
||||
> 你正在看的是重构后的 static-php-cli 编译项目,新项目还未完全重构,所以还有大量的扩展没有完成。
|
||||
> 你可以阅读使用 bash 编写的仅为 Linux 系统使用的静态编译脚本和 Docker,详见 bash-version 分支。 旧版本未来将会切换为次要版本,提供有限支持。
|
||||
> macOS-arm64 因 GitHub 暂未提供 arm runner,如果要构建 arm 二进制,可以使用手动构建。
|
||||
|
||||
未来会提供一个直接可使用的 phar 包和一个 phpmicro 打包的二进制文件,你可以直接从 Release 中获取并使用:
|
||||
目前支持编译的 PHP 版本为:`7.4`,`8.0`,`8.1`,`8.2`。
|
||||
|
||||
### 编译
|
||||
## 文档
|
||||
|
||||
点击这里查看文档:<https://static-php-cli.zhamao.me>。
|
||||
|
||||
## 使用
|
||||
|
||||
请先根据下方扩展列表选择你要编译的扩展。
|
||||
|
||||
### 自托管直接下载
|
||||
|
||||
如果你不想自行编译,可以从本项目现有的 Action 下载 Artifact,也可以从自托管的服务器下载:[进入](https://dl.zhamao.xin/static-php-cli/)
|
||||
|
||||
> 自托管的服务器默认包含的扩展有:`bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip`
|
||||
|
||||
### 支持的扩展情况
|
||||
|
||||
[扩展支持列表](https://static-php-cli.zhamao.me/zh/guide/extensions.html)
|
||||
|
||||
> 如果这里没有你需要的扩展,可以提交 Issue。
|
||||
|
||||
### 使用 Actions 构建
|
||||
|
||||
使用 GitHub Action 可以方便地构建一个静态编译的 PHP 和 phpmicro,同时可以自行定义要编译的扩展。
|
||||
|
||||
1. Fork 本项目。
|
||||
2. 进入项目的 Actions,选择 CI。
|
||||
3. 选择 `Run workflow`,填入你要编译的 PHP 版本、目标类型、扩展列表。(扩展列表使用英文逗号分割,例如 `bcmath,curl,mbstring`)
|
||||
4. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
|
||||
|
||||
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
||||
|
||||
### 手动构建
|
||||
|
||||
先克隆本项目:
|
||||
|
||||
```bash
|
||||
chmod +x spc
|
||||
# 拉取所有依赖库
|
||||
./spc fetch --all
|
||||
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
||||
./spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-all
|
||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||
```
|
||||
|
||||
如果你本机没有安装 PHP,你需要先使用包管理(例如 brew、apt、yum、apk 等)安装 php。
|
||||
|
||||
你也可以通过 `bin/setup-runtime` 命令下载静态编译好的 php-cli 和 Composer。下载的 php 和 Composer 将保存为 `bin/php` 和 `bin/composer`。
|
||||
|
||||
```bash
|
||||
cd static-php-cli
|
||||
chmod +x bin/setup-runtime
|
||||
./bin/setup-runtime
|
||||
|
||||
# 使用独立的 php 运行 static-php-cli
|
||||
./bin/php bin/spc
|
||||
|
||||
# 使用 composer
|
||||
./bin/php bin/composer
|
||||
```
|
||||
|
||||
下面是使用 static-php-cli 编译静态 php 和 micro 的基础用法:
|
||||
|
||||
```bash
|
||||
# 克隆本项目
|
||||
cd static-php-cli
|
||||
composer update
|
||||
chmod +x bin/spc
|
||||
# 检查环境依赖,并根据提示的命令安装缺失的编译工具
|
||||
./bin/spc doctor
|
||||
# 拉取所有依赖库
|
||||
./bin/spc fetch --all
|
||||
# 构建包含 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
|
||||
```
|
||||
|
||||
你也可以使用参数 `--with-php=x.y` 来指定下载的 PHP 版本,目前支持 7.4 ~ 8.2:
|
||||
|
||||
```bash
|
||||
# 优先考虑使用 >= 8.0 的 PHP 版本
|
||||
./bin/spc fetch --with-php=8.2 --all
|
||||
```
|
||||
|
||||
其中,目前支持构建 cli,micro,fpm 三种静态二进制,使用以下参数的一个或多个来指定编译的 SAPI:
|
||||
|
||||
- `--build-cli`:构建 cli 二进制
|
||||
- `--build-micro`:构建 phpmicro 自执行二进制
|
||||
- `--build-fpm`:构建 fpm
|
||||
- `--build-all`:构建所有
|
||||
|
||||
如果出现了任何错误,可以使用 `--debug` 参数来展示完整的输出日志,以供排查错误:
|
||||
|
||||
```bash
|
||||
./bin/spc build openssl,pcntl,mbstring --debug --build-all
|
||||
./bin/spc fetch --all --debug
|
||||
```
|
||||
|
||||
此外,默认编译的 PHP 为 NTS 版本。如需编译线程安全版本(ZTS),只需添加参数 `--enable-zts` 即可。
|
||||
|
||||
```bash
|
||||
./bin/spc build openssl,pcntl --build-all --enable-zts
|
||||
```
|
||||
|
||||
同时,你也可以使用参数 `--no-strip` 来关闭裁剪,关闭裁剪后可以使用 gdb 等工具调试,但这样会让静态二进制体积变大。
|
||||
|
||||
### 使用 php-cli
|
||||
|
||||
采用参数 `--build-all` 或不添加 `--build-micro` 参数时,最后编译结果会输出一个 `./php` 的二进制文件,此文件可分发、可直接使用。
|
||||
该文件编译后会存放在 `source/php-src/sapi/cli/` 目录中,拷贝出来即可。
|
||||
> php-cli 是一个静态的二进制文件,类似 Go、Rust 语言编译后的单个可移植的二进制文件。
|
||||
|
||||
采用参数 `--build-cli` 或`--build-all` 参数时,最后编译结果会输出一个 `./php` 的二进制文件,此文件可分发、可直接使用。
|
||||
该文件编译后会存放在 `buildroot/bin/` 目录中,名称为 `php`,拷贝出来即可。
|
||||
|
||||
```bash
|
||||
./php -v
|
||||
./php -m
|
||||
./php your_code.php
|
||||
cd buildroot/bin/
|
||||
./php -v # 检查版本
|
||||
./php -m # 检查编译的扩展
|
||||
./php your_code.php # 运行代码
|
||||
./php your_project.phar # 运行打包为 phar 单文件的项目
|
||||
```
|
||||
|
||||
### 使用 micro.sfx
|
||||
|
||||
采用项目参数 `--build-all` 或 `--build-micro` 时,最后编译结果会输出一个 `./micro.sfx` 的文件,此文件需要配合你的 PHP 源码使用。
|
||||
该文件编译后会存放在 `source/php-src/sapi/micro/` 目录中,拷贝出来即可。
|
||||
> phpmicro 是一个提供自执行二进制 PHP 的项目,本项目依赖 phpmicro 进行编译自执行二进制。详见 [dixyes/phpmicro](https://github.com/dixyes/phpmicro)。
|
||||
|
||||
采用项目参数 `--build-micro` 或 `--build-all` 时,最后编译结果会输出一个 `./micro.sfx` 的文件,此文件需要配合你的 PHP 源码使用。
|
||||
该文件编译后会存放在 `buildroot/bin/` 目录中,拷贝出来即可。
|
||||
|
||||
使用时应准备好你的项目源码文件,可以是单个 PHP 文件,也可以是 Phar 文件。
|
||||
|
||||
@@ -73,18 +171,27 @@ cat micro.sfx code.php > single-app && chmod +x single-app
|
||||
|
||||
> 有些情况下的 phar 文件可能无法在 micro 环境下运行。
|
||||
|
||||
## 项目支持情况(WIP)
|
||||
### 使用 php-fpm
|
||||
|
||||
- [X] 基础结构编写(采用 symfony/console`)
|
||||
采用项目参数 `--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`。
|
||||
|
||||
## 项目支持情况
|
||||
|
||||
- [X] 基础结构编写(采用 `symfony/console`)
|
||||
- [X] 错误处理
|
||||
- [X] macOS 支持
|
||||
- [ ] Windows 支持
|
||||
- [ ] Linux 支持
|
||||
- [X] Linux 支持
|
||||
- [X] PHP 7.4 支持
|
||||
- [X] fpm 支持
|
||||
|
||||
## 支持的扩展情况(WIP)
|
||||
|
||||
[扩展支持列表](/ext-support.md)
|
||||
更多功能和特性正在陆续支持中,详见:https://github.com/crazywhalecc/static-php-cli/issues/32
|
||||
|
||||
## 贡献
|
||||
|
||||
@@ -97,12 +204,24 @@ cat micro.sfx code.php > single-app && chmod +x single-app
|
||||
- 应遵循命名规范,例如扩展名称应采取 PHP 内注册的扩展名本身,外部库名应遵循项目本身的名称,内部逻辑的函数、类名、变量等应遵循驼峰、下划线等格式,禁止同一模块混用。
|
||||
- 涉及编译外部库的命令和 Patch 时应注意兼容不同操作系统。
|
||||
|
||||
另外,添加新扩展的贡献方式,可以参考下方 `进阶`。
|
||||
|
||||
如果你想贡献文档内容,请到项目仓库 [crazywhalecc/static-php-cli-docs](https://github.com/crazywhalecc/static-php-cli-docs) 贡献。
|
||||
|
||||
## 赞助本项目
|
||||
|
||||
你可以在 [我的个人赞助页](https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md) 支持我和我的项目。
|
||||
|
||||
## 开源协议
|
||||
|
||||
本项目依据旧版本惯例采用 MIT License 开源,新版本采用了部分项目的源代码做参考,特别感谢:
|
||||
本项目依据旧版本惯例采用 MIT License 开源,自身的部分代码引用或修改自以下项目:
|
||||
|
||||
- [dixyes/lwmbs](https://github.com/dixyes/lwmbs)(木兰宽松许可证)
|
||||
- [swoole/swoole-cli](https://github.com/swoole/swoole-cli)(Apache 2.0 LICENSE+SWOOLE-CLI LICENSE)
|
||||
- [swoole/swoole-cli](https://github.com/swoole/swoole-cli)(Apache 2.0 LICENSE、SWOOLE-CLI LICENSE)
|
||||
|
||||
因本项目的特殊性,使用项目编译过程中会使用很多其他开源项目,例如 curl、protobuf 等,它们都有各自的开源协议。
|
||||
请在编译完成后,使用命令 `dump-license`(TODO) 导出项目使用项目的开源协议,并遵守对应项目的 LICENSE。
|
||||
请在编译完成后,使用命令 `bin/spc dump-license` 导出项目使用项目的开源协议,并遵守对应项目的 LICENSE。
|
||||
|
||||
## 进阶
|
||||
|
||||
本项目重构分支为模块化编写。如果你对本项目感兴趣,想加入开发,可以参照文档的 [贡献指南](https://static-php-cli.zhamao.me) 贡献代码或文档。(TODO)
|
||||
|
||||
71
bin/setup-runtime
Executable file
71
bin/setup-runtime
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.zhamao.xin/static-php-cli/php-8.2.6-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"
|
||||
shift
|
||||
;;
|
||||
--*)
|
||||
echo "Illegal option $1"
|
||||
;;
|
||||
esac
|
||||
shift $(($# > 0 ? 1 : 0))
|
||||
done
|
||||
|
||||
case "$mirror" in
|
||||
china)
|
||||
__PHP_RUNTIME_URL__="https://dl.zhamao.xin/static-php-cli/php-8.2.6-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
||||
__COMPOSER_URL__="https://mirrors.aliyun.com/composer/composer.phar"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
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 ""
|
||||
2
bin/spc
2
bin/spc
@@ -1,4 +1,4 @@
|
||||
#!php
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
82
bin/spc-alpine-docker
Executable file
82
bin/spc-alpine-docker
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# This file is using docker to run commands
|
||||
|
||||
self_dir=$(cd "$(dirname "$0")";pwd)
|
||||
|
||||
# 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"
|
||||
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"
|
||||
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
|
||||
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 ..."
|
||||
ALPINE_DOCKERFILE=$(cat << EOF
|
||||
FROM $ALPINE_FROM
|
||||
$SPC_USE_MIRROR
|
||||
RUN apk update
|
||||
RUN apk add bash file wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils bison flex pkgconfig automake curl
|
||||
RUN apk add build-base xz php81 php81-common php81-pcntl php81-tokenizer php81-phar php81-posix php81-xml composer
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
ADD ./src /app/src
|
||||
ADD ./composer.json /app/composer.json
|
||||
ADD ./bin /app/bin
|
||||
RUN composer update --no-dev
|
||||
EOF
|
||||
)
|
||||
echo "$ALPINE_DOCKERFILE" > $(pwd)/Dockerfile
|
||||
|
||||
$DOCKER_EXECUTABLE build -t cwcc-spc-$SPC_USE_ARCH .
|
||||
rm $(pwd)/Dockerfile
|
||||
fi
|
||||
|
||||
# Check if in ci (local terminal can execute with -it)
|
||||
if [ -t 0 ]; then
|
||||
INTERACT=-it
|
||||
else
|
||||
INTERACT=''
|
||||
fi
|
||||
|
||||
# Run docker
|
||||
$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 $@
|
||||
@@ -15,7 +15,8 @@
|
||||
"symfony/console": "^6 || ^5 || ^4",
|
||||
"zhamao/logger": "^1.0",
|
||||
"crazywhalecc/cli-helper": "^0.1.0",
|
||||
"nunomaduro/collision": "*"
|
||||
"nunomaduro/collision": "*",
|
||||
"ext-pcntl": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.2 != 3.7.0",
|
||||
|
||||
173
config/ext.json
173
config/ext.json
@@ -1,10 +1,14 @@
|
||||
{
|
||||
"apcu": {
|
||||
"type": "external",
|
||||
"source": "apcu"
|
||||
},
|
||||
"bcmath": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"bz2": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"bzip2"
|
||||
]
|
||||
@@ -28,24 +32,45 @@
|
||||
},
|
||||
"dom": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"libxml2",
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"enchant": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"event": {
|
||||
"type": "external",
|
||||
"source": "ext-event",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"enchant2"
|
||||
"libevent"
|
||||
],
|
||||
"ext-depends": [
|
||||
"openssl"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"sockets"
|
||||
]
|
||||
},
|
||||
"memcached": {
|
||||
"type": "external",
|
||||
"source": "memcached",
|
||||
"arg-type": "custom",
|
||||
"cpp-extension": true,
|
||||
"lib-depends": [
|
||||
"libmemcached"
|
||||
],
|
||||
"ext-depends": [
|
||||
"session",
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"exif": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"ffi": {
|
||||
"arg-type": "with",
|
||||
"arg-type": "custom",
|
||||
"type": "builtin",
|
||||
"lib-depends": [
|
||||
"libffi"
|
||||
@@ -65,31 +90,20 @@
|
||||
},
|
||||
"gd": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"zlib",
|
||||
"libpng"
|
||||
],
|
||||
"ext-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"gd",
|
||||
"libavif",
|
||||
"libwebp",
|
||||
"libjpeg",
|
||||
"xpm",
|
||||
"freetype"
|
||||
],
|
||||
"lib-depends-windows": [
|
||||
"libiconv",
|
||||
"freetype",
|
||||
"libjpeg",
|
||||
"zlib",
|
||||
"libpng",
|
||||
"xpm"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"gd",
|
||||
"libavif",
|
||||
"libwebp"
|
||||
]
|
||||
},
|
||||
"gettext": {
|
||||
@@ -101,18 +115,26 @@
|
||||
},
|
||||
"gmp": {
|
||||
"type": "builtin",
|
||||
"arg-type": "none",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"gmp"
|
||||
]
|
||||
},
|
||||
"iconv": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends-windows": [
|
||||
"libiconv"
|
||||
]
|
||||
},
|
||||
"imagick": {
|
||||
"type": "external",
|
||||
"source": "ext-imagick",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"imagemagick"
|
||||
]
|
||||
},
|
||||
"imap": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
@@ -123,8 +145,13 @@
|
||||
"kerberos"
|
||||
]
|
||||
},
|
||||
"inotify": {
|
||||
"type": "external",
|
||||
"source": "inotify"
|
||||
},
|
||||
"intl": {
|
||||
"type": "builtin",
|
||||
"cpp-extension": true,
|
||||
"lib-depends": [
|
||||
"icu"
|
||||
]
|
||||
@@ -138,16 +165,40 @@
|
||||
},
|
||||
"mbregex": {
|
||||
"type": "builtin",
|
||||
"lib-depends": [
|
||||
"onig"
|
||||
"arg-type": "custom",
|
||||
"ext-depends": [
|
||||
"mbstring"
|
||||
]
|
||||
},
|
||||
"mbstring": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"onig"
|
||||
]
|
||||
},
|
||||
"memcache": {
|
||||
"type": "external",
|
||||
"source": "ext-memcache",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"ext-depends": [
|
||||
"session"
|
||||
]
|
||||
},
|
||||
"mongodb": {
|
||||
"type": "external",
|
||||
"source": "mongodb",
|
||||
"arg-type": "custom",
|
||||
"lib-suggests": [
|
||||
"icu",
|
||||
"openssl",
|
||||
"zstd",
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"mysqli": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
@@ -186,12 +237,13 @@
|
||||
},
|
||||
"pdo_pgsql": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"arg-type": "with-prefix",
|
||||
"ext-depends": [
|
||||
"pdo"
|
||||
"pdo",
|
||||
"pgsql"
|
||||
],
|
||||
"lib-depends": [
|
||||
"pq"
|
||||
"postgresql"
|
||||
]
|
||||
},
|
||||
"pdo_sqlite": {
|
||||
@@ -205,9 +257,16 @@
|
||||
"sqlite"
|
||||
]
|
||||
},
|
||||
"pgsql": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"postgresql"
|
||||
]
|
||||
},
|
||||
"phar": {
|
||||
"type": "builtin",
|
||||
"lib-suggests": [
|
||||
"ext-depends": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
@@ -215,6 +274,10 @@
|
||||
"type": "builtin",
|
||||
"unix-only": true
|
||||
},
|
||||
"protobuf": {
|
||||
"type": "external",
|
||||
"source": "protobuf"
|
||||
},
|
||||
"pspell": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
@@ -224,18 +287,15 @@
|
||||
},
|
||||
"readline": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"readline"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libedit",
|
||||
"ncurses"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"type": "external",
|
||||
"source": "redis"
|
||||
"source": "redis",
|
||||
"arg-type": "custom"
|
||||
},
|
||||
"session": {
|
||||
"type": "builtin"
|
||||
@@ -245,6 +305,7 @@
|
||||
},
|
||||
"simplexml": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
@@ -259,6 +320,7 @@
|
||||
},
|
||||
"soap": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
]
|
||||
@@ -270,22 +332,31 @@
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"lib-depends": [
|
||||
"sodium"
|
||||
"libsodium"
|
||||
]
|
||||
},
|
||||
"sqlite3": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"sqlite"
|
||||
]
|
||||
},
|
||||
"ssh2": {
|
||||
"type": "external",
|
||||
"source": "ext-ssh2",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"libssh2"
|
||||
]
|
||||
},
|
||||
"swoole": {
|
||||
"type": "external",
|
||||
"source": "swoole",
|
||||
"arg-type": "custom",
|
||||
"cpp-extension": true,
|
||||
"lib-depends": [
|
||||
"openssl",
|
||||
"curl"
|
||||
"openssl"
|
||||
],
|
||||
"ext-depends": [
|
||||
"openssl"
|
||||
@@ -298,14 +369,13 @@
|
||||
"swow": {
|
||||
"type": "external",
|
||||
"source": "swow",
|
||||
"lib-depends": [
|
||||
"libuv"
|
||||
],
|
||||
"arg-type": "custom",
|
||||
"lib-suggests": [
|
||||
"openssl",
|
||||
"curl"
|
||||
],
|
||||
"ext-suggests": [
|
||||
"openssl",
|
||||
"curl"
|
||||
]
|
||||
},
|
||||
@@ -331,8 +401,18 @@
|
||||
"tokenizer": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"xlswriter": {
|
||||
"type": "external",
|
||||
"source": "xlswriter",
|
||||
"arg-type": "custom",
|
||||
"ext-depends": [
|
||||
"zlib",
|
||||
"zip"
|
||||
]
|
||||
},
|
||||
"xml": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
@@ -340,12 +420,14 @@
|
||||
},
|
||||
"xmlreader": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
]
|
||||
},
|
||||
"xmlwriter": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"libxml2"
|
||||
]
|
||||
@@ -360,14 +442,14 @@
|
||||
"yaml": {
|
||||
"type": "external",
|
||||
"source": "yaml",
|
||||
"arg-type": "with",
|
||||
"arg-type": "with-prefix",
|
||||
"lib-depends": [
|
||||
"libyaml"
|
||||
]
|
||||
},
|
||||
"zip": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
"arg-type": "with-prefix",
|
||||
"arg-type-windows": "enable",
|
||||
"lib-depends": [
|
||||
"libzip"
|
||||
@@ -384,8 +466,9 @@
|
||||
"zstd": {
|
||||
"type": "external",
|
||||
"source": "ext-zstd",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"zstd"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
199
config/lib.json
199
config/lib.json
@@ -49,9 +49,7 @@
|
||||
"brotli",
|
||||
"nghttp2",
|
||||
"zstd",
|
||||
"openssl",
|
||||
"idn2",
|
||||
"psl"
|
||||
"openssl"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"zlib",
|
||||
@@ -68,6 +66,24 @@
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"gmp": {
|
||||
"source": "gmp",
|
||||
"static-libs-unix": [
|
||||
@@ -80,6 +96,55 @@
|
||||
"gmp.h"
|
||||
]
|
||||
},
|
||||
"icu": {
|
||||
"source": "icu",
|
||||
"static-libs-unix": [
|
||||
"libicui18n.a",
|
||||
"libicuio.a",
|
||||
"libicuuc.a",
|
||||
"libicudata.a"
|
||||
]
|
||||
},
|
||||
"imagemagick": {
|
||||
"source": "imagemagick",
|
||||
"static-libs-unix": [
|
||||
"libMagick++-7.Q16HDRI.a",
|
||||
"libMagickCore-7.Q16HDRI.a",
|
||||
"libMagickWand-7.Q16HDRI.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"zlib",
|
||||
"libpng",
|
||||
"libjpeg",
|
||||
"bzip2",
|
||||
"libwebp",
|
||||
"freetype"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"zstd",
|
||||
"xz",
|
||||
"libzip",
|
||||
"libxml2"
|
||||
]
|
||||
},
|
||||
"libavif": {
|
||||
"source": "libavif",
|
||||
"static-libs-unix": [
|
||||
"libavif.a"
|
||||
]
|
||||
},
|
||||
"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": [
|
||||
@@ -98,7 +163,31 @@
|
||||
"ffitarget.h"
|
||||
]
|
||||
},
|
||||
|
||||
"libiconv": {
|
||||
"source": "libiconv",
|
||||
"static-libs-unix": [
|
||||
"libiconv.a",
|
||||
"libcharset.a"
|
||||
],
|
||||
"headers": [
|
||||
"iconv.h",
|
||||
"libcharset.h",
|
||||
"localcharset.h"
|
||||
]
|
||||
},
|
||||
"libjpeg": {
|
||||
"source": "libjpeg",
|
||||
"static-libs-unix": [
|
||||
"libjpeg.a",
|
||||
"libturbojpeg.a"
|
||||
]
|
||||
},
|
||||
"libmcrypt": {
|
||||
"source": "libmcrypt",
|
||||
"static-libs-unix": [
|
||||
"libmcrypt.a"
|
||||
]
|
||||
},
|
||||
"libpng": {
|
||||
"source": "libpng",
|
||||
"static-libs-unix": [
|
||||
@@ -120,6 +209,12 @@
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"libsodium": {
|
||||
"source": "libsodium",
|
||||
"static-libs-unix": [
|
||||
"libsodium.a"
|
||||
]
|
||||
},
|
||||
"libssh2": {
|
||||
"source": "libssh2",
|
||||
"static-libs-unix": [
|
||||
@@ -140,6 +235,16 @@
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
"libwebp": {
|
||||
"source": "libwebp",
|
||||
"static-libs-unix": [
|
||||
"libwebp.a",
|
||||
"libwebpdecoder.a",
|
||||
"libwebpdemux.a",
|
||||
"libwebpmux.a",
|
||||
"libsharpyuv.a"
|
||||
]
|
||||
},
|
||||
"libxml2": {
|
||||
"source": "libxml2",
|
||||
"static-libs-unix": [
|
||||
@@ -154,10 +259,13 @@
|
||||
"headers": [
|
||||
"libxml2"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libiconv"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"icu",
|
||||
"xz",
|
||||
"zlib"
|
||||
"zlib",
|
||||
"icu"
|
||||
],
|
||||
"lib-suggests-windows": [
|
||||
"icu",
|
||||
@@ -203,26 +311,16 @@
|
||||
"openssl"
|
||||
]
|
||||
},
|
||||
"libmcrypt": {
|
||||
"source": "libmcrypt",
|
||||
"static-libs-unix": [
|
||||
"libmcrypt.a"
|
||||
]
|
||||
},
|
||||
"mcrypt": {
|
||||
"source": "mcrypt",
|
||||
"static-libs-unix": [
|
||||
"libmcrypt.a"
|
||||
]
|
||||
},
|
||||
"freetype": {
|
||||
"source": "freetype",
|
||||
"ncurses": {
|
||||
"source": "ncurses",
|
||||
"static-libs-unix": [
|
||||
"libfreetype.a"
|
||||
],
|
||||
"headers-unix": [
|
||||
"freetype2/freetype/freetype.h",
|
||||
"freetype2/ft2build.h"
|
||||
"libncurses.a"
|
||||
]
|
||||
},
|
||||
"nghttp2": {
|
||||
@@ -241,26 +339,7 @@
|
||||
"openssl"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"libxml2",
|
||||
"libev",
|
||||
"libcares",
|
||||
"libngtcp2",
|
||||
"libnghttp3",
|
||||
"libbpf",
|
||||
"libevent-openssl",
|
||||
"jansson",
|
||||
"jemalloc",
|
||||
"systemd",
|
||||
"cunit"
|
||||
]
|
||||
},
|
||||
"libuv": {
|
||||
"source": "libuv",
|
||||
"static-libs-unix": [
|
||||
"libuv.a"
|
||||
],
|
||||
"headers": [
|
||||
"uv.h"
|
||||
"libxml2"
|
||||
]
|
||||
},
|
||||
"onig": {
|
||||
@@ -292,10 +371,31 @@
|
||||
"headers": [
|
||||
"openssl"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"pthreads4w": {
|
||||
"source": "pthreads4w",
|
||||
"static-libs-windows": [
|
||||
@@ -308,6 +408,15 @@
|
||||
"semaphore.h"
|
||||
]
|
||||
},
|
||||
"readline": {
|
||||
"source": "readline",
|
||||
"static-libs-unix": [
|
||||
"libreadline.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"ncurses"
|
||||
]
|
||||
},
|
||||
"sqlite": {
|
||||
"source": "sqlite",
|
||||
"static-libs-unix": [
|
||||
@@ -335,6 +444,9 @@
|
||||
"headers-windows": [
|
||||
"lzma",
|
||||
"lzma.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
"libiconv"
|
||||
]
|
||||
},
|
||||
"zlib": {
|
||||
@@ -350,6 +462,13 @@
|
||||
"zconf.h"
|
||||
]
|
||||
},
|
||||
"libmemcached": {
|
||||
"source": "libmemcached",
|
||||
"static-libs-unix": [
|
||||
"libmemcached.a",
|
||||
"libmemcachedutil.a"
|
||||
]
|
||||
},
|
||||
"zstd": {
|
||||
"source": "zstd",
|
||||
"static-libs-unix": [
|
||||
|
||||
@@ -1,4 +1,40 @@
|
||||
{
|
||||
"php-src": {
|
||||
"type": "custom",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"memcached": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/memcached",
|
||||
"path": "php-src/ext/memcached",
|
||||
"filename": "memcached.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libmemcached": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/crazywhalecc/libmemcached-macos.git",
|
||||
"rev": "master",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"brotli": {
|
||||
"type": "ghtar",
|
||||
"repo": "google/brotli",
|
||||
@@ -25,6 +61,45 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"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-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-ssh2": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ssh2",
|
||||
"path": "php-src/ext/ssh2",
|
||||
"filename": "ssh2.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-zstd": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/zstd",
|
||||
@@ -37,7 +112,7 @@
|
||||
},
|
||||
"freetype": {
|
||||
"type": "filelist",
|
||||
"url": "https://download.savannah.gnu.org/releases/freetype/",
|
||||
"url": "https://download-mirror.savannah.gnu.org/releases/freetype/",
|
||||
"regex": "/href=\"(?<file>freetype-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
@@ -45,14 +120,56 @@
|
||||
}
|
||||
},
|
||||
"gmp": {
|
||||
"type": "filelist",
|
||||
"url": "https://gmplib.org/download/gmp/",
|
||||
"regex": "/href=\"(?<file>gmp-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"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": "url",
|
||||
"url": "https://github.com/unicode-org/icu/releases/download/release-73-1/icu4c-73_1-src.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"imagemagick": {
|
||||
"type": "ghtar",
|
||||
"repo": "ImageMagick/ImageMagick",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"libavif": {
|
||||
"type": "ghtar",
|
||||
"repo": "AOMediaCodec/libavif",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libevent": {
|
||||
"type": "ghrel",
|
||||
"repo": "libevent/libevent",
|
||||
"match": "libevent.+\\.tar\\.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libffi": {
|
||||
"type": "ghrel",
|
||||
"repo": "libffi/libffi",
|
||||
@@ -62,14 +179,23 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"mcrypt": {
|
||||
"type": "url",
|
||||
"url": "https://jaist.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz",
|
||||
"libiconv": {
|
||||
"type": "filelist",
|
||||
"url": "https://ftp.gnu.org/gnu/libiconv/",
|
||||
"regex": "/href=\"(?<file>libiconv-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libjpeg": {
|
||||
"type": "ghtar",
|
||||
"repo": "libjpeg-turbo/libjpeg-turbo",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.md"
|
||||
}
|
||||
},
|
||||
"libmcrypt": {
|
||||
"type": "url",
|
||||
"url": "https://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz",
|
||||
@@ -96,6 +222,14 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libsodium": {
|
||||
"type": "url",
|
||||
"url": "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libssh2": {
|
||||
"type": "ghrel",
|
||||
"repo": "libssh2/libssh2",
|
||||
@@ -105,6 +239,14 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libwebp": {
|
||||
"type": "url",
|
||||
"url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.0.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libxml2": {
|
||||
"type": "url",
|
||||
"url": "https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.9.14/libxml2-v2.9.14.tar.gz",
|
||||
@@ -131,16 +273,43 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"mcrypt": {
|
||||
"type": "url",
|
||||
"url": "https://jaist.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"micro": {
|
||||
"type": "git",
|
||||
"path": "php-src/sapi/micro",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/dixyes/phpmicro",
|
||||
"url": "https://github.com/crazywhalecc/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",
|
||||
@@ -150,14 +319,6 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"libuv": {
|
||||
"type": "ghtar",
|
||||
"repo": "libuv/libuv",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"onig": {
|
||||
"type": "ghrel",
|
||||
"repo": "kkos/oniguruma",
|
||||
@@ -176,6 +337,33 @@
|
||||
"path": "LICENSE.txt"
|
||||
}
|
||||
},
|
||||
"pkg-config": {
|
||||
"type": "filelist",
|
||||
"url": "https://pkgconfig.freedesktop.org/releases/",
|
||||
"regex": "/href=\"(?<file>pkg-config-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"postgresql": {
|
||||
"type": "url",
|
||||
"url": "https://ftp.postgresql.org/pub/source/v15.1/postgresql-15.1.tar.gz",
|
||||
"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",
|
||||
@@ -185,6 +373,15 @@
|
||||
"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",
|
||||
@@ -200,7 +397,7 @@
|
||||
"url": "https://www.sqlite.org/2023/sqlite-autoconf-3410100.tar.gz",
|
||||
"license": {
|
||||
"type": "text",
|
||||
"path": "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."
|
||||
"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."
|
||||
}
|
||||
},
|
||||
"swoole": {
|
||||
@@ -223,6 +420,16 @@
|
||||
"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": "filelist",
|
||||
"url": "https://tukaani.org/xz/",
|
||||
@@ -243,9 +450,9 @@
|
||||
}
|
||||
},
|
||||
"zlib": {
|
||||
"type": "filelist",
|
||||
"url": "https://zlib.net/",
|
||||
"regex": "/href=\"(?<file>zlib-(?<version>[^\"]+)\\.tar\\.gz)\"/i",
|
||||
"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"
|
||||
|
||||
@@ -1,70 +1,3 @@
|
||||
# Extension List
|
||||
|
||||
> - yes: supported and tested
|
||||
> - untested: supported but not tested
|
||||
> - empty: not supported yet
|
||||
> - faulty with issue link: not supported yet due to issue
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
|------------|-------|--------------------------------------------------------------------|---------|
|
||||
| bcmath | | yes | |
|
||||
| bz2 | | untested | |
|
||||
| calendar | | yes | |
|
||||
| ctype | | yes | |
|
||||
| curl | | yes | |
|
||||
| date | | yes | |
|
||||
| dom | | untested | |
|
||||
| event | | | |
|
||||
| exif | | yes | |
|
||||
| filter | | yes | |
|
||||
| fileinfo | | | |
|
||||
| ftp | | yes | |
|
||||
| gd | | untested | |
|
||||
| gmp | | untested | |
|
||||
| hash | | yes | |
|
||||
| iconv | | | |
|
||||
| inotify | | | |
|
||||
| json | | yes | |
|
||||
| libxml | | yes | |
|
||||
| mbstring | | yes | |
|
||||
| mcrypt | | [faulty](https://github.com/crazywhalecc/static-php-cli/issues/32) | |
|
||||
| mongodb | | | |
|
||||
| mysqli | | | |
|
||||
| mysqlnd | | yes | |
|
||||
| openssl | | yes | |
|
||||
| pcntl | | untested | |
|
||||
| pcre | | yes | |
|
||||
| pdo | | yes | |
|
||||
| pdo_mysql | | yes | |
|
||||
| pdo_sqlite | | yes | |
|
||||
| pdo_pgsql | | | |
|
||||
| phar | | yes | |
|
||||
| posix | | yes | |
|
||||
| protobuf | | | |
|
||||
| readline | | | |
|
||||
| redis | | yes | |
|
||||
| Reflection | | yes | |
|
||||
| session | | yes | |
|
||||
| shmop | | | |
|
||||
| simplexml | | untested | |
|
||||
| soap | | | |
|
||||
| sockets | | | |
|
||||
| sqlite3 | | untested | |
|
||||
| swow | | | |
|
||||
| swoole | | [faulty](https://github.com/crazywhalecc/static-php-cli/issues/32) | |
|
||||
| tokenizer | | yes | |
|
||||
| xml | | yes | |
|
||||
| xmlreader | | untested | |
|
||||
| xmlwriter | | untested | |
|
||||
| zip | | yes | |
|
||||
| zlib | | yes | |
|
||||
|
||||
## Additional Requirements
|
||||
|
||||
- phpmicro requires PHP >= 8.0
|
||||
- swoole >= 5.0 requires PHP >= 8.0
|
||||
- swow requires PHP >= 8.0
|
||||
|
||||
## Bugs
|
||||
|
||||
See [#32](https://github.com/crazywhalecc/static-php-cli/issues/32).
|
||||
See: [Docs - Extensions](https://static-php-cli.zhamao.me/en/guide/extensions.html)
|
||||
|
||||
@@ -16,7 +16,7 @@ use Symfony\Component\Console\Command\ListCommand;
|
||||
*/
|
||||
class ConsoleApplication extends Application
|
||||
{
|
||||
public const VERSION = '2.0-alpha1';
|
||||
public const VERSION = '2.0-rc3';
|
||||
|
||||
/**
|
||||
* @throws \ReflectionException
|
||||
|
||||
@@ -6,8 +6,10 @@ namespace SPC\builder;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
use SPC\util\DependencyUtil;
|
||||
|
||||
abstract class BuilderBase
|
||||
@@ -30,14 +32,21 @@ abstract class BuilderBase
|
||||
/** @var array<string, Extension> 要编译的扩展列表 */
|
||||
protected array $exts = [];
|
||||
|
||||
/** @var array<int, string> 要编译的扩展列表(仅名字列表,用于最后生成编译的扩展列表给 micro) */
|
||||
protected array $plain_extensions = [];
|
||||
|
||||
/** @var bool 本次编译是否只编译 libs,不编译 PHP */
|
||||
protected bool $libs_only = false;
|
||||
|
||||
/** @var bool 是否 strip 最终的二进制 */
|
||||
protected bool $strip = true;
|
||||
|
||||
/**
|
||||
* 构建指定列表的 libs
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function buildLibs(array $libraries): void
|
||||
{
|
||||
@@ -57,16 +66,13 @@ abstract class BuilderBase
|
||||
if ($libraries === [] && $this->isLibsOnly()) {
|
||||
$libraries = array_keys($support_lib_list);
|
||||
}
|
||||
if (!in_array('pkg-config', $libraries)) {
|
||||
array_unshift($libraries, 'pkg-config');
|
||||
}
|
||||
|
||||
// 排序 libs,根据依赖计算一个新的列表出来
|
||||
$libraries = DependencyUtil::getLibsByDeps($libraries);
|
||||
|
||||
// 这里筛选 libraries,比如纯静态模式排除掉ffi
|
||||
if (defined('BUILD_ALL_STATIC') && BUILD_ALL_STATIC) {
|
||||
$k = array_search('libffi', $libraries, true);
|
||||
$k !== false && array_splice($libraries, $k, 1);
|
||||
}
|
||||
|
||||
// 过滤不支持的库后添加
|
||||
foreach ($libraries as $library) {
|
||||
if (!isset($support_lib_list[$library])) {
|
||||
@@ -76,13 +82,14 @@ abstract class BuilderBase
|
||||
$this->addLib($lib);
|
||||
}
|
||||
|
||||
// 统计还没 fetch 到本地的库
|
||||
$this->checkLibsSource();
|
||||
|
||||
// 计算依赖,经过这里的遍历,如果没有抛出异常,说明依赖符合要求,可以继续下面的
|
||||
foreach ($this->libs as $lib) {
|
||||
$lib->calcDependency();
|
||||
}
|
||||
|
||||
$this->initSource(libs: $libraries);
|
||||
|
||||
// 构建库
|
||||
foreach ($this->libs as $lib) {
|
||||
match ($lib->tryBuild()) {
|
||||
BUILD_STATUS_OK => logger()->info('lib [' . $lib::NAME . '] build success'),
|
||||
@@ -133,6 +140,37 @@ abstract class BuilderBase
|
||||
return $this->exts[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有要编译的扩展对象
|
||||
*
|
||||
* @return Extension[]
|
||||
*/
|
||||
public function getExts(): array
|
||||
{
|
||||
return $this->exts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查 C++ 扩展是否存在
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function hasCppExtension(): bool
|
||||
{
|
||||
// judge cpp-extension
|
||||
$exts = array_keys($this->getExts());
|
||||
$cpp = false;
|
||||
foreach ($exts as $ext) {
|
||||
if (Config::getExt($ext, 'cpp-extension', false) === true) {
|
||||
$cpp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $cpp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置本次 Builder 是否为仅编译库的模式
|
||||
*/
|
||||
@@ -149,12 +187,15 @@ abstract class BuilderBase
|
||||
*/
|
||||
public function proveExts(array $extensions): void
|
||||
{
|
||||
if (defined('BUILD_ALL_STATIC') && BUILD_ALL_STATIC) {
|
||||
$k = array_search('ffi', $extensions, true);
|
||||
$k !== false && array_splice($extensions, $k, 1);
|
||||
CustomExt::loadCustomExt();
|
||||
$this->initSource(sources: ['php-src']);
|
||||
if ($this->getPHPVersionID() >= 80000) {
|
||||
$this->initSource(sources: ['micro']);
|
||||
}
|
||||
$this->initSource(exts: $extensions);
|
||||
foreach ($extensions as $extension) {
|
||||
$ext = new Extension($extension, $this);
|
||||
$class = CustomExt::getExtClass($extension);
|
||||
$ext = new $class($extension, $this);
|
||||
$this->addExt($ext);
|
||||
}
|
||||
|
||||
@@ -162,20 +203,17 @@ abstract class BuilderBase
|
||||
// 检查下依赖就行了,作用是导入依赖给 Extension 对象,今后可以对库依赖进行选择性处理
|
||||
$ext->checkDependency();
|
||||
}
|
||||
|
||||
$this->plain_extensions = $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始构建 PHP
|
||||
* 构建 micro 的规则:
|
||||
* - BUILD_MICRO_NONE(默认):只编译 cli
|
||||
* - BUILD_MICRO_ONLY:只编译 micro
|
||||
* - BUILD_MICRO_BOTH:同时编译 micro 和 cli
|
||||
*
|
||||
* @param int $build_micro_rule 规则
|
||||
* @param bool $with_clean 是否为新构建?
|
||||
* @param bool $bloat 保留
|
||||
* @param int $build_target 规则
|
||||
* @param bool $bloat 保留
|
||||
*/
|
||||
abstract public function buildPHP(int $build_micro_rule = BUILD_MICRO_NONE, bool $with_clean = false, bool $bloat = false);
|
||||
abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE, bool $bloat = false);
|
||||
|
||||
/**
|
||||
* 生成依赖的扩展编译启用参数
|
||||
@@ -188,7 +226,7 @@ abstract class BuilderBase
|
||||
{
|
||||
$ret = [];
|
||||
foreach ($this->exts as $ext) {
|
||||
$ret[] = $ext->getConfigureArg();
|
||||
$ret[] = trim($ext->getConfigureArg());
|
||||
}
|
||||
logger()->info('Using configure: ' . implode(' ', $ret));
|
||||
return implode(' ', $ret);
|
||||
@@ -202,6 +240,36 @@ abstract class BuilderBase
|
||||
return $this->libs_only;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前即将编译的 PHP 的版本 ID,五位数那个
|
||||
*/
|
||||
public function getPHPVersionID(): int
|
||||
{
|
||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||
preg_match('/PHP_VERSION_ID (\d+)/', $file, $match);
|
||||
return intval($match[1]);
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
return implode(', ', $ls);
|
||||
}
|
||||
|
||||
public function setStrip(bool $strip): void
|
||||
{
|
||||
$this->strip = $strip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否存在 lib 库对应的源码,如果不存在,则抛出异常
|
||||
*
|
||||
@@ -224,4 +292,52 @@ abstract class BuilderBase
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected function initSource(?array $sources = null, ?array $libs = null, ?array $exts = null): void
|
||||
{
|
||||
if (!file_exists(DOWNLOAD_PATH . '/.lock.json')) {
|
||||
throw new WrongUsageException('Download lock file "downloads/.lock.json" not found, maybe you need to download sources first ?');
|
||||
}
|
||||
$lock = json_decode(FileSystem::readFile(DOWNLOAD_PATH . '/.lock.json'), true);
|
||||
|
||||
$sources_extracted = [];
|
||||
// source check exist
|
||||
if (is_array($sources)) {
|
||||
foreach ($sources as $source) {
|
||||
$sources_extracted[$source] = true;
|
||||
}
|
||||
}
|
||||
// lib check source exist
|
||||
if (is_array($libs)) {
|
||||
foreach ($libs as $lib) {
|
||||
// get source name for lib
|
||||
$source = Config::getLib($lib, 'source');
|
||||
$sources_extracted[$source] = true;
|
||||
}
|
||||
}
|
||||
// ext check source exist
|
||||
if (is_array($exts)) {
|
||||
foreach ($exts as $ext) {
|
||||
// get source name for ext
|
||||
if (Config::getExt($ext, 'type') !== 'external') {
|
||||
continue;
|
||||
}
|
||||
$source = Config::getExt($ext, 'source');
|
||||
$sources_extracted[$source] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// start check
|
||||
foreach ($sources_extracted as $source => $item) {
|
||||
if (!isset($lock[$source])) {
|
||||
throw new WrongUsageException('Source [' . $source . '] not downloaded, you should download it first !');
|
||||
}
|
||||
|
||||
// check source dir exist
|
||||
$check = $lock[$source]['move_path'] === null ? SOURCE_PATH . '/' . $source : SOURCE_PATH . '/' . $lock[$source]['move_path'];
|
||||
if (!is_dir($check)) {
|
||||
FileSystem::extractSource($source, DOWNLOAD_PATH . '/' . ($lock[$source]['filename'] ?? $lock[$source]['dirname']), $lock[$source]['move_path']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use SPC\builder\linux\LinuxBuilder;
|
||||
use SPC\builder\macos\MacOSBuilder;
|
||||
use SPC\builder\windows\WindowsBuilder;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
||||
/**
|
||||
@@ -30,13 +31,15 @@ class BuilderProvider
|
||||
cc: $input->getOption('cc'),
|
||||
cxx: $input->getOption('cxx'),
|
||||
arch: $input->getOption('arch'),
|
||||
zts: $input->hasOption('enable-zts') ? $input->getOption('enable-zts') : false,
|
||||
),
|
||||
// 'Linux' => new LinuxBuilder(
|
||||
// cc: $input->getOption('cc'),
|
||||
// cxx: $input->getOption('cxx'),
|
||||
// arch: $input->getOption('arch'),
|
||||
// ),
|
||||
default => throw new RuntimeException('Current OS is not supported yet'),
|
||||
'Linux' => new LinuxBuilder(
|
||||
cc: $input->getOption('cc'),
|
||||
cxx: $input->getOption('cxx'),
|
||||
arch: $input->getOption('arch'),
|
||||
zts: $input->hasOption('enable-zts') ? $input->getOption('enable-zts') : false,
|
||||
),
|
||||
default => throw new WrongUsageException('Current OS "' . PHP_OS_FAMILY . '" is not supported yet'),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace SPC\builder;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
|
||||
class Extension
|
||||
@@ -13,8 +14,9 @@ class Extension
|
||||
protected array $dependencies = [];
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function __construct(protected string $name, protected BuilderBase $builder)
|
||||
{
|
||||
@@ -33,13 +35,14 @@ class Extension
|
||||
* 获取开启该扩展的 PHP 编译添加的参数
|
||||
*
|
||||
* @throws FileSystemException|RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function getConfigureArg(): string
|
||||
{
|
||||
$arg = $this->getEnableArg();
|
||||
switch (PHP_OS_FAMILY) {
|
||||
case 'Windows':
|
||||
$arg .= $this->getWindowsConfigureArg();
|
||||
$arg = $this->getWindowsConfigureArg();
|
||||
break;
|
||||
case 'Darwin':
|
||||
case 'Linux':
|
||||
@@ -54,15 +57,17 @@ class Extension
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @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,
|
||||
'enable' => '--enable-' . $_name . ' ',
|
||||
'with' => '--with-' . $_name . ' ',
|
||||
'with-prefix' => '--with-' . $_name . '="' . BUILD_ROOT_PATH . '" ',
|
||||
'none', 'custom' => '',
|
||||
default => throw new RuntimeException("argType does not accept {$arg_type}, use [enable/with] ."),
|
||||
default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-prefix] ."),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -83,6 +88,7 @@ class Extension
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function checkDependency(): static
|
||||
{
|
||||
@@ -111,6 +117,25 @@ class Extension
|
||||
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 '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
@@ -143,145 +168,6 @@ class Extension
|
||||
}
|
||||
}
|
||||
|
||||
private function getWindowsConfigureArg(): string
|
||||
{
|
||||
$arg = '';
|
||||
switch ($this->name) {
|
||||
case 'redis':
|
||||
// $arg = '--enable-redis';
|
||||
// if ($this->builder->getLib('zstd')) {
|
||||
// $arg .= ' --enable-redis-zstd --with-libzstd ';
|
||||
// }
|
||||
break;
|
||||
case 'xml':
|
||||
case 'soap':
|
||||
case 'xmlreader':
|
||||
case 'xmlwriter':
|
||||
case 'dom':
|
||||
$arg .= ' --with-libxml ';
|
||||
break;
|
||||
case 'swow':
|
||||
if ($this->builder->getLib('openssl')) {
|
||||
$arg .= ' --enable-swow-ssl';
|
||||
}
|
||||
if ($this->builder->getLib('curl')) {
|
||||
$arg .= ' --enable-swow-curl';
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
|
||||
private function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '';
|
||||
switch ($this->name) {
|
||||
/*case 'event':
|
||||
$arg = ' --with-event-core --with-event-libevent-dir="' . BUILD_ROOT_PATH . '"';
|
||||
if ($this->builder->getLib('openssl')) {
|
||||
$arg .= ' --with-event-openssl --with-openssl-dir="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
break;*/
|
||||
case 'mbstring':
|
||||
$arg = ' --disable-mbregex ONIG_CFLAGS=-I"' . BUILD_ROOT_PATH . '" ' .
|
||||
'ONIG_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'gmp':
|
||||
$arg = ' --with-gmp="' . BUILD_ROOT_PATH . '" ';
|
||||
break;
|
||||
case 'sqlite3':
|
||||
$arg = ' --with-sqlite3="' . BUILD_ROOT_PATH . '" ' .
|
||||
'SQLITE_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'SQLITE_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'redis':
|
||||
$arg = ' --enable-redis --disable-redis-session';
|
||||
if ($this->builder->getLib('zstd')) {
|
||||
$arg .= ' --enable-redis-zstd --with-libzstd="' . BUILD_ROOT_PATH . '" ';
|
||||
}
|
||||
break;
|
||||
case 'yaml':
|
||||
$arg .= ' --with-yaml="' . BUILD_ROOT_PATH . '" ';
|
||||
break;
|
||||
case 'zstd':
|
||||
$arg .= ' --with-libzstd';
|
||||
break;
|
||||
case 'bz2':
|
||||
$arg = ' --with-bz2="' . BUILD_ROOT_PATH . '" ';
|
||||
break;
|
||||
case 'openssl':
|
||||
$arg .= ' ' .
|
||||
'OPENSSL_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'OPENSSL_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'curl':
|
||||
$arg .= ' ' .
|
||||
'CURL_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'CURL_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'gd':
|
||||
if ($this->builder->getLib('freetype')) {
|
||||
$arg .= ' --with-freetype ' .
|
||||
'FREETYPE2_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '/freetype2" ' .
|
||||
'FREETYPE2_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
}
|
||||
$arg .= ' ' .
|
||||
'PNG_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'PNG_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
// TODO: other libraries
|
||||
case 'phar':
|
||||
case 'zlib':
|
||||
$arg .= ' ' .
|
||||
'ZLIB_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'ZLIB_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'xml': // xml may use expat
|
||||
if ($this->getLibraryDependencies()['expat'] ?? null) {
|
||||
$arg .= ' --with-expat="' . BUILD_ROOT_PATH . '" ' .
|
||||
'EXPAT_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'EXPAT_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
case 'soap':
|
||||
case 'xmlreader':
|
||||
case 'xmlwriter':
|
||||
case 'dom':
|
||||
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '" ' .
|
||||
'LIBXML_CFLAGS=-I"' . realpath('include/libxml2') . '" ' .
|
||||
'LIBXML_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'ffi':
|
||||
$arg .= ' ' .
|
||||
'FFI_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'FFI_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'zip':
|
||||
$arg .= ' ' .
|
||||
'LIBZIP_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'LIBZIP_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'mbregex':
|
||||
$arg .= ' ' .
|
||||
'ONIG_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
|
||||
'ONIG_LIBS="' . $this->getLibFilesString() . '" ';
|
||||
break;
|
||||
case 'swow':
|
||||
$arg .= $this->builder->getLib('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
||||
$arg .= $this->builder->getLib('curl') ? ' --enable-swow-curl' : ' --disable-swow-curl';
|
||||
$arg .= ' SWOW_UV_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ';
|
||||
break;
|
||||
case 'swoole':
|
||||
if ($this->builder->getLib('openssl')) {
|
||||
$arg .= ' --enable-openssl';
|
||||
} else {
|
||||
$arg .= ' --disable-openssl --without-openssl';
|
||||
}
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
|
||||
private function getLibraryDependencies(bool $recursive = false): array
|
||||
{
|
||||
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder;
|
||||
|
||||
use SPC\builder\macos\library\MacOSLibraryBase;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\Config;
|
||||
@@ -133,6 +134,7 @@ abstract class LibraryBase
|
||||
{
|
||||
// 传入 true,表明直接编译
|
||||
if ($force_build) {
|
||||
logger()->info('Building required library [' . static::NAME . ']');
|
||||
$this->build();
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
@@ -151,6 +153,11 @@ abstract class LibraryBase
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
}
|
||||
// pkg-config 做特殊处理,如果是 pkg-config 就检查有没有 pkg-config 二进制
|
||||
if ($this instanceof MacOSLibraryBase && static::NAME === 'pkg-config' && !file_exists(BUILD_ROOT_PATH . '/bin/pkg-config')) {
|
||||
$this->tryBuild(true);
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
// 到这里说明所有的文件都存在,就跳过编译
|
||||
return BUILD_STATUS_ALREADY;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
26
src/SPC/builder/extension/event.php
Normal file
26
src/SPC/builder/extension/event.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('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;
|
||||
}
|
||||
}
|
||||
17
src/SPC/builder/extension/ffi.php
Normal file
17
src/SPC/builder/extension/ffi.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('ffi')]
|
||||
class ffi extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-ffi --enable-zend-signals';
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
17
src/SPC/builder/extension/imagick.php
Normal file
17
src/SPC/builder/extension/imagick.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('imagick')]
|
||||
class imagick extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--with-imagick=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
22
src/SPC/builder/extension/mbregex.php
Normal file
22
src/SPC/builder/extension/mbregex.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('mbregex')]
|
||||
class mbregex extends Extension
|
||||
{
|
||||
public function getDistName(): string
|
||||
{
|
||||
return 'mbstring';
|
||||
}
|
||||
|
||||
public function getConfigureArg(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
21
src/SPC/builder/extension/mbstring.php
Normal file
21
src/SPC/builder/extension/mbstring.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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 getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '--enable-mbstring';
|
||||
if ($this->builder->getExt('mbregex') === null) {
|
||||
$arg .= ' --disable-mbregex';
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
17
src/SPC/builder/extension/memcache.php
Normal file
17
src/SPC/builder/extension/memcache.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('memcache')]
|
||||
class memcache extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-memcache --with-zlib-dir=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
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";
|
||||
}
|
||||
}
|
||||
27
src/SPC/builder/extension/mongodb.php
Normal file
27
src/SPC/builder/extension/mongodb.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('mongodb')]
|
||||
class mongodb extends Extension
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
17
src/SPC/builder/extension/opcache.php
Normal file
17
src/SPC/builder/extension/opcache.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('opcache')]
|
||||
class opcache extends Extension
|
||||
{
|
||||
public function getDistName(): string
|
||||
{
|
||||
return 'Zend Opcache';
|
||||
}
|
||||
}
|
||||
21
src/SPC/builder/extension/redis.php
Normal file
21
src/SPC/builder/extension/redis.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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 --disable-redis-session';
|
||||
if ($this->builder->getLib('zstd')) {
|
||||
$arg .= ' --enable-redis-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
22
src/SPC/builder/extension/swoole.php
Normal file
22
src/SPC/builder/extension/swoole.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('swoole')]
|
||||
class swoole extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
$arg = '--enable-swoole';
|
||||
$arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl';
|
||||
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
|
||||
// curl hook is buggy for static php
|
||||
$arg .= ' --disable-swoole-curl';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
20
src/SPC/builder/extension/swow.php
Normal file
20
src/SPC/builder/extension/swow.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('swow')]
|
||||
class swow extends Extension
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
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';
|
||||
}
|
||||
}
|
||||
36
src/SPC/builder/extension/xml.php
Normal file
36
src/SPC/builder/extension/xml.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\exception\RuntimeException;
|
||||
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;
|
||||
}
|
||||
}
|
||||
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 . '"';
|
||||
}
|
||||
}
|
||||
312
src/SPC/builder/linux/LinuxBuilder.php
Normal file
312
src/SPC/builder/linux/LinuxBuilder.php
Normal file
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux;
|
||||
|
||||
use SPC\builder\BuilderBase;
|
||||
use SPC\builder\linux\library\LinuxLibraryBase;
|
||||
use SPC\builder\traits\UnixBuilderTrait;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\SourcePatcher;
|
||||
|
||||
/**
|
||||
* Linux 系统环境下的构建器
|
||||
*/
|
||||
class LinuxBuilder extends BuilderBase
|
||||
{
|
||||
/** 编译的 Unix 工具集 */
|
||||
use UnixBuilderTrait;
|
||||
|
||||
/** @var string[] Linux 环境下编译依赖的命令 */
|
||||
public const REQUIRED_COMMANDS = ['make', 'bison', 'flex', 'git', 'autoconf', 'automake', 'tar', 'unzip', /* 'xz', 好像不需要 */ 'gzip', 'bzip2', 'cmake'];
|
||||
|
||||
/** @var string 使用的 libc */
|
||||
public string $libc;
|
||||
|
||||
/** @var array 特殊架构下的 cflags */
|
||||
public array $tune_c_flags;
|
||||
|
||||
/** @var string pkg-config 环境变量 */
|
||||
public string $pkgconf_env;
|
||||
|
||||
/** @var string 交叉编译变量 */
|
||||
public string $cross_compile_prefix = '';
|
||||
|
||||
public string $note_section = "Je pense, donc je suis\0";
|
||||
|
||||
private bool $phar_patched = false;
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function __construct(?string $cc = null, ?string $cxx = null, ?string $arch = null, bool $zts = false)
|
||||
{
|
||||
// 初始化一些默认参数
|
||||
$this->cc = $cc ?? match (SystemUtil::getOSRelease()['dist']) {
|
||||
'alpine' => 'gcc',
|
||||
default => 'musl-gcc'
|
||||
};
|
||||
$this->cxx = $cxx ?? 'g++';
|
||||
$this->arch = $arch ?? php_uname('m');
|
||||
$this->gnu_arch = arch2gnu($this->arch);
|
||||
$this->zts = $zts;
|
||||
$this->libc = 'musl'; // SystemUtil::selectLibc($this->cc);
|
||||
|
||||
// 根据 CPU 线程数设置编译进程数
|
||||
$this->concurrency = SystemUtil::getCpuCount();
|
||||
// 设置 cflags
|
||||
$this->arch_c_flags = SystemUtil::getArchCFlags($this->cc, $this->arch);
|
||||
$this->arch_cxx_flags = SystemUtil::getArchCFlags($this->cxx, $this->arch);
|
||||
$this->tune_c_flags = SystemUtil::checkCCFlags(SystemUtil::getTuneCFlags($this->arch), $this->cc);
|
||||
// 设置 cmake
|
||||
$this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile(
|
||||
os: 'Linux',
|
||||
target_arch: $this->arch,
|
||||
cflags: $this->arch_c_flags,
|
||||
cc: $this->cc,
|
||||
cxx: $this->cxx
|
||||
);
|
||||
// 设置 pkgconfig
|
||||
$this->pkgconf_env = 'PKG_CONFIG="' . BUILD_ROOT_PATH . '/bin/pkg-config" PKG_CONFIG_PATH="' . BUILD_LIB_PATH . '/pkgconfig"';
|
||||
// 设置 configure 依赖的环境变量
|
||||
$this->configure_env =
|
||||
$this->pkgconf_env . ' ' .
|
||||
"CC='{$this->cc}' " .
|
||||
"CXX='{$this->cxx}' " .
|
||||
(php_uname('m') === $this->arch ? '' : "CFLAGS='{$this->arch_c_flags}'");
|
||||
// 交叉编译依赖的,TODO
|
||||
if (php_uname('m') !== $this->arch) {
|
||||
$this->cross_compile_prefix = SystemUtil::getCrossCompilePrefix($this->cc, $this->arch);
|
||||
logger()->info('using cross compile prefix: ' . $this->cross_compile_prefix);
|
||||
$this->configure_env .= " CROSS_COMPILE='{$this->cross_compile_prefix}'";
|
||||
}
|
||||
|
||||
$missing = [];
|
||||
foreach (self::REQUIRED_COMMANDS as $cmd) {
|
||||
if (SystemUtil::findCommand($cmd) === null) {
|
||||
$missing[] = $cmd;
|
||||
}
|
||||
}
|
||||
if (!empty($missing)) {
|
||||
throw new WrongUsageException('missing system commands: ' . implode(', ', $missing));
|
||||
}
|
||||
|
||||
// 创立 pkg-config 和放头文件的目录
|
||||
f_mkdir(BUILD_LIB_PATH . '/pkgconfig', recursive: true);
|
||||
f_mkdir(BUILD_INCLUDE_PATH, recursive: true);
|
||||
}
|
||||
|
||||
public function makeAutoconfArgs(string $name, array $libSpecs): string
|
||||
{
|
||||
$ret = '';
|
||||
foreach ($libSpecs as $libName => $arr) {
|
||||
$lib = $this->getLib($libName);
|
||||
|
||||
$arr = $arr ?? [];
|
||||
|
||||
$disableArgs = $arr[0] ?? null;
|
||||
$prefix = $arr[1] ?? null;
|
||||
if ($lib instanceof LinuxLibraryBase) {
|
||||
logger()->info("{$name} \033[32;1mwith\033[0;1m {$libName} support");
|
||||
$ret .= $lib->makeAutoconfEnv($prefix) . ' ';
|
||||
} else {
|
||||
logger()->info("{$name} \033[31;1mwithout\033[0;1m {$libName} support");
|
||||
$ret .= ($disableArgs ?? "--with-{$libName}=no") . ' ';
|
||||
}
|
||||
}
|
||||
return rtrim($ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function buildPHP(int $build_target = BUILD_TARGET_NONE, bool $with_clean = false, bool $bloat = false)
|
||||
{
|
||||
if (!$bloat) {
|
||||
$extra_libs = implode(' ', $this->getAllStaticLibFiles());
|
||||
} else {
|
||||
logger()->info('bloat linking');
|
||||
$extra_libs = implode(
|
||||
' ',
|
||||
array_map(
|
||||
fn ($x) => "-Xcompiler {$x}",
|
||||
array_filter($this->getAllStaticLibFiles())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->hasCppExtension()) {
|
||||
$extra_libs .= ' -lstdc++';
|
||||
}
|
||||
if ($this->getExt('imagick')) {
|
||||
$extra_libs .= ' /usr/lib/libMagick++-7.Q16HDRI.a /usr/lib/libMagickCore-7.Q16HDRI.a /usr/lib/libMagickWand-7.Q16HDRI.a';
|
||||
}
|
||||
|
||||
$envs = $this->pkgconf_env . ' ' .
|
||||
"CC='{$this->cc}' " .
|
||||
"CXX='{$this->cxx}' ";
|
||||
$cflags = $this->arch_c_flags;
|
||||
$use_lld = '';
|
||||
|
||||
switch ($this->libc) {
|
||||
case 'musl_wrapper':
|
||||
case 'glibc':
|
||||
$cflags .= ' -static-libgcc -I"' . BUILD_INCLUDE_PATH . '"';
|
||||
break;
|
||||
case 'musl':
|
||||
if (str_ends_with($this->cc, 'clang') && SystemUtil::findCommand('lld')) {
|
||||
$use_lld = '-Xcompiler -fuse-ld=lld';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new WrongUsageException('libc ' . $this->libc . ' is not implemented yet');
|
||||
}
|
||||
|
||||
$envs = "{$envs} CFLAGS='{$cflags}' LIBS='-ldl -lpthread'";
|
||||
|
||||
SourcePatcher::patchPHPBuildconf($this);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')->exec('./buildconf --force');
|
||||
|
||||
SourcePatcher::patchPHPConfigure($this);
|
||||
|
||||
if ($this->getPHPVersionID() < 80000) {
|
||||
$json_74 = '--enable-json ';
|
||||
} else {
|
||||
$json_74 = '';
|
||||
}
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec(
|
||||
'./configure ' .
|
||||
'--prefix= ' .
|
||||
'--with-valgrind=no ' .
|
||||
'--enable-shared=no ' .
|
||||
'--enable-static=yes ' .
|
||||
'--disable-all ' .
|
||||
'--disable-cgi ' .
|
||||
'--disable-phpdbg ' .
|
||||
'--enable-cli ' .
|
||||
'--enable-fpm ' .
|
||||
$json_74 .
|
||||
'--enable-micro=all-static ' .
|
||||
($this->zts ? '--enable-zts' : '') . ' ' .
|
||||
$this->makeExtensionArgs() . ' ' .
|
||||
$envs
|
||||
);
|
||||
|
||||
SourcePatcher::patchPHPAfterConfigure($this);
|
||||
|
||||
file_put_contents('/tmp/comment', $this->note_section);
|
||||
|
||||
// 清理
|
||||
$this->cleanMake();
|
||||
|
||||
if ($bloat) {
|
||||
logger()->info('bloat linking');
|
||||
$extra_libs = "-Wl,--whole-archive {$extra_libs} -Wl,--no-whole-archive";
|
||||
}
|
||||
|
||||
if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI) {
|
||||
logger()->info('building cli');
|
||||
$this->buildCli($extra_libs, $use_lld);
|
||||
}
|
||||
if (($build_target & BUILD_TARGET_FPM) === BUILD_TARGET_FPM) {
|
||||
logger()->info('building fpm');
|
||||
$this->buildFpm($extra_libs, $use_lld);
|
||||
}
|
||||
if (($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO) {
|
||||
logger()->info('building micro');
|
||||
$this->buildMicro($extra_libs, $use_lld, $cflags);
|
||||
}
|
||||
|
||||
if (php_uname('m') === $this->arch) {
|
||||
$this->sanityCheck($build_target);
|
||||
}
|
||||
|
||||
if ($this->phar_patched) {
|
||||
SourcePatcher::patchMicro(['phar'], true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function buildCli(string $extra_libs, string $use_lld): void
|
||||
{
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec(
|
||||
'make -j' . $this->concurrency .
|
||||
' EXTRA_CFLAGS="-g -Os -fno-ident ' . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags)) . '" ' .
|
||||
"EXTRA_LIBS=\"{$extra_libs}\" " .
|
||||
"EXTRA_LDFLAGS_PROGRAM='{$use_lld} -all-static' " .
|
||||
'cli'
|
||||
);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/cli')
|
||||
->exec("{$this->cross_compile_prefix}objcopy --only-keep-debug php php.debug")
|
||||
->exec('elfedit --output-osabi linux php')
|
||||
->exec("{$this->cross_compile_prefix}strip --strip-all php")
|
||||
->exec("{$this->cross_compile_prefix}objcopy --update-section .comment=/tmp/comment --add-gnu-debuglink=php.debug --remove-section=.note php");
|
||||
$this->deployBinary(BUILD_TARGET_CLI);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function buildMicro(string $extra_libs, string $use_lld, string $cflags): void
|
||||
{
|
||||
if ($this->getPHPVersionID() < 80000) {
|
||||
throw new RuntimeException('phpmicro only support PHP >= 8.0!');
|
||||
}
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
SourcePatcher::patchMicro(['phar']);
|
||||
}
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec(
|
||||
"make -j{$this->concurrency} " .
|
||||
'EXTRA_CFLAGS=' . quote('-g -Os -fno-ident ' . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags))) . ' ' .
|
||||
'EXTRA_LIBS=' . quote($extra_libs) . ' ' .
|
||||
'EXTRA_LDFLAGS_PROGRAM=' . quote("{$cflags} {$use_lld}" . ' -all-static', "'") . ' ' .
|
||||
'micro'
|
||||
);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/micro')->exec("{$this->cross_compile_prefix}strip --strip-all micro.sfx");
|
||||
|
||||
$this->deployBinary(BUILD_TARGET_MICRO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 fpm
|
||||
*
|
||||
* @throws FileSystemException|RuntimeException
|
||||
*/
|
||||
public function buildFpm(string $extra_libs, string $use_lld): void
|
||||
{
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec(
|
||||
'make -j' . $this->concurrency .
|
||||
' EXTRA_CFLAGS="-g -Os -fno-ident ' . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags)) . '" ' .
|
||||
"EXTRA_LIBS=\"{$extra_libs}\" " .
|
||||
"EXTRA_LDFLAGS_PROGRAM='{$use_lld} -all-static' " .
|
||||
'fpm'
|
||||
);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/fpm')
|
||||
->exec("{$this->cross_compile_prefix}objcopy --only-keep-debug php-fpm php-fpm.debug")
|
||||
->exec('elfedit --output-osabi linux php-fpm')
|
||||
->exec("{$this->cross_compile_prefix}strip --strip-all php-fpm")
|
||||
->exec("{$this->cross_compile_prefix}objcopy --update-section .comment=/tmp/comment --add-gnu-debuglink=php-fpm.debug --remove-section=.note php-fpm");
|
||||
$this->deployBinary(BUILD_TARGET_FPM);
|
||||
}
|
||||
}
|
||||
203
src/SPC/builder/linux/SystemUtil.php
Normal file
203
src/SPC/builder/linux/SystemUtil.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux;
|
||||
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
use SPC\builder\traits\UnixSystemUtilTrait;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
|
||||
class SystemUtil
|
||||
{
|
||||
use UnixSystemUtilTrait;
|
||||
|
||||
#[ArrayShape(['dist' => 'mixed|string', 'ver' => 'mixed|string'])]
|
||||
public static function getOSRelease(): array
|
||||
{
|
||||
$ret = [
|
||||
'dist' => 'unknown',
|
||||
'ver' => 'unknown',
|
||||
];
|
||||
switch (true) {
|
||||
case file_exists('/etc/os-release'):
|
||||
$lines = file('/etc/os-release');
|
||||
foreach ($lines as $line) {
|
||||
if (preg_match('/^ID=(.*)$/', $line, $matches)) {
|
||||
$ret['dist'] = $matches[1];
|
||||
}
|
||||
if (preg_match('/^VERSION_ID=(.*)$/', $line, $matches)) {
|
||||
$ret['ver'] = $matches[1];
|
||||
}
|
||||
}
|
||||
$ret['dist'] = trim($ret['dist'], '"\'');
|
||||
$ret['ver'] = trim($ret['ver'], '"\'');
|
||||
if (strcasecmp($ret['dist'], 'centos') === 0) {
|
||||
$ret['dist'] = 'redhat';
|
||||
}
|
||||
break;
|
||||
case file_exists('/etc/centos-release'):
|
||||
$lines = file('/etc/centos-release');
|
||||
goto rh;
|
||||
case file_exists('/etc/redhat-release'):
|
||||
$lines = file('/etc/redhat-release');
|
||||
rh:
|
||||
foreach ($lines as $line) {
|
||||
if (preg_match('/release\s+(\d+(\.\d+)*)/', $line, $matches)) {
|
||||
$ret['dist'] = 'redhat';
|
||||
$ret['ver'] = $matches[1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCpuCount(): int
|
||||
{
|
||||
$ncpu = 1;
|
||||
|
||||
if (is_file('/proc/cpuinfo')) {
|
||||
$cpuinfo = file_get_contents('/proc/cpuinfo');
|
||||
preg_match_all('/^processor/m', $cpuinfo, $matches);
|
||||
$ncpu = count($matches[0]);
|
||||
}
|
||||
|
||||
return $ncpu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function getCCType(string $cc): string
|
||||
{
|
||||
return match (true) {
|
||||
str_ends_with($cc, 'c++'), str_ends_with($cc, 'cc'), str_ends_with($cc, 'g++'), str_ends_with($cc, 'gcc') => 'gcc',
|
||||
$cc === 'clang++', $cc === 'clang', str_starts_with($cc, 'musl-clang') => 'clang',
|
||||
default => throw new RuntimeException("unknown cc type: {$cc}"),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function getArchCFlags(string $cc, string $arch): string
|
||||
{
|
||||
if (php_uname('m') === $arch) {
|
||||
return '';
|
||||
}
|
||||
return match (static::getCCType($cc)) {
|
||||
'clang' => match ($arch) {
|
||||
'x86_64' => '--target=x86_64-unknown-linux',
|
||||
'arm64', 'aarch64' => '--target=arm64-unknown-linux',
|
||||
default => throw new WrongUsageException('unsupported arch: ' . $arch),
|
||||
},
|
||||
'gcc' => '',
|
||||
default => throw new WrongUsageException('cc compiler ' . $cc . ' is not supported'),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function getTuneCFlags(string $arch): array
|
||||
{
|
||||
return match ($arch) {
|
||||
'x86_64' => [
|
||||
'-march=corei7',
|
||||
'-mtune=core-avx2',
|
||||
],
|
||||
'arm64', 'aarch64' => [],
|
||||
default => throw new RuntimeException('unsupported arch: ' . $arch),
|
||||
};
|
||||
}
|
||||
|
||||
public static function checkCCFlags(array $flags, string $cc): array
|
||||
{
|
||||
return array_filter($flags, fn ($flag) => static::checkCCFlag($flag, $cc));
|
||||
}
|
||||
|
||||
public static function checkCCFlag(string $flag, string $cc): string
|
||||
{
|
||||
[$ret] = shell()->execWithResult("echo | {$cc} -E -x c - {$flag}");
|
||||
if ($ret != 0) {
|
||||
return '';
|
||||
}
|
||||
return $flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function getCrossCompilePrefix(string $cc, string $arch): string
|
||||
{
|
||||
return match (static::getCCType($cc)) {
|
||||
// guessing clang toolchains
|
||||
'clang' => match ($arch) {
|
||||
'x86_64' => 'x86_64-linux-gnu-',
|
||||
'arm64', 'aarch64' => 'aarch64-linux-gnu-',
|
||||
default => throw new RuntimeException('unsupported arch: ' . $arch),
|
||||
},
|
||||
// remove gcc postfix
|
||||
'gcc' => str_replace('-cc', '', str_replace('-gcc', '', $cc)) . '-',
|
||||
default => throw new RuntimeException('unsupported cc'),
|
||||
};
|
||||
}
|
||||
|
||||
public static function findStaticLib(string $name): ?array
|
||||
{
|
||||
$paths = getenv('LIBPATH');
|
||||
if (!$paths) {
|
||||
$paths = '/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:';
|
||||
}
|
||||
foreach (explode(':', $paths) as $path) {
|
||||
if (file_exists("{$path}/{$name}")) {
|
||||
return ["{$path}", "{$name}"];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function findStaticLibs(array $names): ?array
|
||||
{
|
||||
$ret = [];
|
||||
foreach ($names as $name) {
|
||||
$path = static::findStaticLib($name);
|
||||
if (!$path) {
|
||||
logger()->warning("static library {$name} not found");
|
||||
return null;
|
||||
}
|
||||
$ret[] = $path;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function findHeader(string $name): ?array
|
||||
{
|
||||
$paths = getenv('INCLUDEPATH');
|
||||
if (!$paths) {
|
||||
$paths = '/include:/usr/include:/usr/local/include';
|
||||
}
|
||||
foreach (explode(':', $paths) as $path) {
|
||||
if (file_exists("{$path}/{$name}") || is_dir("{$path}/{$name}")) {
|
||||
return ["{$path}", "{$name}"];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function findHeaders(array $names): ?array
|
||||
{
|
||||
$ret = [];
|
||||
foreach ($names as $name) {
|
||||
$path = static::findHeader($name);
|
||||
if (!$path) {
|
||||
logger()->warning("header {$name} not found");
|
||||
return null;
|
||||
}
|
||||
$ret[] = $path;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
83
src/SPC/builder/linux/library/LinuxLibraryBase.php
Normal file
83
src/SPC/builder/linux/library/LinuxLibraryBase.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
use SPC\builder\BuilderBase;
|
||||
use SPC\builder\LibraryBase;
|
||||
use SPC\builder\linux\LinuxBuilder;
|
||||
use SPC\builder\traits\UnixLibraryTrait;
|
||||
use SPC\exception\RuntimeException;
|
||||
|
||||
abstract class LinuxLibraryBase extends LibraryBase
|
||||
{
|
||||
use UnixLibraryTrait;
|
||||
|
||||
protected array $static_libs = [];
|
||||
|
||||
protected array $headers;
|
||||
|
||||
protected array $pkgconfs;
|
||||
|
||||
/**
|
||||
* 依赖的名字及是否可选,例如:curl => true,代表依赖 curl 但可选
|
||||
*/
|
||||
protected array $dep_names;
|
||||
|
||||
public function __construct(protected LinuxBuilder $builder)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getBuilder(): BuilderBase
|
||||
{
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function tryBuild(bool $force_build = false): int
|
||||
{
|
||||
// 传入 true,表明直接编译
|
||||
if ($force_build) {
|
||||
logger()->info('Building required library [' . static::NAME . ']');
|
||||
$this->build();
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
|
||||
// 看看这些库是不是存在,如果不存在,则调用编译并返回结果状态
|
||||
foreach ($this->getStaticLibs() as $name) {
|
||||
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
||||
$this->tryBuild(true);
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
}
|
||||
// 头文件同理
|
||||
foreach ($this->getHeaders() as $name) {
|
||||
if (!file_exists(BUILD_INCLUDE_PATH . "/{$name}")) {
|
||||
$this->tryBuild(true);
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
}
|
||||
// pkg-config 做特殊处理,如果是 pkg-config 就检查有没有 pkg-config 二进制
|
||||
if (static::NAME === 'pkg-config' && !file_exists(BUILD_ROOT_PATH . '/bin/pkg-config')) {
|
||||
$this->tryBuild(true);
|
||||
return BUILD_STATUS_OK;
|
||||
}
|
||||
// 到这里说明所有的文件都存在,就跳过编译
|
||||
return BUILD_STATUS_ALREADY;
|
||||
}
|
||||
|
||||
protected function makeFakePkgconfs()
|
||||
{
|
||||
$workspace = BUILD_ROOT_PATH;
|
||||
if ($workspace === '/') {
|
||||
$workspace = '';
|
||||
}
|
||||
foreach ($this->pkgconfs as $name => $content) {
|
||||
file_put_contents(BUILD_LIB_PATH . "/pkgconfig/{$name}", "prefix={$workspace}\n" . $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/linux/library/brotli.php
Normal file
12
src/SPC/builder/linux/library/brotli.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class brotli extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\brotli;
|
||||
|
||||
public const NAME = 'brotli';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/bzip2.php
Normal file
12
src/SPC/builder/linux/library/bzip2.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class bzip2 extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\bzip2;
|
||||
|
||||
public const NAME = 'bzip2';
|
||||
}
|
||||
21
src/SPC/builder/linux/library/curl.php
Normal file
21
src/SPC/builder/linux/library/curl.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class curl extends LinuxLibraryBase
|
||||
{
|
||||
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')) {
|
||||
$libs .= ' -ldl -lpthread';
|
||||
}
|
||||
return $libs;
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/linux/library/freetype.php
Normal file
12
src/SPC/builder/linux/library/freetype.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class freetype extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\freetype;
|
||||
|
||||
public const NAME = 'freetype';
|
||||
}
|
||||
15
src/SPC/builder/linux/library/gmp.php
Normal file
15
src/SPC/builder/linux/library/gmp.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class gmp extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\gmp;
|
||||
|
||||
public const NAME = 'gmp';
|
||||
}
|
||||
34
src/SPC/builder/linux/library/icu.php
Normal file
34
src/SPC/builder/linux/library/icu.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class icu extends LinuxLibraryBase
|
||||
{
|
||||
public const NAME = 'icu';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
$root = BUILD_ROOT_PATH;
|
||||
$cppflag = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1"';
|
||||
shell()->cd($this->source_dir . '/source')
|
||||
->exec(
|
||||
"{$this->builder->configure_env} {$cppflag} ./runConfigureICU Linux " .
|
||||
'--enable-static ' .
|
||||
'--disable-shared ' .
|
||||
'--with-data-packaging=static ' .
|
||||
'--enable-release=yes ' .
|
||||
'--enable-extras=yes ' .
|
||||
'--enable-icuio=yes ' .
|
||||
'--enable-dyload=no ' .
|
||||
'--enable-tools=yes ' .
|
||||
'--enable-tests=no ' .
|
||||
'--enable-samples=no ' .
|
||||
"--prefix={$root}"
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
}
|
||||
}
|
||||
15
src/SPC/builder/linux/library/imagemagick.php
Normal file
15
src/SPC/builder/linux/library/imagemagick.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
/**
|
||||
* a template library class for unix
|
||||
*/
|
||||
class imagemagick extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\imagemagick;
|
||||
|
||||
public const NAME = 'imagemagick';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libavif.php
Normal file
12
src/SPC/builder/linux/library/libavif.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libavif extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libavif;
|
||||
|
||||
public const NAME = 'libavif';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libevent.php
Normal file
12
src/SPC/builder/linux/library/libevent.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libevent extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libevent;
|
||||
|
||||
public const NAME = 'libevent';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libiconv.php
Normal file
12
src/SPC/builder/linux/library/libiconv.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libiconv extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libiconv;
|
||||
|
||||
public const NAME = 'libiconv';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libjpeg.php
Normal file
12
src/SPC/builder/linux/library/libjpeg.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libjpeg extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libjpeg;
|
||||
|
||||
public const NAME = 'libjpeg';
|
||||
}
|
||||
20
src/SPC/builder/linux/library/libmemcached.php
Normal file
20
src/SPC/builder/linux/library/libmemcached.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
use SPC\exception\RuntimeException;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class libmemcached extends LinuxLibraryBase
|
||||
{
|
||||
public const NAME = 'libmemcached';
|
||||
|
||||
public function build()
|
||||
{
|
||||
throw new RuntimeException('libmemcached is currently not supported on Linux platform');
|
||||
}
|
||||
}
|
||||
67
src/SPC/builder/linux/library/libpng.php
Normal file
67
src/SPC/builder/linux/library/libpng.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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\linux\library;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\SourcePatcher;
|
||||
|
||||
class libpng extends LinuxLibraryBase
|
||||
{
|
||||
public const NAME = 'libpng';
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$optimizations = match ($this->builder->arch) {
|
||||
'x86_64' => '--enable-intel-sse ',
|
||||
'arm64' => '--enable-arm-neon ',
|
||||
default => '',
|
||||
};
|
||||
|
||||
// patch configure
|
||||
SourcePatcher::patchUnixLibpng();
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec('chmod +x ./configure')
|
||||
->exec('chmod +x ./install-sh')
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
"--host={$this->builder->gnu_arch}-unknown-linux " .
|
||||
'--disable-shared ' .
|
||||
'--enable-static ' .
|
||||
'--enable-hardware-optimizations ' .
|
||||
'--with-zlib-prefix="' . BUILD_ROOT_PATH . '" ' .
|
||||
$optimizations .
|
||||
'--prefix='
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la")
|
||||
->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH)
|
||||
->cd(BUILD_LIB_PATH)
|
||||
->exec('ln -sf libpng16.a libpng.a');
|
||||
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libsodium.php
Normal file
12
src/SPC/builder/linux/library/libsodium.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libsodium extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libsodium;
|
||||
|
||||
public const NAME = 'libsodium';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libssh2.php
Normal file
12
src/SPC/builder/linux/library/libssh2.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libssh2 extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libssh2;
|
||||
|
||||
public const NAME = 'libssh2';
|
||||
}
|
||||
28
src/SPC/builder/linux/library/libwebp.php
Normal file
28
src/SPC/builder/linux/library/libwebp.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\linux\library;
|
||||
|
||||
class libwebp extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libwebp;
|
||||
|
||||
public const NAME = 'libwebp';
|
||||
}
|
||||
53
src/SPC/builder/linux/library/libxml2.php
Normal file
53
src/SPC/builder/linux/library/libxml2.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
class libxml2 extends LinuxLibraryBase
|
||||
{
|
||||
public const NAME = 'libxml2';
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$enable_zlib = $this->builder->getLib('zlib') ? 'ON' : 'OFF';
|
||||
$enable_icu = $this->builder->getLib('icu') ? 'ON' : 'OFF';
|
||||
$enable_xz = $this->builder->getLib('xz') ? 'ON' : 'OFF';
|
||||
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
|
||||
FileSystem::resetDir($this->source_dir . '/build');
|
||||
shell()->cd($this->source_dir . '/build')
|
||||
->exec(
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
"{$this->builder->makeCmakeArgs()} " .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DLIBXML2_WITH_ICONV=ON ' .
|
||||
'-DIconv_IS_BUILT_IN=OFF ' .
|
||||
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
|
||||
"-DLIBXML2_WITH_ICU={$enable_icu} " .
|
||||
"-DLIBXML2_WITH_LZMA={$enable_xz} " .
|
||||
'-DLIBXML2_WITH_PYTHON=OFF ' .
|
||||
'-DLIBXML2_WITH_PROGRAMS=OFF ' .
|
||||
'-DLIBXML2_WITH_TESTS=OFF ' .
|
||||
'..'
|
||||
)
|
||||
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||
->exec("make install DESTDIR={$destdir}");
|
||||
|
||||
if (is_dir(BUILD_INCLUDE_PATH . '/libxml2/libxml')) {
|
||||
if (is_dir(BUILD_INCLUDE_PATH . '/libxml')) {
|
||||
shell()->exec('rm -rf "' . BUILD_INCLUDE_PATH . '/libxml"');
|
||||
}
|
||||
$path = FileSystem::convertPath(BUILD_INCLUDE_PATH . '/libxml2/libxml');
|
||||
$dst_path = FileSystem::convertPath(BUILD_INCLUDE_PATH . '/');
|
||||
shell()->exec('mv "' . $path . '" "' . $dst_path . '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libyaml.php
Normal file
12
src/SPC/builder/linux/library/libyaml.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libyaml extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libyaml;
|
||||
|
||||
public const NAME = 'libyaml';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libzip.php
Normal file
12
src/SPC/builder/linux/library/libzip.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libzip extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libzip;
|
||||
|
||||
public const NAME = 'libzip';
|
||||
}
|
||||
15
src/SPC/builder/linux/library/ncurses.php
Normal file
15
src/SPC/builder/linux/library/ncurses.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class ncurses extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\ncurses;
|
||||
|
||||
public const NAME = 'ncurses';
|
||||
}
|
||||
63
src/SPC/builder/linux/library/nghttp2.php
Normal file
63
src/SPC/builder/linux/library/nghttp2.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\linux\library;
|
||||
|
||||
class nghttp2 extends LinuxLibraryBase
|
||||
{
|
||||
public const NAME = 'nghttp2';
|
||||
|
||||
public function build()
|
||||
{
|
||||
$args = $this->builder->makeAutoconfArgs(static::NAME, [
|
||||
'zlib' => null,
|
||||
'openssl' => null,
|
||||
'libxml2' => null,
|
||||
'libev' => null,
|
||||
'libcares' => null,
|
||||
'libngtcp2' => null,
|
||||
'libnghttp3' => null,
|
||||
'libbpf' => null,
|
||||
'libevent-openssl' => null,
|
||||
'jansson' => null,
|
||||
'jemalloc' => null,
|
||||
'systemd' => null,
|
||||
'cunit' => null,
|
||||
]);
|
||||
|
||||
[,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static ' .
|
||||
'--disable-shared ' .
|
||||
"--host={$this->builder->gnu_arch}-unknown-linux " .
|
||||
'--enable-lib-only ' .
|
||||
'--with-boost=no ' .
|
||||
$args . ' ' .
|
||||
'--prefix='
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec("make install DESTDIR={$destdir}");
|
||||
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/linux/library/onig.php
Normal file
12
src/SPC/builder/linux/library/onig.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class onig extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\onig;
|
||||
|
||||
public const NAME = 'onig';
|
||||
}
|
||||
78
src/SPC/builder/linux/library/openssl.php
Normal file
78
src/SPC/builder/linux/library/openssl.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?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\linux\library;
|
||||
|
||||
use SPC\builder\linux\SystemUtil;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
|
||||
class openssl extends LinuxLibraryBase
|
||||
{
|
||||
public const NAME = 'openssl';
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
[$lib,$include,$destdir] = SEPARATED_PATH;
|
||||
|
||||
$extra = '';
|
||||
$ex_lib = '-ldl -pthread';
|
||||
|
||||
$env = $this->builder->pkgconf_env . " CFLAGS='{$this->builder->arch_c_flags}'";
|
||||
$env .= " CC='{$this->builder->cc} -static -idirafter " . BUILD_INCLUDE_PATH .
|
||||
' -idirafter /usr/include/ ' .
|
||||
' -idirafter /usr/include/' . $this->builder->arch . '-linux-gnu/ ' .
|
||||
"' ";
|
||||
// lib:zlib
|
||||
$zlib = $this->builder->getLib('zlib');
|
||||
if ($zlib instanceof LinuxLibraryBase) {
|
||||
$extra = 'zlib';
|
||||
$ex_lib = trim($zlib->getStaticLibFiles() . ' ' . $ex_lib);
|
||||
$zlib_extra =
|
||||
'--with-zlib-include=' . BUILD_INCLUDE_PATH . ' ' .
|
||||
'--with-zlib-lib=' . BUILD_LIB_PATH . ' ';
|
||||
} else {
|
||||
$zlib_extra = '';
|
||||
}
|
||||
|
||||
$ex_lib = trim($ex_lib);
|
||||
|
||||
$clang_postfix = SystemUtil::getCCType($this->builder->cc) === 'clang' ? '-clang' : '';
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} {$env} ./Configure no-shared {$extra} " .
|
||||
'--prefix=/ ' .
|
||||
'--libdir=lib ' .
|
||||
'-static ' .
|
||||
"{$zlib_extra}" .
|
||||
'no-legacy ' .
|
||||
"linux-{$this->builder->arch}{$clang_postfix}"
|
||||
)
|
||||
->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/linux/library/pkgconfig.php
Normal file
15
src/SPC/builder/linux/library/pkgconfig.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class pkgconfig extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\pkgconfig;
|
||||
|
||||
public const NAME = 'pkg-config';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/postgresql.php
Normal file
12
src/SPC/builder/linux/library/postgresql.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class postgresql extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\postgresql;
|
||||
|
||||
public const NAME = 'postgresql';
|
||||
}
|
||||
15
src/SPC/builder/linux/library/readline.php
Normal file
15
src/SPC/builder/linux/library/readline.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class readline extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\readline;
|
||||
|
||||
public const NAME = 'readline';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/sqlite.php
Normal file
12
src/SPC/builder/linux/library/sqlite.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class sqlite extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\sqlite;
|
||||
|
||||
public const NAME = 'sqlite';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/xz.php
Normal file
12
src/SPC/builder/linux/library/xz.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class xz extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\xz;
|
||||
|
||||
public const NAME = 'xz';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/zlib.php
Normal file
12
src/SPC/builder/linux/library/zlib.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class zlib extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\zlib;
|
||||
|
||||
public const NAME = 'zlib';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/zstd.php
Normal file
12
src/SPC/builder/linux/library/zstd.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class zstd extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\zstd;
|
||||
|
||||
public const NAME = 'zstd';
|
||||
}
|
||||
@@ -9,7 +9,8 @@ use SPC\builder\macos\library\MacOSLibraryBase;
|
||||
use SPC\builder\traits\UnixBuilderTrait;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\util\Patcher;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\SourcePatcher;
|
||||
|
||||
/**
|
||||
* macOS 系统环境下的构建器
|
||||
@@ -20,16 +21,17 @@ class MacOSBuilder extends BuilderBase
|
||||
/** 编译的 Unix 工具集 */
|
||||
use UnixBuilderTrait;
|
||||
|
||||
/** @var string[] MacOS 环境下编译依赖的命令 */
|
||||
public const REQUIRED_COMMANDS = ['make', 'bison', 'flex', 'pkg-config', 'git', 'autoconf', 'automake', 'tar', 'unzip', 'xz', 'gzip', 'bzip2', 'cmake'];
|
||||
|
||||
/** @var bool 标记是否 patch 了 phar */
|
||||
private bool $phar_patched = false;
|
||||
|
||||
/**
|
||||
* @param null|string $cc C编译器名称,如果不传入则默认使用clang
|
||||
* @param null|string $cxx C++编译器名称,如果不传入则默认使用clang++
|
||||
* @param null|string $arch 当前架构,如果不传入则默认使用当前系统架构
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function __construct(?string $cc = null, ?string $cxx = null, ?string $arch = null)
|
||||
public function __construct(?string $cc = null, ?string $cxx = null, ?string $arch = null, bool $zts = false)
|
||||
{
|
||||
// 如果是 Debug 模式,才使用 set -x 显示每条执行的命令
|
||||
$this->set_x = defined('DEBUG_MODE') ? 'set -x' : 'true';
|
||||
@@ -38,6 +40,7 @@ class MacOSBuilder extends BuilderBase
|
||||
$this->cxx = $cxx ?? 'clang++';
|
||||
$this->arch = $arch ?? php_uname('m');
|
||||
$this->gnu_arch = arch2gnu($this->arch);
|
||||
$this->zts = $zts;
|
||||
// 根据 CPU 线程数设置编译进程数
|
||||
$this->concurrency = SystemUtil::getCpuCount();
|
||||
// 设置 cflags
|
||||
@@ -47,20 +50,11 @@ class MacOSBuilder extends BuilderBase
|
||||
$this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile('Darwin', $this->arch, $this->arch_c_flags);
|
||||
// 设置 configure 依赖的环境变量
|
||||
$this->configure_env =
|
||||
'PKG_CONFIG="' . BUILD_ROOT_PATH . '/bin/pkg-config" ' .
|
||||
'PKG_CONFIG_PATH="' . BUILD_LIB_PATH . '/pkgconfig/" ' .
|
||||
"CC='{$this->cc}' " .
|
||||
"CXX='{$this->cxx}' " .
|
||||
"CFLAGS='{$this->arch_c_flags} -Wimplicit-function-declaration'";
|
||||
// 保存丢失的命令
|
||||
$missing = [];
|
||||
foreach (self::REQUIRED_COMMANDS as $cmd) {
|
||||
if (SystemUtil::findCommand($cmd) === null) {
|
||||
$missing[] = $cmd;
|
||||
}
|
||||
}
|
||||
if (!empty($missing)) {
|
||||
throw new RuntimeException('missing system commands: ' . implode(', ', $missing));
|
||||
}
|
||||
"CFLAGS='{$this->arch_c_flags} -Wimplicit-function-declaration -Os'";
|
||||
|
||||
// 创立 pkg-config 和放头文件的目录
|
||||
f_mkdir(BUILD_LIB_PATH . '/pkgconfig', recursive: true);
|
||||
@@ -85,7 +79,7 @@ class MacOSBuilder extends BuilderBase
|
||||
$prefix = $arr[1] ?? null;
|
||||
if ($lib instanceof MacOSLibraryBase) {
|
||||
logger()->info("{$name} \033[32;1mwith\033[0;1m {$libName} support");
|
||||
$ret .= $lib->makeAutoconfEnv($prefix) . ' ';
|
||||
$ret .= '--with-' . $libName . '=yes ';
|
||||
} else {
|
||||
logger()->info("{$name} \033[31;1mwithout\033[0;1m {$libName} support");
|
||||
$ret .= ($disableArgs ?? "--with-{$libName}=no") . ' ';
|
||||
@@ -124,12 +118,15 @@ class MacOSBuilder extends BuilderBase
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @param int $build_target build target
|
||||
* @param bool $bloat just raw add all lib files
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function buildPHP(int $build_micro_rule = BUILD_MICRO_NONE, bool $with_clean = false, bool $bloat = false): void
|
||||
public function buildPHP(int $build_target = BUILD_TARGET_NONE, bool $bloat = false): void
|
||||
{
|
||||
$extra_libs = $this->getFrameworks(true) . ' ' . ($this->getExt('swoole') ? '-lc++ ' : '');
|
||||
$extra_libs = $this->getFrameworks(true) . ' ' . ($this->hasCppExtension() ? '-lc++ ' : '');
|
||||
if (!$bloat) {
|
||||
$extra_libs .= implode(' ', $this->getAllStaticLibFiles());
|
||||
} else {
|
||||
@@ -144,78 +141,88 @@ class MacOSBuilder extends BuilderBase
|
||||
}
|
||||
|
||||
// patch before configure
|
||||
Patcher::patchPHPBeforeConfigure($this);
|
||||
SourcePatcher::patchPHPBuildconf($this);
|
||||
|
||||
f_passthru(
|
||||
$this->set_x . ' && ' .
|
||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||
'./buildconf --force'
|
||||
);
|
||||
shell()->cd(SOURCE_PATH . '/php-src')->exec('./buildconf --force');
|
||||
|
||||
Patcher::patchPHPConfigure($this);
|
||||
SourcePatcher::patchPHPConfigure($this);
|
||||
|
||||
if ($this->getLib('libxml2') || $this->getExt('iconv')) {
|
||||
$extra_libs .= ' -liconv';
|
||||
}
|
||||
|
||||
f_passthru(
|
||||
$this->set_x . ' && ' .
|
||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||
'./configure ' .
|
||||
'--prefix= ' .
|
||||
'--with-valgrind=no ' . // 不检测内存泄漏
|
||||
'--enable-shared=no ' .
|
||||
'--enable-static=yes ' .
|
||||
"--host={$this->gnu_arch}-apple-darwin " .
|
||||
"CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " .
|
||||
'--disable-all ' .
|
||||
'--disable-cgi ' .
|
||||
'--disable-phpdbg ' .
|
||||
'--enable-cli ' .
|
||||
'--enable-micro ' .
|
||||
($this->zts ? '--enable-zts' : '') . ' ' .
|
||||
$this->makeExtensionArgs() . ' ' .
|
||||
$this->configure_env
|
||||
);
|
||||
|
||||
if ($with_clean) {
|
||||
logger()->info('cleaning up');
|
||||
f_passthru(
|
||||
$this->set_x . ' && ' .
|
||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||
'make clean'
|
||||
);
|
||||
if ($this->getPHPVersionID() < 80000) {
|
||||
$json_74 = '--enable-json ';
|
||||
} else {
|
||||
$json_74 = '';
|
||||
}
|
||||
|
||||
switch ($build_micro_rule) {
|
||||
case BUILD_MICRO_NONE:
|
||||
logger()->info('building cli');
|
||||
$this->buildCli($extra_libs);
|
||||
break;
|
||||
case BUILD_MICRO_ONLY:
|
||||
logger()->info('building micro');
|
||||
$this->buildMicro($extra_libs);
|
||||
break;
|
||||
case BUILD_MICRO_BOTH:
|
||||
logger()->info('building cli and micro');
|
||||
$this->buildCli($extra_libs);
|
||||
$this->buildMicro($extra_libs);
|
||||
break;
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec(
|
||||
'./configure ' .
|
||||
'--prefix= ' .
|
||||
'--with-valgrind=no ' . // 不检测内存泄漏
|
||||
'--enable-shared=no ' .
|
||||
'--enable-static=yes ' .
|
||||
"CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " .
|
||||
'--disable-all ' .
|
||||
'--disable-cgi ' .
|
||||
'--disable-phpdbg ' .
|
||||
'--enable-cli ' .
|
||||
'--enable-fpm ' .
|
||||
$json_74 .
|
||||
'--enable-micro ' .
|
||||
($this->zts ? '--enable-zts' : '') . ' ' .
|
||||
$this->makeExtensionArgs() . ' ' .
|
||||
$this->configure_env
|
||||
);
|
||||
|
||||
SourcePatcher::patchPHPAfterConfigure($this);
|
||||
|
||||
$this->cleanMake();
|
||||
|
||||
if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI) {
|
||||
logger()->info('building cli');
|
||||
$this->buildCli($extra_libs);
|
||||
}
|
||||
if (($build_target & BUILD_TARGET_FPM) === BUILD_TARGET_FPM) {
|
||||
logger()->info('building fpm');
|
||||
$this->buildFpm($extra_libs);
|
||||
}
|
||||
if (($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO) {
|
||||
logger()->info('building micro');
|
||||
$this->buildMicro($extra_libs);
|
||||
}
|
||||
|
||||
if (php_uname('m') === $this->arch) {
|
||||
$this->sanityCheck($build_micro_rule);
|
||||
$this->sanityCheck($build_target);
|
||||
}
|
||||
|
||||
if ($this->phar_patched) {
|
||||
f_passthru('cd ' . SOURCE_PATH . '/php-src && patch -p1 -R < sapi/micro/patches/phar.patch');
|
||||
SourcePatcher::patchMicro(['phar'], true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 cli
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function buildCli(string $extra_libs): void
|
||||
{
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
$shell->exec("make -j{$this->concurrency} EXTRA_CFLAGS=\"-g -Os\" EXTRA_LIBS=\"{$extra_libs} -lresolv\" cli");
|
||||
if ($this->strip) {
|
||||
$shell->exec('dsymutil -f sapi/cli/php')->exec('strip sapi/cli/php');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_CLI);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 phpmicro
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException|RuntimeException
|
||||
*/
|
||||
public function buildMicro(string $extra_libs): void
|
||||
{
|
||||
@@ -224,50 +231,27 @@ class MacOSBuilder extends BuilderBase
|
||||
}
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
try {
|
||||
f_passthru('cd ' . SOURCE_PATH . '/php-src && patch -p1 < sapi/micro/patches/phar.patch');
|
||||
} catch (RuntimeException $e) {
|
||||
logger()->error('failed to patch phat due to patch exit with code ' . $e->getCode());
|
||||
$this->phar_patched = false;
|
||||
}
|
||||
SourcePatcher::patchMicro(['phar']);
|
||||
}
|
||||
|
||||
f_passthru(
|
||||
$this->set_x . ' && ' .
|
||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||
"make -j{$this->concurrency} " .
|
||||
'EXTRA_CFLAGS="-g -Os -fno-ident" ' .
|
||||
"EXTRA_LIBS=\"{$extra_libs} -lresolv\" " .
|
||||
'STRIP="dsymutil -f " ' .
|
||||
// TODO: comment things
|
||||
'micro'
|
||||
);
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec("make -j{$this->concurrency} EXTRA_CFLAGS=\"-g -Os -fno-ident\" EXTRA_LIBS=\"{$extra_libs} -lresolv\" " . ($this->strip ? 'STRIP="dsymutil -f " ' : '') . 'micro');
|
||||
$this->deployBinary(BUILD_TARGET_MICRO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 cli
|
||||
* 构建 fpm
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function buildCli(string $extra_libs): void
|
||||
public function buildFpm(string $extra_libs): void
|
||||
{
|
||||
f_passthru(
|
||||
$this->set_x . ' && ' .
|
||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||
"make -j{$this->concurrency} " .
|
||||
'EXTRA_CFLAGS="-g -Os -fno-ident" ' . // 生成调试信息、优化编译后的尺寸、禁用标识符(如变量、函数名)缩短
|
||||
"EXTRA_LIBS=\"{$extra_libs} -lresolv\" " .
|
||||
// TODO: comment things
|
||||
'cli &&' .
|
||||
'dsymutil -f sapi/cli/php &&' .
|
||||
'strip sapi/cli/php'
|
||||
);
|
||||
}
|
||||
|
||||
public function getPHPVersionID(): int
|
||||
{
|
||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||
preg_match('/PHP_VERSION_ID (\d+)/', $file, $match);
|
||||
return intval($match[1]);
|
||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||
$shell->exec("make -j{$this->concurrency} EXTRA_CFLAGS=\"-g -Os -fno-ident\" EXTRA_LIBS=\"{$extra_libs} -lresolv\" fpm");
|
||||
if ($this->strip) {
|
||||
$shell->exec('dsymutil -f sapi/fpm/php-fpm')->exec('strip sapi/fpm/php-fpm');
|
||||
}
|
||||
$this->deployBinary(BUILD_TARGET_FPM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace SPC\builder\macos;
|
||||
|
||||
use SPC\builder\traits\UnixSystemUtilTrait;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
|
||||
class SystemUtil
|
||||
{
|
||||
@@ -19,7 +20,7 @@ class SystemUtil
|
||||
*/
|
||||
public static function getCpuCount(): int
|
||||
{
|
||||
f_exec('sysctl -n hw.ncpu', $output, $ret);
|
||||
[$ret, $output] = shell()->execWithResult('sysctl -n hw.ncpu');
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('Failed to get cpu count');
|
||||
}
|
||||
@@ -30,14 +31,15 @@ class SystemUtil
|
||||
/**
|
||||
* 获取不同架构对应的 cflags 参数
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @param string $arch 架构名称
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public static function getArchCFlags(string $arch): string
|
||||
{
|
||||
return match ($arch) {
|
||||
'x86_64' => '--target=x86_64-apple-darwin',
|
||||
'arm64','aarch64' => '--target=arm64-apple-darwin',
|
||||
default => throw new RuntimeException('unsupported arch: ' . $arch),
|
||||
default => throw new WrongUsageException('unsupported arch: ' . $arch),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,8 @@ abstract class MacOSLibraryBase extends LibraryBase
|
||||
{
|
||||
use UnixLibraryTrait;
|
||||
|
||||
protected array $static_libs;
|
||||
|
||||
protected array $headers;
|
||||
|
||||
/**
|
||||
* 依赖的名字及是否可选,例如:curl => true,代表依赖 curl 但可选
|
||||
*/
|
||||
protected array $dep_names;
|
||||
|
||||
public function __construct(protected MacOSBuilder $builder)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -22,28 +22,7 @@ namespace SPC\builder\macos\library;
|
||||
|
||||
class brotli extends MacOSLibraryBase
|
||||
{
|
||||
public const NAME = 'brotli';
|
||||
use \SPC\builder\unix\library\brotli;
|
||||
|
||||
protected function build()
|
||||
{
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
f_passthru(
|
||||
"{$this->builder->set_x} && " .
|
||||
"cd {$this->source_dir} && " .
|
||||
'rm -rf build && ' .
|
||||
'mkdir -p build && ' .
|
||||
'cd build && ' .
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
// '--debug-find ' .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'.. && ' .
|
||||
"cmake --build . -j {$this->builder->concurrency} && " .
|
||||
'make install DESTDIR="' . $destdir . '"'
|
||||
);
|
||||
}
|
||||
public const NAME = 'brotli';
|
||||
}
|
||||
|
||||
@@ -22,18 +22,7 @@ namespace SPC\builder\macos\library;
|
||||
|
||||
class bzip2 extends MacOSLibraryBase
|
||||
{
|
||||
public const NAME = 'bzip2';
|
||||
use \SPC\builder\unix\library\bzip2;
|
||||
|
||||
protected function build()
|
||||
{
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"make {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' clean" . ' && ' .
|
||||
"make -j{$this->builder->concurrency} {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' libbz2.a" . ' && ' .
|
||||
// make install may fail when cross-compiling, so we copy files.
|
||||
'cp libbz2.a ' . BUILD_LIB_PATH . ' && ' .
|
||||
'cp bzlib.h ' . BUILD_INCLUDE_PATH
|
||||
);
|
||||
}
|
||||
public const NAME = 'bzip2';
|
||||
}
|
||||
|
||||
@@ -20,99 +20,19 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\SourcePatcher;
|
||||
|
||||
class curl extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\curl {
|
||||
build as unixBuild;
|
||||
}
|
||||
|
||||
public const NAME = 'curl';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
$extra = '';
|
||||
// lib:openssl
|
||||
$openssl = $this->getBuilder()->getLib('openssl');
|
||||
if ($openssl instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DCURL_USE_OPENSSL=ON ';
|
||||
} else {
|
||||
$extra .= '-DCURL_USE_OPENSSL=OFF -DCURL_ENABLE_SSL=OFF ';
|
||||
}
|
||||
// lib:zlib
|
||||
$zlib = $this->getBuilder()->getLib('zlib');
|
||||
if ($zlib instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DZLIB_LIBRARY="' . $zlib->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DZLIB_INCLUDE_DIR=' . BUILD_INCLUDE_PATH . ' ';
|
||||
}
|
||||
// lib:libssh2
|
||||
$libssh2 = $this->builder->getLib('libssh2');
|
||||
if ($libssh2 instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DLIBSSH2_LIBRARY="' . $libssh2->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DLIBSSH2_INCLUDE_DIR="' . BUILD_INCLUDE_PATH . '" ';
|
||||
} else {
|
||||
$extra .= '-DCURL_USE_LIBSSH2=OFF ';
|
||||
}
|
||||
// lib:brotli
|
||||
$brotli = $this->builder->getLib('brotli');
|
||||
if ($brotli) {
|
||||
$extra .= '-DCURL_BROTLI=ON ' .
|
||||
'-DBROTLIDEC_LIBRARY="' . realpath(BUILD_LIB_PATH . '/libbrotlidec-static.a') . ';' . realpath(BUILD_LIB_PATH . '/libbrotlicommon-static.a') . '" ' .
|
||||
'-DBROTLICOMMON_LIBRARY="' . realpath(BUILD_LIB_PATH . '/libbrotlicommon-static.a') . '" ' .
|
||||
'-DBROTLI_INCLUDE_DIR="' . BUILD_INCLUDE_PATH . '" ';
|
||||
} else {
|
||||
$extra .= '-DCURL_BROTLI=OFF ';
|
||||
}
|
||||
// lib:nghttp2
|
||||
$nghttp2 = $this->builder->getLib('nghttp2');
|
||||
if ($nghttp2 instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DUSE_NGHTTP2=ON ' .
|
||||
'-DNGHTTP2_LIBRARY="' . $nghttp2->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DNGHTTP2_INCLUDE_DIR="' . BUILD_INCLUDE_PATH . '" ';
|
||||
} else {
|
||||
$extra .= '-DUSE_NGHTTP2=OFF ';
|
||||
}
|
||||
// lib:ldap
|
||||
$ldap = $this->builder->getLib('ldap');
|
||||
if ($ldap instanceof MacOSLibraryBase) {
|
||||
// $extra .= '-DCURL_DISABLE_LDAP=OFF ';
|
||||
// TODO: LDAP support
|
||||
throw new RuntimeException('LDAP support is not implemented yet');
|
||||
}
|
||||
$extra .= '-DCURL_DISABLE_LDAP=ON ';
|
||||
// lib:zstd
|
||||
$zstd = $this->builder->getLib('zstd');
|
||||
if ($zstd instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DCURL_ZSTD=ON ' .
|
||||
'-DZstd_LIBRARY="' . $zstd->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DZstd_INCLUDE_DIR="' . BUILD_INCLUDE_PATH . '" ';
|
||||
} else {
|
||||
$extra .= '-DCURL_ZSTD=OFF ';
|
||||
}
|
||||
// lib:idn2
|
||||
$idn2 = $this->builder->getLib('idn2');
|
||||
$extra .= $idn2 instanceof MacOSLibraryBase ? '-DUSE_LIBIDN2=ON ' : '-DUSE_LIBIDN2=OFF ';
|
||||
// lib:psl
|
||||
$libpsl = $this->builder->getLib('psl');
|
||||
$extra .= $libpsl instanceof MacOSLibraryBase ? '-DCURL_USE_LIBPSL=ON ' : '-DCURL_USE_LIBPSL=OFF ';
|
||||
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
// compile!
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
'rm -rf build && ' .
|
||||
'mkdir -p build && ' .
|
||||
'cd build && ' .
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
// '--debug-find ' .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
$extra .
|
||||
'-DCMAKE_INSTALL_PREFIX= ' .
|
||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'.. && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
'make install DESTDIR="' . $destdir . '"'
|
||||
);
|
||||
SourcePatcher::patchCurlMacOS();
|
||||
$this->unixBuild();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,30 +9,7 @@ namespace SPC\builder\macos\library;
|
||||
*/
|
||||
class freetype extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\freetype;
|
||||
|
||||
public const NAME = 'freetype';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
[,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
$suggested = '';
|
||||
$suggested .= ($this->builder->getLib('libpng') instanceof MacOSLibraryBase) ? ('--with-png=' . BUILD_ROOT_PATH) : '--without-png';
|
||||
$suggested .= ' ';
|
||||
$suggested .= ($this->builder->getLib('bzip2') instanceof MacOSLibraryBase) ? ('--with-bzip2=' . BUILD_ROOT_PATH) : '--without-bzip2';
|
||||
$suggested .= ' ';
|
||||
$suggested .= ($this->builder->getLib('brotli') instanceof MacOSLibraryBase) ? ('--with-brotli=' . BUILD_ROOT_PATH) : '--without-brotli';
|
||||
$suggested .= ' ';
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static --disable-shared --without-harfbuzz ' .
|
||||
$suggested .
|
||||
'--prefix= && ' . // use prefix=/
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
'make install DESTDIR=' . $destdir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,21 +9,7 @@ namespace SPC\builder\macos\library;
|
||||
*/
|
||||
class gmp extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\gmp;
|
||||
|
||||
public const NAME = 'gmp';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
[,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static --disable-shared ' .
|
||||
'--prefix= && ' . // use prefix=/
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
'make install DESTDIR=' . $destdir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
20
src/SPC/builder/macos/library/icu.php
Normal file
20
src/SPC/builder/macos/library/icu.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class icu extends MacOSLibraryBase
|
||||
{
|
||||
public const NAME = 'icu';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
$root = BUILD_ROOT_PATH;
|
||||
shell()->cd($this->source_dir . '/source')
|
||||
->exec("{$this->builder->configure_env} ./runConfigureICU MacOSX --enable-static --disable-shared --prefix={$root}")
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
}
|
||||
}
|
||||
15
src/SPC/builder/macos/library/imagemagick.php
Normal file
15
src/SPC/builder/macos/library/imagemagick.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class imagemagick extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\imagemagick;
|
||||
|
||||
public const NAME = 'imagemagick';
|
||||
}
|
||||
28
src/SPC/builder/macos/library/libavif.php
Normal file
28
src/SPC/builder/macos/library/libavif.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\macos\library;
|
||||
|
||||
class libavif extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libavif;
|
||||
|
||||
public const NAME = 'libavif';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/libevent.php
Normal file
12
src/SPC/builder/macos/library/libevent.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libevent extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libevent;
|
||||
|
||||
public const NAME = 'libevent';
|
||||
}
|
||||
@@ -26,20 +26,19 @@ class libffi extends MacOSLibraryBase
|
||||
|
||||
protected function build()
|
||||
{
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static ' .
|
||||
'--disable-shared ' .
|
||||
"--host={$this->builder->arch}-apple-darwin " .
|
||||
"--target={$this->builder->arch}-apple-darwin " .
|
||||
'--prefix= ' . // use prefix=/
|
||||
"--libdir={$lib} && " .
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
"make install DESTDIR={$destdir}"
|
||||
);
|
||||
[$lib, , $destdir] = SEPARATED_PATH;
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static ' .
|
||||
'--disable-shared ' .
|
||||
"--host={$this->builder->arch}-apple-darwin " .
|
||||
"--target={$this->builder->arch}-apple-darwin " .
|
||||
'--prefix= ' // use prefix=/
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec("make install DESTDIR={$destdir}");
|
||||
$this->patchPkgconfPrefix(['libffi.pc']);
|
||||
}
|
||||
}
|
||||
|
||||
28
src/SPC/builder/macos/library/libiconv.php
Normal file
28
src/SPC/builder/macos/library/libiconv.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\macos\library;
|
||||
|
||||
class libiconv extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libiconv;
|
||||
|
||||
public const NAME = 'libiconv';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/libjpeg.php
Normal file
12
src/SPC/builder/macos/library/libjpeg.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libjpeg extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libjpeg;
|
||||
|
||||
public const NAME = 'libjpeg';
|
||||
}
|
||||
31
src/SPC/builder/macos/library/libmemcached.php
Normal file
31
src/SPC/builder/macos/library/libmemcached.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class libmemcached extends MacOSLibraryBase
|
||||
{
|
||||
public const NAME = 'libmemcached';
|
||||
|
||||
public function build()
|
||||
{
|
||||
$rootdir = BUILD_ROOT_PATH;
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec('chmod +x configure')
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static --disable-shared ' .
|
||||
'--disable-sasl ' .
|
||||
"--prefix={$rootdir}"
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec('sed -ie "s/-Werror//g" ' . $this->source_dir . '/Makefile')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ namespace SPC\builder\macos\library;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\util\Patcher;
|
||||
|
||||
class libpng extends MacOSLibraryBase
|
||||
{
|
||||
@@ -34,32 +33,29 @@ class libpng extends MacOSLibraryBase
|
||||
*/
|
||||
protected function build()
|
||||
{
|
||||
// 不同架构的专属优化
|
||||
$optimizations = match ($this->builder->arch) {
|
||||
'x86_64' => '--enable-intel-sse ',
|
||||
'arm64' => '--enable-arm-neon ',
|
||||
default => '',
|
||||
};
|
||||
|
||||
// patch configure
|
||||
Patcher::patchUnixLibpng();
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} " .
|
||||
'./configure ' .
|
||||
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
||||
'--disable-shared ' .
|
||||
'--enable-static ' .
|
||||
'--enable-hardware-optimizations ' .
|
||||
$optimizations .
|
||||
'--prefix= && ' . // use prefix=/
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la && " .
|
||||
'make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH . ' && ' .
|
||||
'cd ' . BUILD_LIB_PATH . ' && ' .
|
||||
'ln -sf libpng16.a libpng.a'
|
||||
);
|
||||
shell()->cd($this->source_dir)
|
||||
->exec('chmod +x ./configure')
|
||||
->exec('chmod +x ./install-sh')
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
||||
'--disable-shared ' .
|
||||
'--enable-static ' .
|
||||
'--enable-hardware-optimizations ' .
|
||||
$optimizations .
|
||||
'--prefix='
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la")
|
||||
->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH)
|
||||
->cd(BUILD_LIB_PATH)
|
||||
->exec('ln -sf libpng16.a libpng.a');
|
||||
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
12
src/SPC/builder/macos/library/libsodium.php
Normal file
12
src/SPC/builder/macos/library/libsodium.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libsodium extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libsodium;
|
||||
|
||||
public const NAME = 'libsodium';
|
||||
}
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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);
|
||||
|
||||
@@ -22,35 +6,7 @@ namespace SPC\builder\macos\library;
|
||||
|
||||
class libssh2 extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libssh2;
|
||||
|
||||
public const NAME = 'libssh2';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
// lib:zlib
|
||||
$enable_zlib = $this->builder->getLib('zlib') !== null ? 'ON' : 'OFF';
|
||||
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
'rm -rf build && ' .
|
||||
'mkdir -p build && ' .
|
||||
'cd build && ' .
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
// '--debug-find ' .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DBUILD_EXAMPLES=OFF ' .
|
||||
'-DBUILD_TESTING=OFF ' .
|
||||
"-DENABLE_ZLIB_COMPRESSION={$enable_zlib} " .
|
||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'.. && ' .
|
||||
"cmake --build . -j {$this->builder->concurrency} --target libssh2 && " .
|
||||
'make install DESTDIR="' . $destdir . '"'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
/**
|
||||
* is a template library class for unix
|
||||
*/
|
||||
class libuv extends MacOSLibraryBase
|
||||
{
|
||||
public const NAME = 'libuv';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
[,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static --disable-shared ' .
|
||||
'--prefix= && ' . // use prefix=/
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
'make install DESTDIR=' . $destdir
|
||||
);
|
||||
}
|
||||
}
|
||||
28
src/SPC/builder/macos/library/libwebp.php
Normal file
28
src/SPC/builder/macos/library/libwebp.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\macos\library;
|
||||
|
||||
class libwebp extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libwebp;
|
||||
|
||||
public const NAME = 'libwebp';
|
||||
}
|
||||
@@ -1,26 +1,11 @@
|
||||
<?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\macos\library;
|
||||
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
class libxml2 extends MacOSLibraryBase
|
||||
{
|
||||
@@ -37,30 +22,25 @@ class libxml2 extends MacOSLibraryBase
|
||||
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
'rm -rf build && ' .
|
||||
'mkdir -p build && ' .
|
||||
'cd build && ' .
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
// '--debug-find ' .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DLIBXML2_WITH_ICONV=ON ' .
|
||||
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
|
||||
"-DLIBXML2_WITH_ICU={$enable_icu} " .
|
||||
"-DLIBXML2_WITH_LZMA={$enable_xz} " .
|
||||
'-DLIBXML2_WITH_PYTHON=OFF ' .
|
||||
'-DLIBXML2_WITH_PROGRAMS=OFF ' .
|
||||
'-DLIBXML2_WITH_TESTS=OFF ' .
|
||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'.. && ' .
|
||||
"cmake --build . -j {$this->builder->concurrency} && " .
|
||||
'make install DESTDIR="' . $destdir . '"'
|
||||
);
|
||||
FileSystem::resetDir($this->source_dir . '/build');
|
||||
shell()->cd($this->source_dir . '/build')
|
||||
->exec(
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
// '--debug-find ' .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DLIBXML2_WITH_ICONV=ON ' .
|
||||
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
|
||||
'-DLIBXML2_WITH_ICU=OFF ' .
|
||||
"-DLIBXML2_WITH_LZMA={$enable_xz} " .
|
||||
'-DLIBXML2_WITH_PYTHON=OFF ' .
|
||||
'-DLIBXML2_WITH_PROGRAMS=OFF ' .
|
||||
'-DLIBXML2_WITH_TESTS=OFF ' .
|
||||
"-DCMAKE_INSTALL_PREFIX={$destdir} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'..'
|
||||
)
|
||||
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,95 +1,12 @@
|
||||
<?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\macos\library;
|
||||
|
||||
use SPC\exception\RuntimeException;
|
||||
|
||||
class libyaml extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libyaml;
|
||||
|
||||
public const NAME = 'libyaml';
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
// prepare cmake/config.h.in
|
||||
if (!is_file(SOURCE_PATH . '/libyaml/cmake/config.h.in')) {
|
||||
f_mkdir(SOURCE_PATH . '/libyaml/cmake');
|
||||
file_put_contents(
|
||||
SOURCE_PATH . '/libyaml/cmake/config.h.in',
|
||||
<<<'EOF'
|
||||
#define YAML_VERSION_MAJOR @YAML_VERSION_MAJOR@
|
||||
#define YAML_VERSION_MINOR @YAML_VERSION_MINOR@
|
||||
#define YAML_VERSION_PATCH @YAML_VERSION_PATCH@
|
||||
#define YAML_VERSION_STRING "@YAML_VERSION_STRING@"
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
// prepare yamlConfig.cmake.in
|
||||
if (!is_file(SOURCE_PATH . '/libyaml/yamlConfig.cmake.in')) {
|
||||
file_put_contents(
|
||||
SOURCE_PATH . '/libyaml/yamlConfig.cmake.in',
|
||||
<<<'EOF'
|
||||
# Config file for the yaml library.
|
||||
#
|
||||
# It defines the following variables:
|
||||
# yaml_LIBRARIES - libraries to link against
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(yaml_TARGETS "@PACKAGE_CONFIG_DIR_CONFIG@/yamlTargets.cmake")
|
||||
|
||||
if(NOT yaml_TARGETS_IMPORTED)
|
||||
set(yaml_TARGETS_IMPORTED 1)
|
||||
include(${yaml_TARGETS})
|
||||
endif()
|
||||
|
||||
set(yaml_LIBRARIES yaml)
|
||||
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
'rm -rf build && ' .
|
||||
'mkdir -p build && ' .
|
||||
'cd build && ' .
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
// '--debug-find ' .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DBUILD_TESTING=OFF ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'.. && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
'make install DESTDIR=' . $destdir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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);
|
||||
|
||||
@@ -22,80 +6,7 @@ namespace SPC\builder\macos\library;
|
||||
|
||||
class libzip extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libzip;
|
||||
|
||||
public const NAME = 'libzip';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
$extra = '';
|
||||
// lib:zlib
|
||||
$zlib = $this->builder->getLib('zlib');
|
||||
if ($zlib instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DZLIB_LIBRARY="' . $zlib->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DZLIB_INCLUDE_DIR=' . BUILD_INCLUDE_PATH . ' ';
|
||||
}
|
||||
// lib:bzip2
|
||||
$libbzip2 = $this->builder->getLib('bzip2');
|
||||
if ($libbzip2 instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DENABLE_BZIP2=ON ' .
|
||||
'-DBZIP2_LIBRARIES="' . $libbzip2->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DBZIP2_INCLUDE_DIR=' . BUILD_INCLUDE_PATH . ' ';
|
||||
} else {
|
||||
$extra .= '-DENABLE_BZIP2=OFF ';
|
||||
}
|
||||
// lib:xz
|
||||
$xz = $this->builder->getLib('xz');
|
||||
if ($xz instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DENABLE_LZMA=ON ' .
|
||||
'-DLIBLZMA_LIBRARY="' . $xz->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DLIBLZMA_INCLUDE_DIR=' . BUILD_INCLUDE_PATH . ' ';
|
||||
} else {
|
||||
$extra .= '-DENABLE_LZMA=OFF ';
|
||||
}
|
||||
// lib:zstd
|
||||
$libzstd = $this->builder->getLib('zstd');
|
||||
if ($libzstd instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DENABLE_ZSTD=ON ' .
|
||||
'-DZstd_LIBRARY="' . $libzstd->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DZstd_INCLUDE_DIR="' . BUILD_INCLUDE_PATH . '" ';
|
||||
} else {
|
||||
$extra .= '-DENABLE_ZSTD=OFF ';
|
||||
}
|
||||
// lib:openssl
|
||||
$libopenssl = $this->builder->getLib('openssl');
|
||||
if ($libopenssl instanceof MacOSLibraryBase) {
|
||||
$extra .= '-DENABLE_OPENSSL=ON ' .
|
||||
'-DOpenSSL_LIBRARY="' . $libopenssl->getStaticLibFiles(style: 'cmake') . '" ' .
|
||||
'-DOpenSSL_INCLUDE_DIR="' . BUILD_INCLUDE_PATH . '" ';
|
||||
} else {
|
||||
$extra .= '-DENABLE_OPENSSL=OFF ';
|
||||
}
|
||||
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
'rm -rf build && ' .
|
||||
'mkdir -p build && ' .
|
||||
'cd build && ' .
|
||||
"{$this->builder->configure_env} " . ' cmake ' .
|
||||
// '--debug-find ' .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DENABLE_GNUTLS=OFF ' .
|
||||
'-DENABLE_MBEDTLS=OFF ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DBUILD_DOC=OFF ' .
|
||||
'-DBUILD_EXAMPLES=OFF ' .
|
||||
'-DBUILD_REGRESS=OFF ' .
|
||||
'-DBUILD_TOOLS=OFF ' .
|
||||
$extra .
|
||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'.. && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
'make install DESTDIR=' . $destdir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
15
src/SPC/builder/macos/library/ncurses.php
Normal file
15
src/SPC/builder/macos/library/ncurses.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class ncurses extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\ncurses;
|
||||
|
||||
public const NAME = 'ncurses';
|
||||
}
|
||||
@@ -44,20 +44,20 @@ class nghttp2 extends MacOSLibraryBase
|
||||
|
||||
[,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} " . ' ./configure ' .
|
||||
'--enable-static ' .
|
||||
'--disable-shared ' .
|
||||
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
||||
'--enable-lib-only ' .
|
||||
'--with-boost=no ' .
|
||||
$args . ' ' .
|
||||
'--prefix= && ' . // use prefix=/
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
"make install DESTDIR={$destdir}"
|
||||
);
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} " . ' ./configure ' .
|
||||
'--enable-static ' .
|
||||
'--disable-shared ' .
|
||||
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
||||
'--enable-lib-only ' .
|
||||
'--with-boost=no ' .
|
||||
$args . ' ' .
|
||||
'--prefix='
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec("make install DESTDIR={$destdir}");
|
||||
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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);
|
||||
|
||||
@@ -22,23 +6,7 @@ namespace SPC\builder\macos\library;
|
||||
|
||||
class onig extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\onig;
|
||||
|
||||
public const NAME = 'onig';
|
||||
|
||||
protected function build()
|
||||
{
|
||||
[,,$destdir] = SEPARATED_PATH;
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} " . ' ./configure ' .
|
||||
'--enable-static ' .
|
||||
'--disable-shared ' .
|
||||
"--host={$this->builder->arch}-apple-darwin " .
|
||||
'--prefix= && ' . // use prefix=/
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} && " .
|
||||
'make install DESTDIR=' . $destdir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,16 +37,17 @@ class openssl extends MacOSLibraryBase
|
||||
$ex_lib = trim($zlib->getStaticLibFiles() . ' ' . $ex_lib);
|
||||
}
|
||||
|
||||
f_passthru(
|
||||
$this->builder->set_x . ' && ' .
|
||||
"cd {$this->source_dir} && " .
|
||||
"{$this->builder->configure_env} ./Configure no-shared {$extra} " .
|
||||
'--prefix=/ ' . // use prefix=/
|
||||
"--libdir={$lib} " .
|
||||
" darwin64-{$this->builder->arch}-cc && " .
|
||||
'make clean && ' .
|
||||
"make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\" && " .
|
||||
'make install_sw DESTDIR=' . $destdir
|
||||
);
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./Configure no-shared {$extra} " .
|
||||
'--prefix=/ ' . // use prefix=/
|
||||
"--libdir={$lib} " .
|
||||
'--openssldir=/System/Library/OpenSSL ' .
|
||||
"darwin64-{$this->builder->arch}-cc"
|
||||
)
|
||||
->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/macos/library/pkgconfig.php
Normal file
15
src/SPC/builder/macos/library/pkgconfig.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class pkgconfig extends MacOSLibraryBase
|
||||
{
|
||||
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