Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Provide a hook to link in libraries statically in P...



details:   https://anonhg.NetBSD.org/src/rev/53fd1d3a81bc
branches:  trunk
changeset: 374610:53fd1d3a81bc
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 07 23:24:51 2023 +0000

description:
Provide a hook to link in libraries statically in PROGDPLIBS.
OpenSSL protects the symbols in the shared object via a linker
script, but programs and tests need those protected symbols, so
they either must link against the archive, or I need to expose the
symbols. For now, I chose to expose the symbols.  Note that we
cannot use -Bstatic -Lpath -llibrary -Bdynamic because this seems
to be broken with collect2 and so we use the path directly.

diffstat:

 share/mk/bsd.prog.mk |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 7a8ca1087a77 -r 53fd1d3a81bc share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk      Sun May 07 20:06:17 2023 +0000
+++ b/share/mk/bsd.prog.mk      Sun May 07 23:24:51 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.prog.mk,v 1.341 2022/07/14 03:48:49 mrg Exp $
+#      $NetBSD: bsd.prog.mk,v 1.342 2023/05/07 23:24:51 christos Exp $
 #      @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
 
 .ifndef HOSTPROG
@@ -404,7 +404,11 @@ PROGS=             ${PROG}
 PROGDO.${_lib}!=       cd "${_dir}" && ${PRINTOBJDIR}
 .MAKEOVERRIDES+=PROGDO.${_lib}
 .endif
-LDADD+=                -L${PROGDO.${_lib}} -l${_lib}
+.if defined(PROGDPLIBSSTATIC)
+DPADD+=                ${PROGDO.${_lib}}/lib${_lib}.a
+LDADD+=                ${PROGDO.${_lib}}/lib${_lib}.a
+.else
+LDADD+=                ${PROGDPLIBBEGIN} -L${PROGDO.${_lib}} -l${_lib} ${PROGDPLIBEND}
 .if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a)
 DPADD+=                ${PROGDO.${_lib}}/lib${_lib}_pic.a
 .elif exists(${PROGDO.${_lib}}/lib${_lib}.so)
@@ -412,6 +416,7 @@ DPADD+=             ${PROGDO.${_lib}}/lib${_lib}.so
 .else
 DPADD+=                ${PROGDO.${_lib}}/lib${_lib}.a
 .endif
+.endif
 .endfor
 .endif                                                                 # }
 #



Home | Main Index | Thread Index | Old Index