Skip to content

Commit 4ec39b4

Browse files
committed
merge code
2 parents 0991a63 + 496f231 commit 4ec39b4

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ curl -fSL https://github.com/swoole/build-static-php/blob/main/setup-php-cli-run
3333
# windows powershell
3434
irm https://github.com/swoole/build-static-php/blob/main/setup-swoole-cli-runtime.ps1?raw=true | iex
3535

36+
# windows powershell
37+
irm https://github.com/swoole/swoole-cli/blob/main/setup-swoole-cli-runtime.ps1?raw=true | iex
38+
3639
# 来自 https://www.swoole.com/download
3740
curl -fSL https://github.com/swoole/swoole-cli/blob/main/setup-swoole-cli-runtime.sh?raw=true | bash -s -- --mirror china
3841

sapi/scripts/cygwin/cygwin-config-ext.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ REDIS_VERSION=6.1.0
3535
MONGODB_VERSION=1.17.2
3636
YAML_VERSION=2.2.2
3737
IMAGICK_VERSION=3.7.0
38+
SWOOLE_VERSION=$(awk 'NR==1{ print $1 }' "${__PROJECT__}/sapi/SWOOLE-VERSION.conf")
3839

3940
mkdir -p pool/ext
4041
mkdir -p pool/lib
@@ -105,8 +106,6 @@ tar --strip-components=1 -C ${WORK_TEMP_DIR}/php-src -xf php-${PHP_VERSION}.tar.
105106
cd ${__PROJECT__}
106107
# copy extension
107108
# cp -rf ${WORK_TEMP_DIR}/ext/. ${__PROJECT__}/ext/
108-
# cp -rf ${__PROJECT__}/ext/. ${WORK_TEMP_DIR}/php-src/ext/
109-
# cp -rf ${__PROJECT__}/ext/. ${WORK_TEMP_DIR}/php-src/ext/
110109
cp -rf ${WORK_TEMP_DIR}/ext/. ${WORK_TEMP_DIR}/php-src/ext/
111110

112111
# extension hook

sapi/src/builder/extension/swoole.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,19 @@
55

66
return function (Preprocessor $p) {
77

8+
$file = new SplFileObject(realpath(__DIR__ . '/../../../../sapi/SWOOLE-VERSION.conf'));
9+
$swoole_tag = trim($file->current());
10+
// $swoole_tag = 'v6.0.1';
11+
$file = "swoole-{$swoole_tag}.tar.gz";
12+
$url = "https://github.com/swoole/swoole-src/archive/refs/tags/{$swoole_tag}.tar.gz";
13+
// v5.1.x 不支持 PHP 8.4
14+
// swoole 支持计划 https://wiki.swoole.com/zh-cn/#/version/supported?id=%e6%94%af%e6%8c%81%e8%ae%a1%e5%88%92
815

916
$options = [];
1017

1118
$dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql', 'libzstd'];
1219
$dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo'];
1320

14-
// v5.1.x 不支持 PHP 8.4
15-
// swoole 支持计划 https://wiki.swoole.com/zh-cn/#/version/supported?id=%e6%94%af%e6%8c%81%e8%ae%a1%e5%88%92
16-
17-
$swoole_tag = 'v6.0.2';
18-
19-
$file = new SplFileObject(realpath(__DIR__ . '/../../../../sapi/SWOOLE-VERSION.conf'));
20-
$swoole_tag = trim($file->current());
21-
22-
$file = "swoole-{$swoole_tag}.tar.gz";
23-
$url = "https://github.com/swoole/swoole-src/archive/refs/tags/{$swoole_tag}.tar.gz";
24-
2521
if ($p->getBuildType() === 'debug') {
2622
$options[] = ' --enable-debug ';
2723
$options[] = ' --enable-debug-log ';
@@ -70,18 +66,6 @@
7066
->withDependentLibraries(...$dependentLibraries)
7167
->withDependentExtensions(...$dependentExtensions));
7268

73-
$p->withBeforeConfigureScript('swoole', function (Preprocessor $p) {
74-
$cmd = '';
75-
if ($p->isMacos()) {
76-
$workDir = $p->getPhpSrcDir();
77-
$cmd = <<<EOF
78-
cd {$workDir}/
79-
sed -i '' 's/pthread_barrier_init/pthread_barrier_init_x_fake/' ext/swoole/config.m4
80-
EOF;
81-
}
82-
return $cmd;
83-
84-
});
8569
if ($p->isMacos()) {
8670
# 测试 macos 专有特性
8771
# 定义 _GNU_SOURCE 会隐式启用 _POSIX_C_SOURCE=200112L 和 _XOPEN_SOURCE=600
@@ -105,6 +89,20 @@
10589

10690
$p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)');
10791
$p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)');
92+
93+
$p->withBeforeConfigureScript('swoole', function (Preprocessor $p) {
94+
$cmd = '';
95+
if ($p->isMacos()) {
96+
$workDir = $p->getPhpSrcDir();
97+
$cmd = <<<EOF
98+
cd {$workDir}/
99+
sed -i '' 's/pthread_barrier_init/pthread_barrier_init_x_fake/' ext/swoole/config.m4
100+
EOF;
101+
}
102+
return $cmd;
103+
104+
});
105+
108106
/*
109107
$p->withBeforeConfigureScript('swoole', function () use ($p) {
110108
$workDir = $p->getWorkDir();

sapi/src/template/make.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@
662662
echo $LIBS
663663
elif [ "$1" = "sync" ] ;then
664664
PHP_CLI=$(which php)
665-
test -f ${__PROJECT_DIR__}/runtime/php && PHP_CLI="${__PROJECT_DIR__}/runtime/php -d curl.cainfo=${__PROJECT_DIR__}/runtime/cacert.pem -d openssl.cafile=${__PROJECT_DIR__}/runtime/cacert.pem"
665+
test -f ${__PROJECT_DIR__}/runtime/php/php && PHP_CLI="${__PROJECT_DIR__}/runtime/php/php -d curl.cainfo=${__PROJECT_DIR__}/runtime/php/cacert.pem -d openssl.cafile=${__PROJECT_DIR__}/runtime/php/cacert.pem"
666666
$PHP_CLI -v
667667
$PHP_CLI sync-source-code.php --action run
668668
exit 0

0 commit comments

Comments
 (0)