Skip to content

Commit

Permalink
build: don't directly use the .libs directory
Browse files Browse the repository at this point in the history
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
  • Loading branch information
orbea committed Feb 27, 2024
1 parent f474cc5 commit 56e0fc3
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 20 deletions.
3 changes: 1 addition & 2 deletions examples/multiprocess_c/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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++ \
Expand Down
3 changes: 1 addition & 2 deletions examples/reading_logs_via_rule_message/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ simple_request_SOURCES = \
simple_request.cc

simple_request_LDADD = \
$(top_builddir)/src/libmodsecurity.la \
$(CURL_LDADD) \
$(GEOIP_LDADD) \
$(GLOBAL_LDADD) \
Expand All @@ -18,9 +19,7 @@ simple_request_LDADD = \
$(YAJL_LDADD)

simple_request_LDFLAGS = \
-L$(top_builddir)/src/.libs/ \
$(GEOIP_LDFLAGS) \
-lmodsecurity \
-lpthread \
-lm \
-lstdc++ \
Expand Down
3 changes: 1 addition & 2 deletions examples/reading_logs_with_offset/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ read_SOURCES = \
read.cc

read_LDADD = \
$(top_builddir)/src/libmodsecurity.la \
$(CURL_LDADD) \
$(GEOIP_LDADD) \
$(MAXMIND_LDADD) \
Expand All @@ -18,9 +19,7 @@ read_LDADD = \
$(YAJL_LDADD)

read_LDFLAGS = \
-L$(top_builddir)/src/.libs/ \
$(GEOIP_LDFLAGS) \
-lmodsecurity \
-lpthread \
-lm \
-lstdc++ \
Expand Down
3 changes: 1 addition & 2 deletions examples/simple_example_using_c/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
3 changes: 1 addition & 2 deletions examples/using_bodies_in_chunks/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ simple_request_SOURCES = \
simple_request.cc

simple_request_LDADD = \
$(top_builddir)/src/libmodsecurity.la \
$(CURL_LDADD) \
$(GEOIP_LDADD) \
$(MAXMIND_LDADD) \
Expand All @@ -18,9 +19,7 @@ simple_request_LDADD = \
$(YAJL_LDADD)

simple_request_LDFLAGS = \
-L$(top_builddir)/src/.libs/ \
$(GEOIP_LDFLAGS) \
-lmodsecurity \
-lpthread \
-lm \
-lstdc++ \
Expand Down
9 changes: 3 additions & 6 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ noinst_HEADERS = \


unit_tests_LDADD = \
$(top_builddir)/src/libmodsecurity.la \
$(CURL_LDADD) \
$(GEOIP_LDADD) \
$(MAXMIND_LDADD) \
Expand All @@ -56,9 +57,7 @@ unit_tests_LDADD = \


unit_tests_LDFLAGS = \
-L$(top_builddir)/src/.libs/ \
$(GEOIP_LDFLAGS) \
-lmodsecurity \
-lpthread \
-lm \
-lstdc++ \
Expand Down Expand Up @@ -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) \
Expand All @@ -112,9 +112,7 @@ regression_tests_LDADD = \


regression_tests_LDFLAGS = \
-L$(top_builddir)/src/.libs/ \
$(GEOIP_LDFLAGS) \
-lmodsecurity \
-lpthread \
-lm \
-lstdc++ \
Expand Down Expand Up @@ -153,6 +151,7 @@ rules_optimization_SOURCES = \
optimization/optimization.cc

rules_optimization_LDADD = \
$(top_builddir)/src/libmodsecurity.la \
$(CURL_LDADD) \
$(GEOIP_LDADD) \
$(MAXMIND_LDADD) \
Expand All @@ -166,9 +165,7 @@ rules_optimization_LDADD = \
$(YAJL_LDADD)

rules_optimization_LDFLAGS = \
-L$(top_builddir)/src/.libs/ \
$(GEOIP_LDFLAGS) \
-lmodsecurity \
-lpthread \
-lm \
-lstdc++ \
Expand Down
3 changes: 1 addition & 2 deletions test/benchmark/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ benchmark_SOURCES = \
benchmark.cc

benchmark_LDADD = \
$(top_builddir)/src/libmodsecurity.la \
$(CURL_LDADD) \
$(GEOIP_LDADD) \
$(MAXMIND_LDADD) \
Expand All @@ -18,9 +19,7 @@ benchmark_LDADD = \
$(GLOBAL_LDADD)

benchmark_LDFLAGS = \
-L$(top_builddir)/src/.libs/ \
$(GEOIP_LDFLAGS) \
-lmodsecurity \
-lpthread \
-lm \
-lstdc++ \
Expand Down
2 changes: 1 addition & 1 deletion test/fuzzer/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tools/rules-check/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit 56e0fc3

Please sign in to comment.