Module Name:    src
Committed By:   martin
Date:           Fri Sep  8 09:03:54 UTC 2023

Modified Files:
        src/crypto/external/bsd/heimdal/lib [netbsd-10]: Makefile
        src/crypto/external/bsd/netpgp/lib [netbsd-10]: Makefile
        src/external/bsd/atf/lib [netbsd-10]: Makefile
        src/external/bsd/elftoolchain/lib [netbsd-10]: Makefile
        src/external/bsd/libevent/lib [netbsd-10]: Makefile
        src/external/bsd/openldap/lib [netbsd-10]: Makefile
        src/lib [netbsd-10]: Makefile
Added Files:
        src/crypto/external/bsd/heimdal/lib [netbsd-10]: Makefile.subdir
        src/crypto/external/bsd/netpgp/lib [netbsd-10]: Makefile.subdir
        src/external/bsd/atf/lib [netbsd-10]: Makefile.subdir
        src/external/bsd/elftoolchain/lib [netbsd-10]: Makefile.subdir
        src/external/bsd/libevent/lib [netbsd-10]: Makefile.subdir
        src/external/bsd/openldap/lib [netbsd-10]: Makefile.subdir

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #356):

        external/bsd/libevent/lib/Makefile: revision 1.5
        external/bsd/libevent/lib/Makefile.subdir: revision 1.1
        crypto/external/bsd/heimdal/lib/Makefile: revision 1.3
        lib/Makefile: revision 1.297
        external/bsd/openldap/lib/Makefile.subdir: revision 1.1
        crypto/external/bsd/netpgp/lib/Makefile.subdir: revision 1.1
        crypto/external/bsd/heimdal/lib/Makefile.subdir: revision 1.1
        external/bsd/elftoolchain/lib/Makefile: revision 1.3
        external/bsd/atf/lib/Makefile: revision 1.3
        external/bsd/openldap/lib/Makefile: revision 1.3
        external/bsd/atf/lib/Makefile.subdir: revision 1.1
        crypto/external/bsd/netpgp/lib/Makefile: revision 1.18
        external/bsd/elftoolchain/lib/Makefile.subdir: revision 1.1

lib: Handle various external lib directories with build_install.
This way, update builds track shlib major bumps correctly.

For example, suppose you had built Heimdal's libkrb5.so.27 and
libgssapi.so.11 linked against it, and then you updated past the recent
shlib major bump raising them to libkrb5.so.28 and libgssapi.so.12.

Without this change, the build will make the following sequence of
targets (interleaved with some others):
1. make dependall in libkrb5
2. make dependall in libgssapi
3. make install in libkrb5
4. make install in libgssapi

The existing .WAIT tags in SUBDIR ensure that (1) happens before (2)
and (3) happens before (4).  Unfortunately, this sequence is wrong,
because it will produce the following effect:
1. make dependall in libkrb5 builds libkrb5.so.28
2. make dependall in libgssapi builds libgssapi.so.12, linked against
   libkrb5.so.27
3. make install in libkrb5 installs libkrb5.so.28
4. make install in libgssapi installs libgssapi.so.12

Why the out-of-date libkrb5.so.27 in step (2)?  Because we just pass
-L${DESTDIR}/usr/lib -lkrb5 to the linker (or the equivalent with
--sysroot and implied -L/usr/lib), and ${DESTDIR}/usr/lib still has
only libkrb5.so.27 by the time of step (2), not libkrb5.so.28.

Now any applications that link against libkrb5.so _and_ libgssapi.so
will get libkrb5.so.28 and libgssapi.so.12 -- but transitively, via
libgssapi.so.12, they will also get libkrb5.so.27, which is a recipe
for disaster.

Splicing the Heimdal library subdirectories into lib/Makefile, as
this does, ensures that we run make dependall _and_ make install in
libkrb5 _before_ make dependall in libgssapi, giving the following
correct sequence:
1. make dependall in libkrb5 builds libkrb5.so.28
2. make install in libkrb5 installs libkrb5.so.28
3. make dependall in libgssapi builds libgssapi.so.12, linked against
   libkrb5.so.28
4. make install in libgssapi installs libgssapi.so.12

