nginx-module-modsecurity: added support for older libmaxminddb versions.

The v3.0.5 version of libmodsecurity requires at least libmaxminddb 1.4.x,
while a number of still supported platforms such as Ubuntu 18.04 "bionic",
Debian 10 "buster", or RHEL/CentOS 7/8 have quite outdated versions.

See https://github.com/SpiderLabs/ModSecurity/issues/2254 for details.
diff --git a/contrib/src/modsecurity/Makefile b/contrib/src/modsecurity/Makefile
index 374cb7d..9ed4583 100644
--- a/contrib/src/modsecurity/Makefile
+++ b/contrib/src/modsecurity/Makefile
@@ -19,6 +19,7 @@
 
 modsecurity: modsecurity-v$(MODSECURITY_VERSION).tar.gz .sum-modsecurity
 	$(UNPACK)
+	$(APPLY) $(SRC)/modsecurity/older-libmaxminddb-compatibility.patch
 	$(MOVE)
 
 .modsecurity: modsecurity
diff --git a/contrib/src/modsecurity/older-libmaxminddb-compatibility.patch b/contrib/src/modsecurity/older-libmaxminddb-compatibility.patch
new file mode 100644
index 0000000..58a67be
--- /dev/null
+++ b/contrib/src/modsecurity/older-libmaxminddb-compatibility.patch
@@ -0,0 +1,24 @@
+# see https://github.com/SpiderLabs/ModSecurity/issues/2254
+--- a/src/utils/geo_lookup.h	2021-08-16 13:53:16.361372841 +0000
++++ b/src/utils/geo_lookup.h	2021-08-16 13:53:51.209561652 +0000
+@@ -50,7 +50,7 @@
+     void cleanUp();
+ 
+     bool lookup(const std::string& target, Transaction *transaction,
+-        std::function<bool(int, const std::string &)> debug) const;
++        std::function<bool(int, const std::string &)> debug);
+ 
+  private:
+     GeoLookup() :
+--- a/src/utils/geo_lookup.cc	2021-08-16 13:53:22.615406728 +0000
++++ b/src/utils/geo_lookup.cc	2021-08-16 13:54:15.959695749 +0000
+@@ -113,7 +113,7 @@
+ 
+ 
+ bool GeoLookup::lookup(const std::string& target, Transaction *trans,
+-    std::function<bool(int, const std::string &)> debug) const {
++    std::function<bool(int, const std::string &)> debug) {
+ 
+     if (m_version == NOT_LOADED) {
+         if (debug) {
+
diff --git a/debian/Makefile.module-modsecurity b/debian/Makefile.module-modsecurity
index 9ef1732..17ebfa4 100644
--- a/debian/Makefile.module-modsecurity
+++ b/debian/Makefile.module-modsecurity
@@ -14,6 +14,8 @@
 MODULE_SOURCES_modsecurity=	modsecurity-v$(MODSECURITY_VERSION).tar.gz \
 				modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz
 
+MODULE_PATCHES_modsecurity=	$(CONTRIB)/src/modsecurity/older-libmaxminddb-compatibility.patch
+
 MODULE_CONFARGS_modsecurity=	--add-dynamic-module=$(MODSRC_PREFIX)modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)
 
 .deps-module-modsecurity:
diff --git a/rpm/SPECS/Makefile.module-modsecurity b/rpm/SPECS/Makefile.module-modsecurity
index bf4674a..4b5bad0 100644
--- a/rpm/SPECS/Makefile.module-modsecurity
+++ b/rpm/SPECS/Makefile.module-modsecurity
@@ -14,6 +14,8 @@
 MODULE_SOURCES_modsecurity=	modsecurity-v$(MODSECURITY_VERSION).tar.gz \
 				modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz
 
+MODULE_PATCHES_modsecurity=	$(CONTRIB)/src/modsecurity/older-libmaxminddb-compatibility.patch
+
 MODULE_CONFARGS_modsecurity=	--add-dynamic-module=modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)
 
 .deps-module-modsecurity: