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