| 1 | # $DragonFly: src/nrelease/Makefile,v 1.71 2007/08/13 21:33:47 corecode Exp $ |
| 2 | # |
| 3 | |
| 4 | # compat target |
| 5 | installer_release: release |
| 6 | installer_quickrel: quickrel |
| 7 | installer_realquickrel: realquickrel |
| 8 | installer_fetch: fetch |
| 9 | |
| 10 | .if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel) || make(installer_fetch) |
| 11 | WITH_INSTALLER= |
| 12 | .endif |
| 13 | |
| 14 | ISODIR ?= /usr/release |
| 15 | ISOFILE ?= ${ISODIR}/dfly.iso |
| 16 | ISOROOT = ${ISODIR}/root |
| 17 | OBJSYS= ${.OBJDIR}/../sys |
| 18 | KERNCONF ?= GENERIC VKERNEL |
| 19 | |
| 20 | PKGSRC_PREFIX?= /usr/pkg |
| 21 | PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add |
| 22 | PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete |
| 23 | PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin |
| 24 | PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs |
| 25 | PKGSRC_PKG_PATH?= ${ISODIR}/packages |
| 26 | PKGSRC_DB?= /var/db/pkg |
| 27 | PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.10.0-RELEASE-BUILD |
| 28 | |
| 29 | ENVCMD?= env |
| 30 | TAR?= tar |
| 31 | |
| 32 | PKGSRC_CDRECORD?= cdrtools-2.01.01.27nb1.tgz |
| 33 | PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20070801 |
| 34 | CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716 |
| 35 | |
| 36 | # Default packages to be installed on the release ISO. |
| 37 | # |
| 38 | PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1.tgz |
| 39 | |
| 40 | # Even though buildiso wipes the packages, our check target has to run |
| 41 | # first and old packages (listed as they appear in pkg_info) must be |
| 42 | # cleaned out in order for the pkg_add -n test we use in the check target |
| 43 | # to operate properly. |
| 44 | # |
| 45 | OLD_PKGSRC_PACKAGES?= cdrecord-2.00.3nb2 bootstrap-kit-20070205 |
| 46 | |
| 47 | # Specify which root skeletons are required, and let the user include |
| 48 | # their own. They are copied into ISODIR during the `pkgcustomizeiso' |
| 49 | # target; each overwrites the last. |
| 50 | # |
| 51 | REQ_ROOTSKELS= ${.CURDIR}/root |
| 52 | ROOTSKELS?= ${REQ_ROOTSKELS} |
| 53 | |
| 54 | .if defined(WITH_INSTALLER) |
| 55 | OLD_PKGSRC_PACKAGES+= dfuibe_installer-1.1.6 |
| 56 | PKGSRC_PACKAGES+= dfuibe_installer-1.1.7nb1.tgz dfuife_curses-1.5.tgz |
| 57 | PKGSRC_PACKAGES+= gettext-lib-0.14.5.tgz libaura-3.1.tgz \ |
| 58 | libdfui-4.2.tgz libinstaller-5.1.tgz |
| 59 | ROOTSKELS+= ${.CURDIR}/installer |
| 60 | .endif |
| 61 | |
| 62 | # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add |
| 63 | # the additional '/nrelease' manually, as a safety measure. |
| 64 | # |
| 65 | NRLOBJDIR?= /usr/obj |
| 66 | |
| 67 | WORLD_CCVER ?= ${CCVER} |
| 68 | KERNEL_CCVER ?= ${CCVER} |
| 69 | |
| 70 | ######################################################################### |
| 71 | # BASE ISO TARGETS # |
| 72 | ######################################################################### |
| 73 | |
| 74 | release: check clean buildworld1 buildkernel1 \ |
| 75 | buildiso syssrcs customizeiso mklocatedb mkiso |
| 76 | |
| 77 | quickrel: check clean buildworld2 buildkernel2 \ |
| 78 | buildiso syssrcs customizeiso mklocatedb mkiso |
| 79 | |
| 80 | realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso |
| 81 | |
| 82 | check: |
| 83 | .if !exists(${PKGBIN_PKG_ADD}) |
| 84 | @echo "Unable to find ${PKGBIN_PKG_ADD}. You can use the following" |
| 85 | @echo "command to bootstrap pkgsrc:" |
| 86 | @echo " make pkgsrc_bootstrap" |
| 87 | @exit 1 |
| 88 | .endif |
| 89 | .for PKG in ${OLD_PKGSRC_PACKAGES} |
| 90 | @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_DELETE} -K ${ISOROOT}/var/db/pkg ${PKG} > /dev/null 2>&1 || exit 0 |
| 91 | .endfor |
| 92 | .for PKG in ${PKGSRC_PACKAGES} |
| 93 | @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \ |
| 94 | (echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo " make [installer_]fetch"; exit 1) |
| 95 | .endfor |
| 96 | .if !exists(${PKGBIN_MKISOFS}) |
| 97 | @echo "mkisofs is not installed. It is part of the cdrecord package." |
| 98 | @echo "You can install it with:" |
| 99 | @echo " make pkgsrc_cdrecord" |
| 100 | @exit 1 |
| 101 | .endif |
| 102 | .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz) |
| 103 | @echo "The pkgsrc bootstrap kit is not installed. You can install it with:" |
| 104 | @echo " make [installer_]fetch" |
| 105 | @exit 1 |
| 106 | .endif |
| 107 | .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz) |
| 108 | @echo "The cvsup bootstrap kit is not installed. You can install it with:" |
| 109 | @echo " make [installer_]fetch" |
| 110 | @exit 1 |
| 111 | .endif |
| 112 | |
| 113 | buildworld1 buildworld2: |
| 114 | cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//} |
| 115 | |
| 116 | buildkernel1 buildkernel2: |
| 117 | cd ${.CURDIR}/..; \ |
| 118 | first=; \ |
| 119 | for kernconf in ${KERNCONF}; do \ |
| 120 | CCVER=${KERNEL_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \ |
| 121 | KERNCONF=$${kernconf} \ |
| 122 | $${first:+-DNO_MODULES}; \ |
| 123 | first=done; \ |
| 124 | done |
| 125 | |
| 126 | # note that we do not want to mess with any /usr/obj directories not related |
| 127 | # to buildworld, buildkernel, or nrelease, so we must supply the proper |
| 128 | # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and |
| 129 | # buildkernel mechanism. |
| 130 | # |
| 131 | buildiso: |
| 132 | if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi |
| 133 | if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi |
| 134 | ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld ) |
| 135 | ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \ |
| 136 | make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution ) |
| 137 | chroot ${ISOROOT} /usr/bin/newaliases |
| 138 | cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd |
| 139 | cd ${.CURDIR}/..; \ |
| 140 | first=; \ |
| 141 | for kernconf in ${KERNCONF}; do \ |
| 142 | make DESTDIR=${ISOROOT} \ |
| 143 | installkernel KERNCONF=$${kernconf} \ |
| 144 | $${first:+DESTKERNNAME=kernel.$${kernconf}} \ |
| 145 | $${first:+-DNO_MODULES}; \ |
| 146 | first=done; \ |
| 147 | done |
| 148 | ln -s kernel ${ISOROOT}/kernel.BOOTP |
| 149 | mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/ |
| 150 | mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var |
| 151 | dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev |
| 152 | |
| 153 | # Include kernel sources on the release CD (~14MB) |
| 154 | # |
| 155 | syssrcs: |
| 156 | .if !defined(WITHOUT_SRCS) |
| 157 | ( cd ${.CURDIR}/../..; tar --exclude CVS -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 ) |
| 158 | .endif |
| 159 | |
| 160 | customizeiso: |
| 161 | (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz) |
| 162 | .for ROOTSKEL in ${ROOTSKELS} |
| 163 | cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} |
| 164 | .endfor |
| 165 | rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc |
| 166 | cd ${ISOROOT}; tar xvzpf ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz |
| 167 | cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup |
| 168 | cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1 |
| 169 | rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc |
| 170 | rm -rf `find ${ISOROOT} -type d -name CVS -print` |
| 171 | rm -rf ${ISOROOT}/usr/local/share/pristine |
| 172 | pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd |
| 173 | .for UPGRADE_ITEM in Makefile \ |
| 174 | etc.${MACHINE_ARCH} \ |
| 175 | isdn/Makefile \ |
| 176 | rc.d/Makefile \ |
| 177 | periodic/Makefile \ |
| 178 | periodic/daily/Makefile \ |
| 179 | periodic/security/Makefile \ |
| 180 | periodic/weekly/Makefile \ |
| 181 | periodic/monthly/Makefile |
| 182 | cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} |
| 183 | .endfor |
| 184 | # This is a really bad hack. There seems to be no reliable way |
| 185 | # to install a package to a target directory prefix so we have to |
| 186 | # copy everything into the ISO root and do the install chrooted. |
| 187 | # |
| 188 | rm -rf ${ISOROOT}/tmp/packages |
| 189 | mkdir ${ISOROOT}/tmp/packages |
| 190 | .for PKG in ${PKGSRC_PACKAGES} |
| 191 | cp ${PKGSRC_PKG_PATH}/${PKG} ${ISOROOT}/tmp/packages |
| 192 | .endfor |
| 193 | .for PKG in ${PKGSRC_PACKAGES} |
| 194 | ${ENV} PKG_PATH=/tmp/packages chroot ${ISOROOT} ${PKGBIN_PKG_ADD} -I ${PKG} |
| 195 | .endfor |
| 196 | rm -rf ${ISOROOT}/tmp/packages |
| 197 | find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \; |
| 198 | chroot ${ISOROOT} ${PKGBIN_PKG_ADMIN} rebuild |
| 199 | |
| 200 | mklocatedb: |
| 201 | ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \ |
| 202 | -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \ |
| 203 | -prune -o -print | sed -e 's#^${ISOROOT}##g' | \ |
| 204 | /usr/libexec/locate.mklocatedb \ |
| 205 | -presort >${ISOROOT}/var/db/locate.database ) |
| 206 | |
| 207 | mkiso: |
| 208 | ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \ |
| 209 | -R -J -V DragonFly -o ${ISOFILE} . ) |
| 210 | |
| 211 | clean: |
| 212 | if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi |
| 213 | if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi |
| 214 | if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi |
| 215 | |
| 216 | realclean: clean |
| 217 | rm -rf ${OBJSYS}/${KERNCONF} |
| 218 | # do not use PKGSRC_PKG_PATH here, we do not want to destroy an |
| 219 | # override location. |
| 220 | if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi |
| 221 | |
| 222 | fetch: |
| 223 | mkdir -p ${PKGSRC_PKG_PATH} |
| 224 | .for PKG in ${PKGSRC_PACKAGES} |
| 225 | @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \ |
| 226 | (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG}) |
| 227 | .endfor |
| 228 | .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz) |
| 229 | (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz) |
| 230 | .endif |
| 231 | .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz) |
| 232 | (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz) |
| 233 | .endif |
| 234 | |
| 235 | pkgsrc_bootstrap: |
| 236 | mkdir -p ${PKGSRC_PKG_PATH} |
| 237 | .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz) |
| 238 | (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz) |
| 239 | .endif |
| 240 | (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz) |
| 241 | (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap) |
| 242 | |
| 243 | pkgsrc_cdrecord: |
| 244 | .if !exists (${PKGBIN_MKISOFS}) |
| 245 | ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrtools* |
| 246 | .endif |
| 247 | |
| 248 | |
| 249 | .PHONY: all release installer_release quickrel installer_quickrel realquickrel |
| 250 | .PHONY: installer_fetch |
| 251 | .PHONY: installer_realquickrel check buildworld1 buildworld2 |
| 252 | .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso |
| 253 | .PHONY: clean realclean fetch |
| 254 | |
| 255 | .include <bsd.prog.mk> |