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