Skip to content

Commit

Permalink
Merge pull request #877 from jingjingxyk/build_native_php
Browse files Browse the repository at this point in the history
Build native php
  • Loading branch information
jingjingxyk authored Dec 18, 2024
2 parents 34b1968 + f4d4d73 commit 33dd48a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion sapi/scripts/generate-artifact-hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ WINDOWS_DOWNLOAD_SWOOLE_CLIE_RUNTIME() {

APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}"
test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL}
test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/v5.1.5.1/all-deps.zip
test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/${VERSION}/all-deps.zip

}
WINDOWS_DOWNLOAD() {
Expand Down
26 changes: 12 additions & 14 deletions sapi/src/builder/extension/swoole.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,18 @@
$dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql'];
$dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo'];

$swoole_tag = 'v5.1.6';
if (BUILD_CUSTOM_PHP_VERSION_ID >= 8040) {
// v5.1.x 不支持 PHP 8.4
// swoole 支持计划 https://wiki.swoole.com/zh-cn/#/version/supported?id=%e6%94%af%e6%8c%81%e8%ae%a1%e5%88%92
$swoole_tag = 'master';
$options[] = '--enable-swoole-thread';
$options[] = '--enable-zts';
$options[] = '--disable-opcache-jit';
$options[] = '--enable-brotli';
$options[] = '--enable-zstd';
$dependentLibraries[] = 'libzstd';
$p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)');
$p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)');
}
// v5.1.x 不支持 PHP 8.4
// swoole 支持计划 https://wiki.swoole.com/zh-cn/#/version/supported?id=%e6%94%af%e6%8c%81%e8%ae%a1%e5%88%92
$swoole_tag = 'v6.0.0';
$options[] = '--enable-swoole-thread';
$options[] = '--enable-zts';
$options[] = '--disable-opcache-jit';
$options[] = '--enable-brotli';
$options[] = '--enable-zstd';
$dependentLibraries[] = 'libzstd';
$p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)');
$p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)');

$file = "swoole-{$swoole_tag}.tar.gz";

$url = "https://github.com/swoole/swoole-src/archive/refs/tags/{$swoole_tag}.tar.gz";
Expand Down
10 changes: 8 additions & 2 deletions setup-swoole-cli-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ while [ $# -gt 0 ]; do
X_VERSION=$(echo "$2" | grep -E '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$')
X_APP_VERSION=$(echo "$2" | grep -Eo '^v\d\.\d{1,2}\.\d{1,2}')
elif [ $OS = "linux" ]; then
X_VERSION=$(echo "$2" | grep -P '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$')
X_APP_VERSION=$(echo "$2" | grep -Po '^v\d\.\d{1,2}\.\d{1,2}')
OS_RELEASE=$(awk -F= '/^ID=/{print $2}' /etc/os-release | tr -d '\n' | tr -d '\"')
if [ "$OS_RELEASE" = 'alpine' ]; then
X_VERSION=$(echo "$2" | grep -E '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$')
X_APP_VERSION=$(echo "$2" | grep -Eo '^v\d\.\d{1,2}\.\d{1,2}')
else
X_VERSION=$(echo "$2" | grep -P '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$')
X_APP_VERSION=$(echo "$2" | grep -Po '^v\d\.\d{1,2}\.\d{1,2}')
fi
else
X_VERSION=''
X_APP_VERSION=''
Expand Down

0 comments on commit 33dd48a

Please sign in to comment.