Module Name:    src
Committed By:   christos
Date:           Sun May  7 23:24:51 UTC 2023

Modified Files:
        src/share/mk: bsd.prog.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.341 -r1.342 src/share/mk/bsd.prog.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.prog.mk
diff -u src/share/mk/bsd.prog.mk:1.341 src/share/mk/bsd.prog.mk:1.342
--- src/share/mk/bsd.prog.mk:1.341	Wed Jul 13 23:48:49 2022
+++ src/share/mk/bsd.prog.mk	Sun May  7 19:24:51 2023
@@ -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									# }
 #

Reply via email to