1# $DragonFly: src/nrelease/Makefile,v 1.21 2004/12/20 21:13:09 dillon Exp $ 2# 3 4ISODIR ?= /usr/release 5ISOFILE ?= ${ISODIR}/dfly.iso 6ISOROOT = ${ISODIR}/root 7OBJSYS= ${.OBJDIR}/../sys 8KERNCONF ?= GENERIC 9 10# Specify which packages are required on the ISO, and let the user 11# specify additional packages to include. During the `pkgaddiso' 12# target, the packages are obtained from PACKAGES_LOC. 13# 14REQ_PACKAGES= cdrtools-2.0.3_3 cvsup-without-gui-16.1h 15PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES} 16PACKAGES_LOC?= /usr/ports/packages/All 17 18# Specify which root skeletons are required, and let the user include 19# their own. They are copied into ISODIR during the `pkgcustomizeiso' 20# target; each overwrites the last. 21# 22REQ_ROOTSKELS= ${.CURDIR}/root 23ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS} 24 25# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add 26# the additional '/nrelease' manually, as a safety measure. 27# 28NRLOBJDIR?= /usr/obj 29 30WORLD_CCVER ?= ${CCVER} 31KERNEL_CCVER ?= ${CCVER} 32 33######################################################################### 34# BASE ISO TARGETS # 35######################################################################### 36 37release: check clean buildworld1 buildkernel1 \ 38 buildiso customizeiso pkgaddiso mkiso 39 40quickrel: check clean buildworld2 buildkernel2 \ 41 buildiso customizeiso pkgaddiso mkiso 42 43realquickrel: check clean \ 44 buildiso customizeiso pkgaddiso mkiso 45 46######################################################################### 47# ISO TARGETS WITH INSTALLER # 48######################################################################### 49 50INSTALLER_PKGS= libaura-1.0 libdfui-2.0 libinstaller-2.0 \ 51 dfuibe_installer-1.1.2 dfuife_curses-1.1 \ 52 thttpd-notimeout-2.24 dfuife_cgi-1.1 53INSTALLER_SKELS= installer 54 55INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS}" \ 56 EXTRA_ROOTSKELS="${INSTALLER_SKELS}" 57 58installer_check: 59 @${INSTALLER_ENV} ${MAKE} check 60 61installer_fetchpkgs: 62 @${INSTALLER_ENV} ${MAKE} fetchpkgs 63 64installer_release: 65 ${INSTALLER_ENV} ${MAKE} release 66 67installer_quickrel: 68 ${INSTALLER_ENV} ${MAKE} quickrel 69 70installer_realquickrel: 71 ${INSTALLER_ENV} ${MAKE} realquickrel 72 73######################################################################### 74# HELPER TARGETS # 75######################################################################### 76 77check: 78 @if [ ! -f /usr/local/bin/mkisofs ]; then \ 79 echo "You need to install the mkisofs port for this target"; \ 80 exit 1; \ 81 fi 82.for PKG in ${PACKAGES} 83 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \ 84 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz. This is"; \ 85 echo "typically accomplished by cd'ing into the appropriate"; \ 86 echo "port and typing 'make installer_fetchpksgs'"; \ 87 echo ""; \ 88 echo "If you are trying to build the installer, the"; \ 89 echo "required packages can be obtained from:"; \ 90 echo "http://www.bsdinstaller.org/packages/"; \ 91 exit 1; \ 92 fi 93.endfor 94 @echo "check: all preqs found" 95 96fetchpkgs: 97.for PKG in ${PACKAGES} 98 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \ 99 cd ${PACKAGES_LOC} && \ 100 echo "fetching ${PKG}..." && \ 101 fetch http://www.bsdinstaller.org/packages/${PKG}.tgz; \ 102 fi 103.endfor 104 105buildworld1: 106 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld ) 107 108buildworld2: 109 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make -DNOTOOLS -DNOCLEAN buildworld ) 110 111buildkernel1: 112 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} ) 113 114buildkernel2: 115 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make -DNOCLEAN buildkernel KERNCONF=${KERNCONF} ) 116 117# note that we do not want to mess with any /usr/obj directories not related 118# to buildworld, buildkernel, or nrelease, so we must supply the proper 119# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and 120# buildkernel mechanism. 121# 122buildiso: 123 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi 124 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi 125 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld ) 126 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease make DESTDIR=${ISOROOT} distribution ) 127 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd 128 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \ 129 installkernel KERNCONF=${KERNCONF} ) 130 ln -s kernel ${ISOROOT}/kernel.BOOTP 131 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/ 132 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var 133 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev 134 135customizeiso: 136.for ROOTSKEL in ${ROOTSKELS} 137 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} 138.endfor 139 rm -rf `find ${ISOROOT} -type d -name CVS -print` 140 rm -rf ${ISOROOT}/usr/local/share/pristine 141 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd 142 143pkgcleaniso: 144 rm -f ${ISOROOT}/tmp/chrootscript 145 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript 146.for PKG in ${PACKAGES} 147 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript 148.endfor 149 chmod a+x ${ISOROOT}/tmp/chrootscript 150 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0 151 rm ${ISOROOT}/tmp/chrootscript 152 153pkgaddiso: 154 rm -f ${ISOROOT}/tmp/chrootscript 155 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript 156.for PKG in ${PACKAGES} 157 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz 158 echo "echo 'Installing package ${PKG}...'" >> ${ISOROOT}/tmp/chrootscript 159 echo "pkg_add /tmp/${PKG}.tgz" >> ${ISOROOT}/tmp/chrootscript 160.endfor 161 chmod a+x ${ISOROOT}/tmp/chrootscript 162 chroot ${ISOROOT}/ /tmp/chrootscript 163 rm ${ISOROOT}/tmp/chrootscript 164.for PKG in ${PACKAGES} 165 rm -f ${ISOROOT}/tmp/${PKG}.tgz 166.endfor 167 168mkiso: 169 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \ 170 -R -J -V DragonFly -o ${ISOFILE} . ) 171 172clean: 173 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi 174 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi 175 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi 176 177realclean: clean 178 rm -rf ${OBJSYS}/${KERNCONF} 179 180.include <bsd.prog.mk> 181