Skip to content

Instantly share code, notes, and snippets.

@hamjin
Last active January 7, 2025 02:25
Show Gist options
  • Save hamjin/0e41c58585749d9742545af98da8ce3d to your computer and use it in GitHub Desktop.
Save hamjin/0e41c58585749d9742545af98da8ce3d to your computer and use it in GitHub Desktop.
Build Angie with QUICTLS
#!/bin/bash
export SSL_FEATURES="no-engine no-apps no-tests no-external-tests no-trace enable-zlib enable-zstd enable-tfo enable-weak-ssl-ciphers enable-ssl3 enable-ct enable-ktls enable-sm2 enable-sm4 enable-sm3 enable-ec_nistp_64_gcc_128 -DOPENSSL_TLS_SECURITY_LEVEL=0"
export SSL_CFLAGS="-O3 -march=haswell -mtune=haswell -mavx2 -funroll-loops -D_FORTIFY_SOURCE=2 -fPIC -pipe -flto=thin"
export SSL_LINKER_FLAGS="-fuse-ld=lld -fintegrated-as -static -ljemalloc -Wl,-z,relro,-z,now,--lto-O3,-O3,--as-needed"
## deps
# sudo apt install libatomic-ops-dev libperl-dev
apk add build-base cmake clang lld llvm pcre2-dev perl-dev zstd-dev zstd-static libatomic libatomic_ops-dev libatomic_ops-static jemalloc-static zlib-dev zlib-static linux-headers
## QUICTLS
git clone --depth 1 https://github.com/hamjin/quictls.git
## ngx_brotli
git clone --depth 1 --recurse-submodules https://github.com/google/ngx_brotli.git ngx_brotli
cd ngx_brotli
cmake -B deps/brotli/out --fresh -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_LINKER_TYPE="LLD" \
-DCMAKE_C_FLAGS="$SSL_CFLAGS" \
-DCMAKE_INSTALL_PREFIX=./installed deps/brotli
cmake --build deps/brotli/out -j --clean-first --config Release --target brotlienc
cd ..
## ngx_zstd
git clone --depth 1 --recurse-submodules https://github.com/tokers/zstd-nginx-module.git ngx_zstd
## angie
git clone --depth 1 --recurse-submodules https://github.com/hamjin/angie.git
cd angie
./configure --prefix=/usr/local/nginx --sbin-path=sbin/nginx --pid-path=/run/nginx.pid --conf-path=conf/nginx.conf\
--with-cc="clang" --with-cc-opt="$SSL_CFLAGS" --with-ld-opt="$SSL_LINKER_FLAGS -Wl,-s" \
--with-openssl=../quictls --with-openssl-opt="CC=clang $SSL_FEATURES $SSL_CFLAGS $SSL_LINKER_FLAGS" \
--with-select_module --with-poll_module --with-threads --with-file-aio --with-pcre --with-pcre-jit --with-libatomic \
--with-http_ssl_module --with-http_v2_module --with-http_v3_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_acme_module \
--with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \
--add-module=../ngx_brotli --add-module=../ngx_zstd
make -j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment