Subject: Build system deficiencies (LONG)
To: None <current-users@netbsd.org>
From: John Darrow <John.P.Darrow@wheaton.edu>
List: current-users
Date: 03/05/1999 23:22:43
While building a local snapshot, I ran across a few deficiencies in the
build/release system.  Among them are:

1. maketars including the domestic binaries in both base.tgz and secr.tgz,
instead of putting the exportable versions in base.

2. lack of DESTDIR support for building the X sets

3. no easy way to package up the sources used to build a snapshot, especially
if obj dirs were not used in the build

The included diffs seek to remedy these deficiencies.  Among the features
included are:

1. split release building into exportable and domestic steps, so that
base.tgz gets the exportable versions of the dual-version files

2. added DESTDIR support for the X installs, along with a make variable
(INCLUDE_X_SETS) to package up the x sets along with the normal ones

3. added a make variable (INCLUDE_SRC) to package up the source tarballs
after the build, along with a new target (srctars) in etc/Makefile to just
package the sources without a build.  Also included is a INCLUDE_PKGSRC
variable to tar pkgsrc, too.

4. added maketars/makeflist lists for the source sets, and adding a -n
flag to maketars/makeflist to generate a list using find, thus obsoleting
makesrctars.  Also added is a -r tarroot flag, allowing a fake root to
be added to the file list in the tarball (as the old makesrctars did).

NOTE that for orthogonality with the xsrc and pkgsrc tarballs, the
included diff roots the src tarballs at src rather than usr/src.

5. added a new target (build-rel) to etc/Makefile that will do a complete
build & tar cycle.  If called with the optional variables set, a single
make build-rel can generate a complete set of source & binary tarballs
from a raw source tree.

The build target in src/Makefile is basically untouched - only a small
modification to still build (but not install) the exportable versions
of the dual-version binaries for a later 'make release' in etc.

Still left untouched is DESTDIR support for the actual X builds (i.e.
using include files, libraries, etc. from DESTDIR) - these would require
some significant imake hacking...

The following files are changed:
src/distrib/sets/checkflist
src/distrib/sets/makeflist
src/distrib/sets/maketars
src/etc/Makefile
src/libexec/telnetd/Makefile
src/lib/Makefile
src/domestic/Makefile
src/Makefile
src/usr.bin/login/Makefile
src/usr.bin/telnet/Makefile
xsrc/Makefile
xsrc/xc/Makefile

The following files are added (not included in the diffs, grab the tarball
to get these):
src/distrib/sets/lists/src/mi
src/distrib/sets/lists/secrsrc/mi
src/distrib/sets/lists/syssrc/mi
src/distrib/sets/lists/gnusrc/mi
src/distrib/sets/lists/sharesrc/mi
src/distrib/sets/lists/xsrc/mi

The following file is obsoleted:
src/distrib/sets/makesrctars

Copies of these diffs (made against current-19990305) are available from:
  ftp://ftp.wheaton.edu/pub/jdarrow/updated.diffs

A tarball with complete new copies of the changed files, along with the
source set lists not included in the diffs (also as of 19990305) are in:
  ftp://ftp.wheaton.edu/pub/jdarrow/updated.tgz

(will also send-pr this as a change-request)...

jdarrow

--
John Darrow
Computing Services, Wheaton College, Wheaton, IL
John.P.Darrow@wheaton.edu


Index: src/distrib/sets/checkflist
===================================================================
RCS file: /source/cvs/netbsd/current/src/distrib/sets/checkflist,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** checkflist	1999/01/17 15:27:24	1.1.1.1
--- checkflist	1999/03/05 17:07:20	1.2
***************
*** 44,50 ****
  	shift
  done
  
! sh makeflist $xargs $dargs > $tmpname
  
  ( cd $DESTDIR ; find $origin \( -type d -o -type f -o -type l \) ) | sort | \
      diff $tmpname -
--- 44,50 ----
  	shift
  done
  
! sh makeflist $dargs $xargs > $tmpname
  
  ( cd $DESTDIR ; find $origin \( -type d -o -type f -o -type l \) ) | sort | \
      diff $tmpname -
