Drop libcompat to simplify build deps and really fix #11

The original idea with libcompat was to keep as few objects as
possible for linking with libsyslog.  That in turn to prevent
a user of libsyslog from suddenly also getting strong binding
to symbols like strlcpy() from libsyslog, rather than their C
library of choice.

However, this caused strlcpy.c to be built as both .o and .lo
files, which in turn caused really bizarre build problems due
to bad DAG dependency.

This patch drops libcompat and instead marks all replacement APIs
as weak symbols, which a C library can override.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2020-01-16 22:16:51 +01:00
parent 43eee3d405
commit 84d70e63fc
4 changed files with 16 additions and 13 deletions
+1 -6
View File
@@ -28,7 +28,6 @@
bin_PROGRAMS =
sbin_PROGRAMS = syslogd
lib_LTLIBRARIES = libsyslog.la
noinst_LTLIBRARIES = libcompat.la
if ENABLE_LOGGER
bin_PROGRAMS += logger
@@ -48,10 +47,6 @@ logger_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600
logger_LDADD = $(LIBS) $(LIBOBJS)
logger_LDADD += libsyslog.la
# Convenience library for libsyslog instead of linking with $(LTLIBOBJS),
# which would pull in pidfile() and other (strong) symbols as well.
libcompat_la_SOURCES = ../lib/strlcpy.c ../lib/strlcat.c
pkgconfigdir = $(libdir)/pkgconfig
pkgincludedir = $(includedir)/syslog
pkgconfig_DATA = libsyslog.pc
@@ -59,4 +54,4 @@ pkginclude_HEADERS = syslog.h
libsyslog_la_SOURCES = syslog.c syslog.h compat.h
libsyslog_la_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600
libsyslog_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0:0:0
libsyslog_la_LIBADD = libcompat.la
libsyslog_la_LIBADD = $(LTLIBOJBS)