Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,34 @@ jobs:
-customssl https://boringssl.googlesource.com/boringssl \
-customsslname boringssl

run-nginx-zlib-ng:
runs-on: ubuntu-latest
env:
GOCACHE: ${{ github.workspace }}/.cache
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.25.4
- name: Download nginx zlib-ng patch
run: |
set -euxo pipefail
curl -L https://patch-diff.githubusercontent.com/raw/nginx/nginx/pull/644.patch -o /tmp/nginx-pr-644.patch
- name: Run Nginx with zlib-ng compat
run: |
set -euxo pipefail
make
./nginx-build \
-c ./config/configure.zlibng.example \
-m ./config/modules.json.example \
-d work \
-clear \
-pcre \
-zlib-ng \
-patch /tmp/nginx-pr-644.patch \
-patch-opt "-p1"

run-nginx-oqs-provider:
runs-on: ubuntu-latest
steps:
Expand Down
14 changes: 14 additions & 0 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func (builder *Builder) name() string {
}
case ComponentZlib:
name = "zlib"
case ComponentZlibNG:
name = "zlib-ng"
case ComponentOpenResty:
name = openresty.Name(builder.Version)
case ComponentFreenginx:
Expand Down Expand Up @@ -89,6 +91,11 @@ func (builder *Builder) option() string {
name = "pcre"
}

// zlib-ng does not match option name
if name == "zlib-ng" {
name = "zlib"
}

return fmt.Sprintf("--with-%s", name)
}

