Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Aug 2018 10:16:03 +0000 (UTC)
From:      Ganael LAPLANCHE <martymac@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r478188 - head/ftp/lftp
Message-ID:  <201808271016.w7RAG3Vi094078@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: martymac
Date: Mon Aug 27 10:16:03 2018
New Revision: 478188
URL: https://svnweb.freebsd.org/changeset/ports/478188

Log:
  Fix build when selected SSL library is linked to libthr
  
  When a non-default SSL library is used (GnuTLS, OpenSSL or LibreSSL from
  ports) and if it is linked to libthr, compilation fails with the following
  error :
  
  /usr/bin/ld: undefined reference to symbol `pthread_mutexattr_gettype@@FBSD_1.0' (try adding -lthr)
  //lib/libthr.so.3: could not read symbols: Bad value
  
  As OpenSSL-like ports (OpenSSL from base, OpenSSL and OpenSSL-devel from ports,
  LibreSSL and LibreSSL-devel from ports) may or may not be linked to libthr, fix
  build by detecting if the selected library is linked to libthr or not.
  
  PR:		230813
  Submitted by:	Pascal Christen <pascal.christen@hostpoint.ch>

Modified:
  head/ftp/lftp/Makefile

Modified: head/ftp/lftp/Makefile
==============================================================================
--- head/ftp/lftp/Makefile	Mon Aug 27 10:05:44 2018	(r478187)
+++ head/ftp/lftp/Makefile	Mon Aug 27 10:16:03 2018	(r478188)
@@ -56,6 +56,20 @@ post-install-DOCS-on:
 
 .include <bsd.port.pre.mk>
 
+# Only link to libthr if necessary
+.if ${PORT_OPTIONS:MGNUTLS}
+NEED_PTHREAD=	yes
+.else
+.if exists(${OPENSSLLIB}/libssl.so)
+NEED_PTHREAD!=	ldd ${OPENSSLLIB}/libssl.so | ${GREP} -w 'libthr\.so' || ${ECHO_CMD}
+.else
+NEED_PTHREAD=	# empty
+.endif
+.endif
+.if !empty(NEED_PTHREAD)
+LDFLAGS+=	-pthread
+.endif
+
 .if ${ARCH} == powerpc64
 USE_GCC=	yes
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808271016.w7RAG3Vi094078>