From 2bb78e08c827708e368554b41cbd8fc9b0d1f804 Mon Sep 17 00:00:00 2001 From: Mark Vainomaa Date: Wed, 2 Oct 2019 13:02:46 +0300 Subject: [PATCH] Add Brotli module, use BoringSSL and zlib-ng --- .gitignore | 4 ++++ PKGBUILD | 44 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 72a3ed3..c1c3095 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ *.tar* pkg/ src/ + +boringssl/ +zlib-ng/ +ngx_brotli/ diff --git a/PKGBUILD b/PKGBUILD index 3ee69b5..3f8785c 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -10,6 +10,9 @@ _davext_ver=3.0.0 _fancyindex_ver=0.4.3 _headers_more_ver=0.33 _nchan_ver=1.2.6 +_brotli_commit=e505dce68acc190cc5a1e780a3b0275e39f160ca +_boringssl_commit=9638f8fba961a593c064e3036bb580bdace29e8f +_zlibng_commit=503bdef7a29a7078a50d8149e261c4299a82a9da _pkgname=nginx pkgname=nginx-ilves @@ -19,8 +22,9 @@ pkgdesc='Lightweight HTTP server and IMAP/POP3 proxy server, mainline release' arch=('x86_64') url='https://nginx.org' license=('custom') -depends=('pcre' 'zlib' 'openssl' 'geoip' 'mailcap' +depends=('pcre' 'brotli' 'geoip' 'mailcap' 'libxml2') # Extra modules dependencies +makedepends=('cmake' 'go') backup=('etc/nginx/fastcgi.conf' 'etc/nginx/fastcgi_params' 'etc/nginx/koi-win' @@ -40,7 +44,10 @@ source=("${url}/download/${_pkgname}-${pkgver}.tar.gz"{,.asc} "ngx_davext-${_davext_ver}.tar.gz::https://github.com/arut/nginx-dav-ext-module/archive/v${_davext_ver}.tar.gz" "ngx_fancyindex-${_fancyindex_ver}.tar.gz::https://github.com/aperezdc/ngx-fancyindex/archive/v${_fancyindex_ver}.tar.gz" "ngx_headers_more-${_headers_more_ver}.tar.gz::https://github.com/openresty/headers-more-nginx-module/archive/v${_headers_more_ver}.tar.gz" - "ngx_nchan-${_nchan_ver}.tar.gz::https://github.com/slact/nchan/archive/v${_nchan_ver}.tar.gz") + "ngx_nchan-${_nchan_ver}.tar.gz::https://github.com/slact/nchan/archive/v${_nchan_ver}.tar.gz" + "ngx_brotli::git+https://github.com/google/ngx_brotli#commit=${_brotli_commit}" + "boringssl::git+https://boringssl.googlesource.com/boringssl#commit=${_boringssl_commit}" + "zlib-ng::git+https://github.com/zlib-ng/zlib-ng#commit=${_zlibng_commit}") sha256sums=('63ee35e15a75af028ffa1f995e2b9c120b59ef5f1b61a23b8a4c33c262fc10c3' 'SKIP' '6985a7c271a64b9fce5fb24afc459399643a7abf5e7f1a1cc5043c4941443892' @@ -48,7 +55,10 @@ sha256sums=('63ee35e15a75af028ffa1f995e2b9c120b59ef5f1b61a23b8a4c33c262fc10c3' 'd2499d94d82d4e4eac8425d799e52883131ae86a956524040ff2fd230ef9f859' '81698fb0c1ec9f906ce308c055d5d248085caf390f4b92516c1ec93f87c886d4' 'a3dcbab117a9c103bc1ea5200fc00a7b7d2af97ff7fd525f16f8ac2632e30fbf' - '277f35e479f80f04f76b70549d0ec7abdf8f1658cf46538ea9b0adf3e8b1ad50') + '277f35e479f80f04f76b70549d0ec7abdf8f1658cf46538ea9b0adf3e8b1ad50' + 'SKIP' + 'SKIP' + 'SKIP') _common_flags=( --with-compat @@ -87,6 +97,7 @@ _module_flags=( --add-module=../ngx-fancyindex-${_fancyindex_ver} --add-module=../headers-more-nginx-module-${_headers_more_ver} --add-module=../nchan-${_nchan_ver} + --add-module=../ngx_brotli ) prepare() { @@ -104,6 +115,26 @@ prepare() { } build() { + msg2 "Building BoringSSL" + mkdir -p boringssl-build + pushd boringssl-build + cmake "${srcdir}/boringssl" -G "Unix Makefiles" -DBUILD_SHARED_LIBS=0 + make + + # Move BoringSSL files to proper place + mkdir -p .openssl/lib + cp crypto/libcrypto.a ssl/libssl.a .openssl/lib/ + cp -r ../boringssl/include .openssl/ + popd + + msg2 "Building zlib-ng" + mkdir -p zlib-ng-build + pushd zlib-ng-build + cmake "${srcdir}/zlib-ng" -G "Unix Makefiles" -DZLIB_COMPAT=1 + make + popd + + msg2 "Building nginx" cd "${_pkgname}-${pkgver}" ./configure \ --prefix=/etc/nginx \ @@ -122,10 +153,17 @@ build() { --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ --with-cc-opt="${CFLAGS} ${CPPFLAGS}" \ --with-ld-opt="${LDFLAGS}" \ + --with-openssl="$(realpath ../boringssl-build)" \ + --with-zlib="$(realpath ../zlib-ng-build)" \ ${_common_flags[@]} \ ${_mainline_flags[@]} \ ${_module_flags[@]} + + # No idea why this is needed, but nginx build otherwise fails + touch ../boringssl-build/.openssl/include/openssl/ssl.h + touch ../zlib-ng-build/libz.a + make }