From 4d7d1fa376b34509be71208941eabbd7279c8cd9 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 2 Sep 2023 10:37:59 -0700 Subject: [PATCH] build: don't directly use the .libs directory The build system should not directly use the .libs directory which is intended for internal use by the libtool implementation. Additionally when linking with internal a library the .la file should be used as this provides all the information required by the libtool implementation. When using Slibtool instead of GNU Libtool the build fails because Slibtool is more strict about this and fails to find the required files to link with. Gentoo Bug: https://bugs.gentoo.org/913484 --- examples/multiprocess_c/Makefile.am | 3 +-- examples/reading_logs_via_rule_message/Makefile.am | 3 +-- examples/reading_logs_with_offset/Makefile.am | 3 +-- examples/simple_example_using_c/Makefile.am | 3 +-- examples/using_bodies_in_chunks/Makefile.am | 3 +-- test/Makefile.am | 9 +++------ test/benchmark/Makefile.am | 3 +-- test/fuzzer/Makefile.am | 2 +- tools/rules-check/Makefile.am | 2 +- 9 files changed, 11 insertions(+), 20 deletions(-) diff --git a/examples/multiprocess_c/Makefile.am b/examples/multiprocess_c/Makefile.am index 85c264872..7738670c2 100644 --- a/examples/multiprocess_c/Makefile.am +++ b/examples/multiprocess_c/Makefile.am @@ -6,15 +6,14 @@ multi_SOURCES = \ multi.c multi_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(SSDEEP_LDADD) \ $(LUA_LDADD) \ $(MAXMIND_LDADD) \ $(GLOBAL_LDADD) multi_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ diff --git a/examples/reading_logs_via_rule_message/Makefile.am b/examples/reading_logs_via_rule_message/Makefile.am index 797ac752b..95bc9afd1 100644 --- a/examples/reading_logs_via_rule_message/Makefile.am +++ b/examples/reading_logs_via_rule_message/Makefile.am @@ -6,6 +6,7 @@ simple_request_SOURCES = \ simple_request.cc simple_request_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(GLOBAL_LDADD) \ @@ -18,9 +19,7 @@ simple_request_LDADD = \ $(YAJL_LDADD) simple_request_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ diff --git a/examples/reading_logs_with_offset/Makefile.am b/examples/reading_logs_with_offset/Makefile.am index b798c8c54..146146d23 100644 --- a/examples/reading_logs_with_offset/Makefile.am +++ b/examples/reading_logs_with_offset/Makefile.am @@ -6,6 +6,7 @@ read_SOURCES = \ read.cc read_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(MAXMIND_LDADD) \ @@ -18,9 +19,7 @@ read_LDADD = \ $(YAJL_LDADD) read_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ diff --git a/examples/simple_example_using_c/Makefile.am b/examples/simple_example_using_c/Makefile.am index b03ab96d4..6f1919459 100644 --- a/examples/simple_example_using_c/Makefile.am +++ b/examples/simple_example_using_c/Makefile.am @@ -6,14 +6,13 @@ test_SOURCES = \ test.c test_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(GLOBAL_LDADD) \ $(LUA_LDADD) \ $(SSDEEP_LDADD) test_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lm \ -lstdc++ \ $(LUA_LDFLAGS) \ diff --git a/examples/using_bodies_in_chunks/Makefile.am b/examples/using_bodies_in_chunks/Makefile.am index 799efe781..7cbf0253e 100644 --- a/examples/using_bodies_in_chunks/Makefile.am +++ b/examples/using_bodies_in_chunks/Makefile.am @@ -6,6 +6,7 @@ simple_request_SOURCES = \ simple_request.cc simple_request_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(MAXMIND_LDADD) \ @@ -18,9 +19,7 @@ simple_request_LDADD = \ $(YAJL_LDADD) simple_request_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ diff --git a/test/Makefile.am b/test/Makefile.am index 9237a8749..33675b1d7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -42,6 +42,7 @@ noinst_HEADERS = \ unit_tests_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(MAXMIND_LDADD) \ @@ -56,9 +57,7 @@ unit_tests_LDADD = \ unit_tests_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ @@ -98,6 +97,7 @@ regression_tests_SOURCES = \ regression/custom_debug_log.cc regression_tests_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(MAXMIND_LDADD) \ @@ -112,9 +112,7 @@ regression_tests_LDADD = \ regression_tests_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ @@ -153,6 +151,7 @@ rules_optimization_SOURCES = \ optimization/optimization.cc rules_optimization_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(MAXMIND_LDADD) \ @@ -166,9 +165,7 @@ rules_optimization_LDADD = \ $(YAJL_LDADD) rules_optimization_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ diff --git a/test/benchmark/Makefile.am b/test/benchmark/Makefile.am index 73a975b33..da7b3fbeb 100644 --- a/test/benchmark/Makefile.am +++ b/test/benchmark/Makefile.am @@ -6,6 +6,7 @@ benchmark_SOURCES = \ benchmark.cc benchmark_LDADD = \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(MAXMIND_LDADD) \ @@ -18,9 +19,7 @@ benchmark_LDADD = \ $(GLOBAL_LDADD) benchmark_LDFLAGS = \ - -L$(top_builddir)/src/.libs/ \ $(GEOIP_LDFLAGS) \ - -lmodsecurity \ -lpthread \ -lm \ -lstdc++ \ diff --git a/test/fuzzer/Makefile.am b/test/fuzzer/Makefile.am index d1fd08dc7..8d21af7c9 100644 --- a/test/fuzzer/Makefile.am +++ b/test/fuzzer/Makefile.am @@ -24,7 +24,7 @@ afl_fuzzer_LDADD = \ $(SSDEEP_LDFLAGS) $(SSDEEP_LDADD) \ $(LUA_LDFLAGS) $(LUA_LDADD) \ $(LIBXML2_LDADD) \ - $(top_builddir)/src/.libs/libmodsecurity.a \ + $(top_builddir)/src/libmodsecurity.la \ $(top_builddir)/others/libinjection.la \ $(top_builddir)/others/libmbedtls.la diff --git a/tools/rules-check/Makefile.am b/tools/rules-check/Makefile.am index 615d9598e..270c0cfc5 100644 --- a/tools/rules-check/Makefile.am +++ b/tools/rules-check/Makefile.am @@ -6,7 +6,7 @@ modsec_rules_check_SOURCES = \ rules-check.cc modsec_rules_check_LDADD = \ - $(top_builddir)/src/.libs/libmodsecurity.la \ + $(top_builddir)/src/libmodsecurity.la \ $(CURL_LDADD) \ $(GEOIP_LDADD) \ $(MAXMIND_LDADD) \