Index: src/distrib/sets/makeflist
===================================================================
RCS file: /source/cvs/netbsd/current/src/distrib/sets/makeflist,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -c -r1.1.1.3 -r1.2
*** makeflist	1999/02/25 22:13:47	1.1.1.3
--- makeflist	1999/03/05 17:07:20	1.2
***************
*** 3,9 ****
  # $NetBSD: makeflist,v 1.14 1999/02/13 07:59:45 itohy Exp $
  #
  # Print out the files in some or all lists.
! # Usage: makeflist [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
  #
  
  # set defaults
--- 3,10 ----
  # $NetBSD: makeflist,v 1.14 1999/02/13 07:59:45 itohy Exp $
  #
  # Print out the files in some or all lists.
! # Usage: makeflist [-d] [-b] [-x] [-a arch] [-m machine] [-s setsdir] [-n]
! #     [setname ...]
  #
  
  # set defaults
***************
*** 15,20 ****
--- 16,22 ----
  nlists="base comp etc games man misc text"
  xlists="xbase xcomp xcontrib xfont xserver"
  lists=$nlists
+ nolist=0;
  
  # handle args
  while : ; do
***************
*** 38,52 ****
  	-s*)
  		setd=$2; shift
  		;;
  	-*)
  		cat 1>&2 <<USAGE
! Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
! 	-b		make netbsd + x11 lists
  	-d		do domestic ("secr") sets
  	-x		only make x11 lists
  	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
  	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
  	-s setsdir	directory to find sets	[$setd]
  	[setname ...]	sets to build 	[$lists]
  USAGE
  		exit 1
--- 40,58 ----
  	-s*)
  		setd=$2; shift
  		;;
+ 	-n*)
+ 		nolist=1
+ 		;;
  	-*)
  		cat 1>&2 <<USAGE
! Usage: $0 [-d] [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
  	-d		do domestic ("secr") sets
+ 	-b		make netbsd + x11 lists
  	-x		only make x11 lists
  	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
  	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
  	-s setsdir	directory to find sets	[$setd]
+ 	-n 		generate a list using find in setsdir
  	[setname ...]	sets to build 	[$lists]
  USAGE
  		exit 1
***************
*** 61,66 ****
--- 67,79 ----
  	lists="$@"
  fi
  
+ if [ $nolist -eq 1 ]; then
+ 	(cd $setd; find . \
+ 	    \! \( \( -type l -o -type d \) \( -name obj -o -name 'obj.*' \
+ 	    -o -name CVS -o -name work -o -name 'work.*' \) -prune \) \
+         -print ) | sort -u
+ else
+ 
  # Compute toolchain  used on target cpu.
  if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" ]; then
          shlib=elf
***************
*** 93,95 ****
--- 106,109 ----
  		grep -v ${machine} $setd/lists/man/md_share
  	fi
  done | sort -u
+ fi
Index: src/distrib/sets/maketars
===================================================================
RCS file: /source/cvs/netbsd/current/src/distrib/sets/maketars,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -c -r1.1.1.3 -r1.2
*** maketars	1999/02/25 22:13:47	1.1.1.3
--- maketars	1999/03/05 17:07:20	1.2
***************
*** 3,11 ****
  # $NetBSD: maketars,v 1.13 1999/02/13 07:59:45 itohy Exp $
  #
  # Make release tar files for some or all lists.  Usage:
! # maketars [-b] [-x] [-a arch] [-m machine] [-s setsdir] [-d destdir] \
! #	[-t tardir] [setname ...]
  #
  
  # set defaults
  : ${MAKE=make}
--- 3,12 ----
  # $NetBSD: maketars,v 1.13 1999/02/13 07:59:45 itohy Exp $
  #
  # Make release tar files for some or all lists.  Usage:
! # maketars [-n] [-b] [-x] [-a arch] [-m machine] [-s setsdir] [-d destdir] \
! #	[-t tardir] [-r tarroot] [setname ...]
  #
+ #
  
  # set defaults
  : ${MAKE=make}
***************
*** 17,26 ****
--- 18,32 ----
  lists=$nlists
  tars=$RELEASEDIR
  dest=$DESTDIR
+ tarroot="."
+ nflag=''
  
  # handle args
  while : ; do
  	case $1 in
+ 	-n*)
+ 		nflag='-n'
+ 		;;
  	-b*)
  		lists="$xlists $nlists"
  		;;
***************
*** 42,53 ****
  	-t*)	
  		tars=$2; shift
  		;;
  	-*)
  		cat 1>&2 <<USAGE
! Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] 
  		[-d dest] [-t tars] [setname ...]
! 	-b		make netbsd + x11 lists
! 	-x		only make x11 lists
  	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
  	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
  	-s setsdir	directory to find sets	[$setd]
--- 48,63 ----
  	-t*)	
  		tars=$2; shift
  		;;
+ 	-r*)	
+ 		tarroot=$2; shift
+ 		;;
  	-*)
  		cat 1>&2 <<USAGE
! Usage: $0 [-n] [-b] [-x] [-a arch] [-m machine] [-s setsdir] 
  		[-d dest] [-t tars] [setname ...]
! 	-n		don't use a list, just tar up the whole directory
! 	-b		make netbsd + x11 tars
! 	-x		only make x11 tars
  	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
  	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
  	-s setsdir	directory to find sets	[$setd]
***************
*** 63,68 ****
--- 73,84 ----
  	esac
  	shift
  done
+ if [ -n "$nflag" ]; then
+ 	sdir=$dest
+ else
+ 	sdir=$setd
+ fi
+ 
  if [ -n "$*" ]; then
  	lists="$*"
  fi
***************
*** 80,86 ****
  for setname in $lists; do
  	out=$setname.tgz
  	echo "making $out"
! 	sh $setd/makeflist -a $arch -m $machine -s $setd $setname |
! 	  (cd $dest ; pax -w -d) |
  	  gzip -9 > ${tars}/$out
  done
--- 96,102 ----
  for setname in $lists; do
  	out=$setname.tgz
  	echo "making $out"
! 	sh $setd/makeflist $nflag -a $arch -m $machine -s $sdir $setname |
! 	  (cd $dest ; pax -w -d -s"|^\.|${tarroot}|") |
  	  gzip -9 > ${tars}/$out
  done
Index: src/etc/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/etc/Makefile,v
retrieving revision 1.1.1.5
retrieving revision 1.4
diff -c -r1.1.1.5 -r1.4
*** Makefile	1999/03/05 20:01:09	1.1.1.5
--- Makefile	1999/03/05 21:10:07	1.4
***************
*** 5,10 ****
--- 5,16 ----
  #   DESTDIR must be set before anything in this file will work.
  #   RELEASEDIR is where the tarred up stuff for a snapshot or
  #	release will be placed.
+ #   XSRCDIR is the xsrc source directory.  It is set by default to
+ #       ../../xsrc, but can be overridden.  It is only used if
+ #       INCLUDE_X_SETS is set.
+ #   PKGSRCDIR is the pkgsrc source directory.  It is set by default to
+ #       ../../pkgsrc, but can be overridden.  It is only used if
+ #       INCLUDE_PKGSRC is set.
  #
  # Environment variables with default values:
  #   LOCALTIME will set the default local time for the system you
***************
*** 18,44 ****
  #	default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
  #   UPDATE is normally undefined; if defined, don't do a 'make clean'
  #	before kernel compile
  #   NO_SENDMAIL is normally undefined; if defined, it will not do a
  #	`make distribution' in the sendmail config file source directory.
  #   USE_BIND4 is normally unset; if set, it will install a named.boot
  #	instead of a named.conf in etc/namedb.
  #   EXTRA_KERNELS has a machine-dependent list of kernels to build added
  #	to it, but you may also set this to have extra ones built.
  # 
  # Targets:
  #    distribution: makes a full NetBSD distribution in DESTDIR. If
  #	INSTALL_DONE is set, it will not do a `make install.'
  #    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
  #	Called by distribution.
! #    snapshot: calls distribution, above, and then tars up the files
  #	into a release(7) format in RELEASEDIR. Any port-dependent
  #	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
  
! # XXX: For NO_SENDMAIL and USE_BIND4
! .include <bsd.own.mk>
  
  TZDIR=		/usr/share/zoneinfo
  LOCALTIME?=	US/Pacific
  
  # setting NOOBJ prevents "make obj" from doing anything;
  # an objdir would break the installation stuff below
--- 24,79 ----
  #	default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
  #   UPDATE is normally undefined; if defined, don't do a 'make clean'
  #	before kernel compile
