3 # make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \
6 # Where "/some/dir" is the pathname of a directory on a some filesystem with
7 # at least 1000MB of free space, "somename" is what you want the release to
8 # call itself, "/cvs/dir" is where our source repo resides and, optionally,
9 # which CVS "tag" name should be used when checking out the sources to build
10 # the release (default is HEAD).
12 # Please note: the md(4) driver must be present in the kernel
13 # (either by being compiled in or available as a kld(4) module),
14 # otherwise the target 'release.8' and possibly others will fail.
16 # Note: If you add options to this file, please keep release(7) updated!
18 # Set these, release builder!
21 #BUILDNAME=8.0-CURRENT
23 # Automatic SNAP versioning:
26 BUILDNAME?=${BASE}-${DATE}-SNAP
28 #CHROOTDIR=/junk/release
29 # If this is a -stable snapshot, then set
32 # To test a release with a source tree containing patches and
33 # other work. This tree will get copied instead of getting the
34 # src/ tree from a CVS checkout. For "rerelease", this will NOT
35 # be copied; cvs update will be used instead.
38 # To use a checked-out ports collection directory instead of
39 # checking out from a local CVS repository, set this option.
40 #EXTPORTSDIR=/usr/ports
42 # To add other options to the CVS subcommands (co,up), set
43 #CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'"
45 # To add other options to the CVS command, set
48 # To prefix the cvs command
49 #CVSPREFIX="/usr/bin/time"
51 # Where the CVS repository is
54 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
55 # are building an official release. Otherwise, we are building for
57 .if defined(RELEASETAG)
58 ISRELEASE!= expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
60 # Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
61 AUXRELEASETAG!= echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
62 DOCRELEASETAG?= ${AUXRELEASETAG}
63 PORTSRELEASETAG?= ${AUXRELEASETAG}
67 # If you want to pass flags to the world build such as -j X, use
68 # WORLD_FLAGS. Similarly, you can specify make flags for kernel
69 # builds via KERNEL_FLAGS.
73 TARGET_ARCH?= ${MACHINE_ARCH}
74 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
77 TARGET?= ${TARGET_ARCH}
79 CROSSENV= TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
80 CROSSMAKE= ${MAKE} ${CROSSENV}
81 NATIVEMAKE= ${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE}
83 # If you are using a local CVS repository with components stored in
84 # non-standard modules, override these on the make commandline or
86 RELEASESRCMODULE?= src
87 RELEASEDOCMODULE?= doc
88 RELEASEPORTSMODULE?= ports
90 # Uncomment this to disable the doc.1 target. Docs normally require
91 # the ports tree, so NOPORTS can be set together with NODOC in order
92 # to have neither ports or docs. If only NOPORTS is set to YES, but
93 # docs are still desired, the DOMINIMALDOCPORTS logic below will only
94 # install the ports that are minimally required for the docs. This is
95 # intended as a compromise, less disk space is required than for using
96 # the entire ports collection (and much less time due to the huge number
97 # of directories it would create), but still quite a bit as well as some
98 # CPU cycles (some of the programs are C++, and things like ghostscript
99 # belong to the required ports nevertheless).
101 # Setting this also disables building of release note documentation
106 # When retrieving ports using the pkg_add -r method, set your proxies to these.
107 # src/release/${arch}/mkisoimages.sh can use these.
108 #HTTP_PROXY?= www.example.com
109 #FTP_PROXY?= ftp.example.com
111 # When creating ISO images, point ${CD_PACKAGE_TREE} to a directory containing
112 # the package split by an earlier invocation of the 'package-split' target.
113 #CD_PACKAGE_TREE= /path/to/pkg
115 # Extra source tarballs; each argument is a pair of source dir and
116 # distribution name. The dist name should not exceed 7 characters
117 # (another "s" for "source" will be prepended).
118 #EXTRA_SRC= games/fortune fortune
120 # Modify this definition if you want the release notes
121 # and other release documentation in a language other than English.
122 RELNOTES_LANG?= en_US.ISO8859-1
124 # As an alternative to installing the entire ports collection (which
125 # can take a huge amount of time, in particular on slower disks),
126 # setting ${MINIMALDOCPORTS} allows to install and build just those
127 # ports that are really required for getting the docs up & running.
128 .if defined(NOPORTS) && !defined(NODOC)
129 DOMINIMALDOCPORTS= YES
130 .include "Makefile.inc.docports"
131 RELEASEPORTSMODULE= ${MINIMALDOCPORTS}
136 .if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
142 # Doing 'make index' in /usr/ports requires Perl.
143 MAKEINDEXPORTS= lang/perl5.8
144 # By default, documentation (Handbook, FAQ, etc.) is built for all
145 # the languages. To speed up building, set the DOC_LANG to just
146 # the languages you need. (The language for the release notes is
147 # controlled by the RELNOTES_LANG variable above.)
148 #DOC_LANG= en_US.ISO8859-1
149 DOCPORTS= textproc/docproj
150 # Set this to wherever the distfiles required by release procedures.
151 .if defined(DOCDISTFILES)
152 # Respect DOCDISTFILES which is used before.
153 RELEASEDISTFILES?= ${DOCDISTFILES}
155 RELEASEDISTFILES?= ${.CURDIR}/../../ports/distfiles
157 # Set this to 1 if you want -P to be used for automatic keyboard detection
158 # on the boot floppy. WARNING: Breaks on some Athlon (K7) motherboards.
159 AUTO_KEYBOARD_DETECT?= 0
162 DIST_DOCS_ARCH_INDEP= hardware readme relnotes errata
166 # Things which without too much trouble can be considered variables
167 # BASE_DISTS are special in that they get full /etc installation sets.
169 OTHER_DISTS?= catpages manpages games proflibs dict info doc ${ARCH_DISTS}
171 .if ${TARGET_ARCH} == "amd64"
174 DISTRIBUTIONS?= ${BASE_DISTS} ${OTHER_DISTS}
177 # Build and package both GENERIC and SMP kernels if the target
178 # has both configuration files. Otherwise only GENERIC is done.
180 .if exists(${.CURDIR}/../sys/${TARGET}/conf/SMP)
181 KERNELS_BASE?= GENERIC SMP
183 KERNELS_BASE?= GENERIC
186 # mountpoint for filesystems.
189 # Various floppy image parameters.
193 .if ${TARGET_ARCH} == "i386"
197 .if ${TARGET} == "pc98"
198 SMALLFLOPPYSIZE= 1200
199 SMALLFLOPPYSPLITSIZE= 1152
200 SMALLFLOPPYLABEL= fd1200
204 FLOPPYSPLITSIZE= 1392
211 .elif ${TARGET_ARCH} == "sparc64"
217 .elif ${TARGET_ARCH} == "ia64"
222 .elif ${TARGET_ARCH} == "amd64"
225 FLOPPYSPLITSIZE= 1392
234 .elif ${TARGET_ARCH} == "powerpc"
241 .if defined(NO_FLOPPIES)
245 .if exists(/sbin/bsdlabel)
248 DISKLABEL?= disklabel
251 ZIPPER= gzip -9 --no-name
252 ZIPNSPLIT= ${ZIPPER} -c | split -b 1392k -
254 # Things which may get you into trouble if you change them
255 MTREEFILES= ${.CURDIR}/../etc/mtree
258 RND= ${RD}/release.doc
261 CD_BOOT= ${CD}/bootonly
262 CD_DISC1= ${CD}/disc1
263 CD_DISC2= ${CD}/disc2
267 .if defined(SEPARATE_LIVEFS)
268 CD_LIVEFS= ${CD}/livefs
270 CD_LIVEFS= ${CD_DISC1}
272 _MK?= ${CHROOTDIR}/mk
274 # Where the bootstrap ports (see DOCPORTS) get installed.
275 LOCALDIR= /usr/local/bin
277 .if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
278 DOFS_SH= ${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
280 DOFS_SH= ${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
284 .if ${TARGET_ARCH} == "i386"
285 CRUNCH_TARGETS+=fixit
286 .if ${TARGET} == "pc98"
287 CRUNCH_TARGETS+=fixit-small
291 .if defined(MAKE_FLOPPIES)
293 .if ${TARGET_ARCH} == "i386"
299 .if !defined(NOCDROM)
300 EXTRAS+= cdrom.1 cdrom.2 cdrom.3
301 .if defined(MAKE_ISOS)
304 .if ${TARGET} == "pc98"
315 .if !make(release) && !make(rerelease) && !make(package-split)
316 BINMAKE!= cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
317 WMAKEENV!= cd ${.CURDIR}/..; \
318 ${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
319 WMAKE= ${WMAKEENV} ${BINMAKE}
323 .if defined(RELEASETAG)
324 CVS_SRCARGS+= -r ${RELEASETAG}
328 .if defined(DOCRELEASETAG)
329 CVS_DOCARGS+= -r ${DOCRELEASETAG}
333 .if defined(PORTSRELEASETAG)
334 CVS_PORTSARGS+= -r ${PORTSRELEASETAG}
337 WORLDDIR?= ${.CURDIR}/..
340 .if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
341 @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
343 .if defined(NOPORTSATALL) && !defined(NODOC)
344 @echo "Ports are required for building the docs. Either set NODOC or"
345 @echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
348 .if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
349 .for p in ${LOCAL_PATCHES}
351 @echo "The patch file ${p} does not exist!"
356 .if defined(LOCAL_SCRIPT) && !exists(${LOCAL_SCRIPT})
357 @echo "The local script ${LOCAL_SCRIPT} does not exist!"
361 .if exists(${CHROOTDIR})
362 # The first command will fail on a handful of files that have their schg
363 # flags set. But it greatly speeds up the next two commands.
364 # NB: clear any vestigial devfs mount, just in case
365 -umount ${CHROOTDIR}/dev > /dev/null 2>&1
366 -rm -rf ${CHROOTDIR} 2>/dev/null
367 -chflags -R 0 ${CHROOTDIR}/.
370 mkdir -p ${CHROOTDIR}
371 @echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
372 cd ${WORLDDIR} && ${NATIVEMAKE} -DWITHOUT_GAMES -DWITHOUT_HTML -DWITHOUT_LIB32 \
373 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE installworld DESTDIR=${CHROOTDIR}
374 cd ${WORLDDIR} && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
375 if [ -f /etc/resolv.conf ]; then \
376 cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
378 .if defined(EXTLOCALDIR)
379 rm -rf ${CHROOTDIR}/usr/local
380 cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
382 rm -rf ${CHROOTDIR}/usr/src
383 .if defined(EXTSRCDIR)
384 cd ${CHROOTDIR}/usr && \
385 cp -R -H ${EXTSRCDIR} src
387 cd ${CHROOTDIR}/usr && \
388 ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
389 co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
391 .if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
392 .for p in ${LOCAL_PATCHES}
393 patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
396 .if defined(LOCAL_SCRIPT)
397 cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
398 RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
400 rm -rf ${CHROOTDIR}/usr/ports
401 .if !defined(NOPORTSATALL)
402 .if defined(EXTPORTSDIR)
403 cd ${CHROOTDIR}/usr && cp -R -H ${EXTPORTSDIR} ports
404 # If there are distfiles downloaded removing them
405 rm -rf ports/distfiles/*
407 cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
408 co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
412 rm -rf ${CHROOTDIR}/usr/doc
413 .if defined(EXTDOCDIR)
414 cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
416 cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
417 co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
419 if [ -d ${RELEASEDISTFILES}/ ]; then \
420 cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
422 mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
424 .if !defined(NO_PREFETCHDISTFILES)
425 @cd ${.CURDIR} && ${MAKE} fetch-distfiles
430 .if !defined(RELEASENOUPDATE) && !defined(EXTSRCDIR)
431 .if !defined(RELEASETAG)
432 cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
433 update ${CVSCMDARGS} -P -d -A
435 cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
436 update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
438 rm -f ${CHROOTDIR}/tmp/.world_done
439 .if !defined(NOPORTS) && !defined(EXTPORTSDIR)
440 cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
441 update ${CVSCMDARGS} -P -d
442 rm -f ${CHROOTDIR}/tmp/.skip_ports_index
444 .if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
445 for i in ${MINIMALDOCPORTS}; do \
446 ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
447 update ${CVSCMDARGS} -P -d ) ; \
451 cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
452 update ${CVSCMDARGS} -P -d
456 # Add version information to those things that need it.
457 if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
458 cd ${CHROOTDIR}/usr/src/sys/conf && \
459 mv newvers.sh foo && \
460 sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
463 -test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
464 echo "#!/bin/sh" > ${_MK}
465 echo "set -ex" >> ${_MK}
466 echo "trap 'umount /dev || true' 0" >> ${_MK}
467 echo "_RELTARGET=\$${1:-doRELEASE}" >> ${_MK}
469 AUTO_KEYBOARD_DETECT \
499 echo "export ${var}=\"${${var}}\"" >> ${_MK}
502 # Don't remove this, or the build will fall over!
503 echo "export RELEASEDIR=${_R}" >> ${_MK}
504 echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}" >> ${_MK}
505 echo "export MANBUILDCAT=YES" >> ${_MK}
506 # NB: these may fail if the host is running w/o devfs
507 echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
508 echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true" >> ${_MK}
509 echo "if [ ! -c /dev/null ]; then" >> ${_MK}
510 echo " echo /dev/null is not a device!" >> ${_MK}
511 echo " exit 1" >> ${_MK}
513 echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK}
514 echo " /etc/rc.d/ldconfig start" >> ${_MK}
515 echo "else" >> ${_MK}
516 echo " ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK}
518 echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
519 echo " cd /usr/src" >> ${_MK}
520 echo " ${CROSSMAKE} ${WORLD_FLAGS} -DNO_CLEAN buildworld && \\" >> ${_MK}
521 echo " touch /tmp/.world_done || exit 1" >> ${_MK}
523 echo "if [ ! -f /tmp/.skip_ports_index ]; then" >> ${_MK}
524 echo " echo \">>> make index started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
525 echo " for i in ${MAKEINDEXPORTS}" >> ${_MK}
527 echo " cd /usr/ports/\$${i}" >> ${_MK}
528 echo " env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \\" >> ${_MK}
529 echo " make all install clean BATCH=yes FORCE_PKG_REGISTER=yes" >> ${_MK}
530 echo " done" >> ${_MK}
531 echo " cd /usr/ports" >> ${_MK}
532 echo " rm -f INDEX*" >> ${_MK}
533 echo " make index -DINDEX_PRISTINE" >> ${_MK}
534 echo " rm -f INDEX*.tmp" >> ${_MK}
535 echo " touch /tmp/.skip_ports_index" >> ${_MK}
536 echo " echo \">>> make index finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
538 echo "cd /usr/src/release" >> ${_MK}
539 echo "make obj" >> ${_MK}
540 echo "make \$${_RELTARGET}" >> ${_MK}
541 echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
544 touch ${CHROOTDIR}/tmp/.skip_ports_index
546 # Ensure md.ko is loaded if md(4) is not statically compiled into
548 -mdconfig 2>/dev/null
549 env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
552 rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-8] ${EXTRAS}
555 @for i in ${MAKEINDEXPORTS}; do \
556 cd ${CHROOTDIR}/usr/ports/$$i && \
557 make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
558 checksum-recursive ; \
560 @for i in ${DOCPORTS}; do \
561 cd ${CHROOTDIR}/usr/ports/$$i && \
562 make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
563 WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
564 checksum-recursive ; \
567 # Clean out ${_R} and make the directory structure.
570 -rm -rf ${_R}/* 2> /dev/null
571 -chflags -R noschg ${_R}/.
574 .if defined(MAKE_FLOPPIES)
578 for i in ${DISTRIBUTIONS}; do \
579 mkdir ${RD}/trees/$$i && \
580 mtree -deU -f ${MTREEFILES}/BSD.root.dist \
581 -p ${RD}/trees/$$i > /dev/null && \
582 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
583 -p ${RD}/trees/$$i/usr > /dev/null && \
584 mtree -deU -f ${MTREEFILES}/BSD.include.dist \
585 -p ${RD}/trees/$$i/usr/include > /dev/null && \
586 mtree -deU -f ${MTREEFILES}/BSD.var.dist \
587 -p ${RD}/trees/$$i/var > /dev/null ; \
590 for i in ${KERNELS_BASE} ${KERNELS}; do \
591 mkdir -p ${RD}/kernels/$${i}; \
595 # Install the system into the various distributions.
597 cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base
598 cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
602 # Make and install the generic kernel(s).
604 .for kernel in ${KERNELS_BASE} ${KERNELS}
606 ${CROSSMAKE} ${KERNEL_FLAGS} \
607 KERNCONF=${kernel} kernel \
608 DESTDIR=${RD}/kernels KODIR=/${kernel}
612 # Make and install the three crunched binaries which live on the floppies.
613 # You are not supposed to like this :-)
616 mkdir -p ${RD}/crunch
617 .for j in ${CRUNCH_TARGETS}
618 .if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
621 cd ${j}_crunch; ${WMAKEENV} MAKEFLAGS="-m ${.CURDIR}/../share/mk" \
622 NO_WERROR= crunchgen -o \
623 ${.CURDIR}/${TARGET}/${j}_crunch.conf
624 cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
625 cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
626 cd ${j}_crunch; CFLAGS="-Os -pipe" ${WMAKE} -f ${j}_crunch.mk \
628 ${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
629 mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
635 # --==## Fix up the distributions. ##==--
638 # Create any "synthetic dists" now.
639 @for i in ${DISTRIBUTIONS}; do \
640 if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
641 echo -n "Running $$i dist creation script... "; \
642 env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
647 # Remove all the directories we don't need.
649 (find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \
650 find ${OTHER_DISTS} -depth -type d -empty -print | xargs rmdir)
654 # --==## Package up the tarballs from assembled trees ##==--
659 @for i in ${DISTRIBUTIONS} ; \
661 if [ -d ${RD}/trees/$${i} ] ; then \
662 cd ${.CURDIR} && $(MAKE) doTARBALL \
663 SD=${RD}/trees/$${i} \
664 TN=$$i TD=$$i ARG="." && \
665 echo "$${i} distribution is finished."; \
668 @for i in ${KERNELS_BASE} ${KERNELS} ; \
670 if [ -d ${RD}/kernels/$${i} ] ; then \
671 cd ${.CURDIR} && $(MAKE) doTARBALL \
673 TN=$$i TD=kernels ARG="$$i" && \
674 echo "$${i} distribution is finished."; \
677 .if !defined(NOPORTS)
678 # XXX: Inline stripped version of doTARBALL
679 @rm -rf ${RD}/dists/ports/ports*
680 @mkdir -p ${RD}/dists/ports
681 @echo rolling ports/ports tarball
682 @tar --exclude CVS --exclude 'ports/distfiles/*' \
683 -czf ${RD}/dists/ports/ports.tgz -C /usr ports
684 @cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
685 @(cd ${RD}/dists/ports; \
686 rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
687 md5 * > .CHECKSUM.MD5; \
688 sha256 * > .CHECKSUM.SHA256; \
689 mv .CHECKSUM.MD5 CHECKSUM.MD5; \
690 mv .CHECKSUM.SHA256 CHECKSUM.SHA256)
691 @echo "ports distribution is finished."
697 # --==## Make source dists ##==--
701 @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
702 TD=src TN=sbase ARG="[A-Z]*"
703 @for i in `cd /usr/src && echo [a-z]*` ; do \
704 if [ -d /usr/src/$$i ] ; then \
705 cd ${.CURDIR} && $(MAKE) doTARBALL \
706 TN=`echo s$$i | tr -d '.' | \
708 -e 's/kerberos5/krb5/'` \
709 SD=/usr/src TD=src ARG="$$i" ; \
712 .if defined(EXTRA_SRC)
713 @set ${EXTRA_SRC} && \
714 while [ $$# -ge 2 ] ; do \
715 if [ -d /usr/src/$$1 ] ; then \
716 cd ${.CURDIR} && $(MAKE) doTARBALL \
717 SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
718 fi && shift && shift ; \
721 (cd ${RD}/dists/src; \
722 rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
723 md5 * > .CHECKSUM.MD5; \
724 sha256 * > .CHECKSUM.SHA256; \
725 mv .CHECKSUM.MD5 CHECKSUM.MD5; \
726 mv .CHECKSUM.SHA256 CHECKSUM.SHA256)
727 @echo "src distribution is finished."
731 # Build the memory root filesystem.
733 cp ${RD}/trees/base/etc/disktab /etc
737 mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help \
739 @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
740 DIR=${RD}/mfsfd/stand ZIP=false
741 ( cd ${RD}/mfsfd && \
742 for dir in bin sbin ; do \
743 ln -sf /stand $$dir; \
745 cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
746 cp ${.CURDIR}/../etc/master.passwd ${RD}/mfsfd/etc/master.passwd
747 cp ${RD}/trees/base/etc/*pwd.db ${RD}/mfsfd/etc/
748 ( for F in defaults/rc.conf netconfig protocols ; do \
749 sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
750 ${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
752 grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
753 ${RD}/trees/base/etc/services | \
754 sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
755 > ${RD}/mfsfd/stand/etc/services
756 grep 'operator' ${RD}/trees/base/etc/group \
757 > ${RD}/mfsfd/stand/etc/group
758 ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
759 ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
760 ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
761 cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
763 @for i in ${DIST_DOCS_ARCH_INDEP}; do \
764 cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
765 ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
767 @for i in ${DIST_DOCS_ARCH_DEP}; do \
768 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
769 ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
772 -test -f ${.CURDIR}/install.cfg \
773 && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
774 @mkdir -p ${RD}/mfsfd/boot
775 .if ${TARGET_ARCH} != "ia64" && ${TARGET_ARCH} != "powerpc"
776 @cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
778 .if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
779 @cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
781 @tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
782 tar xf - -C ${RD}/mfsfd/stand
783 @mkdir -p ${RD}/mfsroot
784 sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
785 ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
786 @${ZIPPER} -fv ${RD}/mfsroot/mfsroot
789 KERNFLOPPYSET= ${RD}/floppyset/kern/kernel.gz
790 .if defined(SMALLFLOPPYSIZE)
791 SMALLKERNFLOPPYSET= ${RD}/floppyset/kern-small/kernel.gz
793 .if defined(SPLIT_MFSROOT)
794 MFSROOTFLOPPYSET= ${RD}/floppyset/mfsroot/mfsroot.gz
795 .if defined(SMALLFLOPPYSIZE)
796 SMALLMFSROOTFLOPPYSET= ${RD}/floppyset/mfsroot-small/mfsroot.gz
800 # Build boot and install floppies.
802 @${ZIPPER} -c ${RD}/kernels/GENERIC/kernel > ${RD}/kernels/kernel.gz
803 @echo "Making the kernel boot floppies..."
804 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \
805 FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz
806 .if defined(SMALLFLOPPYSIZE)
807 @echo "Making the small kernel boot floppies..."
808 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \
809 FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \
812 .if defined(SPLIT_MFSROOT)
813 @echo "Making the mfsroot boot floppies..."
814 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \
815 FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz
816 .if defined(SMALLFLOPPYSIZE)
817 @echo "Making the small mfsroot boot floppies..."
818 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \
819 FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \
822 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
823 KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
824 MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot"
825 .if defined(SMALLFLOPPYSIZE)
826 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
827 KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
828 MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \
831 .else # !SPLIT_MFSROOT
832 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
833 KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
834 MFSROOTFILE=${RD}/mfsroot/mfsroot.gz
835 .if defined(SMALLFLOPPYSIZE)
836 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
837 KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
838 MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \
841 .endif # SPLIT_MFSROOT
844 # Build fixit floppy.
846 @echo "Making fixit floppy."
847 @rm -rf ${RD}/fixitfd
849 @cd ${RD}/fixitfd && \
850 mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
852 @cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
854 @sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
855 > ${RD}/fixitfd/etc/protocols
856 @sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
857 > ${RD}/fixitfd/usr/share/misc/scsi_modes
858 @cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
859 @cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
860 @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
861 @chmod 555 ${RD}/fixitfd/stand/tar
862 .if defined(SMALLFLOPPYSIZE)
863 @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
864 DIR=${RD}/fixitfd/stand ZIP=false
865 @sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
866 ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL}
867 @rm -rf ${RD}/fixitfd/stand
868 @mkdir ${RD}/fixitfd/stand
870 @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
871 DIR=${RD}/fixitfd/stand ZIP=false
872 @sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \
873 ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL}
876 # Do our last minute floppies directory setup
878 @(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
879 @(cd ${RD}/floppies; sha256 *.flp > CHECKSUM.SHA256)
883 # --==## Setup a suitable ftp-area ##==--
886 @echo "Setting up FTP distribution area"
888 -@ln -s . ${FD}/${BUILDNAME}
889 .if defined(MAKE_FLOPPIES)
890 @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
892 @cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
894 @for i in ${DIST_DOCS_ARCH_INDEP}; do \
895 cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
896 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
897 cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
898 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
900 @for i in ${DIST_DOCS_ARCH_DEP}; do \
901 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
902 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
903 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
904 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
906 @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
908 @echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
911 # Build a live filesystem cdrom image
913 @echo "Building CDROM live filesystem image"
914 @mkdir -p ${CD_LIVEFS}
915 @for i in ${DISTRIBUTIONS} ; \
917 if [ -d ${RD}/trees/$${i} ] ; then \
918 chflags -R noschg ${RD}/trees/$${i} || true ; \
919 ( cd ${RD}/trees/$${i} && \
920 find . -depth -print | cpio -dumpl ${CD_LIVEFS} ) ; \
923 @echo "Copy GENERIC kernel to boot area"
924 @cp -Rp ${RD}/kernels/GENERIC/ ${CD_LIVEFS}/boot/kernel
925 @rm -f ${CD_LIVEFS}/boot/kernel/*.symbols
926 @rm -f ${CD_LIVEFS}/.profile
927 @cp ${.CURDIR}/fixit.profile ${CD_LIVEFS}/.profile
928 @ln -sf /rescue ${CD_LIVEFS}/stand
929 @echo "Setting up CDROM boot area"
930 @rm -f ${CD_LIVEFS}/boot/loader.conf
931 @cp ${RD}/mfsroot/mfsroot.gz ${CD_LIVEFS}/boot/mfsroot.gz
932 @echo 'mfsroot_load="YES"' > ${CD_LIVEFS}/boot/loader.conf
933 @echo 'mfsroot_type="mfs_root"' >> ${CD_LIVEFS}/boot/loader.conf
934 @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_LIVEFS}/boot/loader.conf
935 .if exists(${RD}/trees/base/boot/device.hints)
936 # Break the link to device.hints so we can modify it
937 @rm -f ${CD_LIVEFS}/boot/device.hints
938 @cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints
940 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf
943 # Build disc1 and disc2 cdrom images
945 @echo "Building CDROM disc1 filesystem image"
946 @mkdir -p ${CD_DISC1}/${BUILDNAME}
947 .if defined(MAKE_FLOPPIES)
948 @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
950 @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}/${BUILDNAME}
952 @for i in ${DIST_DOCS_ARCH_INDEP}; do \
953 cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
954 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
955 cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
956 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
958 @for i in ${DIST_DOCS_ARCH_DEP}; do \
959 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
960 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
961 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
962 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
964 @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
966 .if defined(SEPARATE_LIVEFS)
967 @cp -Rp ${CD_LIVEFS}/boot ${CD_DISC1}
968 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
970 @echo "CD_VOLUME = 1" >> ${CD_DISC1}/cdrom.inf
971 @echo "Building CDROM disc2 filesystem image"
972 @mkdir -p ${CD_DISC2}
973 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
974 @echo "CD_VOLUME = 2" >> ${CD_DISC2}/cdrom.inf
976 echo "Building CDROM docs filesystem image"
978 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DOCS}/cdrom.inf
979 @mkdir -p ${CD_DOCS}/usr/share/doc
980 @for i in `ls ${CD_LIVEFS}/usr/share/doc`; do \
981 if [ -L ${CD_LIVEFS}/usr/share/doc/$$i -o \
982 -d /usr/doc/$$i ]; then \
983 mv ${CD_LIVEFS}/usr/share/doc/$$i \
984 ${CD_DOCS}/usr/share/doc; \
991 # --==## Setup a suitable cdrom-area ##==--
995 @echo "Building bootonly CDROM filesystem image"
997 @cp -Rp ${CD_LIVEFS}/boot ${CD_BOOT}
998 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_BOOT}/cdrom.inf
999 .if defined(MINIROOT)
1000 @echo "Building bootonly UFS filesystem image"
1001 @mkdir -p ${FD}/miniroot
1002 @sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \
1003 ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto
1004 @${ZIPPER} -v ${FD}/miniroot/miniroot.ufs
1010 .if defined(CD_PACKAGE_TREE)
1011 .if exists(${CD_PACKAGE_TREE}/disc1)
1012 CD_DISC1_PKGS= ${CD_PACKAGE_TREE}/disc1
1014 .if exists(${CD_PACKAGE_TREE}/disc2)
1015 CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2
1021 .if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
1022 @echo "Creating ISO images..."
1023 .if defined(CD_BOOT)
1024 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1026 ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
1028 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1030 ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
1032 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
1034 ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \
1037 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
1038 FreeBSD_Documentation \
1039 ${CD}/${BUILDNAME}-${TARGET}-docs.iso ${CD_DOCS}
1041 .if defined(SEPARATE_LIVEFS)
1042 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
1044 ${CD}/${BUILDNAME}-${TARGET}-livefs.iso ${CD_LIVEFS}
1046 @echo "Generating MD5 and SHA256 sums..."
1047 @(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
1048 @(cd ${CD} && sha256 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.SHA256)
1051 @echo "Do not know how to create an ISO for ${TARGET_ARCH}."
1055 # --==## Documentation Project files such as the Handbook and FAQ ##==--
1058 @echo "Making docs..."
1059 @for i in ${DOCPORTS}; do \
1060 cd /usr/ports/$$i && \
1061 env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
1062 make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
1063 WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
1065 @cd /usr/doc && make all install 'FORMATS=html html-split txt' \
1066 INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc \
1071 # --==## RELNOTESng: Next-generation replacements for *.TXT files ##==--
1074 @echo "Making release documentation..."
1075 @cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
1076 INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${RND}
1079 # Various "subroutine" and other supporting targets.
1087 @echo "SD undefined in doTARBALL" && exit 1
1090 @echo "TD undefined in doTARBALL" && exit 1
1093 @echo "ARG undefined in doTARBALL" && exit 1
1095 @rm -rf ${RD}/dists/${TD}/${TN}*
1096 @mkdir -p ${RD}/dists/${TD}
1098 tn=`echo ${TN} | tr 'A-Z' 'a-z'` && \
1099 echo rolling ${TD}/$$tn tarball &&\
1100 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
1101 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1102 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1103 > ${RD}/dists/${TD}/$$tn.inf && \
1104 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1105 cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1106 ${RD}/dists/${TD}/install.sh && \
1107 chmod +x ${RD}/dists/${TD}/install.sh; \
1109 if [ "${SD}" != "/usr/src" ]; then \
1110 mtree -c -i -p ${SD}/${ARG} \
1111 -k gname,md5digest,mode,nlink,uname,size,link,type \
1112 > ${RD}/dists/${TD}/$$tn.mtree ; \
1116 ( cd ${RD}/dists/${TD}; \
1117 rm -f CHECKSUM.MD5 CHECKSUM.SHA256; \
1118 md5 * > .CHECKSUM.MD5; \
1119 sha256 * > .CHECKSUM.SHA256; \
1120 mv .CHECKSUM.MD5 CHECKSUM.MD5; \
1121 mv .CHECKSUM.SHA256 CHECKSUM.SHA256) \
1124 doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 \
1125 release.5 release.6 release.7 release.8 ${EXTRAS}
1126 @echo "Release done"
1129 @rm -f release.4 release.8 floppies.[123]
1130 @cd ${.CURDIR} && ${MAKE} release.4 release.8 floppies.1 floppies.2 \
1132 @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1135 .if !defined(CRUNCH)
1136 @echo "CRUNCH undefined in installCRUNCH" && exit 1
1139 @echo "DIR undefined in installCRUNCH" && exit 1
1142 @echo "ZIP undefined in installCRUNCH" && exit 1
1145 ${ZIPPER} < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1147 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1149 @chmod 555 ${DIR}/${CRUNCH}_crunch
1150 @if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1151 for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1152 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1155 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1156 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1161 # --==## Build a floppy set for a splitfs file ##==--
1163 # FLOPPYBASE - basename of floppy image files
1164 # FLOPPYDESC - description of floppy set
1165 # SPLITFILE - filename of the file to split
1166 # FDSIZE - if specified and "small", small floppy is created
1168 .if make(makeFloppySet)
1169 SPLITDIR= ${RD}/floppyset/${FLOPPYBASE}
1170 .if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1171 FLPSPLITSIZE= ${SMALLFLOPPYSPLITSIZE}
1172 FLPSIZE= ${SMALLFLOPPYSIZE}
1173 FLPLABEL= ${SMALLFLOPPYLABEL}
1175 FLPSPLITSIZE= ${FLOPPYSPLITSIZE}
1176 FLPSIZE= ${FLOPPYSIZE}
1177 FLPLABEL= ${FLOPPYLABEL}
1182 .if !defined(FLOPPYBASE)
1183 @echo "FLOPPYBASE undefined in ${.TARGET}" && exit 1
1185 .if !defined(FLOPPYDESC)
1186 @echo "FLOPPYDESC undefined in ${.TARGET}" && exit 1
1188 .if !defined(SPLITFILE)
1189 @echo "SPLITFILE undefined in ${.TARGET}" && exit 1
1191 sh ${.CURDIR}/scripts/split-file.sh ${SPLITFILE} \
1192 ${RD}/floppyset/${FLOPPYBASE} ${FLPSPLITSIZE} "${FLOPPYDESC}"
1193 ( splitfile=${SPLITDIR}/`basename ${SPLITFILE}`.split ; \
1194 lines=`cat $${splitfile} | wc -l`; \
1195 lines=$$(($$lines - 1)) ; \
1196 for line in `jot $$lines`; do \
1197 file=`head -n $$(($${line} + 1)) $${splitfile} | tail -1 | cut -f 1 -d ' '` ; \
1198 sh -e ${DOFS_SH} ${RD}/floppies/${FLOPPYBASE}$${line}.flp \
1199 ${RD} ${MNT} ${FLPSIZE} ${SPLITDIR}/$${file} \
1200 ${BOOTINODE} ${FLPLABEL}; \
1204 # --==## Build a boot floppy ##==--
1206 # FSIMAGE - base floppy image name
1207 # FDSIZE - if specified and "small", small floppy is created
1208 # KERNFILE - path to kernel split file
1209 # MFSROOTFILE - path to mfsroot split file
1211 .if make(buildBootFloppy)
1212 IMAGEDIR= ${RD}/image.${FSIMAGE}
1213 BOOTDIR= ${RD}/trees/base/boot
1214 HINTSFILE= ${BOOTDIR}/device.hints
1215 ACPI_KO= ${RD}/kernels/GENERIC/acpi.ko
1216 IMAGEFILE= ${RD}/floppies/${FSIMAGE}.flp
1217 .if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1218 FLPSIZE= ${SMALLFLOPPYSIZE}
1219 FLPLABEL= ${SMALLFLOPPYLABEL}
1221 FLPSIZE= ${FLOPPYSIZE}
1222 FLPLABEL= ${FLOPPYLABEL}
1227 .if !defined(FSIMAGE)
1228 @echo "FSIMAGE undefined in ${.TARGET}" && exit 1
1230 .if !defined(KERNFILE)
1231 @echo "KERNFILE undefined in ${.TARGET}" && exit 1
1233 .if !defined(MFSROOTFILE)
1234 @echo "MFSROOTFILE undefined in ${.TARGET}" && exit 1
1236 @echo "Running ${.TARGET} for ${FSIMAGE}"
1239 @echo "Setting up /boot directory for ${FSIMAGE} floppy"
1240 @mkdir -p ${IMAGEDIR}/boot
1241 .if ${TARGET} == "i386"
1242 @${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
1243 ${IMAGEDIR}/boot/loader ${BOOTDIR}/loader
1245 @cp ${BOOTDIR}/loader ${IMAGEDIR}/boot
1247 @cp -Rp ${BOOTDIR}/*.4th ${BOOTDIR}/defaults ${BOOTDIR}/loader.help \
1248 ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot
1249 .if exists(${HINTSFILE})
1250 @cp ${HINTSFILE} ${IMAGEDIR}/boot/device.hints
1251 @${ZIPPER} ${IMAGEDIR}/boot/device.hints
1253 @${ZIPPER} ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \
1254 ${IMAGEDIR}/boot/defaults/loader.conf
1255 @echo 'bootfile="/kernel"' > ${IMAGEDIR}/boot/loader.conf
1256 .if exists(${ACPI_KO})
1257 @${ZIPPER} -c ${ACPI_KO} > ${IMAGEDIR}/acpi.ko.gz
1258 @echo 'acpi_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1259 @echo 'acpi_name="/acpi.ko"' >> ${IMAGEDIR}/boot/loader.conf
1260 @echo 'acpi_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1262 @echo 'mfsroot_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1263 @echo 'mfsroot_type="mfs_root"' >> ${IMAGEDIR}/boot/loader.conf
1264 @echo 'mfsroot_name="/mfsroot"' >> ${IMAGEDIR}/boot/loader.conf
1265 .if !exists(${ACPI_KO})
1266 @echo 'mfsroot_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1268 .if defined(SPLIT_MFSROOT)
1269 @echo 'mfsroot_after="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1271 .if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
1272 .if ${AUTO_KEYBOARD_DETECT}
1273 @echo "-P" >> ${IMAGEDIR}/boot.config
1277 @cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR}
1278 sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \
1279 ${BOOTINODE} ${FLPLABEL}
1280 @echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1282 .if make(package-split)
1283 # Targets related to making a package split
1285 # PKG_COPY instructs the script to copy the actual package files rather than
1287 # PKG_TREE is the path to the package tree to be split
1288 # PKG_DEST is the path to the destination tree to create the split in
1289 # PKG_VERBOSE asks for verbose output of the layout process
1290 # PKG_INDEX is the path to the INDEX file. By default ${PKG_TREE}/INDEX.
1292 .if defined(PKG_COPY)
1297 PKG_WRKIDX= ${PKG_DEST}/INDEX.master
1299 .if defined(TARGET_ARCH)
1300 PKG_ENV+= PKG_ARCH=${TARGET_ARCH}
1302 .if defined(PKG_VERBOSE)
1303 PKG_ENV+= PKG_VERBOSE=1
1305 PKG_INDEX?= ${PKG_TREE}/INDEX
1308 .if !defined(PKG_TREE)
1309 @echo "PKG_TREE must be defined" && exit 1
1311 .if !defined(PKG_DEST)
1312 @echo "PKG_DEST must be defined" && exit 1
1314 @env ${PKG_ENV} python ${.CURDIR}/scripts/package-split.py \
1315 ${PKG_INDEX} ${PKG_WRKIDX}
1316 @env ${PKG_ENV} sh ${.CURDIR}/scripts/package-trees.sh ${PKG_DO_COPY} \
1317 ${PKG_WRKIDX} ${PKG_TREE} ${PKG_DEST}
1320 .include <bsd.obj.mk>