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 33*3b485e46SGlen 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 10346b13263SHiroki SatoCLEANDIRS= dist ftp release bootonly dvd 10446b13263SHiroki Satobeforeclean: 10546b13263SHiroki Sato chflags -R noschg . 1068eb4e096SRuslan Ermilov.include <bsd.obj.mk> 10746b13263SHiroki Satoclean: beforeclean 10812ad0bb1SNathan Whitehorn 10912ad0bb1SNathan Whitehornbase.txz: 110876acefaSHiroki Sato mkdir -p ${DISTDIR} 111876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} 11212ad0bb1SNathan Whitehorn# Set up mergemaster root database 113672d7ddbSSean Bruno sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ 114876acefaSHiroki Sato "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base" 115e9120a25SGlen Barber etcupdate extract -B -M "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" \ 116d6d73d47SJohn Hay -s ${WORLDDIR} -d "${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate" 117bfc3bab8SNathan Whitehorn# Package all components 118876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} 119876acefaSHiroki Sato mv ${DISTDIR}/*.txz . 12012ad0bb1SNathan Whitehorn 12112ad0bb1SNathan Whitehornkernel.txz: 122876acefaSHiroki Sato mkdir -p ${DISTDIR} 123876acefaSHiroki Sato cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} 124876acefaSHiroki Sato mv ${DISTDIR}/kernel*.txz . 12512ad0bb1SNathan Whitehorn 12612ad0bb1SNathan Whitehornsrc.txz: 127876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 12812ad0bb1SNathan Whitehorn ln -fs ${WORLDDIR} ${DISTDIR}/usr/src 1299f5907dbSGlen Barber cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ 13023659c9dSGlen Barber --exclude .git --exclude @ --exclude usr/src/release/dist usr/src 13112ad0bb1SNathan Whitehorn 13212ad0bb1SNathan Whitehornports.txz: 133876acefaSHiroki Sato mkdir -p ${DISTDIR}/usr 13412ad0bb1SNathan Whitehorn ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports 13512ad0bb1SNathan Whitehorn cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ 13623659c9dSGlen Barber --exclude .git --exclude .svn \ 13712ad0bb1SNathan Whitehorn --exclude usr/ports/distfiles --exclude usr/ports/packages \ 13812ad0bb1SNathan Whitehorn --exclude 'usr/ports/INDEX*' --exclude work usr/ports 13912ad0bb1SNathan Whitehorn 14012ad0bb1SNathan Whitehornreldoc: 14112ad0bb1SNathan Whitehorn cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ 14212ad0bb1SNathan Whitehorn INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc 143876acefaSHiroki Sato mkdir -p reldoc 14412ad0bb1SNathan Whitehorn.for i in hardware readme relnotes errata 14553089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT 14653089271STijl Coosemans ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM 14712ad0bb1SNathan Whitehorn.endfor 148876acefaSHiroki Sato cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc 14912ad0bb1SNathan Whitehorn 15012ad0bb1SNathan Whitehornsystem: packagesystem 15112ad0bb1SNathan Whitehorn# Install system 152876acefaSHiroki Sato mkdir -p release 1536e352319SNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 15458ddb0a6SGlen Barber DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \ 155b1e3e965SGlen Barber WITHOUT_PROFILE=1 WITHOUT_SENDMAIL=1 WITHOUT_ATF=1 WITHOUT_LIB32=1 15612ad0bb1SNathan Whitehorn# Copy distfiles 157876acefaSHiroki Sato mkdir -p release/usr/freebsd-dist 158876acefaSHiroki Sato cp *.txz MANIFEST release/usr/freebsd-dist 15912ad0bb1SNathan Whitehorn# Copy documentation, if generated 16012ad0bb1SNathan Whitehorn.if !defined(NODOC) 161876acefaSHiroki Sato cp reldoc/* release 16212ad0bb1SNathan Whitehorn.endif 16312ad0bb1SNathan Whitehorn# Set up installation environment 164de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf 165876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > release/etc/rc.conf 166876acefaSHiroki Sato echo hostid_enable=\"NO\" >> release/etc/rc.conf 167876acefaSHiroki Sato cp ${.CURDIR}/rc.local release/etc 168876acefaSHiroki Sato touch ${.TARGET} 16912ad0bb1SNathan Whitehorn 17046c413feSNathan Whitehornbootonly: packagesystem 17146c413feSNathan Whitehorn# Install system 172876acefaSHiroki Sato mkdir -p bootonly 17346c413feSNathan Whitehorn cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 17446c413feSNathan Whitehorn DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ 17556b72efeSDag-Erling Smørgrav WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ 17646c413feSNathan Whitehorn WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ 17701dae98eSNathan Whitehorn WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \ 17801dae98eSNathan Whitehorn WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \ 17901dae98eSNathan Whitehorn WITHOUT_KERNEL_SYMBOLS=1 18046c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums 181876acefaSHiroki Sato mkdir -p bootonly/usr/freebsd-dist 182876acefaSHiroki Sato cp MANIFEST bootonly/usr/freebsd-dist 18346c413feSNathan Whitehorn# Copy documentation, if generated 18446c413feSNathan Whitehorn.if !defined(NODOC) 185876acefaSHiroki Sato cp reldoc/* bootonly 18646c413feSNathan Whitehorn.endif 18746c413feSNathan Whitehorn# Set up installation environment 188de17cbccSHiroki Sato ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf 189876acefaSHiroki Sato echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf 190876acefaSHiroki Sato echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf 191876acefaSHiroki Sato cp ${.CURDIR}/rc.local bootonly/etc 19246c413feSNathan Whitehorn 193dc244562SGlen Barberdvd: 194dc244562SGlen Barber# Install system 195dc244562SGlen Barber mkdir -p ${.TARGET} 196dc244562SGlen Barber cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 1972b471d3aSGlen Barber DESTDIR=${.OBJDIR}/${.TARGET} WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 198dc244562SGlen Barber# Copy distfiles 199dc244562SGlen Barber mkdir -p ${.TARGET}/usr/freebsd-dist 200dc244562SGlen Barber cp *.txz MANIFEST ${.TARGET}/usr/freebsd-dist 201dc244562SGlen Barber# Copy documentation, if generated 202dc244562SGlen Barber.if !defined(NODOC) 203dc244562SGlen Barber cp reldoc/* ${.TARGET} 204dc244562SGlen Barber.endif 205dc244562SGlen Barber# Set up installation environment 206dc244562SGlen Barber ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf 207dc244562SGlen Barber echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf 208dc244562SGlen Barber echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf 209dc244562SGlen Barber cp ${.CURDIR}/rc.local ${.TARGET}/etc 210dc244562SGlen Barber touch ${.TARGET} 211dc244562SGlen Barber 2128cec99b6SGlen Barberrelease.iso: disc1.iso 2138cec99b6SGlen Barberdisc1.iso: system 214876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release 21512ad0bb1SNathan Whitehorn 216dc244562SGlen Barberdvd1.iso: dvd pkg-stage 217dc244562SGlen Barber sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd 218dc244562SGlen Barber 21946c413feSNathan Whitehornbootonly.iso: bootonly 220876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly 22146c413feSNathan Whitehorn 222cb95a96bSGlen Barbermemstick: memstick.img 2233c334738SGlen Barbermemstick.img: system 224876acefaSHiroki Sato sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} 22512ad0bb1SNathan Whitehorn 226a9da1707SGlen Barbermini-memstick: mini-memstick.img 227a9da1707SGlen Barbermini-memstick.img: system 228a9da1707SGlen Barber sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET} 229a9da1707SGlen Barber 23012ad0bb1SNathan Whitehornpackagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} 231876acefaSHiroki Sato sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST 232299a8b95SNathan Whitehorn touch ${.TARGET} 23312ad0bb1SNathan Whitehorn 234dc244562SGlen Barberpkg-stage: 2356f50c4eaSGlen Barber.if !defined(NOPKG) 2366f50c4eaSGlen Barber env REPOS_DIR=${.CURDIR}/pkg_repos/ \ 2376f50c4eaSGlen Barber sh ${.CURDIR}/scripts/pkg-stage.sh 2380d0e89b7SGlen Barber mkdir -p ${.OBJDIR}/dvd/packages/repos/ 2390d0e89b7SGlen Barber cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \ 2400d0e89b7SGlen Barber ${.OBJDIR}/dvd/packages/repos/ 241dc244562SGlen Barber.endif 2420d0e89b7SGlen Barber touch ${.TARGET} 243dc244562SGlen Barber 2448cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso 245dc244562SGlen Barberdvdrom: dvd1.iso 24612ad0bb1SNathan Whitehornftp: packagesystem 247299a8b95SNathan Whitehorn rm -rf ftp 248876acefaSHiroki Sato mkdir -p ftp 249299a8b95SNathan Whitehorn cp *.txz MANIFEST ftp 25012ad0bb1SNathan Whitehorn 2510bd47e83SNathan Whitehornrelease: 2520bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj 2530bd47e83SNathan Whitehorn ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} 25412ad0bb1SNathan Whitehorn 255299a8b95SNathan Whitehorninstall: 256876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR) 257876acefaSHiroki Sato mkdir -p ${DESTDIR} 258876acefaSHiroki Sato.endif 259de17cbccSHiroki Sato cp -a ftp ${DESTDIR}/ 260de17cbccSHiroki Sato.for I in ${IMAGES} 261de17cbccSHiroki Sato cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} 262510f3303SGlen Barber. if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) 263*3b485e46SGlen Barber ${XZCMD} -k ${DESTDIR}/${OSRELEASE}-${I} 264cbc0e08aSGlen Barber. endif 265de17cbccSHiroki Sato.endfor 266de17cbccSHiroki Sato cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 267de17cbccSHiroki Sato cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 268