+ #   EXPORTABLE_SYSTEM is normally undefined; if defined, don't do anything
+ #	involving the domestic sources, even if they are present on the
+ #	system.  Normally not needed, as the release target will handle
+ #	the building and separation of exportable and domestic sources.
+ #	One exception may be the building of a static, exportable
+ #	libtelnet/telnet/telnetd from a machine which includes domestic
+ #	sources.
  #   NO_SENDMAIL is normally undefined; if defined, it will not do a
  #	`make distribution' in the sendmail config file source directory.
  #   USE_BIND4 is normally unset; if set, it will install a named.boot
  #	instead of a named.conf in etc/namedb.
  #   EXTRA_KERNELS has a machine-dependent list of kernels to build added
  #	to it, but you may also set this to have extra ones built.
+ #   INCLUDE_X_SETS is normally unset; if set, it will package up the
+ #	X sets in addition to the normal ones.
+ #   XDESTDIR is normally unset; if set, it will be used instead of
+ #	DESTDIR for the X sets.
+ #   INCLUDE_SRC is normally unset; if set, it will package up the
+ #	sources in addition to the binary sets.
+ #   INCLUDE_PKGSRC is normally unset; if set, it will package up the
+ #	package system sources in addition to the normal sources.
+ #	It has no effect if INCLUDE_SRC is not also set.
+ #   RELEASESRCDIR is where source sets will go; if unset, it defaults to
+ #	RELEASEDIR/source
  # 
  # Targets:
  #    distribution: makes a full NetBSD distribution in DESTDIR. If
  #	INSTALL_DONE is set, it will not do a `make install.'
  #    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
  #	Called by distribution.
! #    release: calls distribution, above, and then tars up the files
  #	into a release(7) format in RELEASEDIR. Any port-dependent
  #	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
+ #    snapshot: same as release.
+ #    srctars: package up the system sources (and optionally xsrc and pkgsrc).
+ #    build-rel: compiles and packages a complete release, possibly
+ #	including X, sources, pkgsrc, and domestic bits.  Basically
+ #	does the equivalent of a 'make build' in .. (and possibly XSRCDIR)
+ #	followed by a 'make release', with some juggling to handle the
+ #	domestic bits.
+ #
  
! .include <bsd.own.mk>			# for configuration variables.
  
  TZDIR=		/usr/share/zoneinfo
  LOCALTIME?=	US/Pacific
+ XDESTDIR?=	${DESTDIR}
+ XSRCDIR?=	../../xsrc
+ PKGSRCDIR?=	../../pkgsrc
+ RELEASESRCDIR?=	${RELEASEDIR}/source
  
  # setting NOOBJ prevents "make obj" from doing anything;
  # an objdir would break the installation stuff below
***************
*** 99,114 ****
  
  all clean cleandir depend distclean etc includes install lint:
  
! .ifndef DESTDIR
! distribution distrib-dirs snapshot:
! 	@echo setenv DESTDIR before doing that!
  	@false
  .else
  distribution: distrib-dirs
  .if !defined(INSTALL_DONE)
  	(cd ..; ${MAKE} includes)
  	(cd ..; ${MAKE} install)
  .endif
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
--- 134,170 ----
  
  all clean cleandir depend distclean etc includes install lint:
  
