Configure libtls and nc(1) to statically link to libcrypto/ssl

An issue that Reyk Floeter noted while building a Debian package for
LibreSSL is that installing libtls along with OpenSSL causes linker
issues since it will often pick up the wrong libcrypto/libssl. This
change makes libtls statically link the object files it needs rather
than relying on the shared libraries, effectively making libtls
self-contained and able to be packaged independently.

This should make it possible for other projects that also use libtls to
be able to package support without requiring the target OS to ship
libcrypto / libssl from LibreSSL.

678278df55
This commit is contained in:
Brent Cook 2020-08-20 09:30:21 -05:00
parent 17c8816401
commit fe42a8011b
4 changed files with 8 additions and 10 deletions

View File

@ -12,9 +12,9 @@ endif
EXTRA_DIST = nc.1 EXTRA_DIST = nc.1
EXTRA_DIST += CMakeLists.txt EXTRA_DIST += CMakeLists.txt
nc_LDADD = $(abs_top_builddir)/crypto/libcrypto.la nc_LDFLAGS = $(abs_top_builddir)/crypto/.libs/libcompat.a
nc_LDADD += $(abs_top_builddir)/ssl/libssl.la
nc_LDADD += $(abs_top_builddir)/tls/libtls.la nc_LDADD = $(abs_top_builddir)/tls/libtls.la
nc_LDADD += $(PLATFORM_LDADD) $(PROG_LDADD) nc_LDADD += $(PLATFORM_LDADD) $(PROG_LDADD)
AM_CPPFLAGS += -I$(top_srcdir)/apps/nc/compat AM_CPPFLAGS += -I$(top_srcdir)/apps/nc/compat

View File

@ -29,8 +29,7 @@ USER_CFLAGS="$CFLAGS"
AC_PROG_CC([cc gcc]) AC_PROG_CC([cc gcc])
AC_PROG_CC_STDC AC_PROG_CC_STDC
AM_PROG_CC_C_O AM_PROG_CC_C_O
AC_PROG_LIBTOOL LT_INIT([pic-only])
LT_INIT
CHECK_OS_OPTIONS CHECK_OS_OPTIONS

View File

@ -9,8 +9,7 @@ Name: LibreSSL-libtls
Description: Secure communications using the TLS socket protocol. Description: Secure communications using the TLS socket protocol.
Version: @VERSION@ Version: @VERSION@
Requires: Requires:
Requires.private: libcrypto libssl
Conflicts: Conflicts:
Libs: -L${libdir} -ltls Libs: -L${libdir} -ltls
Libs.private: @LIBS@ -lcrypto -lssl @PLATFORM_LDADD@ Libs.private: @LIBS@ @PLATFORM_LDADD@
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -7,9 +7,9 @@ EXTRA_DIST += CMakeLists.txt
EXTRA_DIST += tls.sym EXTRA_DIST += tls.sym
libtls_la_LDFLAGS = -version-info @LIBTLS_VERSION@ -no-undefined -export-symbols $(top_srcdir)/tls/tls.sym libtls_la_LDFLAGS = -version-info @LIBTLS_VERSION@ -no-undefined -export-symbols $(top_srcdir)/tls/tls.sym
libtls_la_LIBADD = $(abs_top_builddir)/ssl/libssl.la libtls_la_LDFLAGS += $(abs_top_builddir)/ssl/.libs/libssl.a
libtls_la_LIBADD += $(abs_top_builddir)/crypto/libcrypto.la libtls_la_LDFLAGS += $(abs_top_builddir)/crypto/.libs/libcrypto.a
libtls_la_LIBADD += $(PLATFORM_LDADD) libtls_la_LIBADD = $(PLATFORM_LDADD)
libtls_la_CPPFLAGS = $(AM_CPPFLAGS) libtls_la_CPPFLAGS = $(AM_CPPFLAGS)
if OPENSSLDIR_DEFINED if OPENSSLDIR_DEFINED