Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature swoole v5.1 #464

Closed
wants to merge 15 commits into from
2 changes: 1 addition & 1 deletion sapi/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ RUN apk update
RUN apk upgrade
RUN apk add vim alpine-sdk xz autoconf automake linux-headers clang-dev clang lld libtool cmake bison re2c gettext coreutils
RUN apk add bash tini
RUN apk add libc++-static libltdl-static
RUN apk add libc++-static libltdl-static
WORKDIR /work
2 changes: 1 addition & 1 deletion sapi/docker/Dockerfile-arm64
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ RUN apk add bison
RUN apk add re2c
RUN apk add bash
RUN apk add tini
RUN apk add libc++-static libltdl-static
RUN apk add libc++-static libltdl-static
WORKDIR /work
2 changes: 1 addition & 1 deletion sapi/src/Preprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Preprocessor
'intl',
'fileinfo',
'pdo_mysql',
'pdo_sqlite',
//'pdo_sqlite',
'soap',
'xsl',
'gmp',
Expand Down
29 changes: 18 additions & 11 deletions sapi/src/builder/extension/swoole.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
<?php

use SwooleCli\Library;
use SwooleCli\Preprocessor;
use SwooleCli\Extension;

return function (Preprocessor $p) {
$depends = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2'];
$options = '--enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares ';
$swoole_tag = 'v5.1.0';
$file = "swoole-{$swoole_tag}.tar.gz";

$url = "https://github.com/swoole/swoole-src/archive/refs/tags/{$swoole_tag}.tar.gz";

$dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql'];
$dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo'];
$options = ' --enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares ';
$options .= ' --enable-swoole-coro-time --enable-thread-context ';
$options .= ' --with-brotli-dir=' . BROTLI_PREFIX;
$options .= ' --with-nghttp2-dir=' . NGHTTP2_PREFIX;
$options .= ' --enable-swoole-sqlite --enable-swoole-pgsql ';
$options .= ' --with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX . ' ';

if ($p->getInputOption('with-swoole-pgsql')) {
$options .= ' --enable-swoole-pgsql';
$depends[] = 'pgsql';
}

$ext = (new Extension('swoole'))
->withOptions($options)
->withLicense('https://github.com/swoole/swoole-src/blob/master/LICENSE', Extension::LICENSE_APACHE2)
->withHomePage('https://github.com/swoole/swoole-src')
->withLicense('https://github.com/swoole/swoole-src/blob/master/LICENSE', Extension::LICENSE_APACHE2)
->withManual('https://wiki.swoole.com/#/')
->withDependentExtensions('curl', 'openssl', 'sockets', 'mysqlnd');
call_user_func_array([$ext, 'withDependentLibraries'], $depends);
->withOptions($options)
;

call_user_func_array([$ext, 'withDependentLibraries'], $dependentLibraries);
call_user_func_array([$ext, 'withDependentExtensions'], $dependentExtensions);

$p->addExtension($ext);
};
33 changes: 33 additions & 0 deletions sapi/src/builder/extension/swoole_v5000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use SwooleCli\Preprocessor;
use SwooleCli\Extension;

return function (Preprocessor $p) {
$swoole_tag = 'v5.0.3';
$file = "swoole-{$swoole_tag}.tar.gz";

$dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2'];
$dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo'];
$options = ' --enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares ';
$options .= ' --enable-swoole-coro-time --enable-thread-context ';

$options .= ' --with-brotli-dir=' . BROTLI_PREFIX;
$options .= ' --with-nghttp2-dir=' . NGHTTP2_PREFIX;

if ($p->getInputOption('with-swoole-pgsql')) {
$dependent_libraries[] = 'pgsql';
}

$ext = (new Extension('swoole_v5000'))
->withHomePage('https://github.com/swoole/swoole-src')
->withLicense('https://github.com/swoole/swoole-src/blob/master/LICENSE', Extension::LICENSE_APACHE2)
->withManual('https://wiki.swoole.com/#/')
->withOptions($options)
;

call_user_func_array([$ext, 'withDependentLibraries'], $dependentLibraries);
call_user_func_array([$ext, 'withDependentExtensions'], $dependentExtensions);

$p->addExtension($ext);
};
4 changes: 4 additions & 0 deletions sapi/src/template/make.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
echo $LIBS > <?= $this->getWorkDir() ?>/libs.log

./configure $OPTIONS

<?php if ($this->getOsType()=='linux') : ?>
sed -i.backup 's/-export-dynamic/-all-static/g' Makefile
<?php endif ; ?>
}

make_build() {
Expand Down
Loading