197d92980SPeter Wemm# $FreeBSD$ 20202c140SRodney W. Grimes# 312ad0bb1SNathan Whitehorn# Makefile for building releases and release media. 4bd668f6fSPoul-Henning Kamp# 512ad0bb1SNathan Whitehorn# User-driven targets: 68cec99b6SGlen Barber# cdrom: Builds release CD-ROM media (disc1.iso) 75d27274aSGlen Barber# dvdrom: Builds release DVD-ROM media (dvd1.iso) 83c334738SGlen Barber# memstick: Builds memory stick image (memstick.img) 9a9da1707SGlen Barber# mini-memstick: Builds minimal memory stick image (mini-memstick.img) 1012ad0bb1SNathan Whitehorn# ftp: Sets up FTP distribution area (ftp) 1112ad0bb1SNathan Whitehorn# release: Build all media and FTP distribution area 12299a8b95SNathan Whitehorn# install: Copies all release media into ${DESTDIR} 13bd668f6fSPoul-Henning Kamp# 1412ad0bb1SNathan Whitehorn# Variables affecting the build process: 1512ad0bb1SNathan Whitehorn# WORLDDIR: location of src tree -- must have built world and default kernel 1612ad0bb1SNathan Whitehorn# (by default, the directory above this one) 1712ad0bb1SNathan Whitehorn# PORTSDIR: location of ports tree to distribute (default: /usr/ports) 1812ad0bb1SNathan Whitehorn# DOCDIR: location of doc tree (default: /usr/doc) 199d22cb2eSHiroki Sato# NOPKG: if set, do not distribute third-party packages 2012ad0bb1SNathan Whitehorn# NOPORTS: if set, do not distribute ports tree 2112ad0bb1SNathan Whitehorn# NOSRC: if set, do not distribute source tree 2212ad0bb1SNathan Whitehorn# NODOC: if set, do not generate release documentation 23f7f650c7SGlen Barber# WITH_DVD: if set, generate dvd1.iso 2455af5cf1SGlen Barber# WITH_COMPRESSED_IMAGES: if set, compress installation images with xz(1) 25cbc0e08aSGlen Barber# (uncompressed images are not removed) 2612ad0bb1SNathan Whitehorn# TARGET/TARGET_ARCH: architecture of built release 27b03ddec9SJohn Baldwin# 28ab0e9cdcSPoul-Henning Kamp 2912ad0bb1SNathan WhitehornWORLDDIR?= ${.CURDIR}/.. 3012ad0bb1SNathan WhitehornPORTSDIR?= /usr/ports 3112ad0bb1SNathan WhitehornDOCDIR?= /usr/doc 3212ad0bb1SNathan WhitehornRELNOTES_LANG?= en_US.ISO8859-1 333b485e46SGlen BarberXZCMD?= /usr/bin/xz 34fff8eb57SJohn Baldwin 35464485c8SHiroki Sato.if !defined(TARGET) || empty(TARGET) 36464485c8SHiroki SatoTARGET= ${MACHINE} 37464485c8SHiroki Sato.endif 38464485c8SHiroki Sato.if !defined(TARGET_ARCH) || empty(TARGET_ARCH) 390bd47e83SNathan Whitehorn.if ${TARGET} == ${MACHINE} 40464485c8SHiroki SatoTARGET_ARCH= ${MACHINE_ARCH} 418f1f55e9SRuslan Ermilov.else 42464485c8SHiroki SatoTARGET_ARCH= ${TARGET} 43464485c8SHiroki Sato.endif 448f1f55e9SRuslan Ermilov.endif 4512ad0bb1SNathan WhitehornIMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} 46876acefaSHiroki SatoDISTDIR= dist 478f1f55e9SRuslan Ermilov 48de17cbccSHiroki Sato# Define OSRELEASE by using newvars.sh 49de17cbccSHiroki Sato.if !defined(OSRELEASE) || empty(OSRELEASE) 50de17cbccSHiroki Sato.for _V in TYPE BRANCH REVISION 51de17cbccSHiroki Sato${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V} 52de17cbccSHiroki Sato.endfor 53de17cbccSHiroki Sato.for _V in ${TARGET_ARCH} 54de17cbccSHiroki Sato.if !empty(TARGET:M${_V}) 55de17cbccSHiroki SatoOSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET} 56de17cbccSHiroki Sato.else 57de17cbccSHiroki SatoOSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} 58de17cbccSHiroki Sato.endif 59de17cbccSHiroki Sato.endfor 60de17cbccSHiroki Sato.endif 61de17cbccSHiroki Sato 6212ad0bb1SNathan Whitehorn.if !exists(${DOCDIR}) 6312ad0bb1SNathan WhitehornNODOC= true 6412ad0bb1SNathan Whitehorn.endif 6512ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR}) 6612ad0bb1SNathan WhitehornNOPORTS= true 67dd1a1b3dSJoerg Wunsch.endif 68dd1a1b3dSJoerg Wunsch 6912ad0bb1SNathan WhitehornEXTRA_PACKAGES= 706daa108fSRuslan Ermilov.if !defined(NOPORTS) 7112ad0bb1SNathan WhitehornEXTRA_PACKAGES+= ports.txz 726daa108fSRuslan Ermilov.endif 734731faa3SJordan K. Hubbard.if !defined(NOSRC) 7412ad0bb1SNathan WhitehornEXTRA_PACKAGES+= src.txz 752e3a1557SKen Smith.endif 76a1b193b5SJohn Baldwin.if !defined(NODOC) 7712ad0bb1SNathan WhitehornEXTRA_PACKAGES+= reldoc 78b2200964SJohn Baldwin.endif 79b2200964SJohn Baldwin 8012ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp 81876acefaSHiroki SatoIMAGES= 8212ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) 8312ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom 848cec99b6SGlen BarberIMAGES+= disc1.iso bootonly.iso 85d8824524SGlen Barber. if defined(WITH_DVD) && !empty(WITH_DVD) 86dc244562SGlen BarberRELEASE_TARGETS+= dvdrom 87dc244562SGlen BarberIMAGES+= dvd1.iso 88dc244562SGlen Barber. endif 896daa108fSRuslan Ermilov.endif 9012ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh) 913c334738SGlen BarberRELEASE_TARGETS+= memstick.img 92a9da1707SGlen BarberRELEASE_TARGETS+= mini-memstick.img 933c334738SGlen BarberIMAGES+= memstick.img 94a9da1707SGlen BarberIMAGES+= mini-memstick.img 95e738d1eaSJohn Baldwin.endif 96e738d1eaSJohn Baldwin 9746b13263SHiroki SatoCLEANFILES= packagesystem *.txz MANIFEST system ${IMAGES} 980c535991SGlen Barber.if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) 990c535991SGlen Barber. for I in ${IMAGES} 10055af5cf1SGlen BarberCLEANFILES+= ${I}.xz 1010c535991SGlen Barber. endfor 1020c535991SGlen Barber.endif 103*cd15d7f3SGlen Barber. if defined(WITH_DVD) && !empty(WITH_DVD) 104*cd15d7f3SGlen BarberCLEANFILES+= pkg-stage 105*cd15d7f3SGlen Barber. endif 10646b13263SHiroki SatoCLEANDIRS= dist ftp release bootonly dvd 10746b13263SHiroki Satobeforeclean: 10846b13263SHiroki Sato chflags -R noschg . 1098eb4e096SRuslan Ermilov.include <bsd.obj.mk> 11046b13263SHiroki Satoclean: beforeclean 11112ad0bb1SNathan Whitehorn 11212ad0bb1SNathan Whitehornbase.txz: 113876acefaSHiroki Sato mkdir -p ${DISTDIR} 114876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} 11512ad0bb1SNathan Whitehorn# Set up mergemaster root database 116672d7ddbSSean Bruno sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ 117876acefaSHiroki Sato "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base" 118e9120a25SGlen Barber etcupdate extract -B -M "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" \ 119d6d73d47SJohn Hay -s ${WORLDDIR} -d "${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate" 120bfc3bab8SNathan Whitehorn# Package all components 121876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} 122876acefaSHiroki Sato mv ${DISTDIR}/*.txz . 12312ad0bb1SNathan Whitehorn 12412ad0bb1SNathan Whitehornkernel.txz: 125876acefaSHiroki Sato mkdir -p ${DISTDIR} 126876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} 127876acefaSHiroki Sato mv ${DISTDIR}/kernel*.txz . 12812ad0bb1SNathan Whitehorn 12912ad0bb1SNathan Whitehornsrc.txz: 130876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 13112ad0bb1SNathan Whitehorn ln -fs ${WORLDDIR} ${DISTDIR}/usr/src 1329f5907dbSGlen Barber cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ 13323659c9dSGlen Barber --exclude .git --exclude @ --exclude usr/src/release/dist usr/src 13412ad0bb1SNathan Whitehorn 13512ad0bb1SNathan Whitehornports.txz: 136876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 13712ad0bb1SNathan Whitehorn ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports 13812ad0bb1SNathan Whitehorn cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ 13923659c9dSGlen Barber --exclude .git --exclude .svn \ 14012ad0bb1SNathan Whitehorn --exclude usr/ports/distfiles --exclude usr/ports/packages \ 14112ad0bb1SNathan Whitehorn --exclude 'usr/ports/INDEX*' --exclude work usr/ports 14212ad0bb1SNathan Whitehorn 14312ad0bb1SNathan Whitehornreldoc: 14412ad0bb1SNathan Whitehorn cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ 14512ad0bb1SNathan Whitehorn INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc 146876acefaSHiroki Sato mkdir -p reldoc 14712ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata 14853089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT 14953089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM 15012ad0bb1SNathan Whitehorn.endfor 151876acefaSHiroki Sato cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc 15212ad0bb1SNathan Whitehorn 15312ad0bb1SNathan Whitehornsystem: packagesystem 15412ad0bb1SNathan Whitehorn# Install system 155876acefaSHiroki Sato mkdir -p release 1566e352319SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 15758ddb0a6SGlen Barber DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \ 158b1e3e965SGlen Barber WITHOUT_PROFILE=1 WITHOUT_SENDMAIL=1 WITHOUT_ATF=1 WITHOUT_LIB32=1 15912ad0bb1SNathan Whitehorn# Copy distfiles 160876acefaSHiroki Sato mkdir -p release/usr/freebsd-dist 161876acefaSHiroki Sato cp *.txz MANIFEST release/usr/freebsd-dist 16212ad0bb1SNathan Whitehorn# Copy documentation, if generated 16312ad0bb1SNathan Whitehorn.if !defined(NODOC) 164876acefaSHiroki Sato cp reldoc/* release 16512ad0bb1SNathan Whitehorn.endif 16612ad0bb1SNathan Whitehorn# Set up installation environment 167de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf 168876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > release/etc/rc.conf 169876acefaSHiroki Sato echo hostid_enable=\"NO\" >> release/etc/rc.conf 17073e46dbaSGlen Barber echo debug.witness.trace=0 >> release/etc/sysctl.conf 171876acefaSHiroki Sato cp ${.CURDIR}/rc.local release/etc 172876acefaSHiroki Sato touch ${.TARGET} 17312ad0bb1SNathan Whitehorn 17446c413feSNathan Whitehornbootonly: packagesystem 17546c413feSNathan Whitehorn# Install system 176876acefaSHiroki Sato mkdir -p bootonly 17746c413feSNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 17846c413feSNathan Whitehorn DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ 17956b72efeSDag-Erling Smørgrav WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ 18046c413feSNathan Whitehorn WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ 18101dae98eSNathan Whitehorn WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \ 18201dae98eSNathan Whitehorn WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \ 18301dae98eSNathan Whitehorn WITHOUT_KERNEL_SYMBOLS=1 18446c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums 185876acefaSHiroki Sato mkdir -p bootonly/usr/freebsd-dist 186876acefaSHiroki Sato cp MANIFEST bootonly/usr/freebsd-dist 18746c413feSNathan Whitehorn# Copy documentation, if generated 18846c413feSNathan Whitehorn.if !defined(NODOC) 189876acefaSHiroki Sato cp reldoc/* bootonly 19046c413feSNathan Whitehorn.endif 19146c413feSNathan Whitehorn# Set up installation environment 192de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf 193876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf 194876acefaSHiroki Sato echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf 19573e46dbaSGlen Barber echo debug.witness.trace=0 >> bootonly/etc/sysctl.conf 196876acefaSHiroki Sato cp ${.CURDIR}/rc.local bootonly/etc 19746c413feSNathan Whitehorn 198dc244562SGlen Barberdvd: 199dc244562SGlen Barber# Install system 200dc244562SGlen Barber mkdir -p ${.TARGET} 201dc244562SGlen Barber cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 2022b471d3aSGlen Barber DESTDIR=${.OBJDIR}/${.TARGET} WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 203dc244562SGlen Barber# Copy distfiles 204dc244562SGlen Barber mkdir -p ${.TARGET}/usr/freebsd-dist 205dc244562SGlen Barber cp *.txz MANIFEST ${.TARGET}/usr/freebsd-dist 206dc244562SGlen Barber# Copy documentation, if generated 207dc244562SGlen Barber.if !defined(NODOC) 208dc244562SGlen Barber cp reldoc/* ${.TARGET} 209dc244562SGlen Barber.endif 210dc244562SGlen Barber# Set up installation environment 211dc244562SGlen Barber ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf 212dc244562SGlen Barber echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf 213dc244562SGlen Barber echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf 21473e46dbaSGlen Barber echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf 215dc244562SGlen Barber cp ${.CURDIR}/rc.local ${.TARGET}/etc 216dc244562SGlen Barber touch ${.TARGET} 217dc244562SGlen Barber 2188cec99b6SGlen Barberrelease.iso: disc1.iso 2198cec99b6SGlen Barberdisc1.iso: system 220876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release 22112ad0bb1SNathan Whitehorn 222dc244562SGlen Barberdvd1.iso: dvd pkg-stage 223dc244562SGlen Barber sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd 224dc244562SGlen Barber 22546c413feSNathan Whitehornbootonly.iso: bootonly 226876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly 22746c413feSNathan Whitehorn 228cb95a96bSGlen Barbermemstick: memstick.img 2293c334738SGlen Barbermemstick.img: system 230876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} 23112ad0bb1SNathan Whitehorn 232a9da1707SGlen Barbermini-memstick: mini-memstick.img 233a9da1707SGlen Barbermini-memstick.img: system 234a9da1707SGlen Barber sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET} 235a9da1707SGlen Barber 23612ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} 237876acefaSHiroki Sato sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST 238299a8b95SNathan Whitehorn touch ${.TARGET} 23912ad0bb1SNathan Whitehorn 240dc244562SGlen Barberpkg-stage: 2416f50c4eaSGlen Barber.if !defined(NOPKG) 2426f50c4eaSGlen Barber env REPOS_DIR=${.CURDIR}/pkg_repos/ \ 2436f50c4eaSGlen Barber sh ${.CURDIR}/scripts/pkg-stage.sh 2440d0e89b7SGlen Barber mkdir -p ${.OBJDIR}/dvd/packages/repos/ 2450d0e89b7SGlen Barber cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \ 2460d0e89b7SGlen Barber ${.OBJDIR}/dvd/packages/repos/ 247dc244562SGlen Barber.endif 2480d0e89b7SGlen Barber touch ${.TARGET} 249dc244562SGlen Barber 2508cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso 251dc244562SGlen Barberdvdrom: dvd1.iso 25212ad0bb1SNathan Whitehornftp: packagesystem 253299a8b95SNathan Whitehorn rm -rf ftp 254876acefaSHiroki Sato mkdir -p ftp 255299a8b95SNathan Whitehorn cp *.txz MANIFEST ftp 25612ad0bb1SNathan Whitehorn 2570bd47e83SNathan Whitehornrelease: 2580bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj 2590bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} 26012ad0bb1SNathan Whitehorn 261299a8b95SNathan Whitehorninstall: 262876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR) 263876acefaSHiroki Sato mkdir -p ${DESTDIR} 264876acefaSHiroki Sato.endif 265de17cbccSHiroki Sato cp -a ftp ${DESTDIR}/ 266de17cbccSHiroki Sato.for I in ${IMAGES} 267de17cbccSHiroki Sato cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} 268510f3303SGlen Barber. if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) 2693b485e46SGlen Barber ${XZCMD} -k ${DESTDIR}/${OSRELEASE}-${I} 270cbc0e08aSGlen Barber. endif 271de17cbccSHiroki Sato.endfor 272de17cbccSHiroki Sato cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 273de17cbccSHiroki Sato cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 274