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