From 5bb58b8e607f2c13e160eedbbc974650b2bacf80 Mon Sep 17 00:00:00 2001 From: Paolino Date: Mon, 17 Jul 2023 17:32:10 +0200 Subject: [PATCH] Adding PCRE2 support for windows build in Makefile.win Including new parameter PCRE2, which if set will enable PCRE2 in the build. --- apache2/Makefile.win | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/apache2/Makefile.win b/apache2/Makefile.win index ed4bfc9e..9efa74f8 100644 --- a/apache2/Makefile.win +++ b/apache2/Makefile.win @@ -1,29 +1,37 @@ ########################################################################### # -# Usage: NMAKE -f Makefile.win APACHE={httpd installion dir} PCRE={pcre dir} LIBXML2={LibXML2 dir} [ LUA={Lua dir} ] +# Usage: NMAKE -f Makefile.win APACHE={httpd installion dir} PCRE|PCRE2={pcre dir} LIBXML2={LibXML2 dir} [ LUA={Lua dir} ] # +!IF "$(PCRE2)" != "" +PCRE = $(PCRE2) +!ENDIF + !IF "$(APACHE)" == "" || "$(PCRE)" == "" || "$(LIBXML2)" == "" || "$(CURL)" == "" -!ERROR NMAKE arguments: APACHE=dir PCRE=dir LIBXML2=dir CURL=dir are required to build mod_security2 for Windows +!ERROR NMAKE arguments: APACHE=dir PCRE|PCRE2=dir LIBXML2=dir CURL=dir are required to build mod_security2 for Windows !ENDIF # Linking libraries LIBS = $(APACHE)\lib\libhttpd.lib \ $(APACHE)\lib\libapr-1.lib \ $(APACHE)\lib\libaprutil-1.lib \ - $(PCRE)\pcre.lib \ - $(CURL)\libcurl.lib \ + $(CURL)\libcurl.lib \ $(LIBXML2)\win32\bin.msvc\libxml2.lib \ Ws2_32.lib \ "iphlpapi.lib" +!IF "$(PCRE2)" != "" +LIBS =$(LIBS) $(PCRE2)\lib\pcre2-8.lib +!ELSE +LIBS =$(LIBS) $(PCRE)\lib\pcre.lib +!ENDIF ########################################################################### ########################################################################### - -!IF "$(IIS_BUILD)" == "yes" -DEFS=$(DEFS) -DVERSION_IIS -!ENDIF - + +!IF "$(IIS_BUILD)" == "yes" +DEFS=$(DEFS) -DVERSION_IIS +!ENDIF + CC = CL MT = mt @@ -37,9 +45,14 @@ INCLUDES = -I. -I.. \ -I$(PCRE)\include -I$(PCRE) \ -I$(LIBXML2)\include \ -I$(APACHE)\include - -# Enables support for SecRemoteRules and external resources. -DEFS=$(DEFS) -DWITH_CURL -DWITH_REMOTE_RULES + +# Enables support for SecRemoteRules and external resources. +DEFS=$(DEFS) -DWITH_CURL -DWITH_REMOTE_RULES + +# Enable PCRE2 +!IF "$(PCRE2)" != "" +DEFS =$(DEFS) -DWITH_PCRE2 +!ENDIF # Lua is optional !IF "$(LUA)" != "" @@ -65,8 +78,8 @@ OBJS = mod_security2.obj apache2_config.obj apache2_io.obj apache2_util.obj \ msc_parsers.obj msc_util.obj msc_pcre.obj persist_dbm.obj \ msc_reqbody.obj msc_geo.obj msc_gsb.obj msc_crypt.obj msc_tree.obj msc_unicode.obj acmp.obj msc_lua.obj \ msc_release.obj \ - msc_status_engine.obj \ - msc_remote_rules.obj \ + msc_status_engine.obj \ + msc_remote_rules.obj \ msc_json.obj \ libinjection/libinjection_html5.obj \ libinjection/libinjection_sqli.obj \