Skip to content

Commit 1a91599

Browse files
authored
升级 curl openssl libidn2 nghttp2 nghttp3 libssh2 库 ,新增libpsl库 (#1021)
* macos 使用系统内置clang 编译器 * 升级 curl openssl libidn2 nghttp2 nghttp3 libssh2 ,新增libpsl * update gmp build config * update ngtcp2 build config * update unix_odbc build config * update unixodbc build config
1 parent 032016e commit 1a91599

File tree

12 files changed

+170
-102
lines changed

12 files changed

+170
-102
lines changed

prepare.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@
4444
if ($p->isMacos()) {
4545
$p->setExtraLdflags('');
4646
$homebrew_prefix = trim(shell_exec('brew --prefix'));
47-
$p->withBinPath($homebrew_prefix . '/opt/llvm/bin')
48-
->withBinPath($homebrew_prefix . '/opt/flex/bin')
47+
$p->withBinPath($homebrew_prefix . '/opt/flex/bin')
4948
->withBinPath($homebrew_prefix . '/opt/bison/bin')
5049
->withBinPath($homebrew_prefix . '/opt/libtool/bin')
5150
->withBinPath($homebrew_prefix . '/opt/m4/bin')
5251
->withBinPath($homebrew_prefix . '/opt/automake/bin/')
5352
->withBinPath($homebrew_prefix . '/opt/autoconf/bin/')
5453
->withBinPath($homebrew_prefix . '/opt/gettext/bin')
55-
->setLinker('ld64.lld');
54+
->setLinker('ld');
5655
$p->setLogicalProcessors('$(sysctl -n hw.ncpu)');
5756
} else {
5857
$p->setLinker('ld.lld');

sapi/src/builder/library/curl.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@
88
$openssl_prefix = OPENSSL_PREFIX;
99
$zlib_prefix = ZLIB_PREFIX;
1010
$cares_prefix = CARES_PREFIX;
11-
11+
# HTTP3 (and QUIC)
12+
# https://github.com/curl/curl/blob/master/docs/HTTP3.md#openssl-version
1213
$p->addLibrary(
1314
(new Library('curl'))
1415
->withHomePage('https://curl.se/')
1516
->withManual('https://curl.se/docs/install.html')
1617
->withLicense('https://github.com/curl/curl/blob/master/COPYING', Library::LICENSE_SPEC)
17-
->withUrl('https://curl.se/download/curl-8.4.0.tar.gz')
18-
->withFileHash('md5', '533e8a3b1228d5945a6a512537bea4c7')
18+
->withUrl('https://github.com/curl/curl/releases/download/curl-8_16_0/curl-8.16.0.tar.gz')
19+
->withFileHash('md5', '3db9de72cc8f04166fa02d3173ac78bb')
1920
->withPrefix($curl_prefix)
2021
->withConfigure(
2122
<<<EOF
2223
./configure --help
2324
24-
PACKAGES='zlib openssl libcares libbrotlicommon libbrotlidec libbrotlienc libzstd libnghttp2 '
25-
PACKAGES="\$PACKAGES libssh2 libnghttp3 libngtcp2 libngtcp2_crypto_quictls" # libidn2 libngtcp2_crypto_openssl
25+
PACKAGES='zlib openssl libcares libbrotlicommon libbrotlidec libbrotlienc libzstd '
26+
PACKAGES="\$PACKAGES libssh2 libnghttp2 libnghttp3 libidn2 libpsl " # libngtcp2
2627
27-
CPPFLAGS="$(pkg-config --cflags-only-I --static \$PACKAGES)" \
28+
CPPFLAGS="$(pkg-config --cflags-only-I --static \$PACKAGES) -I{$openssl_prefix}/include/openssl/" \
2829
LDFLAGS="$(pkg-config --libs-only-L --static \$PACKAGES)" \
2930
LIBS="$(pkg-config --libs-only-l --static \$PACKAGES)" \
3031
./configure --prefix={$curl_prefix} \
@@ -40,7 +41,6 @@
4041
--enable-mime \
4142
--enable-cookies \
4243
--enable-doh \
43-
--enable-threaded-resolver \
4444
--enable-ipv6 \
4545
--enable-proxy \
4646
--enable-websockets \
@@ -53,16 +53,16 @@
5353
--with-zlib={$zlib_prefix} \
5454
--enable-ares={$cares_prefix} \
5555
--with-nghttp2 \
56-
--with-ngtcp2 \
5756
--with-nghttp3 \
58-
--without-libidn2 \
57+
--with-libidn2 \
5958
--with-libssh2 \
6059
--with-openssl \
6160
--with-default-ssl-backend=openssl \
61+
--with-openssl-quic \
6262
--without-gnutls \
6363
--without-mbedtls \
6464
--without-wolfssl \
65-
--without-bearssl \
65+
--without-libressl \
6666
--without-rustls
6767
6868
EOF
@@ -77,8 +77,10 @@
7777
'libzstd',
7878
'nghttp2',
7979
'nghttp3',
80-
'ngtcp2',
81-
'libssh2'
82-
) # 'libidn2',
80+
//'ngtcp2',
81+
'libssh2',
82+
'libidn2',
83+
'libpsl'
84+
)
8385
);
8486
};

