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