1# $FreeBSD$ 2# 3# make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \ 4# [RELEASETAG=tag] 5# 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). 11# 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. 15# 16# Note: If you add options to this file, please keep release(7) updated! 17# 18# Set these, release builder! 19# 20# Fixed version: 21#BUILDNAME=7.0-CURRENT 22# 23# Automatic SNAP versioning: 24DATE != date +%Y%m%d 25BASE = 7.0 26BUILDNAME?=${BASE}-${DATE}-SNAP 27# 28#CHROOTDIR=/junk/release 29# If this is a -stable snapshot, then set 30#RELEASETAG=RELENG_6 31# 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. 36#EXTSRCDIR=/usr/src 37# 38# To add other options to the CVS subcommands (co,up), set 39#CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'" 40# 41# To add other options to the CVS command, set 42#CVSARGS="-lfq" 43# 44# To prefix the cvs command 45#CVSPREFIX="/usr/bin/time" 46# 47# Where the CVS repository is 48#CVSROOT="/home/ncvs" 49# 50# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we 51# are building an official release. Otherwise, we are building for 52# a branch. 53.if defined(RELEASETAG) 54ISRELEASE!= expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true 55.if ${ISRELEASE} != 0 56# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees. 57AUXRELEASETAG!= echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//' 58DOCRELEASETAG?= ${AUXRELEASETAG} 59PORTSRELEASETAG?= ${AUXRELEASETAG} 60.endif 61.endif 62 63# If you want to pass flags to the world build such as -j X, use 64# WORLD_FLAGS. Similarly, you can specify make flags for kernel 65# builds via KERNEL_FLAGS. 66#WORLD_FLAGS=-j4 67#KERNEL_FLAGS=-j4 68 69TARGET_ARCH?= ${MACHINE_ARCH} 70.if ${TARGET_ARCH} == ${MACHINE_ARCH} 71TARGET?= ${MACHINE} 72.else 73TARGET?= ${TARGET_ARCH} 74.endif 75CROSSENV= TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} 76CROSSMAKE= ${MAKE} ${CROSSENV} 77NATIVEMAKE= ${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE} 78 79# If you are using a local CVS repository with components stored in 80# non-standard modules, override these on the make commandline or 81# in the environment. 82RELEASESRCMODULE?= src 83RELEASEDOCMODULE?= doc 84RELEASEPORTSMODULE?= ports 85 86# Uncomment this to disable the doc.1 target. Docs normally require 87# the ports tree, so NOPORTS can be set together with NODOC in order 88# to have neither ports or docs. If only NOPORTS is set to YES, but 89# docs are still desired, the DOMINIMALDOCPORTS logic below will only 90# install the ports that are minimally required for the docs. This is 91# intended as a compromise, less disk space is required than for using 92# the entire ports collection (and much less time due to the huge number 93# of directories it would create), but still quite a bit as well as some 94# CPU cycles (some of the programs are C++, and things like ghostscript 95# belong to the required ports nevertheless). 96# 97# Setting this also disables building of release note documentation 98# (RELNOTESng). 99#NODOC= YES 100#NOPORTS= YES 101 102# When retrieving ports using the pkg_add -r method, set your proxies to these. 103# src/release/${arch}/mkisoimages.sh can use these. 104#HTTP_PROXY?= www.example.com 105#FTP_PROXY?= ftp.example.com 106 107# When creating ISO images, point ${CD_PACKAGE_TREE} to a directory containing 108# the package split by an earlier invocation of the 'package-split' target. 109#CD_PACKAGE_TREE= /path/to/pkg 110 111# Extra source tarballs; each argument is a pair of source dir and 112# distribution name. The dist name should not exceed 7 characters 113# (another "s" for "source" will be prepended). 114#EXTRA_SRC= games/fortune fortune 115 116# Modify this definition if you want the release notes 117# and other release documentation in a language other than English. 118RELNOTES_LANG?= en_US.ISO8859-1 119 120# As an alternative to installing the entire ports collection (which 121# can take a huge amount of time, in particular on slower disks), 122# setting ${MINIMALDOCPORTS} allows to install and build just those 123# ports that are really required for getting the docs up & running. 124.if defined(NOPORTS) && !defined(NODOC) 125DOMINIMALDOCPORTS= YES 126.include "Makefile.inc.docports" 127RELEASEPORTSMODULE= ${MINIMALDOCPORTS} 128.endif 129 130# Helper variable 131.if defined(NOPORTS) 132.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES" 133NOPORTSATALL= YES 134.endif 135.endif 136 137# 138# Doing 'make index' in /usr/ports requires Perl. 139MAKEINDEXPORTS= lang/perl5.8 140# By default, documentation (Handbook, FAQ, etc.) is built for all 141# the languages. To speed up building, set the DOC_LANG to just 142# the languages you need. (The language for the release notes is 143# controlled by the RELNOTES_LANG variable above.) 144#DOC_LANG= en_US.ISO8859-1 145DOCPORTS= textproc/docproj 146# Set this to wherever the distfiles required by release procedures. 147.if defined(DOCDISTFILES) 148# Respect DOCDISTFILES which is used before. 149RELEASEDISTFILES?= ${DOCDISTFILES} 150.else 151RELEASEDISTFILES?= ${.CURDIR}/../../ports/distfiles 152.endif 153# Set this to 1 if you want -P to be used for automatic keyboard detection 154# on the boot floppy. WARNING: Breaks on some Athlon (K7) motherboards. 155AUTO_KEYBOARD_DETECT?= 0 156 157.if !defined(NODOC) 158DIST_DOCS_ARCH_INDEP= readme errata 159DIST_DOCS_ARCH_DEP= installation relnotes hardware 160.endif 161 162# Things which without too much trouble can be considered variables 163# BASE_DISTS are special in that they get full /etc installation sets. 164# 165OTHER_DISTS?= catpages manpages games proflibs dict info doc ${ARCH_DISTS} 166BASE_DISTS?= base 167.if ${TARGET_ARCH} == "amd64" 168ARCH_DISTS?= lib32 169.endif 170DISTRIBUTIONS?= ${BASE_DISTS} ${OTHER_DISTS} 171 172# mountpoint for filesystems. 173MNT= /mnt 174 175# Various floppy image parameters. 176# 177 178.undef MAKE_FLOPPIES 179.if ${TARGET_ARCH} == "i386" 180MAKE_FLOPPIES= true 181.if ${TARGET} == "pc98" 182SMALLFLOPPYSIZE= 1200 183SMALLFLOPPYSPLITSIZE= 1152 184SMALLFLOPPYLABEL= fd1200 185SPLIT_MFSROOT= 186.endif 187FLOPPYSIZE= 1440 188FLOPPYSPLITSIZE= 1392 189FLOPPYINODE= 40000 190FLOPPYLABEL= fd1440 191BOOTINODE= 80000 192MFSSIZE= 4320 193MFSINODE= 8000 194MFSLABEL= minimum3 195.elif ${TARGET_ARCH} == "alpha" 196MAKE_FLOPPIES= true 197FLOPPYSIZE= 1440 198FLOPPYSPLITSIZE= 1392 199FLOPPYINODE= 40000 200FLOPPYLABEL= fd1440 201BOOTINODE= 80000 202MFSSIZE= 4320 203MFSINODE= 8000 204MFSLABEL= auto 205SPLIT_MFSROOT= 206.elif ${TARGET_ARCH} == "sparc64" 207DISKLABEL= sunlabel 208MFSSIZE= 4096 209MFSINODE= 8192 210MFSLABEL= auto 211MINIROOT= 212.elif ${TARGET_ARCH} == "ia64" 213MFSSIZE= 8192 214MFSINODE= 8192 215MFSLABEL= auto 216SEPARATE_LIVEFS= 217.elif ${TARGET_ARCH} == "amd64" 218MFSSIZE= 4096 219MFSINODE= 8192 220MFSLABEL= auto 221.elif ${TARGET_ARCH} == "powerpc" 222DISKLABEL= "" 223MFSSIZE= 4096 224MFSINODE= 8192 225MFSLABEL= auto 226SEPARATE_LIVEFS= 227.endif 228.if defined(NO_FLOPPIES) 229.undef MAKE_FLOPPIES 230.endif 231 232.if exists(/sbin/bsdlabel) 233DISKLABEL?= bsdlabel 234.else 235DISKLABEL?= disklabel 236.endif 237 238ZIPNSPLIT= gzip --no-name -9 -c | split -b 1392k - 239 240# Things which may get you into trouble if you change them 241MTREEFILES= ${.CURDIR}/../etc/mtree 242_R?= /R 243RD= ${_R}/stage 244RND= ${RD}/release.doc 245FD= ${_R}/ftp 246CD= ${_R}/cdrom 247.if ${TARGET} != "pc98" 248CD_BOOT= ${CD}/bootonly 249.endif 250CD_DISC1= ${CD}/disc1 251CD_DISC2= ${CD}/disc2 252.if defined(SEPARATE_LIVEFS) 253CD_LIVEFS= ${CD}/livefs 254.else 255CD_LIVEFS= ${CD_DISC1} 256.endif 257_MK?= ${CHROOTDIR}/mk 258 259# Where the bootstrap ports (see DOCPORTS) get installed. 260LOCALDIR= /usr/local/bin 261 262.if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel" 263DOFS_SH= ${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET} 264.else 265DOFS_SH= ${.CURDIR}/scripts/doFS.sh ${DISKLABEL} "" 266.endif 267 268CRUNCH_TARGETS= boot 269.if ${TARGET_ARCH} == "i386" 270CRUNCH_TARGETS+=fixit 271.if ${TARGET} == "pc98" 272CRUNCH_TARGETS+=fixit-small 273.endif 274.endif 275 276.if defined(MAKE_FLOPPIES) 277EXTRAS= floppies.1 278.if ${TARGET_ARCH} == "i386" 279EXTRAS+= floppies.2 280.endif 281EXTRAS+= floppies.3 282.endif 283EXTRAS+= ftp.1 284.if !defined(NOCDROM) 285EXTRAS+= cdrom.1 cdrom.2 cdrom.3 286.if defined(MAKE_ISOS) 287EXTRAS+= iso.1 288.endif 289.if ${TARGET} == "pc98" 290BOOTABLE= 291.else 292BOOTABLE="-b" 293.endif 294.endif 295 296.if !defined(NODOC) 297DOCREL= doc.1 doc.2 298.endif 299 300.if !make(release) && !make(rerelease) && !make(package-split) 301BINMAKE!= cd ${.CURDIR}/..; ${MAKE} -V BINMAKE 302WMAKEENV!= cd ${.CURDIR}/..; \ 303 ${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV 304WMAKE= ${WMAKEENV} ${BINMAKE} 305.endif 306 307CVS_SRCARGS= -P 308.if defined(RELEASETAG) 309CVS_SRCARGS+= -r ${RELEASETAG} 310.endif 311 312CVS_DOCARGS= -P 313.if defined(DOCRELEASETAG) 314CVS_DOCARGS+= -r ${DOCRELEASETAG} 315.endif 316 317CVS_PORTSARGS= -P 318.if defined(PORTSRELEASETAG) 319CVS_PORTSARGS+= -r ${PORTSRELEASETAG} 320.endif 321 322WORLDDIR?= ${.CURDIR}/.. 323 324release rerelease: 325.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT) 326 @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false 327.endif 328.if defined(NOPORTSATALL) && !defined(NODOC) 329 @echo "Ports are required for building the docs. Either set NODOC or" 330 @echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!" 331 @exit 1 332.endif 333.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES) 334.for p in ${LOCAL_PATCHES} 335.if !exists(${p}) 336 @echo "The patch file ${p} does not exist!" 337 @exit 1 338.endif 339.endfor 340.endif 341.if defined(LOCAL_SCRIPT) && !exists(${LOCAL_SCRIPT}) 342 @echo "The local script ${LOCAL_SCRIPT} does not exist!" 343 @exit 1 344.endif 345.if make(release) 346.if exists(${CHROOTDIR}) 347# The first command will fail on a handful of files that have their schg 348# flags set. But it greatly speeds up the next two commands. 349 # NB: clear any vestigial devfs mount, just in case 350 -umount ${CHROOTDIR}/dev > /dev/null 2>&1 351 -rm -rf ${CHROOTDIR} 2>/dev/null 352 -chflags -R 0 ${CHROOTDIR}/. 353 -rm -rf ${CHROOTDIR} 354.endif 355 mkdir -p ${CHROOTDIR} 356 @echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`" 357 cd ${WORLDDIR} && ${NATIVEMAKE} -DNO_GAMES -DNO_HTML -DNO_LIB32 \ 358 -DNO_MAN -DNO_NLS -DNO_PROFILE installworld DESTDIR=${CHROOTDIR} 359 cd ${WORLDDIR} && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR} 360 if [ -f /etc/resolv.conf ]; then \ 361 cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \ 362 fi 363.if defined(EXTLOCALDIR) 364 rm -rf ${CHROOTDIR}/usr/local 365 cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local 366.endif 367 rm -rf ${CHROOTDIR}/usr/src 368.if defined(EXTSRCDIR) 369 cd ${CHROOTDIR}/usr && \ 370 cp -R -H ${EXTSRCDIR} src 371.else 372 cd ${CHROOTDIR}/usr && \ 373 ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \ 374 co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE} 375.endif 376.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES) 377.for p in ${LOCAL_PATCHES} 378 patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p} 379.endfor 380.endif 381.if defined(LOCAL_SCRIPT) 382 cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \ 383 RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT} 384.endif 385 rm -rf ${CHROOTDIR}/usr/ports 386.if !defined(NOPORTSATALL) 387 cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \ 388 co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE} 389.endif 390.if !defined(NODOC) 391 rm -rf ${CHROOTDIR}/usr/doc 392.if defined(EXTDOCDIR) 393 cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc 394.else 395 cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \ 396 co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE} 397.endif 398 if [ -d ${RELEASEDISTFILES}/ ]; then \ 399 cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \ 400 else \ 401 mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \ 402 fi 403.if !defined(NO_PREFETCHDISTFILES) 404 @cd ${.CURDIR} && ${MAKE} fetch-distfiles 405.endif 406.endif 407.endif 408.if make(rerelease) 409.if !defined(RELEASENOUPDATE) 410.if !defined(RELEASETAG) 411 cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \ 412 update ${CVSCMDARGS} -P -d -A 413.else 414 cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \ 415 update ${CVSCMDARGS} -P -d -r ${RELEASETAG} 416.endif 417 rm -f ${CHROOTDIR}/tmp/.world_done 418.if !defined(NOPORTS) 419 cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \ 420 update ${CVSCMDARGS} -P -d 421 rm -f ${CHROOTDIR}/tmp/.skip_ports_index 422.endif 423.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES" 424 for i in ${MINIMALDOCPORTS}; do \ 425 ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \ 426 update ${CVSCMDARGS} -P -d ) ; \ 427 done 428.endif 429.if !defined(NODOC) 430 cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \ 431 update ${CVSCMDARGS} -P -d 432.endif 433.endif 434.endif 435 # Add version information to those things that need it. 436 if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \ 437 cd ${CHROOTDIR}/usr/src/sys/conf && \ 438 mv newvers.sh foo && \ 439 sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \ 440 rm foo; \ 441 fi 442 -test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release 443 echo "#!/bin/sh" > ${_MK} 444 echo "set -ex" >> ${_MK} 445 echo "trap 'umount /dev || true' 0" >> ${_MK} 446 echo "_RELTARGET=\$${1:-doRELEASE}" >> ${_MK} 447.for var in \ 448 AUTO_KEYBOARD_DETECT \ 449 BUILDNAME \ 450 CD_PACKAGE_TREE \ 451 DISTRIBUTIONS \ 452 DOC_LANG \ 453 DOMINIMALDOCPORTS \ 454 EXTRA_SRC \ 455 FTP_PASSIVE_MODE \ 456 FTP_PROXY \ 457 HTTP_PROXY \ 458 KERNELS \ 459 KERNEL_FLAGS \ 460 MAKE_FLOPPIES \ 461 MAKE_ISOS \ 462 NOCDROM \ 463 NODOC \ 464 NOPORTS \ 465 NO_SHARED \ 466 NOSRC \ 467 NO_CPU_CFLAGS \ 468 NO_CPU_COPTFLAGS \ 469 NO_FLOPPIES \ 470 NO_SENDMAIL \ 471 RELEASETAG \ 472 RELNOTES_LANG \ 473 SEPARATE_LIVEFS \ 474 TARGET \ 475 TARGET_ARCH \ 476 WORLD_FLAGS 477.if defined(${var}) 478 echo "export ${var}=\"${${var}}\"" >> ${_MK} 479.endif 480.endfor 481 # Don't remove this, or the build will fall over! 482 echo "export RELEASEDIR=${_R}" >> ${_MK} 483 echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}" >> ${_MK} 484 echo "export MANBUILDCAT=YES" >> ${_MK} 485 # NB: these may fail if the host is running w/o devfs 486 echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK} 487 echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true" >> ${_MK} 488 echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK} 489 echo " /etc/rc.d/ldconfig start" >> ${_MK} 490 echo "else" >> ${_MK} 491 echo " ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK} 492 echo "fi" >> ${_MK} 493 echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK} 494 echo " cd /usr/src" >> ${_MK} 495 echo " ${CROSSMAKE} ${WORLD_FLAGS} -DNO_CLEAN buildworld && \\" >> ${_MK} 496 echo " touch /tmp/.world_done || exit 1" >> ${_MK} 497 echo "fi" >> ${_MK} 498 echo "if [ ! -f /tmp/.skip_ports_index ]; then" >> ${_MK} 499 echo " echo \">>> make index started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} 500 echo " for i in ${MAKEINDEXPORTS}" >> ${_MK} 501 echo " do" >> ${_MK} 502 echo " cd /usr/ports/\$${i}" >> ${_MK} 503 echo " env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \\" >> ${_MK} 504 echo " make all install clean BATCH=yes FORCE_PKG_REGISTER=yes" >> ${_MK} 505 echo " done" >> ${_MK} 506 echo " cd /usr/ports" >> ${_MK} 507 echo " rm -f INDEX*" >> ${_MK} 508 echo " make index -DINDEX_PRISTINE" >> ${_MK} 509 echo " rm -f INDEX*.tmp" >> ${_MK} 510 echo " touch /tmp/.skip_ports_index" >> ${_MK} 511 echo " echo \">>> make index finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} 512 echo "fi" >> ${_MK} 513 echo "cd /usr/src/release" >> ${_MK} 514 echo "make obj" >> ${_MK} 515 echo "make \$${_RELTARGET}" >> ${_MK} 516 echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} 517 chmod 755 ${_MK} 518.if defined(NOPORTS) 519 touch ${CHROOTDIR}/tmp/.skip_ports_index 520.endif 521 # Ensure md.ko is loaded if md(4) is not statically compiled into 522 # the kernel 523 -mdconfig 2>/dev/null 524 env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}` 525 526clean: 527 rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-8] ${EXTRAS} 528 529fetch-distfiles: 530 @for i in ${MAKEINDEXPORTS}; do \ 531 cd ${CHROOTDIR}/usr/ports/$$i && \ 532 make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \ 533 checksum-recursive ; \ 534 done 535 @for i in ${DOCPORTS}; do \ 536 cd ${CHROOTDIR}/usr/ports/$$i && \ 537 make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \ 538 WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \ 539 checksum-recursive ; \ 540 done 541 542# Clean out ${_R} and make the directory structure. 543release.1: 544 mkdir -p ${_R} 545 -rm -rf ${_R}/* 2> /dev/null 546 -chflags -R noschg ${_R}/. 547 rm -rf ${_R}/* 548 mkdir ${RD} 549.if defined(MAKE_FLOPPIES) 550 mkdir ${RD}/floppies 551.endif 552 mkdir ${RD}/trees 553 mkdir ${RD}/kernels 554 for i in ${DISTRIBUTIONS}; do \ 555 mkdir ${RD}/trees/$$i && \ 556 mtree -deU -f ${MTREEFILES}/BSD.root.dist \ 557 -p ${RD}/trees/$$i > /dev/null && \ 558 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \ 559 -p ${RD}/trees/$$i/usr > /dev/null && \ 560 mtree -deU -f ${MTREEFILES}/BSD.include.dist \ 561 -p ${RD}/trees/$$i/usr/include > /dev/null && \ 562 mtree -deU -f ${MTREEFILES}/BSD.var.dist \ 563 -p ${RD}/trees/$$i/var > /dev/null ; \ 564 done 565 touch ${.TARGET} 566 567# Install the system into the various distributions. 568release.2: 569 cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base 570 cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \ 571 DISTDIR=${RD}/trees 572 touch ${.TARGET} 573 574# Make and install the generic kernel(s). 575release.3: 576.for kernel in ${KERNELS} 577 cd ${.CURDIR}/..; \ 578 ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \ 579 KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \ 580 DESTDIR=${RD}/trees/base 581.endfor 582 # Install a standard boot kernel+modules. 583 cd ${.CURDIR}/..; \ 584 ${CROSSMAKE} ${KERNEL_FLAGS} \ 585 kernel \ 586 DESTDIR=${RD}/trees/base; \ 587 cd ${.CURDIR}/..; \ 588 ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \ 589 reinstallkernel -DINSTALL_DEBUG \ 590 DESTDIR=${RD}/trees/base 591 touch ${.TARGET} 592 593# Make and install the three crunched binaries which live on the floppies. 594# You are not supposed to like this :-) 595release.4: 596 rm -rf ${RD}/crunch 597 mkdir -p ${RD}/crunch 598.for j in ${CRUNCH_TARGETS} 599.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf) 600 rm -rf ${j}_crunch 601 mkdir ${j}_crunch 602 cd ${j}_crunch; ${WMAKEENV} crunchgen -o \ 603 ${.CURDIR}/${TARGET}/${j}_crunch.conf 604 cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean 605 cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools 606 cd ${j}_crunch; CFLAGS="-Os -pipe" ${WMAKE} -f ${j}_crunch.mk \ 607 -DNO_CPU_CFLAGS all 608 ${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch 609 mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j} 610.endif 611.endfor 612 touch ${.TARGET} 613 614# 615# --==## Fix up the distributions. ##==-- 616# 617release.5: 618 # Create any "synthetic dists" now. 619 @for i in ${DISTRIBUTIONS}; do \ 620 if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \ 621 echo -n "Running $$i dist creation script... "; \ 622 env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \ 623 echo "Done."; \ 624 fi \ 625 done \ 626 627 # Remove all the directories we don't need. 628 -cd ${RD}/trees && \ 629 (find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \ 630 find ${OTHER_DISTS} -depth -type d -print | xargs rmdir) 631 touch ${.TARGET} 632 633# 634# --==## Package up the tarballs from assembled trees ##==-- 635# 636release.6: 637 rm -rf ${RD}/dists 638 mkdir -p ${RD}/dists 639 @for i in ${DISTRIBUTIONS} ; \ 640 do \ 641 if [ -d ${RD}/trees/$${i} ] ; then \ 642 cd ${.CURDIR} && $(MAKE) doTARBALL \ 643 SD=${RD}/trees/$${i} \ 644 TN=$$i TD=$$i ARG="." && \ 645 echo "$${i} distribution is finished."; \ 646 fi ; \ 647 done 648.if !defined(NOPORTS) 649 # XXX: Inline stripped version of doTARBALL 650 @rm -rf ${RD}/dists/ports/ports* 651 @mkdir -p ${RD}/dists/ports 652 @echo rolling ports/ports tarball 653 @tar --exclude CVS --exclude 'ports/distfiles/*' \ 654 -czf ${RD}/dists/ports/ports.tgz -C /usr ports 655 @cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh 656 @(cd ${RD}/dists/ports; \ 657 rm -f CHECKSUM.MD5; \ 658 md5 * > CHECKSUM.MD5) 659 @echo "ports distribution is finished." 660.endif 661 touch ${.TARGET} 662 663 664# 665# --==## Make source dists ##==-- 666# 667release.7: 668.if !defined(NOSRC) 669 @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \ 670 TD=src TN=sbase ARG="[A-Z]*" 671 @for i in `cd /usr/src && echo [a-z]*` ; do \ 672 if [ -d /usr/src/$$i ] ; then \ 673 cd ${.CURDIR} && $(MAKE) doTARBALL \ 674 TN=`echo s$$i | tr -d '.' | \ 675 sed -e 's/usr/u/' \ 676 -e 's/kerberos5/krb5/'` \ 677 SD=/usr/src TD=src ARG="$$i" ; \ 678 fi ; \ 679 done 680.if defined(EXTRA_SRC) 681 @set ${EXTRA_SRC} && \ 682 while [ $$# -ge 2 ] ; do \ 683 if [ -d /usr/src/$$1 ] ; then \ 684 cd ${.CURDIR} && $(MAKE) doTARBALL \ 685 SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \ 686 fi && shift && shift ; \ 687 done 688.endif 689 (cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5) 690 @echo "src distribution is finished." 691.endif 692 touch ${.TARGET} 693 694# Build the memory root filesystem. 695release.8: 696 cp ${RD}/trees/base/etc/disktab /etc 697 rm -rf ${RD}/mfsfd 698 mkdir ${RD}/mfsfd 699 cd ${RD}/mfsfd && \ 700 mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help \ 701 var/empty 702 @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \ 703 DIR=${RD}/mfsfd/stand ZIP=false 704 ( cd ${RD}/mfsfd && \ 705 for dir in bin sbin ; do \ 706 ln -sf /stand $$dir; \ 707 done ) 708 cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand 709.if ${TARGET} == "pc98" 710 cp ${.CURDIR}/../etc/defaults/pccard.conf \ 711 ${RD}/mfsfd/etc/defaults/pccard.conf 712.endif 713 cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf 714 cp ${.CURDIR}/../etc/master.passwd ${RD}/mfsfd/etc/master.passwd 715 pwd_mkdb -d ${RD}/mfsfd/etc -p ${RD}/mfsfd/etc/master.passwd 716 ( for F in defaults/rc.conf netconfig protocols ; do \ 717 sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \ 718 ${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \ 719 done ) 720 grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \ 721 ${RD}/trees/base/etc/services | \ 722 sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \ 723 > ${RD}/mfsfd/stand/etc/services 724 grep 'operator' ${RD}/trees/base/etc/group \ 725 > ${RD}/mfsfd/stand/etc/group 726 ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services 727 ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group 728 ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig 729 cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp 730.if !defined(NODOC) 731 @for i in ${DIST_DOCS_ARCH_INDEP}; do \ 732 cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \ 733 ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ 734 done 735 @for i in ${DIST_DOCS_ARCH_DEP}; do \ 736 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \ 737 ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ 738 done 739 @mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT \ 740 ${RD}/mfsfd/stand/help/INSTALL.TXT 741.endif 742 -test -f ${.CURDIR}/install.cfg \ 743 && cp ${.CURDIR}/install.cfg ${RD}/mfsfd 744 @mkdir -p ${RD}/mfsfd/boot 745.if ${TARGET_ARCH} != "ia64" && ${TARGET_ARCH} != "powerpc" 746 @cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot 747.endif 748.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64" 749 @cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot 750.endif 751 @tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \ 752 tar xf - -C ${RD}/mfsfd/stand 753 @mkdir -p ${RD}/mfsroot 754 sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \ 755 ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL} 756 @gzip -9fnv ${RD}/mfsroot/mfsroot 757 touch ${.TARGET} 758 759KERNFLOPPYSET= ${RD}/floppyset/kern/kernel.gz 760.if defined(SMALLFLOPPYSIZE) 761SMALLKERNFLOPPYSET= ${RD}/floppyset/kern-small/kernel.gz 762.endif 763.if defined(SPLIT_MFSROOT) 764MFSROOTFLOPPYSET= ${RD}/floppyset/mfsroot/mfsroot.gz 765.if defined(SMALLFLOPPYSIZE) 766SMALLMFSROOTFLOPPYSET= ${RD}/floppyset/mfsroot-small/mfsroot.gz 767.endif 768.endif 769 770# Build boot and install floppies. 771floppies.1: 772 @gzip -9nc ${RD}/trees/base/boot/kernel/kernel > ${RD}/kernels/kernel.gz 773 @echo "Making the kernel boot floppies..." 774 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \ 775 FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz 776.if defined(SMALLFLOPPYSIZE) 777 @echo "Making the small kernel boot floppies..." 778 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \ 779 FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \ 780 FDSIZE="SMALL" 781.endif 782.if defined(SPLIT_MFSROOT) 783 @echo "Making the mfsroot boot floppies..." 784 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \ 785 FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz 786.if defined(SMALLFLOPPYSIZE) 787 @echo "Making the small mfsroot boot floppies..." 788 @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \ 789 FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \ 790 FDSIZE="SMALL" 791.endif 792 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \ 793 KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \ 794 MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot" 795.if defined(SMALLFLOPPYSIZE) 796 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \ 797 KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \ 798 MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \ 799 FDSIZE="SMALL" 800.endif 801.else # !SPLIT_MFSROOT 802 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \ 803 KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \ 804 MFSROOTFILE=${RD}/mfsroot/mfsroot.gz 805.if defined(SMALLFLOPPYSIZE) 806 @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \ 807 KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \ 808 MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \ 809 FDSIZE="SMALL" 810.endif 811.endif # SPLIT_MFSROOT 812 touch ${.TARGET} 813 814# Build fixit floppy. 815floppies.2: 816 @echo "Making fixit floppy." 817 @rm -rf ${RD}/fixitfd 818 @mkdir ${RD}/fixitfd 819 @cd ${RD}/fixitfd && \ 820 mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \ 821 usr/share/misc 822 @cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \ 823 ${RD}/fixitfd/etc 824 @sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \ 825 > ${RD}/fixitfd/etc/protocols 826 @sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \ 827 > ${RD}/fixitfd/usr/share/misc/scsi_modes 828 @cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile 829 @cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services 830 @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar 831 @chmod 555 ${RD}/fixitfd/stand/tar 832.if defined(SMALLFLOPPYSIZE) 833 @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \ 834 DIR=${RD}/fixitfd/stand ZIP=false 835 @sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \ 836 ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL} 837 @rm -rf ${RD}/fixitfd/stand 838 @mkdir ${RD}/fixitfd/stand 839.endif 840 @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \ 841 DIR=${RD}/fixitfd/stand ZIP=false 842 @sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \ 843 ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL} 844 touch ${.TARGET} 845 846# Do our last minute floppies directory setup 847floppies.3: 848.if !defined(NODOC) 849 @cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \ 850 ${RD}/floppies/README.TXT 851 @(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5) 852.else 853 @(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5) 854.endif 855 touch ${.TARGET} 856 857# 858# --==## Setup a suitable ftp-area ##==-- 859# 860ftp.1: 861 @echo "Setting up FTP distribution area" 862 @mkdir -p ${FD} 863 -@ln -s . ${FD}/${BUILDNAME} 864.if defined(MAKE_FLOPPIES) 865 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} 866.endif 867 @cd ${RD}/dists && find . -print | cpio -dumpl ${FD} 868.if !defined(NODOC) 869 @for i in ${DIST_DOCS_ARCH_INDEP}; do \ 870 cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \ 871 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ 872 cp ${RND}/${RELNOTES_LANG}/$$i/article.html \ 873 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ 874 done 875 @for i in ${DIST_DOCS_ARCH_DEP}; do \ 876 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \ 877 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ 878 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \ 879 ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ 880 done 881 @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD} 882 @mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT 883 @mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM 884.endif 885 @echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf 886 touch ${.TARGET} 887 888# Build a live filesystem cdrom image 889cdrom.1: 890 @echo "Building CDROM live filesystem image" 891 @mkdir -p ${CD_LIVEFS} 892 @for i in ${DISTRIBUTIONS} ; \ 893 do \ 894 if [ -d ${RD}/trees/$${i} ] ; then \ 895 chflags -R noschg ${RD}/trees/$${i} || true ; \ 896 ( cd ${RD}/trees/$${i} && \ 897 find . -depth -print | cpio -dumpl ${CD_LIVEFS} ) ; \ 898 fi \ 899 done 900 @rm -f ${CD_LIVEFS}/.profile 901 @cp ${.CURDIR}/fixit.profile ${CD_LIVEFS}/.profile 902 @ln -sf /rescue ${CD_LIVEFS}/stand 903.if ${TARGET} != "pc98" 904 @echo "Setting up CDROM boot area" 905 @rm -f ${CD_LIVEFS}/boot/loader.conf 906 @cp ${RD}/mfsroot/mfsroot.gz ${CD_LIVEFS}/boot/mfsroot.gz 907 @echo 'mfsroot_load="YES"' > ${CD_LIVEFS}/boot/loader.conf 908 @echo 'mfsroot_type="mfs_root"' >> ${CD_LIVEFS}/boot/loader.conf 909 @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_LIVEFS}/boot/loader.conf 910.if exists(${RD}/trees/base/boot/device.hints) 911 # Break the link to device.hints so we can modify it 912 @rm -f ${CD_LIVEFS}/boot/device.hints 913 @cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints 914.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64" 915 @echo 'hint.atkbd.0.flags="0x1"' >> ${CD_LIVEFS}/boot/device.hints 916.endif 917.endif 918.endif 919 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf 920 touch ${.TARGET} 921 922# Build disc1 and disc2 cdrom images 923cdrom.2: 924 @echo "Building CDROM disc1 filesystem image" 925 @mkdir -p ${CD_DISC1}/${BUILDNAME} 926.if defined(MAKE_FLOPPIES) 927 @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1} 928.endif 929 @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}/${BUILDNAME} 930.if !defined(NODOC) 931 @for i in ${DIST_DOCS_ARCH_INDEP}; do \ 932 cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \ 933 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ 934 cp ${RND}/${RELNOTES_LANG}/$$i/article.html \ 935 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ 936 done 937 @for i in ${DIST_DOCS_ARCH_DEP}; do \ 938 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \ 939 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ 940 cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \ 941 ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ 942 done 943 @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1} 944 @mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT 945 @mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM 946.endif 947 @echo "CD_VOLUME = 1" >> ${CD_DISC1}/cdrom.inf 948.if defined(SEPARATE_LIVEFS) 949 @cp -Rp ${CD_LIVEFS}/boot ${CD_DISC1} 950 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf 951.endif 952 @echo "Building CDROM disc2 filesystem image" 953 @mkdir -p ${CD_DISC2} 954 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf 955 @echo "CD_VOLUME = 2" >> ${CD_DISC2}/cdrom.inf 956.if !defined(NODOC) 957 @mkdir -p ${CD_DISC2}/usr/share/doc 958 @for i in `ls ${CD_LIVEFS}/usr/share/doc`; do \ 959 if [ -L ${CD_LIVEFS}/usr/share/doc/$$i -o \ 960 -d /usr/doc/$$i ]; then \ 961 mv ${CD_LIVEFS}/usr/share/doc/$$i \ 962 ${CD_DISC2}/usr/share/doc; \ 963 fi \ 964 done 965.endif 966 touch ${.TARGET} 967 968# 969# --==## Setup a suitable cdrom-area ##==-- 970# 971cdrom.3: 972.if defined(CD_BOOT) 973 @echo "Building bootonly CDROM filesystem image" 974 @mkdir -p ${CD_BOOT} 975 @cp -Rp ${CD_LIVEFS}/boot ${CD_BOOT} 976 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_BOOT}/cdrom.inf 977.if defined(MINIROOT) 978 @echo "Building bootonly UFS filesystem image" 979 @mkdir -p ${FD}/miniroot 980 @sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \ 981 ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto 982 @gzip -9v ${FD}/miniroot/miniroot.ufs 983.endif 984.endif 985 touch ${.TARGET} 986 987.if make(iso.1) 988.if defined(CD_PACKAGE_TREE) 989.if exists(${CD_PACKAGE_TREE}/disc1) 990CD_DISC1_PKGS= ${CD_PACKAGE_TREE}/disc1 991.endif 992.if exists(${CD_PACKAGE_TREE}/disc2) 993CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2 994.endif 995.endif 996.endif 997 998iso.1: 999.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh) 1000 @echo "Creating ISO images..." 1001.if defined(CD_BOOT) 1002 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ 1003 FreeBSD_bootonly \ 1004 ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT} 1005.endif 1006 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ 1007 FreeBSD_Install \ 1008 ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \ 1009 ${CD_DISC1_PKGS} 1010 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ 1011 FreeBSD_Packages \ 1012 ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \ 1013 ${CD_DISC2_PKGS} 1014.if defined(SEPARATE_LIVEFS) 1015 @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ 1016 FreeBSD_LiveFS \ 1017 ${CD}/${BUILDNAME}-${TARGET}-livefs.iso ${CD_LIVEFS} 1018.endif 1019 @echo "Generating MD5 sums..." 1020 @(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5) 1021 touch ${.TARGET} 1022.else 1023 @echo "Do not know how to create an ISO for ${TARGET_ARCH}." 1024.endif 1025 1026# 1027# --==## Documentation Project files such as the Handbook and FAQ ##==-- 1028# 1029doc.1: 1030 @echo "Making docs..." 1031 @for i in ${DOCPORTS}; do \ 1032 cd /usr/ports/$$i && \ 1033 env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \ 1034 make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \ 1035 WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \ 1036 done 1037 @cd /usr/doc && make all install 'FORMATS=html html-split txt' \ 1038 INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc \ 1039 URLS_ABSOLUTE=YES 1040 touch ${.TARGET} 1041 1042# 1043# --==## RELNOTESng: Next-generation replacements for *.TXT files ##==-- 1044# 1045doc.2: 1046 @echo "Making release documentation..." 1047 @cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \ 1048 INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${RND} 1049 touch ${.TARGET} 1050 1051# Various "subroutine" and other supporting targets. 1052 1053# RD= 1054# SD= 1055# TD= 1056# ARG= 1057doTARBALL: 1058.if !defined(SD) 1059 @echo "SD undefined in doTARBALL" && exit 1 1060.endif 1061.if !defined(TD) 1062 @echo "TD undefined in doTARBALL" && exit 1 1063.endif 1064.if !defined(ARG) 1065 @echo "ARG undefined in doTARBALL" && exit 1 1066.endif 1067 @rm -rf ${RD}/dists/${TD}/${TN}* 1068 @mkdir -p ${RD}/dists/${TD} 1069 @( cd ${SD} && \ 1070 tn=`echo ${TN} | tr 'A-Z' 'a-z' | cut -c1-8` && \ 1071 echo rolling ${TD}/$$tn tarball &&\ 1072 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \ 1073 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \ 1074 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \ 1075 > ${RD}/dists/${TD}/$$tn.inf && \ 1076 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \ 1077 cp -p ${.CURDIR}/scripts/$${TD}-install.sh \ 1078 ${RD}/dists/${TD}/install.sh; \ 1079 fi && \ 1080 if [ "${SD}" != "/usr/src" ]; then \ 1081 mtree -c -i -p ${SD}/${ARG} \ 1082 -k gname,md5digest,mode,nlink,uname,size,link,type \ 1083 > ${RD}/dists/${TD}/$$tn.mtree ; \ 1084 else \ 1085 true; \ 1086 fi; \ 1087 ( cd ${RD}/dists/${TD}; \ 1088 rm -f CHECKSUM.MD5; \ 1089 md5 * > CHECKSUM.MD5 ) \ 1090 ) 1091 1092doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 \ 1093 release.5 release.6 release.7 release.8 ${EXTRAS} 1094 @echo "Release done" 1095 1096floppies: 1097 @rm -f release.4 release.8 floppies.[123] 1098 @cd ${.CURDIR} && ${MAKE} release.4 release.8 floppies.1 floppies.2 \ 1099 floppies.3 1100 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} 1101 1102installCRUNCH: 1103.if !defined(CRUNCH) 1104 @echo "CRUNCH undefined in installCRUNCH" && exit 1 1105.endif 1106.if !defined(DIR) 1107 @echo "DIR undefined in installCRUNCH" && exit 1 1108.endif 1109.if !defined(ZIP) 1110 @echo "ZIP undefined in installCRUNCH" && exit 1 1111.endif 1112 @if ${ZIP} ; then \ 1113 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \ 1114 else \ 1115 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \ 1116 fi 1117 @chmod 555 ${DIR}/${CRUNCH}_crunch 1118 @if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \ 1119 for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \ 1120 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 1121 done \ 1122 else \ 1123 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \ 1124 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 1125 done \ 1126 fi 1127 1128# 1129# --==## Build a floppy set for a splitfs file ##==-- 1130# 1131# FLOPPYBASE - basename of floppy image files 1132# FLOPPYDESC - description of floppy set 1133# SPLITFILE - filename of the file to split 1134# FDSIZE - if specified and "small", small floppy is created 1135 1136.if make(makeFloppySet) 1137SPLITDIR= ${RD}/floppyset/${FLOPPYBASE} 1138.if defined(FDSIZE) && ${FDSIZE} == "SMALL" 1139FLPSPLITSIZE= ${SMALLFLOPPYSPLITSIZE} 1140FLPSIZE= ${SMALLFLOPPYSIZE} 1141FLPLABEL= ${SMALLFLOPPYLABEL} 1142.else 1143FLPSPLITSIZE= ${FLOPPYSPLITSIZE} 1144FLPSIZE= ${FLOPPYSIZE} 1145FLPLABEL= ${FLOPPYLABEL} 1146.endif 1147.endif 1148 1149makeFloppySet: 1150.if !defined(FLOPPYBASE) 1151 @echo "FLOPPYBASE undefined in ${.TARGET}" && exit 1 1152.endif 1153.if !defined(FLOPPYDESC) 1154 @echo "FLOPPYDESC undefined in ${.TARGET}" && exit 1 1155.endif 1156.if !defined(SPLITFILE) 1157 @echo "SPLITFILE undefined in ${.TARGET}" && exit 1 1158.endif 1159 sh ${.CURDIR}/scripts/split-file.sh ${SPLITFILE} \ 1160 ${RD}/floppyset/${FLOPPYBASE} ${FLPSPLITSIZE} "${FLOPPYDESC}" 1161 ( splitfile=${SPLITDIR}/`basename ${SPLITFILE}`.split ; \ 1162 lines=`cat $${splitfile} | wc -l`; \ 1163 lines=$$(($$lines - 1)) ; \ 1164 for line in `jot $$lines`; do \ 1165 file=`head -n $$(($${line} + 1)) $${splitfile} | tail -1 | cut -f 1 -d ' '` ; \ 1166 sh -e ${DOFS_SH} ${RD}/floppies/${FLOPPYBASE}$${line}.flp \ 1167 ${RD} ${MNT} ${FLPSIZE} ${SPLITDIR}/$${file} \ 1168 ${BOOTINODE} ${FLPLABEL}; \ 1169 done ) 1170 1171# 1172# --==## Build a boot floppy ##==-- 1173# 1174# FSIMAGE - base floppy image name 1175# FDSIZE - if specified and "small", small floppy is created 1176# KERNFILE - path to kernel split file 1177# MFSROOTFILE - path to mfsroot split file 1178 1179.if make(buildBootFloppy) 1180IMAGEDIR= ${RD}/image.${FSIMAGE} 1181BOOTDIR= ${RD}/trees/base/boot 1182HINTSFILE= ${BOOTDIR}/device.hints 1183ACPI_KO= ${BOOTDIR}/kernel/acpi.ko 1184IMAGEFILE= ${RD}/floppies/${FSIMAGE}.flp 1185.if defined(FDSIZE) && ${FDSIZE} == "SMALL" 1186FLPSIZE= ${SMALLFLOPPYSIZE} 1187FLPLABEL= ${SMALLFLOPPYLABEL} 1188.else 1189FLPSIZE= ${FLOPPYSIZE} 1190FLPLABEL= ${FLOPPYLABEL} 1191.endif 1192.endif 1193 1194buildBootFloppy: 1195.if !defined(FSIMAGE) 1196 @echo "FSIMAGE undefined in ${.TARGET}" && exit 1 1197.endif 1198.if !defined(KERNFILE) 1199 @echo "KERNFILE undefined in ${.TARGET}" && exit 1 1200.endif 1201.if !defined(MFSROOTFILE) 1202 @echo "MFSROOTFILE undefined in ${.TARGET}" && exit 1 1203.endif 1204 @echo "Running ${.TARGET} for ${FSIMAGE}" 1205 @rm -rf ${IMAGEDIR} 1206 @mkdir ${IMAGEDIR} 1207 @echo "Setting up /boot directory for ${FSIMAGE} floppy" 1208 @mkdir -p ${IMAGEDIR}/boot 1209.if ${TARGET} == "i386" 1210 @${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \ 1211 ${IMAGEDIR}/boot/loader ${BOOTDIR}/loader 1212.else 1213 @cp ${BOOTDIR}/loader ${IMAGEDIR}/boot 1214.endif 1215 @cp -Rp ${BOOTDIR}/*.4th ${BOOTDIR}/defaults ${BOOTDIR}/loader.help \ 1216 ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot 1217.if exists(${HINTSFILE}) 1218 @cp ${HINTSFILE} ${IMAGEDIR}/boot/device.hints 1219.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64" 1220 @echo 'hint.atkbd.0.flags="0x1"' >> ${IMAGEDIR}/boot/device.hints 1221.endif 1222 @gzip -9n ${IMAGEDIR}/boot/device.hints 1223.endif 1224 @gzip -9n ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \ 1225 ${IMAGEDIR}/boot/defaults/loader.conf 1226 @echo 'bootfile="/kernel"' > ${IMAGEDIR}/boot/loader.conf 1227.if exists(${ACPI_KO}) 1228 @gzip -9nc ${ACPI_KO} > ${IMAGEDIR}/acpi.ko.gz 1229 @echo 'acpi_load="YES"' >> ${IMAGEDIR}/boot/loader.conf 1230 @echo 'acpi_name="/acpi.ko"' >> ${IMAGEDIR}/boot/loader.conf 1231 @echo 'acpi_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf 1232.endif 1233 @echo 'mfsroot_load="YES"' >> ${IMAGEDIR}/boot/loader.conf 1234 @echo 'mfsroot_type="mfs_root"' >> ${IMAGEDIR}/boot/loader.conf 1235 @echo 'mfsroot_name="/mfsroot"' >> ${IMAGEDIR}/boot/loader.conf 1236.if !exists(${ACPI_KO}) 1237 @echo 'mfsroot_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf 1238.endif 1239.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT} 1240 @echo "-P" >> ${IMAGEDIR}/boot.config 1241.endif 1242 @rm -f ${IMAGEFILE} 1243 @cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR} 1244 sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \ 1245 ${BOOTINODE} ${FLPLABEL} 1246 @echo "Created ${RD}/floppies/${FSIMAGE}.flp" 1247 1248.if make(package-split) 1249# Targets related to making a package split 1250# 1251# PKG_COPY instructs the script to copy the actual package files rather than 1252# make hard links 1253# PKG_TREE is the path to the package tree to be split 1254# PKG_DEST is the path to the destination tree to create the split in 1255# PKG_VERBOSE asks for verbose output of the layout process 1256# PKG_INDEX is the path to the INDEX file. By default ${PKG_TREE}/INDEX. 1257 1258.if defined(PKG_COPY) 1259PKG_DO_COPY= cp 1260.else 1261PKG_DO_COPY= ln 1262.endif 1263PKG_WRKIDX= ${PKG_DEST}/INDEX.master 1264PKG_ENV?= 1265.if defined(TARGET_ARCH) 1266PKG_ENV+= PKG_ARCH=${TARGET_ARCH} 1267.endif 1268.if defined(PKG_VERBOSE) 1269PKG_ENV+= PKG_VERBOSE=1 1270.endif 1271PKG_INDEX?= ${PKG_TREE}/INDEX 1272 1273package-split: 1274.if !defined(PKG_TREE) 1275 @echo "PKG_TREE must be defined" && exit 1 1276.endif 1277.if !defined(PKG_DEST) 1278 @echo "PKG_DEST must be defined" && exit 1 1279.endif 1280 @env ${PKG_ENV} python ${.CURDIR}/scripts/package-split.py \ 1281 ${PKG_INDEX} ${PKG_WRKIDX} 1282 @env ${PKG_ENV} sh ${.CURDIR}/scripts/package-trees.sh ${PKG_DO_COPY} \ 1283 ${PKG_WRKIDX} ${PKG_TREE} ${PKG_DEST} 1284.endif 1285 1286.include <bsd.obj.mk> 1287