forked from swoole/swoole-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswoole_latest.php
More file actions
75 lines (63 loc) · 2.93 KB
/
swoole_latest.php
File metadata and controls
75 lines (63 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
use SwooleCli\Preprocessor;
use SwooleCli\Extension;
return function (Preprocessor $p) {
$swoole_tag = 'master';
$file = "swoole-v{$swoole_tag}.tar.gz";
$options = [];
if ($p->getBuildType() === 'debug') {
$options[] = ' --enable-debug ';
$options[] = ' --enable-debug-log ';
$options[] = ' --enable-swoole-coro-time ';
}
$dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql', 'libzstd'];
$dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo'];
$options[] = '--enable-swoole';
$options[] = '--enable-sockets';
$options[] = '--enable-mysqlnd';
$options[] = '--enable-swoole-curl';
$options[] = '--enable-cares';
$options[] = '--with-brotli-dir=' . BROTLI_PREFIX;
$options[] = '--with-nghttp2-dir=' . NGHTTP2_PREFIX;
$options[] = '--enable-swoole-pgsql';
$options[] = '--enable-swoole-sqlite';
$options[] = '--with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX;
$options[] = '--enable-swoole-thread';
$options[] = '--enable-brotli';
$options[] = '--enable-zstd';
$options[] = '--enable-swoole-stdext';
$options[] = '--enable-zts';
$options[] = '--disable-opcache-jit';
if ($p->isLinux() && $p->getInputOption('with-iouring')) {
$options[] = '--enable-iouring';
$dependentLibraries[] = 'liburing';
$p->withExportVariable('URING_CFLAGS', '$(pkg-config --cflags --static liburing)');
$p->withExportVariable('URING_LIBS', '$(pkg-config --libs --static liburing)');
}
$p->addExtension((new Extension('swoole_latest'))
->withAliasName('swoole')
->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/#/')
->withFile($file)
->withDownloadScript(
'swoole-src',
<<<EOF
git clone -b $swoole_tag --depth=1 https://github.com/swoole/swoole-src.git
EOF
)
->withAutoUpdateFile()
->withOptions(implode(' ', $options))
->withBuildCached(false)
->withAutoUpdateFile()
->withDependentLibraries(...$dependentLibraries)
->withDependentExtensions(...$dependentExtensions)
);
//call_user_func_array([$ext, 'withDependentLibraries'], $dependentLibraries);
//call_user_func_array([$ext, 'withDependentExtensions'], $dependentExtensions);
$p->withVariable('LIBS', '$LIBS ' . ($p->isMacos() ? '-lc++' : '-lstdc++'));
$p->withExportVariable('CARES_CFLAGS', '$(pkg-config --cflags --static libcares)');
$p->withExportVariable('CARES_LIBS', '$(pkg-config --libs --static libcares)');
$p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)');
$p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)');
};