1# $FreeBSD$ 2# 3# Makefile for building releases and release media. 4# 5# User-driven targets: 6# cdrom: Builds release CD-ROM media (disc1.iso) 7# memstick: Builds memory stick image (memstick.img) 8# ftp: Sets up FTP distribution area (ftp) 9# release: Build all media and FTP distribution area 10# install: Copies all release media into ${DESTDIR} 11# 12# Variables affecting the build process: 13# WORLDDIR: location of src tree -- must have built world and default kernel 14# (by default, the directory above this one) 15# PORTSDIR: location of ports tree to distribute (default: /usr/ports) 16# DOCDIR: location of doc tree (default: /usr/doc) 17# NOPORTS: if set, do not distribute ports tree 18# NOSRC: if set, do not distribute source tree 19# NODOC: if set, do not generate release documentation 20# TARGET/TARGET_ARCH: architecture of built release 21# 22 23WORLDDIR?= ${.CURDIR}/.. 24PORTSDIR?= /usr/ports 25DOCDIR?= /usr/doc 26RELNOTES_LANG?= en_US.ISO8859-1 27 28TARGET?= ${MACHINE} 29.if ${TARGET} == ${MACHINE} 30TARGET_ARCH?= ${MACHINE_ARCH} 31.else 32TARGET_ARCH?= ${TARGET} 33.endif 34IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} 35DISTDIR= dist 36 37# Define OSRELEASE by using newvars.sh 38.if !defined(OSRELEASE) || empty(OSRELEASE) 39.for _V in TYPE BRANCH REVISION 40${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V} 41.endfor 42.for _V in ${TARGET_ARCH} 43.if !empty(TARGET:M${_V}) 44OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET} 45.else 46OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} 47.endif 48.endfor 49.endif 50 51.if !exists(${DOCDIR}) 52NODOC= true 53.endif 54.if !exists(${PORTSDIR}) 55NOPORTS= true 56.endif 57 58EXTRA_PACKAGES= 59.if !defined(NOPORTS) 60EXTRA_PACKAGES+= ports.txz 61.endif 62.if !defined(NOSRC) 63EXTRA_PACKAGES+= src.txz 64.endif 65.if !defined(NODOC) 66EXTRA_PACKAGES+= reldoc 67.endif 68 69RELEASE_TARGETS= ftp 70IMAGES= 71.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) 72RELEASE_TARGETS+= cdrom 73IMAGES+= disc1.iso bootonly.iso 74.endif 75.if exists(${.CURDIR}/${TARGET}/make-memstick.sh) 76RELEASE_TARGETS+= memstick.img 77IMAGES+= memstick.img 78.endif 79 80.include <bsd.obj.mk> 81 82base.txz: 83 mkdir -p ${DISTDIR} 84 cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} 85# Set up mergemaster root database 86 sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ 87 "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base" 88# Package all components 89 cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} 90 mv ${DISTDIR}/*.txz . 91 92kernel.txz: 93 mkdir -p ${DISTDIR} 94 cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} 95 mv ${DISTDIR}/kernel*.txz . 96 97src.txz: 98 mkdir -p ${DISTDIR}/usr 99 ln -fs ${WORLDDIR} ${DISTDIR}/usr/src 100 cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ 101 --exclude CVS --exclude @ --exclude usr/src/release/dist usr/src 102 103ports.txz: 104 mkdir -p ${DISTDIR}/usr 105 ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports 106 cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ 107 --exclude CVS --exclude .svn \ 108 --exclude usr/ports/distfiles --exclude usr/ports/packages \ 109 --exclude 'usr/ports/INDEX*' --exclude work usr/ports 110 111reldoc: 112 cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ 113 INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc 114 mkdir -p reldoc 115.for i in hardware readme relnotes errata 116 ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT 117 ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM 118.endfor 119 cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc 120 121system: packagesystem 122# Install system 123 mkdir -p release 124 cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 125 DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 126# Copy distfiles 127 mkdir -p release/usr/freebsd-dist 128 cp *.txz MANIFEST release/usr/freebsd-dist 129# Copy documentation, if generated 130.if !defined(NODOC) 131 cp reldoc/* release 132.endif 133# Set up installation environment 134 ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf 135 echo sendmail_enable=\"NONE\" > release/etc/rc.conf 136 echo hostid_enable=\"NO\" >> release/etc/rc.conf 137 cp ${.CURDIR}/rc.local release/etc 138 touch ${.TARGET} 139 140bootonly: packagesystem 141# Install system 142 mkdir -p bootonly 143 cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ 144 DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \ 145 WITHOUT_BIND_DNSSEC=1 WITHOUT_BIND_ETC=1 WITHOUT_BIND_MTREE=1 \ 146 WITHOUT_BIND_NAMED=1 WITHOUT_GAMES=1 WITHOUT_GROFF=1 \ 147 WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \ 148 WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \ 149 WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \ 150 WITHOUT_KERNEL_SYMBOLS=1 151# Copy manifest only (no distfiles) to get checksums 152 mkdir -p bootonly/usr/freebsd-dist 153 cp MANIFEST bootonly/usr/freebsd-dist 154# Copy documentation, if generated 155.if !defined(NODOC) 156 cp reldoc/* bootonly 157.endif 158# Set up installation environment 159 ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf 160 echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf 161 echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf 162 cp ${.CURDIR}/rc.local bootonly/etc 163 164release.iso: disc1.iso 165disc1.iso: system 166 sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release 167 168bootonly.iso: bootonly 169 sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly 170 171memstick: memstick.img 172memstick.img: system 173 sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} 174 175packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} 176 sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST 177 touch ${.TARGET} 178 179cdrom: disc1.iso bootonly.iso 180ftp: packagesystem 181 rm -rf ftp 182 mkdir -p ftp 183 cp *.txz MANIFEST ftp 184 185release: 186 ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj 187 ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} 188 189clean: 190 chflags -R noschg . 191 rm -rf dist ftp 192 rm -f packagesystem 193 rm -f *.txz MANIFEST 194 rm -f system 195 rm -rf release bootonly 196 rm -f disc1.iso bootonly.iso memstick.img 197 198install: 199.if defined(DESTDIR) && !empty(DESTDIR) 200 mkdir -p ${DESTDIR} 201.endif 202 cp -a ftp ${DESTDIR}/ 203.for I in ${IMAGES} 204 cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} 205.endfor 206 cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 207 cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 208