#!/bin/sh -e
# build nghttp3 (for GitHub workflow)
git clone --depth 1 -b OpenSSL_1_1_1o+quic https://github.com/quictls/openssl
cd openssl
# For Linux
./config enable-tls1_3 --prefix=$PWD/build
make -j$(nproc)
make install_sw
cd ..
git clone https://github.com/ngtcp2/nghttp3
cd nghttp3
autoreconf -i
./configure --prefix=$PWD/build --enable-lib-only
make -j$(nproc) check
make install
cd ..
git clone https://github.com/ngtcp2/ngtcp2
cd ngtcp2
autoreconf -i
# For Mac users who have installed libev with MacPorts, append
# ',-L/opt/local/lib' to LDFLAGS, and also pass
# CPPFLAGS="-I/opt/local/include" to ./configure.
# For OpenSSL >= v3.0.0, replace "openssl/build/lib" with
# "openssl/build/lib64".
./configure PKG_CONFIG_PATH=$PWD/../openssl/build/lib/pkgconfig:$PWD/../nghttp3/build/lib/pkgconfig LDFLAGS="-Wl,-rpath,$PWD/../openssl/build/lib" --prefix=$PWD/build
make -j$(nproc) check
make install
cd ..
git clone https://github.com/curl/curl
cd curl
./buildconf
./configure --with-ssl=$PWD/../openssl/build/ --with-nghttp3=$PWD/../nghttp3/build/ --with-ngtcp2=$PWD/../ngtcp2/build/ --enable-alt-svc --prefix=$PWD/build
make -j$(nproc)
make install
% ./curl --version
curl 7.84.0-DEV (x86_64-apple-darwin20.6.0) libcurl/7.84.0-DEV OpenSSL/1.1.1o zlib/1.2.11 brotli/1.0.9 libidn2/2.3.2 ngtcp2/0.6.0-DEV nghttp3/0.5.0-DEV librtmp/2.3
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP3 HTTPS-proxy IDN IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets
https://github.com/curl/curl/blob/master/docs/HTTP3.md
https://github.com/ngtcp2/ngtcp2
https://blog.csdn.net/u014023993/article/details/106131072
https://qing.su/article/157.html
https://zhuanlan.zhihu.com/p/444332157