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