Skip to content
Merged
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
16 changes: 12 additions & 4 deletions thirdparty/nginx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ psrctmp := $(PLATFORM_DIR)/srctmp
pvers := $(NGINX_VERSION)
pname := nginx
zname := zimbra-$(pname)
pfile := $(zname)-$(pvers).tar.gz
pfile := $(pname)-$(pvers).tar.gz
purl := http://nginx.org/download/$(pname)-$(pvers).tar.gz
psrc_file := $(SRC_DIR)/$(pfile)
psrc_final_file := $(SRC_DIR)/$(zname)-$(pvers).tar.gz
zspec := $(pname).spec
zmodules := zmmodules

Expand All @@ -19,7 +21,11 @@ getsrc:
mkdir -p $(SRC_DIR)
mkdir -p $(psrctmp)
mkdir -p $(psrctmp)/$(pname)-$(pvers)-zimbra/
cp -pr $(pname)/* $(psrctmp)/$(pname)-$(pvers)-zimbra/
cd $(psrctmp) && \
$(WGET) $(purl) && \
$(TAR) -xvf $(pname)-$(pvers).tar.gz && \
cp -pr $(pname)-$(pvers)/* $(psrctmp)/$(pname)-$(pvers)-zimbra/
cd $(PLATFORM_DIR)
mkdir -p $(psrctmp)/$(pname)-$(pvers)-zimbra/modules
cd $(psrctmp)/$(pname)-$(pvers)-zimbra/modules && \
git clone https://github.com/nviennot/nginx-tcp-keepalive.git nviennot-nginx-tcp-keepalive >/dev/null 2>&1 && \
Expand Down Expand Up @@ -51,7 +57,8 @@ build_rpm:
$(replace-pkginfo) $(specfile) && \
$(replace-pathinfo) $(specfile) && \
$(MKDIR) BUILD BUILDROOT RPMS SOURCES SRPMS && \
$(CP) $(psrc_file) SOURCES/ && \
$(CP) $(psrc_final_file) SOURCES/ && \
$(CP) $(PKG_ROOT)/patches/*.patch SOURCES/ && \
$(PKG_BUILD) $(specfile)

build_deb: z_tgz = $(zname)_$(pvers).orig.tar.gz
Expand All @@ -60,8 +67,9 @@ build_deb:
$(CD) $(PLATFORM_DIR)/$(zname) && \
$(replace-pkginfo) debian/changelog $(z_shlibs) && \
$(replace-pathinfo) debian/rules && \
$(CP) $(psrc_file) ../$(z_tgz) && \
$(CP) $(psrc_final_file) ../$(z_tgz) && \
$(TAR) xfz ../$(z_tgz) --strip-components=1 && \
$(CP) $(PKG_ROOT)/patches/*.patch debian/patches/ && \
$(PKG_BUILD)

clean: pkgrm
Expand Down
14 changes: 14 additions & 0 deletions thirdparty/nginx/patches/nginx_README.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- nginx/README.md 1970-01-01 05:30:00.000000000 +0530
+++ nginx/README.md 2023-09-14 18:47:11.380437400 +0530
@@ -0,0 +1,11 @@
+# nginx
+
+This is the official repository for building out the third party dependency nginx for Zimbra Collaboration Suite 8.7 and later.
+
+Issues should be reported via [Zimbra Forum](https://forums.zimbra.org/)
+
+## Development branch
+zimbra/develop
+
+## Release tags
+zimbra-release-1.24.0
15 changes: 15 additions & 0 deletions thirdparty/nginx/patches/nginx_auto_cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff -urN nginx/auto/cc/gcc nginx/auto/cc/gcc
--- nginx/auto/cc/gcc 2023-03-07 16:26:44.050300500 +0530
+++ nginx/auto/cc/gcc 2023-09-14 18:47:11.398148600 +0530
@@ -50,7 +50,10 @@

#NGX_GCC_OPT="-O2"
#NGX_GCC_OPT="-Os"
-NGX_GCC_OPT="-O"
+# Zimbra customizations start here (Jira Tickets: )
+#NGX_GCC_OPT="-O"
+NGX_GCC_OPT="-O0"
+# Zimbra customizations end here

#CFLAGS="$CFLAGS -fomit-frame-pointer"

110 changes: 110 additions & 0 deletions thirdparty/nginx/patches/nginx_auto_lib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
diff -urN nginx/auto/lib/conf nginx/auto/lib/conf
--- nginx/auto/lib/conf 2023-03-07 16:26:44.070240100 +0530
+++ nginx/auto/lib/conf 2023-09-14 18:47:11.422502700 +0530
@@ -52,3 +52,9 @@
if [ $NGX_LIBATOMIC != NO ]; then
. auto/lib/libatomic/conf
fi
+
+# Zimbra customizations start here: Implement SASL Authentication (Jira Tickets: )
+if [ $USE_SASL = YES ]; then
+ . auto/lib/sasl/conf
+fi
+# Zimbra customizations end here
diff -urN nginx/auto/lib/sasl/conf nginx/auto/lib/sasl/conf
--- nginx/auto/lib/sasl/conf 1970-01-01 05:30:00.000000000 +0530
+++ nginx/auto/lib/sasl/conf 2023-03-04 13:25:59.784471400 +0530
@@ -0,0 +1,93 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Zimbra Collaboration Suite Server
+# Copyright (C) 2011 Zimbra Software, LLC.
+#
+# The contents of this file are subject to the Zimbra Public License
+# Version 1.4 ("License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.zimbra.com/license.
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
+# ***** END LICENSE BLOCK *****
+#
+ ngx_feature="SASL library"
+ ngx_feature_name="NGX_SASL"
+ ngx_feature_run=no
+ ngx_feature_incs="#include <sasl/sasl.h>"
+ ngx_feature_path=
+ ngx_feature_libs="-lsasl2"
+ ngx_feature_test="int rc = sasl_server_init(NULL, \"test\");"
+ . auto/feature
+
+
+if [ $ngx_found = no ]; then
+
+ # FreeBSD port
+
+ ngx_feature="SASL library in /usr/local/"
+ ngx_feature_path="/usr/local/include"
+
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lsasl2"
+ else
+ ngx_feature_libs="-L/usr/local/lib -lsasl2"
+ fi
+
+ . auto/feature
+fi
+
+
+if [ $ngx_found = no ]; then
+
+ # NetBSD port
+
+ ngx_feature="SASL library in /usr/pkg/"
+ ngx_feature_path="/usr/pkg/include/"
+
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lsasl2"
+ else
+ ngx_feature_libs="-L/usr/pkg/lib -lsasl2"
+ fi
+
+ . auto/feature
+fi
+
+
+if [ $ngx_found = no ]; then
+
+ # MacPorts
+
+ ngx_feature="SASL library in /opt/local/"
+ ngx_feature_path="/opt/local/include"
+
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lsasl2"
+ else
+ ngx_feature_libs="-L/opt/local/lib -lsasl2"
+ fi
+
+ . auto/feature
+fi
+
+
+if [ $ngx_found = yes ]; then
+
+ CORE_INCS="$CORE_INCS $ngx_feature_path"
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+ SASL=YES
+
+else
+
+cat << END
+
+$0: error: SASL support in the MAIL filter modules requires the SASL library.
+You can either not enable the feature or install the libraries.
+
+END
+
+ exit 1
+
+fi
65 changes: 65 additions & 0 deletions thirdparty/nginx/patches/nginx_auto_modules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
--- nginx/auto/modules 2023-08-18 17:02:49.192905800 +0530
+++ nginx/auto/modules 2023-09-14 18:47:11.461941600 +0530
@@ -63,6 +63,7 @@

ngx_module_type=HTTP

+ # Zimbra customizations start here: Adding ngx_http_upstream_fair (Jira Tickets: )
if :; then
ngx_module_name="ngx_http_module \
ngx_http_core_module \
@@ -77,7 +78,8 @@
src/http/ngx_http_variables.h \
src/http/ngx_http_script.h \
src/http/ngx_http_upstream.h \
- src/http/ngx_http_upstream_round_robin.h"
+ src/http/ngx_http_upstream_round_robin.h \
+ src/http/ngx_http_upstream_fair.h"
ngx_module_srcs="src/http/ngx_http.c \
src/http/ngx_http_core_module.c \
src/http/ngx_http_special_response.c \
@@ -88,13 +90,14 @@
src/http/ngx_http_variables.c \
src/http/ngx_http_script.c \
src/http/ngx_http_upstream.c \
- src/http/ngx_http_upstream_round_robin.c"
+ src/http/ngx_http_upstream_round_robin.c \
+ src/http/ngx_http_upstream_fair.c"
ngx_module_libs=
ngx_module_link=YES

. auto/module
fi
-
+ # Zimbra customizations end here (Jira Tickets: )

if [ $HTTP_CACHE = YES ]; then
have=NGX_HTTP_CACHE . auto/have
@@ -939,6 +942,13 @@

ngx_module_incs=

+ # Zimbra customizations start here: Implement SASL Authentication (Jira Tickets: )
+ if [ $MAIL_SASL = YES ]; then
+ USE_SASL=YES
+ have=NGX_MAIL_SASL . auto/have
+ fi
+ # Zimbra customizations end
+
if [ $MAIL_SSL = YES ]; then
USE_OPENSSL=YES
have=NGX_MAIL_SSL . auto/have
@@ -1285,9 +1295,11 @@
. auto/module
fi

-
+# Zimbra customizations start here: Adding Nginx memcache and zm_lookup module (Jira Tickets: )
modules="$CORE_MODULES $EVENT_MODULES"
-
+modules="$modules $MEMCACHE_MODULE"
+modules="$modules $ZM_LOOKUP_MODULE"
+# Zimbra customizations end here

# thread pool module should be initialized after events
if [ $USE_THREADS = YES ]; then
58 changes: 58 additions & 0 deletions thirdparty/nginx/patches/nginx_auto_options.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
--- nginx/auto/options 2023-08-18 17:02:49.224080200 +0530
+++ nginx/auto/options 2023-09-14 18:47:11.483533400 +0530
@@ -151,6 +151,12 @@
USE_OPENSSL=NO
OPENSSL=NONE

+# Zimbra customizations start here: Implement SASL Authentication (Jira Tickets: )
+USE_SASL=NO
+SASL=NONE
+SASL_OPT=
+# Zimbra customizations end here
+
USE_ZLIB=NO
ZLIB=NONE
ZLIB_OPT=
@@ -292,6 +298,9 @@
--with-http_stub_status_module) HTTP_STUB_STATUS=YES ;;

--with-mail) MAIL=YES ;;
+ # Zimbra customizations start here: Implement SASL Authentication (Jira Tickets: )
+ --with-mail-sasl) MAIL_SASL=YES ;;
+ # Zimbra customizations end here
--with-mail=dynamic) MAIL=DYNAMIC ;;
--with-mail_ssl_module) MAIL_SSL=YES ;;
# STUB
@@ -363,6 +372,11 @@
--with-openssl=*) OPENSSL="$value" ;;
--with-openssl-opt=*) OPENSSL_OPT="$value" ;;

+ # Zimbra customizations start here: Implement SASL Authentication (Jira Tickets: )
+ --with-sasl=*) SASL="$value" ;;
+ --with-sasl-opt=*) SASL_OPT="$value" ;;
+ # Zimbra customizations end here
+
--with-md5=*)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-md5\" option is deprecated"
@@ -524,6 +538,9 @@
--without-http-cache disable HTTP cache

--with-mail enable POP3/IMAP4/SMTP proxy module
+ # Zimbra customizations start here: Implement SASL Authentication (Jira Tickets: )
+ --with-mail-sasl enable SASL support
+ # Zimbra customizations end here
--with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module
--with-mail_ssl_module enable ngx_mail_ssl_module
--without-mail_pop3_module disable ngx_mail_pop3_module
@@ -577,6 +594,10 @@
--with-pcre-jit build PCRE with JIT compilation support
--without-pcre2 do not use PCRE2 library

+ # Zimbra customizations start here: Implement SASL Authentication (Jira Tickets: )
+ --with-sasl=DIR set path to sasl library sources
+ --with-sasl-opt=OPTIONS set additional options for sasl building
+ # Zimbra customizations end
--with-zlib=DIR set path to zlib library sources
--with-zlib-opt=OPTIONS set additional build options for zlib
--with-zlib-asm=CPU use zlib assembler sources optimized
45 changes: 45 additions & 0 deletions thirdparty/nginx/patches/nginx_auto_sources.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--- nginx/auto/sources 2023-08-18 17:02:49.229066800 +0530
+++ nginx/auto/sources 2023-09-14 18:47:11.526404800 +0530
@@ -7,6 +7,7 @@

CORE_INCS="src/core"

+# Zimbra customizations start here: Adding Nginx memcache and zm_lookup module (Jira Tickets: )
CORE_DEPS="src/core/nginx.h \
src/core/ngx_config.h \
src/core/ngx_core.h \
@@ -39,6 +40,8 @@
src/core/ngx_module.h \
src/core/ngx_resolver.h \
src/core/ngx_open_file_cache.h \
+ src/core/ngx_memcache.h \
+ src/core/ngx_zm_lookup.h \
src/core/ngx_crypt.h \
src/core/ngx_proxy_protocol.h \
src/core/ngx_syslog.h"
@@ -76,10 +79,12 @@
src/core/ngx_module.c \
src/core/ngx_resolver.c \
src/core/ngx_open_file_cache.c \
+ src/core/ngx_memcache.c \
+ src/core/ngx_zm_lookup.c \
src/core/ngx_crypt.c \
src/core/ngx_proxy_protocol.c \
src/core/ngx_syslog.c"
-
+# Zimbra customizations end

EVENT_MODULES="ngx_events_module ngx_event_core_module"

@@ -127,6 +132,11 @@
FILE_AIO_SRCS="src/os/unix/ngx_file_aio_read.c"
LINUX_AIO_SRCS="src/os/unix/ngx_linux_aio_read.c"

+# Zimbra customizations start here: Adding Nginx memcache and zm_lookup module (Jira Tickets: )
+MEMCACHE_MODULE=ngx_memcache_module
+ZM_LOOKUP_MODULE=ngx_zm_lookup_module
+# Zimbra customizations end here
+
UNIX_INCS="$CORE_INCS $EVENT_INCS src/os/unix"

UNIX_DEPS="$CORE_DEPS $EVENT_DEPS \
Loading