Merge branch 'vendor/OPENSSL'
[dragonfly.git] / nrelease / Makefile
1 # $DragonFly: src/nrelease/Makefile,v 1.90 2008/09/01 21:20:30 swildner Exp $
2 #
3
4 #########################################################################
5 #                               ENHANCEMENTS                            #
6 #########################################################################
7
8 # New method e.g. 'make gui release'.  A series of enhancement
9 # targes may be specified which set make variables which enhance
10 # the build in various ways.
11 #
12 gui installer img:
13
14 #########################################################################
15 #                                SETUP                                  #
16 #########################################################################
17
18 ISODIR?=        /usr/release
19 ISOROOT?=       ${ISODIR}/root
20 OBJSYS=         ${.OBJDIR}/../sys
21
22 MAKE_JOBS?=     $$(sysctl -n hw.ncpu)
23
24 # temporary until everybody has converted to x86_64
25 .if ${MACHINE_ARCH} == "amd64"
26 MACHINE_ARCH=   x86_64
27 .makeenv MACHINE_ARCH
28 .endif
29
30 .if make(gui)
31 KERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
32 .else
33 # XXX makeshift fix to build the right kernel for the (target) architecture
34 # We should configure this in the platform files somehow
35 .if ${MACHINE_ARCH} == "i386"
36 KERNCONF ?= GENERIC VKERNEL
37 .else
38 KERNCONF ?= X86_64_GENERIC
39 .endif
40 .endif
41
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_BOOTSTRAP_URL?=  http://avalon.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD
49 CVSUP_BOOTSTRAP_KIT?=   cvsup-bootstrap-20070716
50
51 # We use env -i in the chroot, so that environment variables won't
52 # disturb any (pkgsrc) build.  This has happened for TARGET_ARCH,
53 # which is used by gmake in completely different context.
54 #
55 CHROOT_CMD?=            env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c
56
57 # User may specify extra packages in addition to the defaults
58 #
59 PKGSRC_EXTRA_PACKAGES?=
60
61 # Pkgsrc packages to be built and installed on the release ISO
62 #
63 PKGSRC_PACKAGES?=       pkgtools/pkg_leaves \
64                         pkgtools/pkg_tarup \
65                         devel/scmgit \
66                         net/isc-dhcp4 \
67                         net/isc-dhcpd4 \
68                         sysutils/cdrtools \
69                         ${PKGSRC_EXTRA_PACKAGES}
70
71 # pkgsrc options to use when building packages
72 #
73 PKGSRC_OPTIONS+=        MAKE_JOBS=${MAKE_JOBS}
74 PKGSRC_OPTIONS+=        WRKOBJDIR=/usr/pkgobj
75 PKGSRC_OPTIONS+=        PKG_DEFAULT_OPTIONS='dri inet6'
76 .if !make(gui)
77 PKGSRC_OPTIONS+=        PKG_OPTIONS.scmgit=-scmgit-gui
78 .endif
79
80 # Even though buildiso wipes the packages, our check target has to run
81 # first and old packages (listed as they appear in pkg_info) must be
82 # cleaned out in order for the pkg_add -n test we use in the check target
83 # to operate properly.
84 #
85 OLD_PKGSRC_PACKAGES?=   cdrtools-2.01.01.27nb1 \
86                         cdrecord-2.00.3nb2 \
87                         bootstrap-kit-20070205 \
88                         dfuibe_installer-1.1.6 \
89                         gettext-lib-0.14.5 \
90                         dfuibe_installer-1.1.7nb1 \
91                         dfuife_curses-1.5 \
92                         gettext-lib-0.14.6 \
93                         gettext-tools-0.14.6nb1 \
94                         libaura-3.1 \
95                         libdfui-4.2 \
96                         libinstaller-5.1 \
97                         bootstrap-kit-20080211 \
98                         cdrtools-ossdvd-2.01.1.36nb2 \
99                         isc-dhcp-base-4.0.0 \
100                         isc-dhcp-server-4.0.0
101
102 # Specify which root skeletons are required, and let the user include
103 # their own.  They are copied into ISODIR during the `customizeiso'
104 # target; each overwrites the last.
105 #
106 REQ_ROOTSKELS=  ${.CURDIR}/root
107 ROOTSKELS?=     ${REQ_ROOTSKELS}
108
109 .if make(gui)
110 ISOFILE?=               ${ISODIR}/dfly-gui.iso
111 IMGFILE?=               ${ISODIR}/dfly-gui.img
112 PKGSRC_PACKAGES+=       meta-pkgs/modular-xorg-apps \
113                         meta-pkgs/modular-xorg-drivers \
114                         meta-pkgs/modular-xorg-fonts \
115                         meta-pkgs/modular-xorg-libs \
116                         wm/fluxbox \
117                         wm/fvwm \
118                         www/firefox \
119                         print/xpdf \
120                         shells/zsh \
121                         editors/emacs \
122                         editors/vim \
123                         chat/pidgin \
124                         chat/irssi \
125                         chat/xchat \
126                         x11/modular-xorg-server \
127                         x11/rxvt-unicode \
128                         x11/eterm \
129                         lang/perl5 \
130                         editors/nano \
131                         shells/bash \
132                         devel/exctags \
133                         archivers/zip \
134                         security/sudo \
135                         www/links-gui \
136                         net/nmap \
137                         net/wget \
138                         fonts/terminus-font \
139                         net/rsync \
140                         sysutils/idesk \
141                         time/asclock \
142                         misc/screen
143 ROOTSKELS+=             ${.CURDIR}/gui
144 .endif
145
146 ISOFILE ?= ${ISODIR}/dfly.iso
147 IMGFILE ?= ${ISODIR}/dfly.img
148
149 IMGMNT ?= ${ISODIR}/mnt
150
151 # USB umass now probes starting at da8, so the usb stick is
152 # probably sitting on da8.
153 #
154 IMGUSBDEV ?= da8
155
156 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
157 # the additional '/nrelease' manually, as a safety measure.
158 #
159 NRLOBJDIR?= /usr/obj
160
161 #########################################################################
162 #                               BASE ISO TARGETS                        #
163 #########################################################################
164
165 release:        check clean buildworld1 buildkernel1 \
166                 buildiso srcs customizeiso mklocatedb \
167                 mkiso mkimg
168
169 quickrel:       check clean buildworld2 buildkernel2 \
170                 buildiso srcs customizeiso mklocatedb \
171                 mkiso mkimg
172
173 realquickrel:   check clean \
174                 buildiso srcs customizeiso mklocatedb \
175                 mkiso mkimg
176
177 restartpkgs:    check customizeiso mklocatedb mkiso mkimg
178
179 quick:          quickrel
180
181 realquick:      realquickrel
182
183
184 #########################################################################
185 #                          CORE SUPPORT TARGETS                         #
186 #########################################################################
187
188 check:
189 .if !exists(${PKGBIN_PKG_ADMIN})
190         @echo "You never bootstrapped pkgsrc on your machine.  You can install it with:"
191         @echo "    make pkgsrc_bootstrap"
192 .endif
193 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
194         @echo "The cvsup bootstrap kit is not installed.  You can install it with:"
195         @echo "    make fetch"
196 .endif
197 .if !exists (${PKGBIN_MKISOFS})
198         @echo
199         @echo "Your machine does not have cdrtools installed.  You can install it with:"
200         @echo "    make pkgsrc_cdrecord"
201 .endif
202 .if !defined(PKGSRC_PATH)
203         @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
204         @echo "package building.  For example /usr/pkgsrc.  See the Makefile"
205         @echo "in /usr if you are unfamiliar with pkgsrc."
206 .endif
207 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
208         @exit 1
209 .endif
210 .if !exists (${PKGBIN_MKISOFS})
211         @exit 1
212 .endif
213 .if !defined(PKGSRC_PATH)
214         @exit 1
215 .endif
216
217 buildworld1 buildworld2:
218         cd ${.CURDIR}/..; \
219         ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
220                 make -j ${MAKE_JOBS} -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
221
222 buildkernel1 buildkernel2:
223 .if make(gui)
224         cd ${.CURDIR}/..; \
225         for kernconf in ${KERNCONF}; do \
226                 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
227                         make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
228                         KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \
229         done
230 .else
231         cd ${.CURDIR}/..; \
232         first=; \
233         for kernconf in ${KERNCONF}; do \
234                 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
235                         make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
236                         KERNCONF=$${kernconf} \
237                         $${first:+-DNO_MODULES}; \
238                 first=done; \
239         done
240 .endif
241
242 # note that we do not want to mess with any /usr/obj directories not related
243 # to buildworld, buildkernel, or nrelease, so we must supply the proper
244 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and 
245 # buildkernel mechanism.
246 #
247 buildiso:
248         if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
249         if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
250         ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
251         ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
252                 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
253         cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
254 .if make(gui)
255         if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi
256         cd ${.CURDIR}/..; \
257         make installkernel DESTDIR=${ISOROOT} \
258         KERNCONF=DFLYLIVE DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
259         cd ${.CURDIR}/..; \
260         make installkernel DESTDIR=${ISOROOT} \
261         KERNCONF=VKERNEL DESTKERNNAME=kernel.VKERNEL -DNO_MODULES KERNCONFDIR=${.CURDIR}/gui/root; \
262         cd ${.CURDIR}/..; \
263         make installkernel DESTDIR=${ISOROOT}/kernel.smp \
264         KERNCONF=DFLYLIVE-SMP DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
265         cd ${.CURDIR}/..; \
266         make installkernel DESTDIR=${ISOROOT}/kernel.smp \
267         KERNCONF=DFLYLIVE-SMP-NOAPIC DESTKERNNAME=kernel.noapic \
268                 KERNCONFDIR=${.CURDIR}/gui/root -DNO_MODULES;
269 .else
270         cd ${.CURDIR}/..; \
271         first=; \
272         for kernconf in ${KERNCONF}; do \
273                 make DESTDIR=${ISOROOT} \
274                         installkernel KERNCONF=$${kernconf} \
275                         $${first:+DESTKERNNAME=kernel.$${kernconf}} \
276                         $${first:+-DNO_MODULES}; \
277                 first=done; \
278         done
279 .endif
280         ln -s kernel ${ISOROOT}/boot/kernel.BOOTP
281         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
282         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
283         dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
284
285 # Release CD: Kernel sources (~16M) and the full pkgsrc tree (~27M)
286 # Release DVD: Full sources (~90M) and the full pkgsrc tree (~27M)
287 #
288 srcs:
289 .if !defined(WITHOUT_SRCS)
290         rm -f ${ISOROOT}/usr/pkgsrc-git.tgz
291         rm -f ${ISOROOT}/usr/pkgsrc
292         mkdir -p ${ISOROOT}/usr/pkgsrc
293         cd ${ISOROOT}/usr/pkgsrc && git init
294         cd ${ISOROOT}/usr/pkgsrc && \
295                 git remote add origin git://git.dragonflybsd.org/pkgsrc.git
296         cd ${ISOROOT}/usr/pkgsrc && git fetch origin
297         cd ${ISOROOT}/usr/pkgsrc && git branch vendor origin/vendor
298         cd ${ISOROOT}/usr/pkgsrc && git gc
299 .if make(gui)
300         rm -f ${ISOROOT}/usr/src-git.tgz
301         rm -rf ${ISOROOT}/usr/src
302         mkdir -p ${ISOROOT}/usr/src
303         cd ${ISOROOT}/usr/src && git init
304         cd ${ISOROOT}/usr/src && \
305                 git remote add origin git://git.dragonflybsd.org/dragonfly.git
306         cd ${ISOROOT}/usr/src && git fetch origin
307         cd ${ISOROOT}/usr/src && git branch master origin/master
308         cd ${ISOROOT}/usr/src && git gc
309 .else
310         rm -f ${ISOROOT}/usr/src-sys.tgz
311         cd ${.CURDIR}/.. && tar --exclude .git --exclude CVS -s '/^\./src/' \
312                 -czf ${ISOROOT}/usr/src-sys.tgz ./Makefile ./Makefile.inc1 ./sys
313 .endif
314 .endif
315
316 # Customize the ISO by copying rootskels in reverse priority order,
317 # building packages, and doing other post-install tasks.
318 #
319 customizeiso:
320         # Copy the rootskels.  Allow sources to be owned by someone other
321         # then root (as is common when checked out via git).
322         #
323 .for ROOTSKEL in ${ROOTSKELS}
324         cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
325         @test -O ${.CURDIR} || echo "chowning copied files to root:wheel"
326         @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel))
327 .endfor
328         (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
329         cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
330         cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
331         pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
332 .for UPGRADE_ITEM in Makefile                   \
333                      etc.${MACHINE_ARCH}        \
334                      isdn/Makefile              \
335                      rc.d/Makefile              \
336                      periodic/Makefile          \
337                      periodic/daily/Makefile    \
338                      periodic/security/Makefile \
339                      periodic/weekly/Makefile   \
340                      periodic/monthly/Makefile
341         cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
342 .endfor
343         #
344         # Setup some things & mount pkgsrc tree.  Use defensive umounts and
345         # rm -rf's to allow restarts.  Allow /usr/pkgsrc to be read-only.
346         #
347         # If we did not get past the bootstrap we clean out the entire
348         # /usr/pkg infrastructure.  Otherwise we attempt to pick up where
349         # we left off.
350         #
351         cp -p /etc/resolv.conf ${ISOROOT}/etc
352         ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
353         -@umount ${ISOROOT}/usr/pkgsrc/distfiles
354         -@umount ${ISOROOT}/usr/pkgsrc
355         -@umount ${ISOROOT}/dev
356         mkdir -p ${ISODIR}/distfiles
357         rm -rf ${ISOROOT}/usr/pkgobj
358         #
359         # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable.
360         # Make /usr/pkgsrc read-only for safety, else a failed umount and
361         # our rm -rf will do bad things.
362         #
363         mkdir -p ${ISOROOT}/usr/pkgobj
364         mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap
365         mkdir -p ${ISOROOT}/usr/pkgsrc
366         mount_null -o ro ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
367         mount_null /dev ${ISOROOT}/dev
368         cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \
369             || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles
370         #
371         # Bootstrap, if not already installed, and add licenses needed
372         # for the gui release
373         #
374         test -e ${ISODIR}/.didbootstrap || \
375             rm -rf ${ISOROOT}/usr/pkg ${ISOROOT}/var/db/pkg \
376                     ${ISOROOT}/var/db/pkg.refcount
377         test -e ${ISODIR}/.didbootstrap || \
378             ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap;    \
379                 ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
380 .if make(gui)
381         test -e ${ISODIR}/.didbootstrap || \
382             echo ".ifdef BSD_PKG_MK     # added by nrelease" \
383                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
384         test -e ${ISODIR}/.didbootstrap || \
385             echo "ACCEPTABLE_LICENSES+=openmotif-license" \
386                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
387         test -e ${ISODIR}/.didbootstrap || \
388             echo "ACCEPTABLE_LICENSES+=vim-license" \
389                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
390         test -e ${ISODIR}/.didbootstrap || \
391             echo ".endif                        # added by nrelease" \
392                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
393 .endif
394         test -e ${ISODIR}/.didbootstrap || sync
395         test -e ${ISODIR}/.didbootstrap || touch ${ISODIR}/.didbootstrap
396         #
397         # Build and install packages, skip packages already installed
398         #
399 .for PKG in ${PKGSRC_PACKAGES}
400         ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
401             (bmake check > /dev/null 2>&1 || \
402             bmake ${PKGSRC_OPTIONS} clean build install)"
403 .endfor
404         #
405         # Remove packages which nothing depends on and clean up
406         #
407         ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
408         -umount ${ISOROOT}/usr/pkgsrc/distfiles
409         umount ${ISOROOT}/dev
410         umount ${ISOROOT}/usr/pkgsrc
411         rm -rf ${ISOROOT}/usr/pkgobj
412         rm -f ${ISOROOT}/etc/resolv.conf
413         makewhatis ${ISOROOT}/usr/local/man
414         makewhatis ${ISOROOT}/usr/pkg/man
415
416 # So locate works
417 #
418 mklocatedb:
419         ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
420                 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
421                 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
422                 /usr/libexec/locate.mklocatedb \
423                 -presort >${ISOROOT}/var/db/locate.database )
424
425 mkiso:
426         ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
427                 -R -J -o ${ISOFILE} \
428                 -V "DragonFly `${.CURDIR}/../tools/gitrev.sh | cut -c -22`" . )
429
430
431 mkimg:
432 .if make(img)
433         if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
434         -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT};           \
435             vnconfig -u `cat ${ISODIR}/vn.which`; fi
436         @echo "STEP: determine required image size"
437         sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`;                  \
438             sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
439             dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz};
440         fdisk -IB -p ${IMGFILE}
441         @echo "STEP: determine free vn device"
442         vnconfig -l | grep "not in use" | head -n 1 |                   \
443             cut -f 1 -d: > ${ISODIR}/vn.which
444         vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE}
445         @echo "STEP: write standard disklabel"
446         disklabel -w -r `cat ${ISODIR}/vn.which`s1 auto
447         @echo "STEP: read disklabel back"
448         disklabel -r `cat ${ISODIR}/vn.which`s1 > ${IMGFILE}.label
449         @echo "STEP: determine number of sectors of whole disk"
450         secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`;                \
451             echo "  a:  $${secs} 0 4.2BSD" >> ${IMGFILE}.label;
452         @echo "STEP: write modified disklabel back"
453         disklabel -R -r `cat ${ISODIR}/vn.which`s1 ${IMGFILE}.label
454         rm ${IMGFILE}.label
455         @echo "STEP: write bootsector"
456         disklabel -B `cat ${ISODIR}/vn.which`s1
457         boot0cfg -B -o noupdate `cat ${ISODIR}/vn.which`
458         newfs /dev/`cat ${ISODIR}/vn.which`s1a
459         mount /dev/`cat ${ISODIR}/vn.which`s1a ${IMGMNT}
460         cpdup ${ISOROOT} ${IMGMNT}
461         @echo "STEP: fixup ${IMGMNT}/etc/fstab"
462         echo "/dev/${IMGUSBDEV}s1a / ufs rw,noatime 0 0" > ${IMGMNT}/etc/fstab
463         echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab
464         @echo "STEP: fixup ${IMGMNT}/boot/loader.conf"
465         -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new
466         echo 'vfs.root.mountfrom="ufs:${IMGUSBDEV}s1a"' >> ${IMGMNT}/boot/loader.conf.new
467         mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf
468         @echo "STEP: cleanup"
469         df ${IMGMNT}
470         umount ${IMGMNT}
471         vnconfig -u `cat ${ISODIR}/vn.which`
472         rm -f ${ISODIR}/vn.which
473         rmdir ${IMGMNT}
474         @echo "STEP: done"
475 .endif
476
477 clean:
478         -umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1
479         -umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1
480         -umount ${ISOROOT}/dev > /dev/null 2>&1
481         -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT};           \
482             vnconfig -u `cat ${ISODIR}/vn.which`; fi
483         if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
484         rm -rf ${ISOROOT}
485         rm -rf ${NRLOBJDIR}/nrelease
486         rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which
487
488 realclean:      clean
489         rm -rf ${OBJSYS}/${KERNCONF}
490         #
491         # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
492         # override location.
493         #
494         rm -rf ${ISODIR}/packages
495         rm -rf ${ISODIR}/distfiles
496
497 fetch:
498         @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
499 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
500         (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
501 .endif
502
503 pkgsrc_bootstrap:
504 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
505         mkdir -p /usr/release/bootstrap
506         (cd ${PKGSRC_PATH}/bootstrap; ./bootstrap --workdir /usr/release/bootstrap)
507 .endif
508
509 pkgsrc_cdrecord:
510 .if !exists (${PKGBIN_MKISOFS})
511         (cd ${PKGSRC_PATH}/sysutils/cdrtools; bmake clean build install)
512 .endif
513
514 help all:
515         @echo "make [gui] release   - complete build from scratch"
516         @echo "make [gui] quick     - attempt to do an incremental rebuild"
517         @echo "make [gui] realquick - attempt to restart after world & kernel"
518         @echo "make [gui] restartpkgs - attempt to restart at the pkg building stage"
519         @echo ""
520         @echo "Extra packages may be specified with PKGSRC_EXTRA_PACKAGES"
521
522 .PHONY: release quickrel realquickrel
523 .PHONY: installer
524 .PHONY: quick realquick
525 .PHONY: check buildworld1 buildworld2
526 .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
527 .PHONY: clean realclean fetch help all srcs
528
529 .include <bsd.prog.mk>