! .if ( !defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") && \
! 	( !defined(FORCE_BUILD) && !make(distrib-dirs) )
! build-rel distribution release release-export release-secr snapshot:
! 	@echo That\'s really NOT a good idea... If you try that
! 	@echo with DESTDIR unset, empty, or set to \"/\", you will overwrite
! 	@echo most of your configuration and log files in /etc and /var.
! 	@echo In addition, on a system with domestic binaries, there may be
! 	@echo some breakage of libtelnet, telnetd, and telnet \(and possibly
! 	@echo other things\) during the time between when the exportable
! 	@echo libraries are installed and when the domestic versions are
! 	@echo put into place.
! 	@echo If you really want to force the build, set FORCE_BUILD in
! 	@echo the environment or /etc/mk.conf and rerun the make.
  	@false
  .else
+ 
+ # If RELEASEDIR is set, we assume we've been called from the release-export
+ # target, so don't install the domestic files yet.
+ 
  distribution: distrib-dirs
  .if !defined(INSTALL_DONE)
  	(cd ..; ${MAKE} includes)
+ .if !defined(RELEASEDIR)
  	(cd ..; ${MAKE} install)
+ .else
+ 	(cd ..; ${MAKE} EXPORTABLE_SYSTEM=1 install)
+ .endif	# RELEASEDIR
+ .if defined(INCLUDE_X_SETS)
+ 	(cd ${XSRCDIR}; ${MAKE} DESTDIR=${XDESTDIR} distribution)
  .endif
+ .endif	# INSTALL_DONE
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
***************
*** 202,229 ****
  	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
  .endif
  
- 
  distrib-dirs:
! 	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
  	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
! 	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
  
  .if !defined(RELEASEDIR)
! snapshot snap_pre:
  	@echo setenv RELEASEDIR before doing that!
  	@false
  .else
! release snapshot: distribution snap_pre snap_md snap_kern 
! 	sh ../distrib/sets/maketars -s ../distrib/sets \
! 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
  .if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
  	sh ../distrib/sets/maketars -s ../distrib/sets \
! 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr
! 	(cd ${RELEASEDIR}/binary/security && \
! 		cksum -o 1 *.tgz >BSDSUM && \
! 		cksum *.tgz >CKSUM && \
! 		cksum -m *.tgz >MD5 && \
! 		cksum -o 2 *.tgz >SYSVSUM )
  .endif
  	(cd ${RELEASEDIR}/binary/sets && \
  		cksum -o 1 *.tgz >BSDSUM && \
--- 258,299 ----
  	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
  .endif
  
  distrib-dirs:
! 	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/
  	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
! 	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
  
  .if !defined(RELEASEDIR)
! build-rel release release-export release-secr snapshot snap_pre:
  	@echo setenv RELEASEDIR before doing that!
  	@false
  .else
! # Build everything and package it up
! build-rel:
! 	(cd ..; ${MAKE} EXPORTABLE_SYSTEM=1 build)
! .if defined(INCLUDE_X_SETS)
! 	(cd ${XSRCDIR}; ${MAKE} DESTDIR=${XDESTDIR} build)
! .endif
! 	${MAKE} INSTALL_DONE=1 release-export
  .if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
+ 	(cd ../domestic; ${MAKE} _SLAVE_BUILD= build)
+ 	${MAKE} INSTALL_DONE=1 release-secr
+ .endif
+ .if defined(INCLUDE_SRC)
+ 	${MAKE} srctars
+ .endif
+ 
+ release snapshot: release-export release-secr
+ .if defined(INCLUDE_SRC)
+ 	${MAKE} srctars
+ .endif
+ 
+ release-export: distribution snap_pre snap_md snap_kern 
  	sh ../distrib/sets/maketars -s ../distrib/sets \
! 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
! .if defined(INCLUDE_X_SETS)
! 	sh ../distrib/sets/maketars -x -s ../distrib/sets \
! 		-d ${XDESTDIR} -t ${RELEASEDIR}/binary/sets
  .endif
  	(cd ${RELEASEDIR}/binary/sets && \
  		cksum -o 1 *.tgz >BSDSUM && \
***************
*** 236,245 ****
  		cksum *.gz >CKSUM && \
  		cksum -m *.gz >MD5 && \
  		cksum -o 2 *.gz >SYSVSUM )
  .endif
  
  snap_pre:
- 	/bin/rm -rf ${RELEASEDIR}
  	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
  	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
  	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
--- 306,328 ----
  		cksum *.gz >CKSUM && \
  		cksum -m *.gz >MD5 && \
  		cksum -o 2 *.gz >SYSVSUM )
+ .endif	# EXTRA_KERNELS
+ 
+ release-secr:
+ .if !defined(EXPORTABLE_SYSTEM)
+ .if exists(../domestic) && !defined(INSTALL_DONE)
+ 	(cd ../domestic; ${MAKE} install)
  .endif
+ 	sh ../distrib/sets/maketars -s ../distrib/sets \
+ 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr
+ 	(cd ${RELEASEDIR}/binary/security && \
+ 		cksum -o 1 *.tgz >BSDSUM && \
+ 		cksum *.tgz >CKSUM && \
+ 		cksum -m *.tgz >MD5 && \
+ 		cksum -o 2 *.tgz >SYSVSUM )
+ .endif	# EXPORTABLE_SYSTEM
  
  snap_pre:
  	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
  	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
  	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
***************
*** 280,290 ****
  			${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
  .endfor # EXTRA_KERNELS
  	
! .endif # RELEASEDIR check
  
  snap_md:
  # nothing here -- look in the machine-dependent Makefile.inc
  
  .endif	# DESTDIR check
  
  .include <bsd.prog.mk>
--- 363,408 ----
  			${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
  .endfor # EXTRA_KERNELS
  	
! .endif	# RELEASEDIR check
  
  snap_md:
  # nothing here -- look in the machine-dependent Makefile.inc
  
  .endif	# DESTDIR check
+ 
+ .if !defined(RELEASESRCDIR) 
+ srctars:
+ 	@echo setenv RELEASEDIR or RELEASESRCDIR before doing that!
+ 	@false
+ .else
+ srctars:
+ 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASESRCDIR}
+ 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASESRCDIR}/sets
+ 	sh ../distrib/sets/maketars -s ../distrib/sets -d .. -r 'src' \
+ 		-t ${RELEASESRCDIR}/sets src gnusrc syssrc sharesrc
+ .if defined(INCLUDE_X_SETS)
+ 	sh ../distrib/sets/maketars -s ../distrib/sets -d ${XSRCDIR} \
+ 		-r 'xsrc' -t ${RELEASESRCDIR}/sets xsrc
+ .endif
+ .if defined(INCLUDE_PKGSRC)
+ 	sh ../distrib/sets/maketars -n -s ../distrib/sets -d ${PKGSRCDIR} \
+ 		-r 'pkgsrc' -t ${RELEASESRCDIR}/sets pkgsrc
+ .endif
+ 	(cd ${RELEASESRCDIR}/sets && \
+ 		cksum -o 1 *.tgz >BSDSUM && \
+ 		cksum *.tgz >CKSUM && \
+ 		cksum -m *.tgz >MD5 && \
+ 		cksum -o 2 *.tgz >SYSVSUM )
+ .if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
+ 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASESRCDIR}/security
+ 	sh ../distrib/sets/maketars -s ../distrib/sets -d .. -r 'src' \
+ 		-t ${RELEASESRCDIR}/security secrsrc
+ 	(cd ${RELEASESRCDIR}/security && \
+ 		cksum -o 1 *.tgz >BSDSUM && \
+ 		cksum *.tgz >CKSUM && \
+ 		cksum -m *.tgz >MD5 && \
+ 		cksum -o 2 *.tgz >SYSVSUM )
+ .endif	#  EXPORTABLE_SYSTEM
+ .endif  # RELEASESRCDIR
  
  .include <bsd.prog.mk>
