modsecurity: 2.9.0 -> 2.9.2

* Enable building on macOS
* also fixes an issue where a system Lua install fooled the configure
script into thinking it was enabled.
This commit is contained in:
Eli Flanagan 2017-10-12 08:37:50 -04:00
parent 5a8f9a8b6c
commit 90594b8f52
2 changed files with 44 additions and 19 deletions

View File

@ -0,0 +1,17 @@
--- a/apache2/Makefile.in 2017-10-10 09:45:51.000000000 -0400
+++ b/apache2/Makefile.in 2017-10-10 09:46:04.000000000 -0400
@@ -1208,14 +1208,12 @@
@LINUX_TRUE@ for m in $(pkglib_LTLIBRARIES); do \
@LINUX_TRUE@ base=`echo $$m | sed 's/\..*//'`; \
@LINUX_TRUE@ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \
-@LINUX_TRUE@ install -D -m444 $(DESTDIR)$(pkglibdir)/$$base.so $(DESTDIR)$(APXS_MODULES)/$$base.so; \
@LINUX_TRUE@ done
@LINUX_FALSE@install-exec-hook: $(pkglib_LTLIBRARIES)
@LINUX_FALSE@ @echo "Removing unused static libraries..."; \
@LINUX_FALSE@ for m in $(pkglib_LTLIBRARIES); do \
@LINUX_FALSE@ base=`echo $$m | sed 's/\..*//'`; \
@LINUX_FALSE@ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \
-@LINUX_FALSE@ cp -p $(DESTDIR)$(pkglibdir)/$$base.so $(DESTDIR)$(APXS_MODULES); \
@LINUX_FALSE@ done
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -1,35 +1,43 @@
{ stdenv, lib, fetchurl, pkgconfig { stdenv, lib, fetchurl, pkgconfig
, curl, apacheHttpd, pcre, apr, aprutil, libxml2 }: , curl, apacheHttpd, pcre, apr, aprutil, libxml2
, luaSupport ? false, lua5
}:
with lib; with lib;
let luaValue = if luaSupport then lua5 else "no";
optional = stdenv.lib.optional;
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "modsecurity-${version}"; name = "modsecurity-${version}";
version = "2.9.0"; version = "2.9.2";
src = fetchurl { src = fetchurl {
url = "https://www.modsecurity.org/tarball/${version}/${name}.tar.gz"; url = "https://www.modsecurity.org/tarball/${version}/${name}.tar.gz";
sha256 = "e2bbf789966c1f80094d88d9085a81bde082b2054f8e38e0db571ca49208f434"; sha256 = "41a8f73476ec891f3a9e8736b98b64ea5c2105f1ce15ea57a1f05b4bf2ffaeb5";
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ curl apacheHttpd pcre apr aprutil libxml2 ]; buildInputs = [ curl apacheHttpd pcre apr aprutil libxml2 ] ++
configureFlags = [ optional luaSupport lua5;
"--enable-standalone-module"
"--enable-static" configureFlags = ''
"--with-curl=${curl.dev}" --enable-standalone-module
"--with-apxs=${apacheHttpd.dev}/bin/apxs" --enable-static
"--with-pcre=${pcre.dev}" --with-curl=${curl.dev}
"--with-apr=${apr.dev}" --with-apxs=${apacheHttpd.dev}/bin/apxs
"--with-apu=${aprutil.dev}/bin/apu-1-config" --with-pcre=${pcre.dev}
"--with-libxml=${libxml2.dev}" --with-apr=${apr.dev}
]; --with-apu=${aprutil.dev}/bin/apu-1-config
--with-libxml=${libxml2.dev}
--with-lua=${luaValue}
'';
outputs = ["out" "nginx"]; outputs = ["out" "nginx"];
# by default modsecurity's install script copies compiled output to httpd's modules folder
preBuild = '' # this patch removes those lines
substituteInPlace apache2/Makefile.in --replace "install -D " "# install -D" patches = [ ./Makefile.in.patch ];
'';
postInstall = '' postInstall = ''
mkdir -p $nginx mkdir -p $nginx
@ -41,6 +49,6 @@ stdenv.mkDerivation rec {
license = licenses.asl20; license = licenses.asl20;
homepage = https://www.modsecurity.org/; homepage = https://www.modsecurity.org/;
maintainers = with maintainers; [offline]; maintainers = with maintainers; [offline];
platforms = platforms.linux; platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
}; };
} }