Note that LIBDPLIBS isn't enough here, as implemented.  LIBDPLIBS
ensures that the incremental build will remake libgssapi.so.  But it
doesn't ensure that the new libkrb5.so.28 is available before then,
so it doesn't prevent this problem.

We use the same mechanism for crypto/external/bsd/openssl/lib
already; this just extends it to other external library collections.

As an alternative, in principle perhaps we could teach LIBDPLIBS to
ensure that libkrb5.so comes out of the libkrb5 objdir, and not out
of ${DESTDIR}/usr/lib.  But that requires some work to make happen,
and make it reliable, whereas this approach we've already confirmed
works without other adverse consequences (besides leaving
grody-looking mechanism lying around) for the libcrypto major bump
already.  We need to get this pulled up to the branch so all the
other major bumps it required are handled correctly by update builds.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.56.1 src/crypto/external/bsd/heimdal/lib/Makefile
cvs rdiff -u -r0 -r1.1.2.2 \
    src/crypto/external/bsd/heimdal/lib/Makefile.subdir
cvs rdiff -u -r1.17 -r1.17.26.1 src/crypto/external/bsd/netpgp/lib/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/crypto/external/bsd/netpgp/lib/Makefile.subdir
cvs rdiff -u -r1.2 -r1.2.36.1 src/external/bsd/atf/lib/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/external/bsd/atf/lib/Makefile.subdir
cvs rdiff -u -r1.2 -r1.2.6.1 src/external/bsd/elftoolchain/lib/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/external/bsd/elftoolchain/lib/Makefile.subdir
cvs rdiff -u -r1.4 -r1.4.20.1 src/external/bsd/libevent/lib/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/external/bsd/libevent/lib/Makefile.subdir
cvs rdiff -u -r1.2 -r1.2.2.1 src/external/bsd/openldap/lib/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/external/bsd/openldap/lib/Makefile.subdir
cvs rdiff -u -r1.294.2.1 -r1.294.2.2 src/lib/Makefile

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

Modified files:

Index: src/crypto/external/bsd/heimdal/lib/Makefile
diff -u src/crypto/external/bsd/heimdal/lib/Makefile:1.2 src/crypto/external/bsd/heimdal/lib/Makefile:1.2.56.1
--- src/crypto/external/bsd/heimdal/lib/Makefile:1.2	Wed May 25 19:21:17 2011
+++ src/crypto/external/bsd/heimdal/lib/Makefile	Fri Sep  8 09:03:53 2023
@@ -1,34 +1,9 @@
-# $NetBSD: Makefile,v 1.2 2011/05/25 19:21:17 he Exp $
+# $NetBSD: Makefile,v 1.2.56.1 2023/09/08 09:03:53 martin Exp $
 
 .include "bsd.own.mk"
 
 HEIMBASE=${.CURDIR}/..
 
-.if (${MKKERBEROS} != "no")
-SUBDIR = \
-	libheimbase	\
-	libcom_err	\
-	libroken	\
-	libvers		\
-	.WAIT		\
-	libsl		\
-	.WAIT		\
-	libasn1		\
-	libwind		\
-	.WAIT		\
-	libhx509	\
-	.WAIT		\
-	libkrb5		\
-	.WAIT		\
-	libhdb		\
-	libkafs		\
-	libheimntlm	\
-	.WAIT		\
-	libkdc		\
-	libgssapi	\
-	libkadm5srv	\
-	libkadm5clnt
-
-.endif	# MKKERBEROS != no
+.include "Makefile.subdir"
 
 .include <bsd.subdir.mk>

Index: src/crypto/external/bsd/netpgp/lib/Makefile
diff -u src/crypto/external/bsd/netpgp/lib/Makefile:1.17 src/crypto/external/bsd/netpgp/lib/Makefile:1.17.26.1
--- src/crypto/external/bsd/netpgp/lib/Makefile:1.17	Fri Dec  5 04:52:02 2014
+++ src/crypto/external/bsd/netpgp/lib/Makefile	Fri Sep  8 09:03:54 2023
@@ -1,6 +1,5 @@
-#	$NetBSD: Makefile,v 1.17 2014/12/05 04:52:02 agc Exp $
+#	$NetBSD: Makefile,v 1.17.26.1 2023/09/08 09:03:54 martin Exp $
 
-SUBDIR+=	netpgp .WAIT
-SUBDIR+=	verify
+.include "Makefile.subdir"
 
 .include <bsd.subdir.mk>

Index: src/external/bsd/atf/lib/Makefile
diff -u src/external/bsd/atf/lib/Makefile:1.2 src/external/bsd/atf/lib/Makefile:1.2.36.1
--- src/external/bsd/atf/lib/Makefile:1.2	Sat Feb  8 19:15:33 2014
+++ src/external/bsd/atf/lib/Makefile	Fri Sep  8 09:03:54 2023
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile,v 1.2 2014/02/08 19:15:33 jmmv Exp $
+# $NetBSD: Makefile,v 1.2.36.1 2023/09/08 09:03:54 martin Exp $
 
-SUBDIR= libatf-c .WAIT libatf-c++ tools
+.include "Makefile.subdir"
 
 .include <bsd.subdir.mk>

Index: src/external/bsd/elftoolchain/lib/Makefile
diff -u src/external/bsd/elftoolchain/lib/Makefile:1.2 src/external/bsd/elftoolchain/lib/Makefile:1.2.6.1
--- src/external/bsd/elftoolchain/lib/Makefile:1.2	Wed Apr  7 20:31:16 2021
+++ src/external/bsd/elftoolchain/lib/Makefile	Fri Sep  8 09:03:54 2023
@@ -1,6 +1,5 @@
-#	$NetBSD: Makefile,v 1.2 2021/04/07 20:31:16 jkoshy Exp $
-SUBDIR=		libelf
-SUBDIR+=	.WAIT		# Process 'libelf' before 'libdwarf'.
-SUBDIR+=	libdwarf
+#	$NetBSD: Makefile,v 1.2.6.1 2023/09/08 09:03:54 martin Exp $
+
+.include "Makefile.subdir"
 
 .include <bsd.subdir.mk>

Index: src/external/bsd/libevent/lib/Makefile
diff -u src/external/bsd/libevent/lib/Makefile:1.4 src/external/bsd/libevent/lib/Makefile:1.4.20.1
--- src/external/bsd/libevent/lib/Makefile:1.4	Sun May 21 15:28:39 2017
+++ src/external/bsd/libevent/lib/Makefile	Fri Sep  8 09:03:53 2023
@@ -1,8 +1,5 @@
-#	$NetBSD: Makefile,v 1.4 2017/05/21 15:28:39 riastradh Exp $
-.include <bsd.own.mk>
+#	$NetBSD: Makefile,v 1.4.20.1 2023/09/08 09:03:53 martin Exp $
 
-SUBDIR=	 libevent .WAIT
-SUBDIR+=	libevent_openssl
-SUBDIR+= libevent_pthreads
+.include "Makefile.subdir"
 
 .include <bsd.subdir.mk>

Index: src/external/bsd/openldap/lib/Makefile
diff -u src/external/bsd/openldap/lib/Makefile:1.2 src/external/bsd/openldap/lib/Makefile:1.2.2.1
--- src/external/bsd/openldap/lib/Makefile:1.2	Tue Dec 28 17:05:43 2021
+++ src/external/bsd/openldap/lib/Makefile	Fri Sep  8 09:03:54 2023
@@ -1,5 +1,5 @@
-#	$NetBSD: Makefile,v 1.2 2021/12/28 17:05:43 christos Exp $
+#	$NetBSD: Makefile,v 1.2.2.1 2023/09/08 09:03:54 martin Exp $
 
-SUBDIR=	liblber .WAIT libldap libldap_r liblutil # librewrite liblunicode slapd
+.include "Makefile.subdir"
 
 .include <bsd.subdir.mk>

Index: src/lib/Makefile
diff -u src/lib/Makefile:1.294.2.1 src/lib/Makefile:1.294.2.2
--- src/lib/Makefile:1.294.2.1	Fri Aug 11 13:43:41 2023
+++ src/lib/Makefile	Fri Sep  8 09:03:53 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.294.2.1 2023/08/11 13:43:41 martin Exp $
+#	$NetBSD: Makefile,v 1.294.2.2 2023/09/08 09:03:53 martin Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include <bsd.own.mk>
@@ -69,7 +69,8 @@ SUBDIR+=	../external/bsd/am-utils/lib
 
 SUBDIR+=	../external/bsd/flex/lib
 SUBDIR+=	../external/bsd/tre/lib
-SUBDIR+=	../external/bsd/elftoolchain/lib
+ELFTOOLCHAINLIB=../external/bsd/elftoolchain/lib/
+.include "${ELFTOOLCHAINLIB}Makefile.subdir"
 SUBDIR+=	../external/bsd/liblzf/lib
 SUBDIR+=	../external/bsd/libpcap/lib
 
@@ -208,7 +209,8 @@ SUBDIR+=	npf		# depends on libnpf
 .endif
 
 .if (${MKATF} != "no")
-SUBDIR+=	../external/bsd/atf/lib		# depends on libstdc++
+ATFLIB=	../external/bsd/atf/lib/
+.include "${ATFLIB}Makefile.subdir"		# depends on libstdc++
 .endif
 
 .if (${MKKYUA} != "no")
@@ -224,20 +226,25 @@ SUBDIR+=	librump		# depends on librumpus
 .endif
 
 .if (${MKKERBEROS} != "no")
-SUBDIR+=	../crypto/external/bsd/heimdal/lib	# depends on libcrypto
+# heimdal depends on libcrypto, libedit, libterminfo
+HEIMDALLIB=	../crypto/external/bsd/heimdal/lib/
+.include "${HEIMDALLIB}Makefile.subdir"			# depends on libcrypto
 							# libedit, libterminfo,
 .endif
 
 SUBDIR+=	../external/bsd/libfido2/lib	# depends on libcbor
-SUBDIR+=	../crypto/external/bsd/netpgp/lib  # depends on libcrypto, ...
-SUBDIR+=	../external/bsd/libevent/lib	# depends on libcrypto
+NETPGPLIB=	../crypto/external/bsd/netpgp/lib/
+.include "${NETPGPLIB}Makefile.subdir"		# depends on libcrypto, ...
+LIBEVENTLIB=	../external/bsd/libevent/lib/
+.include "${LIBEVENTLIB}Makefile.subdir"	# depends on libcrypto
 .if ${MKDTRACE} != "no"
 SUBDIR+=	../external/bsd/libproc/lib	# depends on libstdc++, libctf
 .endif
 SUBDIR+=	../external/bsd/fetch/lib	# depends on libssl
 
 .if (${MKLDAP} != "no")
-SUBDIR+=	../external/bsd/openldap/lib	# depends on libcrypto, ...
+OPENLDAPLIB=	../external/bsd/openldap/lib/	# depends on libcrypto, ...
+.include "${OPENLDAPLIB}Makefile.subdir"
 .endif
 
 .if (${MKZFS} != "no")

Added files:

Index: src/crypto/external/bsd/heimdal/lib/Makefile.subdir
diff -u /dev/null src/crypto/external/bsd/heimdal/lib/Makefile.subdir:1.1.2.2
--- /dev/null	Fri Sep  8 09:03:54 2023
+++ src/crypto/external/bsd/heimdal/lib/Makefile.subdir	Fri Sep  8 09:03:53 2023
@@ -0,0 +1,26 @@
+#	$NetBSD: Makefile.subdir,v 1.1.2.2 2023/09/08 09:03:53 martin Exp $
+
+.if (${MKKERBEROS} != "no")
+SUBDIR+=	${HEIMDALLIB}libheimbase
+SUBDIR+=	${HEIMDALLIB}libcom_err
+SUBDIR+=	${HEIMDALLIB}libroken
+SUBDIR+=	${HEIMDALLIB}libvers
+SUBDIR+=	.WAIT
+SUBDIR+=	${HEIMDALLIB}libsl
+SUBDIR+=	.WAIT
+SUBDIR+=	${HEIMDALLIB}libasn1
+SUBDIR+=	${HEIMDALLIB}libwind
+SUBDIR+=	.WAIT
+SUBDIR+=	${HEIMDALLIB}libhx509
+SUBDIR+=	.WAIT
+SUBDIR+=	${HEIMDALLIB}libkrb5
+SUBDIR+=	.WAIT
+SUBDIR+=	${HEIMDALLIB}libhdb
+SUBDIR+=	${HEIMDALLIB}libkafs
+SUBDIR+=	${HEIMDALLIB}libheimntlm
+SUBDIR+=	.WAIT
+SUBDIR+=	${HEIMDALLIB}libkdc
+SUBDIR+=	${HEIMDALLIB}libgssapi
+SUBDIR+=	${HEIMDALLIB}libkadm5srv
+SUBDIR+=	${HEIMDALLIB}libkadm5clnt
+.endif	# MKKERBEROS != no