Index: src/libexec/telnetd/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/libexec/telnetd/Makefile,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -c -r1.1.1.3 -r1.2
*** Makefile	1999/02/25 22:33:20	1.1.1.3
--- Makefile	1999/03/05 17:07:23	1.2
***************
*** 8,15 ****
  # XXX Keep telnetd(8) and libtelnet from getting out of sync during the build
  # XXX process.
  .if !exists(${.CURDIR}/../../domestic/libexec/telnetd) || \
!     defined(EXPORTABLE_SYSTEM) || \
!     make (obj) || make(clean) || make(cleandir) || make(distclean)
  
  PROG=	telnetd
  CPPFLAGS+=-DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO -DDIAGNOSTICS -DOPENPTY_PTY
--- 8,14 ----
  # XXX Keep telnetd(8) and libtelnet from getting out of sync during the build
  # XXX process.
  .if !exists(${.CURDIR}/../../domestic/libexec/telnetd) || \
!     defined(EXPORTABLE_SYSTEM) || !make(install)
  
  PROG=	telnetd
  CPPFLAGS+=-DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO -DDIAGNOSTICS -DOPENPTY_PTY
Index: src/lib/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/lib/Makefile,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -c -r1.1.1.2 -r1.2
*** Makefile	1999/01/18 20:42:09	1.1.1.2
--- Makefile	1999/03/05 17:07:23	1.2
***************
*** 10,17 ****
  # XXX Keep telnet(1) and libtelnet from getting out of sync during the build
  # XXX process.
  .if !exists(${.CURDIR}/../domestic/lib/libtelnet) || \
! 	defined(EXPORTABLE_SYSTEM) || make(obj) || \
! 	make(clean) || make(cleandir) || make(distclean)
  SUBDIR+=	libtelnet
  .endif
  
