From 0bcabf3208e0c840044b4f1df3ba6a74de2a2bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tilman=20Keskin=C3=B6z?= Date: Thu, 22 May 2025 18:59:51 +0200 Subject: [PATCH 1/4] buildfix for srcdir != builddir --- Makefile.am | 2 +- others/Makefile.am | 2 +- test/Makefile.am | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4468ba7154..7ac184b504 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,7 +63,7 @@ cppcheck: --enable=warning,style,performance,portability,unusedFunction,missingInclude \ --inconclusive \ --template="warning: {file},{line},{severity},{id},{message}" \ - -I headers -I . -I others -I src -I others/mbedtls/include \ + -I headers -I . -I $(top_srcdir)/others -I $(top_srcdir)/src -I $(top_srcdir)/others/mbedtls/include \ --error-exitcode=1 \ -i "src/parser/seclang-parser.cc" -i "src/parser/seclang-scanner.cc" \ -i others \ diff --git a/others/Makefile.am b/others/Makefile.am index 956c8d901d..b102a0330c 100644 --- a/others/Makefile.am +++ b/others/Makefile.am @@ -28,6 +28,6 @@ libmbedtls_la_SOURCES = \ mbedtls/library/sha1.c \ mbedtls/library/platform_util.c -libmbedtls_la_CFLAGS = -DMBEDTLS_CONFIG_FILE=\"mbedtls/mbedtls_config.h\" -Imbedtls/include +libmbedtls_la_CFLAGS = -DMBEDTLS_CONFIG_FILE=\"mbedtls/mbedtls_config.h\" -I$(top_srcdir)/others/mbedtls/include libmbedtls_la_CPPFLAGS = libmbedtls_la_LIBADD = diff --git a/test/Makefile.am b/test/Makefile.am index 2c1ba02a49..971d9739b6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -72,7 +72,7 @@ unit_tests_LDFLAGS = \ unit_tests_CPPFLAGS = \ -Icommon \ - -I../ \ + -I$(srcdir)/../ \ -g \ -I$(top_builddir)/headers \ $(CURL_CFLAGS) \ @@ -127,7 +127,7 @@ regression_tests_LDFLAGS = \ regression_tests_CPPFLAGS = \ -Icommon \ - -I../ \ + -I$(srcdir)../ \ -g \ -I$(top_builddir)/headers \ $(CURL_CFLAGS) \ @@ -179,7 +179,7 @@ rules_optimization_LDFLAGS = \ rules_optimization_CPPFLAGS = \ -Icommon \ - -I../ \ + -I$(srcdir)/../ \ -g \ -I$(top_builddir)/headers \ $(CURL_CFLAGS) \ From 0caf30679f1987ed8131c8e418440b7cc6f21e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tilman=20Keskin=C3=B6z?= Date: Thu, 22 May 2025 18:59:55 +0200 Subject: [PATCH 2/4] buildfix If libxml2 is in a non-default directory, it needs to be added to LDFLAGS --- tools/rules-check/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/rules-check/Makefile.am b/tools/rules-check/Makefile.am index c79a625671..8080411716 100644 --- a/tools/rules-check/Makefile.am +++ b/tools/rules-check/Makefile.am @@ -26,7 +26,8 @@ modsec_rules_check_LDFLAGS = \ $(LMDB_LDFLAGS) \ $(LUA_LDFLAGS) \ $(SSDEEP_LDFLAGS) \ - $(YAJL_LDFLAGS) + $(YAJL_LDFLAGS) \ + $(LIBXML2_LDFLAGS) modsec_rules_check_CPPFLAGS = \ -I$(top_builddir)/headers \ From 7660125da657f1137b8a6fc28b12d2bd296726ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tilman=20Keskin=C3=B6z?= Date: Thu, 22 May 2025 18:59:56 +0200 Subject: [PATCH 3/4] buildfix for srcdir != builddir automake doesn't support wildcards. See https://www.gnu.org/software/automake/manual/html_node/Wildcards.html for details. Use the GNU make $(wildcard ) extension. Note: this breaks with non-GNU make --- configure.ac | 2 +- src/Makefile.am | 39 ++++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 93addd7083..7a78bb6c76 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,7 @@ AC_PREFIX_DEFAULT([/usr/local/modsecurity]) # General automake options. -AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) +AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) # Check for dependencies (C++, AR, Lex, Yacc and Make) diff --git a/src/Makefile.am b/src/Makefile.am index 3fb4dc1f73..79cf12aa13 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -68,21 +68,21 @@ libmodsecurity_includesub_actions_HEADERS = \ noinst_HEADERS = \ - actions/*.h \ - actions/ctl/*.h \ - actions/data/*.h \ - actions/disruptive/*.h \ - actions/transformations/*.h \ - debug_log/*.h \ - audit_log/writer/*.h \ - collection/backend/*.h \ - operators/*.h \ - parser/*.h \ - request_body_processor/*.h \ - utils/*.h \ - variables/*.h \ - engine/*.h \ - *.h + $(wildcard actions/*.h) \ + $(wildcard actions/ctl/*.h) \ + $(wildcard actions/data/*.h) \ + $(wildcard actions/disruptive/*.h) \ + $(wildcard actions/transformations/*.h) \ + $(wildcard debug_log/*.h) \ + $(wildcard audit_log/writer/*.h) \ + $(wildcard collection/backend/*.h) \ + $(wildcard operators/*.h) \ + $(wildcard parser/*.h) \ + $(wildcard request_body_processor/*.h) \ + $(wildcard utils/*.h) \ + $(wildcard variables/*.h) \ + $(wildcard engine/*.h) \ + $(wildcard *.h) ENGINES = \ @@ -308,13 +308,14 @@ libmodsecurity_la_CFLAGS = libmodsecurity_la_CPPFLAGS = \ - -I.. \ + -I$(top_srcdir) \ + -I$(top_builddir) \ -g \ - -I../others \ - -I../others/mbedtls/include \ + -I$(top_srcdir)/others \ + -I$(top_srcdir)/others/mbedtls/include \ -fPIC \ -O3 \ - -I../headers \ + -I$(top_srcdir)/headers \ $(CURL_CFLAGS) \ $(GEOIP_CFLAGS) \ $(GLOBAL_CPPFLAGS) \ From de624f94603ba858c3e892d120da9a11ed938d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tilman=20Keskin=C3=B6z?= Date: Fri, 23 May 2025 10:28:38 +0200 Subject: [PATCH 4/4] Attempt to fix bogus change. Reported by: CI via Ervin Hegedus --- test/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index 971d9739b6..2e7e05d614 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -72,7 +72,7 @@ unit_tests_LDFLAGS = \ unit_tests_CPPFLAGS = \ -Icommon \ - -I$(srcdir)/../ \ + -I$(top_srcdir)/ \ -g \ -I$(top_builddir)/headers \ $(CURL_CFLAGS) \ @@ -127,7 +127,7 @@ regression_tests_LDFLAGS = \ regression_tests_CPPFLAGS = \ -Icommon \ - -I$(srcdir)../ \ + -I$(top_srcdir) \ -g \ -I$(top_builddir)/headers \ $(CURL_CFLAGS) \ @@ -179,7 +179,7 @@ rules_optimization_LDFLAGS = \ rules_optimization_CPPFLAGS = \ -Icommon \ - -I$(srcdir)/../ \ + -I$(top_srcdir)/ \ -g \ -I$(top_builddir)/headers \ $(CURL_CFLAGS) \