Expand All @@ -106,6 +113,8 @@ func (builder *Builder) DownloadURL() string {
return builder.CustomURL
case ComponentZlib:
return fmt.Sprintf("%s/zlib-%s.tar.gz", ZlibDownloadURLPrefix, builder.Version)
case ComponentZlibNG:
return fmt.Sprintf("%s/%s.tar.gz", ZlibNGDownloadURLPrefix, builder.Version)
case ComponentOpenResty:
return fmt.Sprintf("%s/openresty-%s.tar.gz", OpenRestyDownloadURLPrefix, builder.Version)
case ComponentFreenginx:
Expand All @@ -116,6 +125,9 @@ func (builder *Builder) DownloadURL() string {
}

func (builder *Builder) SourcePath() string {
if builder.name() == "" {
return fmt.Sprintf("%s", builder.Version)
}
return fmt.Sprintf("%s-%s", builder.name(), builder.Version)
}

Expand Down Expand Up @@ -194,6 +206,8 @@ func MakeBuilder(component int, version string) Builder {
builder.DownloadURLPrefix = LibreSSLDownloadURLPrefix
case ComponentZlib:
builder.DownloadURLPrefix = ZlibDownloadURLPrefix
case ComponentZlibNG:
builder.DownloadURLPrefix = ZlibNGDownloadURLPrefix
case ComponentOpenResty:
builder.DownloadURLPrefix = OpenRestyDownloadURLPrefix
case ComponentFreenginx:
Expand Down
5 changes: 5 additions & 0 deletions builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func setupBuilders(t *testing.T) []Builder {
builders[ComponentOpenSSL] = MakeLibraryBuilder(ComponentOpenSSL, OpenSSLVersion, true)
builders[ComponentLibreSSL] = MakeLibraryBuilder(ComponentLibreSSL, LibreSSLVersion, true)
builders[ComponentZlib] = MakeLibraryBuilder(ComponentZlib, ZlibVersion, false)
builders[ComponentZlibNG] = MakeLibraryBuilder(ComponentZlibNG, ZlibNGVersion, false)
builders[ComponentOpenResty] = MakeBuilder(ComponentOpenResty, OpenRestyVersion)
builders[ComponentFreenginx] = MakeBuilder(ComponentFreenginx, FreenginxVersion)
// Add custom SSL builder
Expand Down Expand Up @@ -52,6 +53,10 @@ func TestName(t *testing.T) {
got: builders[ComponentZlib].name(),
want: "zlib",
},
{
got: builders[ComponentZlibNG].name(),
want: "zlib-ng",
},
{
got: builders[ComponentOpenResty].name(),
want: "openresty",
Expand Down
7 changes: 7 additions & 0 deletions builder/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ const (
ZlibDownloadURLPrefix = "https://zlib.net"
)

// zlib-ng
const (
ZlibNGVersion = "2.3.1"
ZlibNGDownloadURLPrefix = "https://github.com/zlib-ng/zlib-ng/archive/refs/tags"
)

// openResty
const (
OpenRestyVersion = "1.27.1.2"
Expand All @@ -52,5 +58,6 @@ const (
ComponentLibreSSL
ComponentCustomSSL
ComponentZlib
ComponentZlibNG
ComponentMax
)
6 changes: 6 additions & 0 deletions config/configure.zlibng.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--with-zlib-conf-opt="--zlib-compat" \
15 changes: 15 additions & 0 deletions nginx-build.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func main() {
openSSLStatic := nginxBuildOptions.Bools["openssl"].Enabled
libreSSLStatic := nginxBuildOptions.Bools["libressl"].Enabled
zlibStatic := nginxBuildOptions.Bools["zlib"].Enabled
zlibNGStatic := nginxBuildOptions.Bools["zlib-ng"].Enabled
clear := nginxBuildOptions.Bools["clear"].Enabled
versionPrint := nginxBuildOptions.Bools["version"].Enabled
versionsPrint := nginxBuildOptions.Bools["versions"].Enabled
Expand All @@ -141,6 +142,7 @@ func main() {
openSSLVersion := nginxBuildOptions.Values["opensslversion"].Value
libreSSLVersion := nginxBuildOptions.Values["libresslversion"].Value
zlibVersion := nginxBuildOptions.Values["zlibversion"].Value
zlibNGVersion := nginxBuildOptions.Values["zlibngversion"].Value
openRestyVersion := nginxBuildOptions.Values["openrestyversion"].Value
freenginxVersion := nginxBuildOptions.Values["freenginxversion"].Value
patchOption := nginxBuildOptions.Values["patch-opt"].Value
Expand Down Expand Up @@ -243,6 +245,7 @@ func main() {
}

zlibBuilder := builder.MakeLibraryBuilder(builder.ComponentZlib, *zlibVersion, *zlibStatic)
zlibNGBuilder := builder.MakeLibraryBuilder(builder.ComponentZlibNG, *zlibNGVersion, *zlibNGStatic)

if *idempotent {
builders := []builder.Builder{
Expand Down Expand Up @@ -417,6 +420,14 @@ func main() {
}()
}

if *zlibNGStatic {
wg.Add(1)
go func() {
downloadAndExtractParallel(&zlibNGBuilder)
wg.Done()
}()
}

wg.Add(1)
go func() {
downloadAndExtractParallel(&nginxBuilder)
Expand Down Expand Up @@ -471,6 +482,10 @@ func main() {
dependencies = append(dependencies, builder.MakeStaticLibrary(&zlibBuilder))
}

if *zlibNGStatic {
dependencies = append(dependencies, builder.MakeStaticLibrary(&zlibNGBuilder))
}

log.Printf("Generate configure script for %s.....", nginxBuilder.SourcePath())

if *pcreStatic && pcreBuilder.IsIncludeWithOption(nginxConfigure) {
Expand Down
7 changes: 7 additions & 0 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func makeNginxBuildOptions() Options {
argsBool["zlib"] = OptionBool{
Desc: "embedded zlib staticlibrary",
}
argsBool["zlib-ng"] = OptionBool{
Desc: "embedded zlib-ng staticlibrary",
}
argsBool["clear"] = OptionBool{
Desc: "remove entries in working directory",
}
Expand Down Expand Up @@ -115,6 +118,10 @@ func makeNginxBuildOptions() Options {
Desc: "zlib version",
Default: builder.ZlibVersion,
}
argsString["zlibngversion"] = OptionValue{
Desc: "zlib-ng version",
Default: builder.ZlibNGVersion,
}
argsString["openrestyversion"] = OptionValue{
Desc: "openresty version",
Default: builder.OpenRestyVersion,
Expand Down
Loading