--- 10,16 ----
  # XXX Keep telnet(1) and libtelnet from getting out of sync during the build
  # XXX process.
  .if !exists(${.CURDIR}/../domestic/lib/libtelnet) || \
! 	defined(EXPORTABLE_SYSTEM) || !make(install)
  SUBDIR+=	libtelnet
  .endif
  
Index: src/domestic/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/domestic/Makefile,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -c -r1.1.1.4 -r1.2
*** Makefile	1999/01/31 06:26:42	1.1.1.4
--- Makefile	1999/03/05 17:07:23	1.2
***************
*** 3,8 ****
--- 3,10 ----
  # Makefile for export-restricted sources.  This hierarchy shouldn't make
  # it outside of the US.
  
+ .include <bsd.own.mk>			# for configuration variables.
+ 
  .if defined(NBUILDJOBS)
  _J= -j${NBUILDJOBS}
  .endif
***************
*** 40,46 ****
  	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
  .endif
  .endif
! .if !defined(UPDATE) && !defined(_SLAVE_BUILD)
  	${MAKE} cleandir
  .endif
  	${MAKE} includes
--- 42,48 ----
  	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
  .endif
  .endif
! .if !defined(UPDATE)
  	${MAKE} cleandir
  .endif
  	${MAKE} includes
Index: src/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/Makefile,v
retrieving revision 1.1.1.5
retrieving revision 1.2
diff -c -r1.1.1.5 -r1.2
*** Makefile	1999/02/25 22:12:06	1.1.1.5
--- Makefile	1999/03/05 17:07:23	1.2
***************
*** 107,119 ****
  	    ${MAKE} MKMAN=no MKINFO=no install)
  	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
  .if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
! 	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
  .endif
  	${MAKE} whatis.db
  	@echo -n "Build finished at: "
  	@date
  
! release snapshot: build
! 	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
  
  .include <bsd.subdir.mk>
--- 107,163 ----
  	    ${MAKE} MKMAN=no MKINFO=no install)
  	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
  .if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
! 	(cd ${.CURDIR}/domestic && ${MAKE} _SLAVE_BUILD= build)
  .endif
  	${MAKE} whatis.db
  	@echo -n "Build finished at: "
  	@date
  
! .if ( !defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") && \
! 	!defined(FORCE_BUILD)
! release snapshot:
! 	@echo That\'s really NOT a good idea... If you \'make release\'
! 	@echo with DESTDIR unset, empty, or set to \"/\", you will overwrite
! 	@echo most of your configuration and log files in /etc and /var.
! 	@echo In addition, on a system with domestic binaries, there may be
! 	@echo some breakage of libtelnet, telnetd, and telnet \(and possibly
! 	@echo other things\) during the time between when the exportable
! 	@echo libraries are installed and when the domestic versions are
! 	@echo put into place.
! 	@echo If you really want to force the build, set FORCE_BUILD in
! 	@echo the environment or /etc/mk.conf and rerun \'make release\'.
! 	@false
! .elif !defined(RELEASEDIR)
! release snapshot:
! 	@echo setenv RELEASEDIR before doing that!
! 	@false
! .else
! 
! # We have to create the exportable sets before we install the domestic files.
! # Otherwise we overwrite the exportable files before we can tar them up.
! # The easiest way to implement this is to split the release target in
! # etc/Makefile into two parts, one run before the domestic build, and
! # one run after.
! # Note that, as a side-effect of this change, the initial 'make cleandir'
! # in domestic is not performed until after the entire exportable set is
! # built (though this could be changed with a few more if statements or
! # another make variable).
! #
! release snapshot:
! 	${MAKE} EXPORTABLE_SYSTEM=1 build
! .if !defined(DESTDIR)
! 	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ INSTALL_DONE=1 release-export)
! .else
! 	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release-export)
! .endif
! .if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
! 	(cd ${.CURDIR}/domestic && ${MAKE} _SLAVE_BUILD= build)
! .if !defined(DESTDIR)
! 	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ INSTALL_DONE=1 release-secr)
! .else
! 	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release-secr)
! .endif
! .endif
! .endif
  
  .include <bsd.subdir.mk>
Index: src/usr.bin/login/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/usr.bin/login/Makefile,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -c -r1.1.1.3 -r1.2
*** Makefile	1999/03/05 20:37:36	1.1.1.3
--- Makefile	1999/03/05 21:03:17	1.2
***************
*** 4,11 ****
  .include <bsd.own.mk>			# for EXPORTABLE_SYSTEM definition
  
  .if !exists(${.CURDIR}/../../domestic/usr.bin/login) || \
