Skip to content

Commit 2ebdc45

Browse files
committed
<
2 parents 1839f13 + 4cb4c9c commit 2ebdc45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+538
-180
lines changed

README-zh.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
**static-php-cli**是一个用于静态编译、构建 PHP 解释器的工具,支持众多流行扩展。
1111

12-
目前 static-php-cli 支持 `cli``fpm``embed``micro` SAPI。
12+
目前 static-php-cli 支持 `cli``fpm``embed``micro``frankenphp` SAPI。
1313

1414
**static-php-cli**也支持将 PHP 代码和 PHP 运行时打包为一个文件并运行。
1515

@@ -292,6 +292,12 @@ bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=sys
292292

293293
你可以在 [我的个人赞助页](https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md) 支持我和我的项目。你捐赠的一部分将会被用于维护 **static-php.dev** 服务器。
294294

295+
**特别赞助商**:
296+
297+
<a href="https://beyondco.de/"><img src="/docs/public/images/beyondcode-seeklogo.png" width="300" alt="Beyond Code Logo" /></a>
298+
299+
<a href="https://nativephp.com/"><img src="/docs/public/images/nativephp-logo.svg" width="300" alt="NativePHP Logo" /></a>
300+
295301
## 开源协议
296302

297303
本项目采用 MIT License 许可开源,下面是类似的项目:

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
**static-php-cli** is a powerful tool designed for building static, standalone PHP runtime
1111
with popular extensions.
1212

13-
Static PHP built by **static-php-cli** supports `cli`, `fpm`, `embed` and `micro` SAPI.
13+
Static PHP built by **static-php-cli** supports `cli`, `fpm`, `embed`, `micro` and `frankenphp` SAPI.
1414

1515
**static-php-cli** also has the ability to package PHP projects
1616
along with the PHP interpreter into one single executable file.
@@ -317,6 +317,12 @@ Now there is a [static-php](https://github.com/static-php) organization, which i
317317

318318
You can sponsor me or my project from [GitHub Sponsor](https://github.com/crazywhalecc). A portion of your donation will be used to maintain the **static-php.dev** server.
319319

320+
**Special thanks to sponsors below**:
321+
322+
<a href="https://beyondco.de/"><img src="/docs/public/images/beyondcode-seeklogo.png" width="300" alt="Beyond Code Logo" /></a>
323+
324+
<a href="https://nativephp.com/"><img src="/docs/public/images/nativephp-logo.svg" width="300" alt="NativePHP Logo" /></a>
325+
320326
## Open-Source License
321327

322328
This project itself is based on MIT License,

bin/spc-gnu-docker

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fi
6464
# Detect docker env is setup
6565
if ! $DOCKER_EXECUTABLE images | grep -q cwcc-spc-gnu-$SPC_USE_ARCH-$SPC_DOCKER_VERSION; then
6666
echo "Docker container does not exist. Building docker image ..."
67-
$DOCKER_EXECUTABLE buildx build $PLATFORM_ARG --no-cache -t cwcc-spc-gnu-$SPC_USE_ARCH-$SPC_DOCKER_VERSION -f- . <<EOF
67+
$DOCKER_EXECUTABLE buildx build $PLATFORM_ARG -t cwcc-spc-gnu-$SPC_USE_ARCH-$SPC_DOCKER_VERSION -f- . <<EOF
6868
FROM centos:7
6969
RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
7070
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
@@ -96,7 +96,7 @@ RUN curl -fsSL -o patchelf.tgz https://github.com/NixOS/patchelf/releases/downlo
9696
tar -xzf patchelf.tgz -C /patchelf --strip-components=1 && \
9797
cp /patchelf/bin/patchelf /usr/bin/
9898
99-
RUN curl -o cmake.tgz -fsSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$SPC_USE_ARCH.tar.gz && \
99+
RUN curl -o cmake.tgz -#fSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$SPC_USE_ARCH.tar.gz && \
100100
mkdir /cmake && \
101101
tar -xzf cmake.tgz -C /cmake --strip-components 1
102102
@@ -107,8 +107,8 @@ ADD ./bin/setup-runtime /app/bin/setup-runtime
107107
ADD ./bin/spc /app/bin/spc
108108
RUN /app/bin/setup-runtime
109109
RUN /app/bin/php /app/bin/composer install --no-dev
110-
ENV PATH="/app/bin:/cmake/bin:$PATH"
111110
ENV SPC_LIBC=glibc
111+
ENV PATH="/app/bin:/cmake/bin:/opt/rh/devtoolset-10/root/usr/bin:\$PATH"
112112
113113
ADD ./config/env.ini /app/config/env.ini
114114
RUN CC=gcc bin/spc doctor --auto-fix --debug
@@ -128,7 +128,6 @@ RUN curl -o automake.tgz -fsSL https://ftp.gnu.org/gnu/automake/automake-1.17.ta
128128
make && \
129129
make install && \
130130
ln -sf /usr/local/bin/automake /usr/bin/automake
131-
132131
EOF
133132
fi
134133

@@ -154,11 +153,7 @@ if [ -f "$(pwd)/craft.yml" ]; then
154153
fi
155154

156155
# Apply env in temp env file
157-
echo 'CC=/opt/rh/devtoolset-10/root/usr/bin/gcc' > /tmp/spc-gnu-docker.env
158-
echo 'CXX=/opt/rh/devtoolset-10/root/usr/bin/g++' >> /tmp/spc-gnu-docker.env
159-
echo 'AR=/opt/rh/devtoolset-10/root/usr/bin/ar' >> /tmp/spc-gnu-docker.env
160-
echo 'LD=/opt/rh/devtoolset-10/root/usr/bin/ld' >> /tmp/spc-gnu-docker.env
161-
echo 'SPC_DEFAULT_C_FLAGS=-fPIC' >> /tmp/spc-gnu-docker.env
156+
echo 'SPC_DEFAULT_C_FLAGS=-fPIC' > /tmp/spc-gnu-docker.env
162157
echo 'SPC_LIBC=glibc' >> /tmp/spc-gnu-docker.env
163158
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"' >> /tmp/spc-gnu-docker.env
164159
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil -lrt"' >> /tmp/spc-gnu-docker.env

config/env.ini

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ SPC_CMD_VAR_FRANKENPHP_XCADDY_MODULES="--with github.com/dunglas/frankenphp/cadd
5555
; EXTENSION_DIR=
5656

5757
[windows]
58+
; build target: win7-static
59+
SPC_TARGET=native-windows
5860
; php-sdk-binary-tools path
5961
PHP_SDK_PATH="${WORKING_DIR}\php-sdk-binary-tools"
6062
; upx executable path
@@ -63,6 +65,17 @@ UPX_EXEC="${PKG_ROOT_PATH}\bin\upx.exe"
6365
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static
6466

6567
[linux]
68+
; Linux can use different build toolchain, but the toolchain can not be changed in this file:
69+
; - musl (default): used for general linux distros, can build `musl-static` target only.
70+
; - zig (WIP): used for general linux distros, can build `musl` and `glibc` targets.
71+
; - musl-native: used for alpine linux, can build `musl-static` and `musl`(WIP) target.
72+
; - gnu-native (assume): used for general linux distros, can build `glibc` target only and have portability issues.
73+
74+
; build target:
75+
; - musl-static (default): pure static linking, using musl-libc, can run on any linux distro.
76+
; - musl: static linking with dynamic linking to musl-libc, can run on musl-based linux distro.
77+
; - glibc: static linking with dynamic linking to glibc, can run on glibc-based linux distro.
78+
6679
; include PATH for musl libc.
6780
SPC_LIBC=musl
6881
SPC_LIBC_VERSION=
@@ -80,7 +93,7 @@ SPC_EXTRA_LIBS=
8093
; upx executable path
8194
UPX_EXEC=${PKG_ROOT_PATH}/bin/upx
8295
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
83-
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream
96+
SPC_MICRO_PATCHES=cli_checks,disable_huge_page
8497

8598
; *** default build command for building php ***
8699
; buildconf command
@@ -111,6 +124,9 @@ SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=""
111124
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -pie"
112125

113126
[macos]
127+
; build target: macho or macho (possibly we could support macho-universal in the future)
128+
; Currently we do not support universal and cross-compilation for macOS.
129+
SPC_TARGET=native-macos
114130
; compiler environments
115131
CC=clang
116132
CXX=clang++
@@ -120,7 +136,7 @@ SPC_DEFAULT_CXX_FLAGS="--target=${MAC_ARCH}-apple-darwin -Os"
120136
; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated)
121137
SPC_EXTRA_LIBS=
122138
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
123-
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,macos_iconv
139+
SPC_MICRO_PATCHES=cli_checks,macos_iconv
124140

125141
; *** default build command for building php ***
126142
; buildconf command

docs/.vitepress/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export default {
4747
nav: [],
4848
socialLinks: [
4949
{icon: 'github', link: 'https://github.com/crazywhalecc/static-php-cli'}
50-
]
50+
],
51+
footer: {
52+
message: 'Released under the MIT License.',
53+
copyright: 'Copyright © 2023-present crazywhalecc'
54+
}
5155
}
5256
}

docs/.vitepress/theme/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import DefaultTheme from 'vitepress/theme'
33
import {inBrowser, useData} from "vitepress";
44
import {watchEffect} from "vue";
5+
import './style.css';
56

67
export default {
78
...DefaultTheme,
@@ -13,4 +14,4 @@ export default {
1314
}
1415
})
1516
}
16-
}
17+
}

docs/.vitepress/theme/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** override default styles */
2+
.vp-sponsor-grid-image {
3+
max-height:36px !important;
4+
max-width: 1000px !important;
5+
}
6+

docs/en/guide/extension-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ and this extension cannot be compiled into php by static linking, so it cannot b
8282

8383
## xdebug
8484

85-
1. Xdebug is only buildable as a shared extension. On Linux, you need to use static-php-cli with SPC_LIBC=glibc.
85+
1. Xdebug is only buildable as a shared extension. You need to use a build target other than `musl-static` for SPC_TARGET.
8686
2. When using Linux/glibc or macOS, you can compile Xdebug as a shared extension using --build-shared="xdebug".
8787
The compiled `./php` binary can be configured and run by specifying the INI, eg `./php -d 'zend_extension=/path/to/xdebug.so' your-code.php`.
8888

docs/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,16 @@ features:
2121
- title: Dependency Management
2222
details: static-php-cli comes with dependency management and supports installation of different types of PHP extensions.
2323
---
24+
25+
<script setup>
26+
import {VPSponsors} from "vitepress/theme";
27+
const sponsors = [
28+
{ name: 'Beyond Code', img: '/images/beyondcode-seeklogo.png', url: 'https://beyondco.de/' },
29+
{ name: 'NativePHP', img: '/images/nativephp-logo.svg', url: 'https://nativephp.com/' },
30+
];
31+
</script>
32+
33+
## Special Sponsors
34+
35+
<VPSponsors :data="sponsors"/>
36+
28.7 KB
Loading

0 commit comments

Comments
 (0)