libmodsecurity: migrate to pcre2

This commit is contained in:
Izorkin
2026-06-18 21:37:00 +03:00
parent 7e2d2fc2f9
commit f71782a90c
+9 -27
View File
@@ -12,7 +12,6 @@
libxml2,
lmdb,
lua,
pcre,
pcre2,
ssdeep,
yajl,
@@ -37,6 +36,7 @@ stdenv.mkDerivation (finalAttrs: {
flex
pkg-config
];
buildInputs = [
curl
geoip
@@ -44,7 +44,6 @@ stdenv.mkDerivation (finalAttrs: {
libxml2
lmdb
lua
pcre
pcre2
ssdeep
yajl
@@ -58,34 +57,15 @@ stdenv.mkDerivation (finalAttrs: {
configureFlags = [
"--enable-parser-generation"
"--disable-doxygen-doc"
"--with-curl=${curl.dev}"
"--with-libxml=${libxml2.dev}"
"--with-lmdb=${lmdb.out}"
"--with-maxmind=${libmaxminddb}"
"--with-pcre=${pcre.dev}"
"--with-pcre2=${pcre2.out}"
"--disable-examples"
"--with-lmdb=${lmdb}"
"--with-ssdeep=${ssdeep}"
];
postPatch = ''
substituteInPlace build/lmdb.m4 \
--replace "\''${path}/include/lmdb.h" "${lmdb.dev}/include/lmdb.h" \
--replace "lmdb_inc_path=\"\''${path}/include\"" "lmdb_inc_path=\"${lmdb.dev}/include\""
substituteInPlace build/pcre2.m4 \
--replace "/usr/local/pcre2" "${pcre2.out}/lib" \
--replace "\''${path}/include/pcre2.h" "${pcre2.dev}/include/pcre2.h" \
--replace "pcre2_inc_path=\"\''${path}/include\"" "pcre2_inc_path=\"${pcre2.dev}/include\""
substituteInPlace build/ssdeep.m4 \
--replace "/usr/local/libfuzzy" "${ssdeep}/lib" \
--replace "\''${path}/include/fuzzy.h" "${ssdeep}/include/fuzzy.h" \
--replace "ssdeep_inc_path=\"\''${path}/include\"" "ssdeep_inc_path=\"${ssdeep}/include\""
substituteInPlace modsecurity.conf-recommended \
--replace "SecUnicodeMapFile unicode.mapping 20127" "SecUnicodeMapFile $out/share/modsecurity/unicode.mapping 20127"
# https://github.com/owasp-modsecurity/ModSecurity/blob/v3.0.15/build.sh#L6-L25
cd src
echo "noinst_HEADERS = \\" > headers.mk
ls -1 \
echo "noinst_HEADERS = \\" > ./src/headers.mk
ls -1 ./src/ \
actions/*.h \
actions/ctl/*.h \
actions/data/*.h \
@@ -100,8 +80,10 @@ stdenv.mkDerivation (finalAttrs: {
utils/*.h \
variables/*.h \
engine/*.h \
*.h | tr "\012" " " >> headers.mk
cd ../
*.h | tr "\012" " " >> ./src/headers.mk
substituteInPlace modsecurity.conf-recommended \
--replace-fail "SecUnicodeMapFile unicode.mapping 20127" "SecUnicodeMapFile $out/share/modsecurity/unicode.mapping 20127"
'';
postInstall = ''