1 # $DragonFly: src/nrelease/Makefile,v 1.90 2008/09/01 21:20:30 swildner Exp $
4 #########################################################################
6 #########################################################################
8 # These targets are now obsolete and should not be used
10 installer_release: warning release
11 installer_quickrel: warning quickrel
12 installer_realquickrel: warning realquickrel
13 installer_fetch: warning fetch
15 # New method e.g. 'make gui release'. A series of enhancement
16 # targes may be specified which set make variables which enhance
17 # the build in various ways.
22 @echo "WARNING: The installer_* targets are now obsolete, please"
23 @echo "use 'make blah' instead of 'make installer_blah'"
25 @echo "will continue in 10 seconds"
28 #########################################################################
30 #########################################################################
32 ISODIR ?= /usr/release
33 ISOROOT ?= ${ISODIR}/root
34 OBJSYS= ${.OBJDIR}/../sys
37 KERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
39 KERNCONF ?= GENERIC VKERNEL
42 PKGSRC_PREFIX?= /usr/pkg
43 PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
44 PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
45 PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
46 PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
47 PKGSRC_PKG_PATH?= ${ISODIR}/packages
48 PKGSRC_DB?= /var/db/pkg
49 PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD
50 CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716
52 # We use env -i in the chroot, so that environment variables won't
53 # disturb any (pkgsrc) build. This has happened for TARGET_ARCH,
54 # which is used by gmake in completely different context.
55 CHROOT_CMD?= env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c
57 # pkgsrc packages to be built and installed on the release ISO
59 PKGSRC_PACKAGES?= devel/scmgit \
65 # pkgsrc options to use when building packages
68 PKGSRC_OPTIONS?= PKG_OPTIONS.scmgit=-scmgit-gui
71 # Even though buildiso wipes the packages, our check target has to run
72 # first and old packages (listed as they appear in pkg_info) must be
73 # cleaned out in order for the pkg_add -n test we use in the check target
74 # to operate properly.
76 OLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 \
78 bootstrap-kit-20070205 \
79 dfuibe_installer-1.1.6 \
81 dfuibe_installer-1.1.7nb1 \
84 gettext-tools-0.14.6nb1 \
88 bootstrap-kit-20080211 \
89 cdrtools-ossdvd-2.01.1.36nb2 \
93 # Specify which root skeletons are required, and let the user include
94 # their own. They are copied into ISODIR during the `pkgcustomizeiso'
95 # target; each overwrites the last.
97 REQ_ROOTSKELS= ${.CURDIR}/root \
99 ROOTSKELS?= ${REQ_ROOTSKELS}
102 ISOFILE?= ${ISODIR}/dfly-gui.iso
103 IMGFILE?= ${ISODIR}/dfly-gui.img
104 PKGSRC_PACKAGES+= meta/modular-xorg-apps \
105 meta/modular-xorg-drivers \
106 meta/modular-xorg-fonts \
107 meta/modular-xorg-libs \
128 fonts/terminus-font \
132 ROOTSKELS+= ${.CURDIR}/gui
135 ISOFILE ?= ${ISODIR}/dfly.iso
136 IMGFILE ?= ${ISODIR}/dfly.img
138 IMGMNT ?= ${ISODIR}/mnt
139 IMGUSBDEV ?= /dev/da0
141 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
142 # the additional '/nrelease' manually, as a safety measure.
146 #########################################################################
148 #########################################################################
150 release: check clean buildworld1 buildkernel1 \
151 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
153 quickrel: check clean buildworld2 buildkernel2 \
154 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
156 realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso \
161 realquick: realquickrel
163 #########################################################################
164 # CORE SUPPORT TARGETS #
165 #########################################################################
168 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
169 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
173 .if !defined(PKGSRC_PATH)
174 @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
175 @echo "package building."
179 buildworld1 buildworld2:
180 cd ${.CURDIR}/..; ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} make -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
182 buildkernel1 buildkernel2:
185 for kernconf in ${KERNCONF}; do \
186 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
187 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
188 KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \
193 for kernconf in ${KERNCONF}; do \
194 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
195 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
196 KERNCONF=$${kernconf} \
197 $${first:+-DNO_MODULES}; \
202 # note that we do not want to mess with any /usr/obj directories not related
203 # to buildworld, buildkernel, or nrelease, so we must supply the proper
204 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
205 # buildkernel mechanism.
208 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
209 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
210 ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
211 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
212 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
213 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
215 if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi
217 make installkernel DESTDIR=${ISOROOT} \
218 KERNCONF=DFLYLIVE DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
220 make installkernel DESTDIR=${ISOROOT} \
221 KERNCONF=VKERNEL DESTKERNNAME=kernel.VKERNEL -DNO_MODULES KERNCONFDIR=${.CURDIR}/gui/root; \
223 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
224 KERNCONF=DFLYLIVE-SMP DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
226 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
227 KERNCONF=DFLYLIVE-SMP-NOAPIC DESTKERNNAME=kernel.noapic \
228 KERNCONFDIR=${.CURDIR}/gui/root -DNO_MODULES;
232 for kernconf in ${KERNCONF}; do \
233 make DESTDIR=${ISOROOT} \
234 installkernel KERNCONF=$${kernconf} \
235 $${first:+DESTKERNNAME=kernel.$${kernconf}} \
236 $${first:+-DNO_MODULES}; \
240 ln -s kernel ${ISOROOT}/kernel.BOOTP
241 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
242 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
243 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
245 # Include kernel sources on the release CD (~14MB)
248 .if !defined(WITHOUT_SRCS)
249 ( cd ${.CURDIR}/../..; tar -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
253 .for ROOTSKEL in ${ROOTSKELS}
254 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
256 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
257 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
258 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
259 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
260 .for UPGRADE_ITEM in Makefile \
261 etc.${MACHINE_ARCH} \
265 periodic/daily/Makefile \
266 periodic/security/Makefile \
267 periodic/weekly/Makefile \
268 periodic/monthly/Makefile
269 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
271 # setup some things & mount pkgsrc tree
272 cp -p /etc/resolv.conf ${ISOROOT}/etc
273 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
274 mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap/work
275 mkdir ${ISOROOT}/usr/pkgsrc
276 mount_null ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
279 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
280 # build and install packages
281 .for PKG in ${PKGSRC_PACKAGES}
282 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} build install"
284 # remove packages which nothing depends on
285 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
286 umount ${ISOROOT}/usr/pkgsrc
287 rmdir ${ISOROOT}/usr/pkgsrc
288 rm -rf ${ISOROOT}/usr/pkgobj
289 rm -f ${ISOROOT}/etc/resolv.conf
290 makewhatis ${ISOROOT}/usr/local/man
291 makewhatis ${ISOROOT}/usr/pkg/man
294 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
295 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
296 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
297 /usr/libexec/locate.mklocatedb \
298 -presort >${ISOROOT}/var/db/locate.database )
301 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
302 -R -J -o ${ISOFILE} \
303 -V DragonFly-`${.CURDIR}/../tools/gitrev.sh | cut -c -22` . )
308 if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
310 echo "determine required image size" > /dev/null; \
311 sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \
312 echo "add 15% more space as required" > /dev/null; \
313 sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
314 dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz}; \
315 fdisk -IB -p ${IMGFILE}; \
316 echo "determine free vn device" > /dev/null; \
317 vn=`vnconfig -l | grep "not in use" | head -n 1 | cut -f 1 -d:`; \
318 vnconfig -e -s labels $${vn} ${IMGFILE}; \
319 echo "write standard disklabel" > /dev/null; \
320 disklabel -w -r $${vn}s1 auto; \
321 echo "read disklabel back" > /dev/null; \
322 disklabel -r $${vn}s1 > ${IMGFILE}.label; \
323 echo "determine number of sectors of whole disk" > /dev/null; \
324 secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \
325 echo "and add a: partition" > /dev/null; \
326 echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label; \
327 echo "write modified disklabel back" > /dev/null; \
328 disklabel -R -r $${vn}s1 ${IMGFILE}.label; \
329 rm ${IMGFILE}.label; \
330 echo "write bootsector" > /dev/null; \
331 disklabel -B $${vn}s1; \
332 newfs /dev/$${vn}s1a; \
333 mount /dev/$${vn}s1a ${IMGMNT}; \
334 cpdup -vvv ${ISOROOT} ${IMGMNT}; \
335 echo "fix /etc/fstab" > /dev/null; \
336 echo "${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc/fstab; \
337 echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab; \
340 vnconfig -u $${vn}; \
345 -umount ${ISOROOT}/usr/pkgsrc
346 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
347 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
348 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
351 rm -rf ${OBJSYS}/${KERNCONF}
352 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
354 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
357 @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
358 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
359 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
363 mkdir -p ${PKGSRC_PKG_PATH}
364 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
365 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
367 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
368 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
371 .if !exists (${PKGBIN_MKISOFS})
372 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrtools*
376 .PHONY: all release installer_release quickrel installer_quickrel realquickrel
377 .PHONY: installer_fetch installer
378 .PHONY: quick realquick
379 .PHONY: installer_realquickrel check buildworld1 buildworld2
380 .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
381 .PHONY: clean realclean fetch
383 .include <bsd.prog.mk>