Index: src/crypto/external/bsd/netpgp/lib/Makefile.subdir
diff -u /dev/null src/crypto/external/bsd/netpgp/lib/Makefile.subdir:1.1.2.2
--- /dev/null	Fri Sep  8 09:03:54 2023
+++ src/crypto/external/bsd/netpgp/lib/Makefile.subdir	Fri Sep  8 09:03:54 2023
@@ -0,0 +1,5 @@
+#	$NetBSD: Makefile.subdir,v 1.1.2.2 2023/09/08 09:03:54 martin Exp $
+
+SUBDIR+=	${NETPGPLIB}netpgp
+SUBDIR+=	.WAIT
+SUBDIR+=	${NETPGPLIB}verify

Index: src/external/bsd/atf/lib/Makefile.subdir
diff -u /dev/null src/external/bsd/atf/lib/Makefile.subdir:1.1.2.2
--- /dev/null	Fri Sep  8 09:03:54 2023
+++ src/external/bsd/atf/lib/Makefile.subdir	Fri Sep  8 09:03:54 2023
@@ -0,0 +1,6 @@
+#	$NetBSD: Makefile.subdir,v 1.1.2.2 2023/09/08 09:03:54 martin Exp $
+
+SUBDIR+=	${ATFLIB}libatf-c
+SUBDIR+=	.WAIT
+SUBDIR+=	${ATFLIB}libatf-c++
+SUBDIR+=	${ATFLIB}tools

Index: src/external/bsd/elftoolchain/lib/Makefile.subdir
diff -u /dev/null src/external/bsd/elftoolchain/lib/Makefile.subdir:1.1.2.2
--- /dev/null	Fri Sep  8 09:03:54 2023
+++ src/external/bsd/elftoolchain/lib/Makefile.subdir	Fri Sep  8 09:03:54 2023
@@ -0,0 +1,5 @@
+#	$NetBSD: Makefile.subdir,v 1.1.2.2 2023/09/08 09:03:54 martin Exp $
+
+SUBDIR+=	${ELFTOOLCHAINLIB}libelf
+SUBDIR+=	.WAIT		# Process 'libelf' before 'libdwarf'.
+SUBDIR+=	${ELFTOOLCHAINLIB}libdwarf

Index: src/external/bsd/libevent/lib/Makefile.subdir
diff -u /dev/null src/external/bsd/libevent/lib/Makefile.subdir:1.1.2.2
--- /dev/null	Fri Sep  8 09:03:54 2023
+++ src/external/bsd/libevent/lib/Makefile.subdir	Fri Sep  8 09:03:53 2023
@@ -0,0 +1,6 @@
+#	$NetBSD: Makefile.subdir,v 1.1.2.2 2023/09/08 09:03:53 martin Exp $
+
+SUBDIR+=	${LIBEVENTLIB}libevent
+SUBDIR+=	.WAIT
+SUBDIR+=	${LIBEVENTLIB}libevent_openssl
+SUBDIR+=	${LIBEVENTLIB}libevent_pthreads

Index: src/external/bsd/openldap/lib/Makefile.subdir
diff -u /dev/null src/external/bsd/openldap/lib/Makefile.subdir:1.1.2.2
--- /dev/null	Fri Sep  8 09:03:54 2023
+++ src/external/bsd/openldap/lib/Makefile.subdir	Fri Sep  8 09:03:54 2023
@@ -0,0 +1,8 @@
+#	$NetBSD: Makefile.subdir,v 1.1.2.2 2023/09/08 09:03:54 martin Exp $
+
+SUBDIR+=	${OPENLDAPLIB}liblber
+SUBDIR+=	.WAIT
+SUBDIR+=	${OPENLDAPLIB}libldap
+SUBDIR+=	${OPENLDAPLIB}libldap_r
+SUBDIR+=	${OPENLDAPLIB}liblutil
+SUBDIR+=	# librewrite liblunicode slapd

Reply via email to