sapi/src/builder/library/gmp.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@
1010
->withHomePage('https://gmplib.org/')
1111
->withManual('https://gmplib.org/')
1212
->withLicense('https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', Library::LICENSE_GPL)
13-
->withUrl('https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.lz')
13+
//->withUrl('https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.lz')
14+
->withUrl('https://ftpmirror.gnu.org/gnu/gmp/gmp-6.3.0.tar.lz')
1415
->withFileHash('md5', 'db3f4050677df3ff2bd23422c0d3caa1')
1516
->withPrefix($gmp_prefix)
1617
->withConfigure(
1718
<<<EOF
1819
./configure --help
20+
21+
CFLAGS="-fPIC" \
1922
./configure \
2023
--prefix=$gmp_prefix \
2124
--enable-static=yes \
22-
--enable-shared=no
25+
--enable-shared=no \
26+
--with-pic
27+
2328
EOF
2429
)
2530
->withPkgName('gmp')

sapi/src/builder/library/libidn2.php

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,41 @@
44
use SwooleCli\Preprocessor;
55

66
return function (Preprocessor $p) {
7-
if (0) {
8-
$libiconv_prefix = ICONV_PREFIX;
9-
$libidn2_prefix = LIBIDN2_PREFIX;
10-
$libunistring_prefix = LIBUNISTRING_PREFIX;
11-
$p->addLibrary(
12-
(new Library('libidn2'))
13-
->withHomePage('https://gitlab.com/libidn/libidn2')
14-
->withManual('https://www.gnu.org/software/libidn/libidn2/manual/')
15-
->withLicense('https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', Library::LICENSE_GPL)
16-
->withUrl('https://ftp.gnu.org/gnu/libidn/libidn2-2.3.4.tar.gz')
17-
->withPrefix($libidn2_prefix)
18-
->withConfigure(
19-
<<<EOF
7+
8+
$libiconv_prefix = ICONV_PREFIX;
9+
$libidn2_prefix = LIBIDN2_PREFIX;
10+
$libunistring_prefix = LIBUNISTRING_PREFIX;
11+
$libintl_prefix= GETTEXT_PREFIX;
12+
$options = '';
13+
if ($p->isMacos()) {
14+
$options = '--with-libintl-prefix='.$libintl_prefix;
15+
} else {
16+
$options = '--without-libintl-prefix';
17+
}
18+
$p->addLibrary(
19+
(new Library('libidn2'))
20+
->withHomePage('https://gitlab.com/libidn/libidn2')
21+
->withManual('https://www.gnu.org/software/libidn/libidn2/manual/')
22+
->withLicense('https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', Library::LICENSE_GPL)
23+
//->withUrl('https://ftp.gnu.org/gnu/libidn/libidn2-2.3.8.tar.gz')
24+
->withUrl('https://ftpmirror.gnu.org/gnu/libidn/libidn2-2.3.8.tar.gz')
25+
->withFileHash('md5', 'a8e113e040d57a523684e141970eea7a')
26+
->withPrefix($libidn2_prefix)
27+
->withConfigure(
28+
<<<EOF
2029
./configure --help
2130
./configure --prefix={$libidn2_prefix} \
2231
--enable-static=yes \
2332
--enable-shared=no \
2433
--disable-doc \
2534
--with-libiconv-prefix={$libiconv_prefix} \
2635
--with-libunistring-prefix={$libunistring_prefix} \
27-
--without-libintl-prefix
36+
{$options}
2837
2938
EOF
30-
)
31-
->withPkgName('libidn2')
32-
->withDependentLibraries('libiconv', 'libunistring')
33-
);
34-
}
39+
)
40+
->withPkgName('libidn2')
41+
->withDependentLibraries('libiconv', 'libunistring', 'gettext')
42+
);
43+
3544
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
use SwooleCli\Library;
4+
use SwooleCli\Preprocessor;
5+
6+
return function (Preprocessor $p) {
7+
$libpsl_prefix = LIBPSL_PREFIX;
8+
$libiconv_prefix = ICONV_PREFIX;
9+
$libintl_prefix = GETTEXT_PREFIX;
10+
$libunistring_prefix = LIBUNISTRING_PREFIX;
11+
$options = '';
12+
if ($p->isMacos()) {
13+
$options = '--with-libintl-prefix=' . $libintl_prefix;
14+
} else {
15+
$options = '--without-libintl-prefix';
16+
}
17+
$p->addLibrary(
18+
(new Library('libpsl'))
19+
->withHomePage('https://rockdaboot.github.io/libpsl')
20+
->withManual('https://github.com/rockdaboot/libpsl.git')
21+
->withLicense('https://github.com/rockdaboot/libpsl/blob/master/LICENSE', Library::LICENSE_MIT)
22+
->withUrl('https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz')
23+
->withFileHash('md5', '870a798ee9860b6e77896548428dba7b')
24+
->withPrefix($libpsl_prefix)
25+
->withConfigure(
26+
<<<EOF
27+
./configure --help
28+
PACKAGES=" libidn2 "
29+
30+
CPPFLAGS="$(pkg-config --cflags-only-I --static \$PACKAGES) -I{$libiconv_prefix}/include/ -I{$libunistring_prefix}/include/" \
31+
LDFLAGS="$(pkg-config --libs-only-L --static \$PACKAGES) -L{$libiconv_prefix}/lib/ -L{$libunistring_prefix}/lib/" \
32+
LIBS="$(pkg-config --libs-only-l --static \$PACKAGES) -liconv -lunistring" \
33+
./configure \
34+
--prefix={$libpsl_prefix} \
35+
--enable-static=yes \
36+
--enable-shared=no \
37+
--enable-builtin \
38+
--with-libiconv-prefix={$libiconv_prefix} \
39+
{$options}
40+
41+
42+
EOF
43+
)
44+
->withPkgName('libpsl')
45+
->withDependentLibraries('libiconv', 'libunistring', 'gettext', 'libunistring')
46+
);
47+
48+
};

sapi/src/builder/library/libssh2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
->withLicense('https://www.libssh2.org/license.html', Library::LICENSE_SPEC)
1414
->withManual('https://github.com/libssh2/libssh2.git')
1515
->withManual('https://github.com/libssh2/libssh2/blob/master/docs/INSTALL_CMAKE.md')
16-
->withUrl('https://libssh2.org/download/libssh2-1.11.0.tar.gz')
17-
->withFileHash('md5', 'a01d543fd891ca48fe47726540d50b17')
16+
->withUrl('https://libssh2.org/download/libssh2-1.11.1.tar.gz')
17+
->withFileHash('md5', '38857d10b5c5deb198d6989dacace2e6')
1818
->withPrefix($libssh2_prefix)
1919
->withBuildScript(
2020
<<<EOF

sapi/src/builder/library/nghttp2.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@
55

66
return function (Preprocessor $p) {
77
$nghttp2_prefix = NGHTTP2_PREFIX;
8+
$cares_prefix = CARES_PREFIX;
9+
$openssl_prefix =OPENSSL_PREFIX;
810
$p->addLibrary(
911
(new Library('nghttp2'))
1012
->withHomePage('https://github.com/nghttp2/nghttp2.git')
1113
->withManual('https://nghttp2.org/')
1214
->withLicense('https://github.com/nghttp2/nghttp2/blob/master/COPYING', Library::LICENSE_MIT)
13-
->withUrl('https://github.com/nghttp2/nghttp2/releases/download/v1.57.0/nghttp2-1.57.0.tar.gz')
14-
->withFileHash('md5', 'd4c92d9a85e551bb084964d2be05929c')
15+
->withUrl('https://github.com/nghttp2/nghttp2/releases/download/v1.68.0/nghttp2-1.68.0.tar.gz')
16+
->withFileHash('md5', 'e0d023d49a8d07d4d7ff8c5a93725720')
1517
->withPrefix($nghttp2_prefix)
16-
->withConfigure(
18+
->withBuildScript(
1719
<<<EOF
18-
./configure --help
19-
packages="zlib libxml-2.0 libcares openssl " # jansson libev libbpf libelf libngtcp2 libnghttp3
20-
CPPFLAGS="$(pkg-config --cflags-only-I --static \$packages )" \
21-
LDFLAGS="$(pkg-config --libs-only-L --static \$packages )" \
22-
LIBS="$(pkg-config --libs-only-l --static \$packages )" \
23-
./configure --prefix={$nghttp2_prefix} \
24-
--enable-static=yes \
25-
--enable-shared=no \
26-
--enable-lib-only \
27-
--with-libxml2 \
28-
--with-zlib \
29-
--with-libcares \
30-
--with-openssl \
31-
--disable-http3 \
32-
--disable-python-bindings \
33-
--without-jansson \
34-
--without-libevent-openssl \
35-
--without-libev \
36-
--without-cunit \
37-
--without-jemalloc \
38-
--without-mruby \
39-
--without-neverbleed \
40-
--without-cython \
41-
--without-libngtcp2 \
42-
--without-libnghttp3 \
43-
--without-libbpf \
44-
--with-boost=no
20+
mkdir -p build
21+
cd build
22+
23+
cmake .. \
24+
-DCMAKE_INSTALL_PREFIX={$nghttp2_prefix} \
25+
-DCMAKE_BUILD_TYPE=Release \
26+
-DBUILD_SHARED_LIBS=OFF \
27+
-DBUILD_STATIC_LIBS=ON \
28+
-DENABLE_LIB_ONLY=ON \
29+
-DCMAKE_PREFIX_PATH="{$openssl_prefix};{$cares_prefix}" \
30+
-DOPENSSL_ROOT_DIR={$openssl_prefix} \
31+
-DENABLE_APP=OFF \
32+
-DENABLE_DOC=OFF \
33+
-DWITH_LIBXML2=ON \
34+
-DBUILD_TESTING=OFF \
35+
-DCMAKE_DISABLE_FIND_PACKAGE_Libngtcp2=ON \
36+
-DCMAKE_DISABLE_FIND_PACKAGE_Systemd=ON \
37+
-DCMAKE_DISABLE_FIND_PACKAGE_Libngtcp2=ON \
38+
-DCMAKE_DISABLE_FIND_PACKAGE_Libnghttp3=ON \
39+
-DCMAKE_DISABLE_FIND_PACKAGE_Jansson=ON \
40+
-DCMAKE_DISABLE_FIND_PACKAGE_Jemalloc=ON \
41+
-DCMAKE_DISABLE_FIND_PACKAGE_Libevent=ON \
42+
-DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON
43+
44+
cmake --build . --target install
4545
EOF
4646
)
4747
->withPkgName('libnghttp2')

sapi/src/builder/library/nghttp3.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
->withHomePage('https://github.com/ngtcp2/nghttp3')
1111
->withLicense('https://github.com/ngtcp2/nghttp3/blob/main/COPYING', Library::LICENSE_MIT)
1212
->withManual('https://nghttp2.org/nghttp3/')
13-
->withUrl('https://github.com/ngtcp2/nghttp3/archive/refs/tags/v1.0.0.tar.gz')
14-
->withFile('nghttp3-v1.0.0.tar.gz')
15-
->withFileHash('md5', '0446cce05f003bace3ac51277181ae51')
13+
->withUrl('https://github.com/ngtcp2/nghttp3/releases/download/v1.12.0/nghttp3-1.12.0.tar.gz')
14+
->withFile('nghttp3-1.12.0.tar.gz')
15+
->withFileHash('md5', 'ede30acfe793c5e9103eee5d38cd0304')
1616
->withPrefix($nghttp3_prefix)
1717
->withConfigure(
1818
<<<EOF

sapi/src/builder/library/ngtcp2.php

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,33 @@
55

66
return function (Preprocessor $p) {
77
$ngtcp2_prefix = NGTCP2_PREFIX;
8+
$openssl_prefix = OPENSSL_PREFIX;
9+
$libnghttp3_prefix = NGHTTP3_PREFIX;
810
$p->addLibrary(
911
(new Library('ngtcp2'))
1012
->withHomePage('https://github.com/ngtcp2/ngtcp2')
1113
->withLicense('https://github.com/ngtcp2/ngtcp2/blob/main/COPYING', Library::LICENSE_MIT)
1214
->withManual('https://curl.se/docs/http3.html')
13-
->withUrl('https://github.com/ngtcp2/ngtcp2/releases/download/v1.1.0/ngtcp2-1.1.0.tar.gz')
14-
->withFile('ngtcp2-1.1.0.tar.gz')
15-
->withFileHash('md5', 'e05c501244a2af34b492753763c74e04')
15+
->withUrl('https://github.com/ngtcp2/ngtcp2/releases/download/v1.17.0/ngtcp2-1.17.0.tar.gz')
16+
->withFile('ngtcp2-1.17.0.tar.gz')
17+
->withFileHash('md5', '7b5221830f1f09ea7998aaf7dfcb87ac')
1618
->withPrefix($ngtcp2_prefix)
17-
->withConfigure(
19+
->withBuildScript(
1820
<<<EOF
19-
autoreconf -fi
20-
./configure --help
21+
mkdir -p build
22+
cd build
23+
24+
cmake .. \
25+
-DCMAKE_INSTALL_PREFIX={$ngtcp2_prefix} \
26+
-DCMAKE_BUILD_TYPE=Release \
27+
-DENABLE_SHARED_LIB=OFF \
28+
-DENABLE_STATIC_LIB=ON \
29+
-DENABLE_OPENSSL=ON \
30+
-DENABLE_LIB_ONLY=ON \
31+
-DCMAKE_PREFIX_PATH="{$openssl_prefix};{$libnghttp3_prefix}" \
32+
-DOPENSSL_ROOT_DIR={$openssl_prefix} \
33+
-DBUILD_TESTING=OFF
2134
22-
PACKAGES="openssl libnghttp3 "
23-
CPPFLAGS="$(pkg-config --cflags-only-I --static \$PACKAGES )" \
24-
LDFLAGS="$(pkg-config --libs-only-L --static \$PACKAGES )" \
25-
LIBS="$(pkg-config --libs-only-l --static \$PACKAGES )" \
26-
./configure \
27-
--prefix=$ngtcp2_prefix \
28-
--enable-shared=no \
29-
--enable-static=yes \
30-
--enable-lib-only \
31-
--without-libev \
32-
--with-openssl \
33-
--with-libnghttp3=yes \
34-
--without-gnutls \
35-
--without-boringssl \
36-
--without-picotls \
37-
--without-wolfssl \
38-
--without-cunit \
39-
--without-jemalloc
4035
EOF
4136
)
4237
->withPkgName('libngtcp2')

0 commit comments

Comments
 (0)