nginx: fix compatibility with zlib-ng (#358812)

This commit is contained in:
Franz Pletz 2024-11-27 14:34:52 +01:00 committed by GitHub
commit 352dc5c800
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 7 deletions

View File

@ -1,4 +1,4 @@
outer@{ lib, stdenv, fetchurl, fetchpatch, openssl, zlib, pcre2, libxml2, libxslt
outer@{ lib, stdenv, fetchurl, fetchpatch, openssl, zlib-ng, pcre2, libxml2, libxslt
, nginx-doc
, nixosTests
@ -66,7 +66,7 @@ stdenv.mkDerivation {
removeReferencesTo
] ++ nativeBuildInputs;
buildInputs = [ openssl zlib pcre2 libxml2 libxslt perl ]
buildInputs = [ openssl zlib-ng pcre2 libxml2 libxslt perl ]
++ buildInputs
++ mapModules "inputs"
++ lib.optional withGeoIP geoip
@ -126,6 +126,13 @@ stdenv.mkDerivation {
env.NIX_CFLAGS_COMPILE = toString ([
"-I${libxml2.dev}/include/libxml2"
"-Wno-error=implicit-fallthrough"
(
# zlig-ng patch needs this
if stdenv.cc.isGNU then
"-Wno-error=discarded-qualifiers"
else
"-Wno-error=incompatible-pointer-types-discards-qualifiers"
)
] ++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") [
# fix build vts module on gcc11
"-Wno-error=stringop-overread"
@ -155,6 +162,13 @@ stdenv.mkDerivation {
'';
})
./nix-skip-check-logs-path.patch
] ++ lib.optionals (pname != "openresty") [
# https://github.com/NixOS/nixpkgs/issues/357522
# https://github.com/zlib-ng/patches/blob/5a036c0a00120c75ee573b27f4f44ade80d82ff2/nginx/README.md
(fetchpatch {
url = "https://raw.githubusercontent.com/zlib-ng/patches/38756e6325a5d2cc32709b8e9549984c63a78815/nginx/1.26.2-zlib-ng.patch";
hash = "sha256-LX5kP6jFiqgt4ApKw5eqOAFJNkc5QI6kX8ZRvBYTi9k=";
})
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
(fetchpatch {
url = "https://raw.githubusercontent.com/openwrt/packages/c057dfb09c7027287c7862afab965a4cd95293a3/net/nginx/patches/102-sizeof_test_fix.patch";

View File

@ -1610,7 +1610,6 @@ with pkgs;
android-tools = lowPrio (darwin.apple_sdk_11_0.callPackage ../tools/misc/android-tools { });
angie = callPackage ../servers/http/angie {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
# We don't use `with` statement here on purpose!
# See https://github.com/NixOS/nixpkgs/pull/10474#discussion_r42369334
@ -1618,7 +1617,6 @@ with pkgs;
};
angieQuic = callPackage ../servers/http/angie {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
withQuic = true;
# We don't use `with` statement here on purpose!
@ -11830,7 +11828,6 @@ with pkgs;
nginx = nginxStable;
nginxQuic = callPackage ../servers/http/nginx/quic.nix {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
# We don't use `with` statement here on purpose!
# See https://github.com/NixOS/nixpkgs/pull/10474#discussion_r42369334
@ -11840,7 +11837,6 @@ with pkgs;
};
nginxStable = callPackage ../servers/http/nginx/stable.nix {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
# We don't use `with` statement here on purpose!
# See https://github.com/NixOS/nixpkgs/pull/10474#discussion_r42369334
@ -11848,7 +11844,6 @@ with pkgs;
};
nginxMainline = callPackage ../servers/http/nginx/mainline.nix {
zlib = zlib-ng.override { withZlibCompat = true; };
withKTLS = true;
withPerl = false;
# We don't use `with` statement here on purpose!
@ -11877,6 +11872,7 @@ with pkgs;
openafs = callPackage ../servers/openafs/1.8 { };
openresty = callPackage ../servers/http/openresty {
zlib-ng = zlib;
withPerl = false;
modules = [];
};