!     defined(EXPORTABLE_SYSTEM) || \
!     make(obj) || make(clean) || make(cleandir) || make(distclean)
  
  PROG=	login
  SRCS=	login.c
--- 4,10 ----
  .include <bsd.own.mk>			# for EXPORTABLE_SYSTEM definition
  
  .if !exists(${.CURDIR}/../../domestic/usr.bin/login) || \
!     defined(EXPORTABLE_SYSTEM) || !make(install)
  
  PROG=	login
  SRCS=	login.c
Index: src/usr.bin/telnet/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/usr.bin/telnet/Makefile,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -c -r1.1.1.2 -r1.2
*** Makefile	1999/01/18 21:19:55	1.1.1.2
--- Makefile	1999/03/05 17:07:23	1.2
***************
*** 39,46 ****
  # XXX Keep telnet(1) and libtelnet from getting out of sync during the build
  # XXX process.
  .if !exists(${.CURDIR}/../../domestic/usr.bin/telnet) || \
!     defined(EXPORTABLE_SYSTEM) || \
!     make(obj) || make(clean) || make(cleandir) || make(distclean)
  
  PROG=	telnet
  
--- 39,45 ----
  # XXX Keep telnet(1) and libtelnet from getting out of sync during the build
  # XXX process.
  .if !exists(${.CURDIR}/../../domestic/usr.bin/telnet) || \
!     defined(EXPORTABLE_SYSTEM) || !make(install)
  
  PROG=	telnet
  
Index: xsrc/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/xsrc/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.5
diff -c -r1.1.1.1 -r1.5
*** Makefile	1999/01/17 15:28:17	1.1.1.1
--- Makefile	1999/03/05 17:07:23	1.5
***************
*** 17,26 ****
  install: install-xc install-contrib
  
  install-xc:
! 	cd xc; ${MAKE} install && ${MAKE} install.man
  
  install-contrib:
! 	cd contrib; ${MAKE} install && ${MAKE} install.man
  
  clean:
  	cd xc; ${MAKE} clean
--- 17,40 ----
  install: install-xc install-contrib
  
  install-xc:
! 	cd xc; ${MAKE} DESTDIR=${DESTDIR} install && \
! 	    ${MAKE} DESTDIR=${DESTDIR} install.man
  
  install-contrib:
! 	cd contrib; ${MAKE} DESTDIR=${DESTDIR} install && \
! 	    ${MAKE} DESTDIR=${DESTDIR} install.man
! 
! .ifndef DESTDIR
! distribution distrib-dirs:
! 	@echo setenv DESTDIR before doing that!
! 	@false
! .else
! distribution: distrib-dirs install
! 
! distrib-dirs:
! 	/usr/bin/install -d -o root -g wheel -m 755 ${DESTDIR}
! 
! .endif	# DESTDIR check
  
  clean:
  	cd xc; ${MAKE} clean
Index: xsrc/xc/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/xsrc/xc/Makefile,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -c -r1.1.1.2 -r1.3
*** Makefile	1999/01/19 02:56:29	1.1.1.2
--- Makefile	1999/03/05 17:07:23	1.3
***************
*** 176,188 ****
  includes:
  	    $(MAKE_CMD) $@
  install.linkkit:
! 	    $(MAKE_CMD) $@
  install.ln:
! 	    $(MAKE_CMD) $@
  install.man:
! 	    $(MAKE_CMD) $@
  install:
! 	    $(MAKE_CMD) $@
  Makefiles:
  	    $(MAKE_CMD) $@
  man_keywords:
--- 176,188 ----
  includes:
  	    $(MAKE_CMD) $@
  install.linkkit:
! 	    $(MAKE_CMD) DESTDIR=$(DESTDIR) $@
  install.ln:
! 	    $(MAKE_CMD) DESTDIR=$(DESTDIR) $@
  install.man:
! 	    $(MAKE_CMD) DESTDIR=$(DESTDIR) $@
  install:
! 	    $(MAKE_CMD) DESTDIR=$(DESTDIR) $@
  Makefiles:
  	    $(MAKE_CMD) $@
  man_keywords: