Make XPT_SCSI_IO path quiet again.
[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
8# These targets are now obsolete and should not be used
9#
10installer_release: warning release
11installer_quickrel: warning quickrel
12installer_realquickrel: warning realquickrel
13installer_fetch: warning fetch
cc224c64 14
f4ec1279 15# New method e.g. 'make gui release'. A series of enhancement
9b29c40a
MD
16# targes may be specified which set make variables which enhance
17# the build in various ways.
18#
b9c3e754 19gui installer img:
9b29c40a
MD
20
21warning:
22 @echo "WARNING: The installer_* targets are now obsolete, please"
f4ec1279 23 @echo "use 'make blah' instead of 'make installer_blah'"
9b29c40a
MD
24 @echo ""
25 @echo "will continue in 10 seconds"
26 @sleep 10
27
9b29c40a
MD
28#########################################################################
29# SETUP #
30#########################################################################
31
6ca9a59c 32ISODIR ?= /usr/release
5ec00f8a 33ISOROOT ?= ${ISODIR}/root
6ca9a59c 34OBJSYS= ${.OBJDIR}/../sys
bfe20b28
SW
35
36.if make(gui)
37KERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
38.else
1d3eb8c5 39KERNCONF ?= GENERIC VKERNEL
bfe20b28 40.endif
6ca9a59c 41
cc224c64 42PKGSRC_PREFIX?= /usr/pkg
bce110a5 43PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
95b64753 44PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
c791834f 45PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
bce110a5
MD
46PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
47PKGSRC_PKG_PATH?= ${ISODIR}/packages
48PKGSRC_DB?= /var/db/pkg
4b08f3df 49CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716
bce110a5 50
fbc26094 51# pkgsrc packages to be built and installed on the release ISO
95b64753 52#
fbc26094
SW
53PKGSRC_PACKAGES?= devel/scmgit \
54 net/isc-dhcp4 \
55 net/isc-dhcpd4 \
56 pkgtools/pkg_leaves \
57 sysutils/cdrtools
58
59# pkgsrc options to use when building packages
60#
61.if !make(gui)
62PKGSRC_OPTIONS?= PKG_OPTIONS.scmgit=-scmgit-gui
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
MD
87# Specify which root skeletons are required, and let the user include
88# their own. They are copied into ISODIR during the `pkgcustomizeiso'
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
fbc26094
SW
98PKGSRC_PACKAGES+= meta/modular-xorg-apps \
99 meta/modular-xorg-drivers \
100 meta/modular-xorg-fonts \
101 meta/modular-xorg-libs \
102 wm/fluxbox \
103 www/firefox3 \
104 print/xpdf \
105 shells/zsh \
106 editors/emacs \
107 editors/vim \
108 chat/pidgin \
109 chat/irssi \
110 chat/xchat \
111 x11/rxvt-unicode \
112 x11/eterm \
113 lang/perl5 \
114 editors/nano \
115 shells/bash \
116 devel/exctags \
117 archivers/zip \
118 security/sudo \
119 www/links-gui \
120 net/nmap \
121 net/wget \
122 fonts/terminus-font \
123 net/rsync \
124 sysutils/idesk \
125 misc/screen
3f279b9e
SW
126ROOTSKELS+= ${.CURDIR}/gui
127.endif
128
3f279b9e 129ISOFILE ?= ${ISODIR}/dfly.iso
b9c3e754
MN
130IMGFILE ?= ${ISODIR}/dfly.img
131
60b68cbb 132IMGMNT ?= ${ISODIR}/mnt
b9c3e754 133IMGUSBDEV ?= /dev/da0
3f279b9e 134
5b22b655
MD
135# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
136# the additional '/nrelease' manually, as a safety measure.
137#
138NRLOBJDIR?= /usr/obj
139
8188de86
MD
140#########################################################################
141# BASE ISO TARGETS #
142#########################################################################
143
7ebbae99 144release: check clean buildworld1 buildkernel1 \
b9c3e754 145 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
8188de86 146
7ebbae99 147quickrel: check clean buildworld2 buildkernel2 \
b9c3e754 148 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
2e3f8f38 149
b9c3e754
MN
150realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso \
151 mkimg
6ca9a59c 152
9b29c40a
MD
153quick: quickrel
154
155realquick: realquickrel
156
157#########################################################################
158# CORE SUPPORT TARGETS #
159#########################################################################
160
d2582113 161check:
0a1628e7
MD
162.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
163 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
f4ec1279 164 @echo " make fetch"
0a1628e7
MD
165 @exit 1
166.endif
fbc26094
SW
167.if !defined(PKGSRC_PATH)
168 @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
169 @echo "package building."
170 @exit 1
171.endif
2e3f8f38 172
588a679c 173buildworld1 buildworld2:
f4ec1279 174 cd ${.CURDIR}/..; ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} make -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
6ca9a59c 175
588a679c 176buildkernel1 buildkernel2:
bfe20b28
SW
177.if make(gui)
178 cd ${.CURDIR}/..; \
179 for kernconf in ${KERNCONF}; do \
448b21e7 180 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
82f56cac 181 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
bfe20b28
SW
182 KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \
183 done
184.else
588a679c
SS
185 cd ${.CURDIR}/..; \
186 first=; \
187 for kernconf in ${KERNCONF}; do \
448b21e7 188 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
82f56cac 189 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
588a679c
SS
190 KERNCONF=$${kernconf} \
191 $${first:+-DNO_MODULES}; \
192 first=done; \
193 done
bfe20b28 194.endif
6ca9a59c 195
5b22b655
MD
196# note that we do not want to mess with any /usr/obj directories not related
197# to buildworld, buildkernel, or nrelease, so we must supply the proper
198# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
199# buildkernel mechanism.
200#
6ca9a59c
MD
201buildiso:
202 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 203 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
f4ec1279 204 ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
205 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
206 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
21aa02d0 207 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
bfe20b28 208.if make(gui)
fbc26094 209 if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi
bfe20b28
SW
210 cd ${.CURDIR}/..; \
211 make installkernel DESTDIR=${ISOROOT} \
212 KERNCONF=DFLYLIVE DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
213 cd ${.CURDIR}/..; \
214 make installkernel DESTDIR=${ISOROOT} \
215 KERNCONF=VKERNEL DESTKERNNAME=kernel.VKERNEL -DNO_MODULES KERNCONFDIR=${.CURDIR}/gui/root; \
216 cd ${.CURDIR}/..; \
217 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
218 KERNCONF=DFLYLIVE-SMP DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
219 cd ${.CURDIR}/..; \
220 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
221 KERNCONF=DFLYLIVE-SMP-NOAPIC DESTKERNNAME=kernel.noapic \
222 KERNCONFDIR=${.CURDIR}/gui/root -DNO_MODULES;
223.else
588a679c
SS
224 cd ${.CURDIR}/..; \
225 first=; \
226 for kernconf in ${KERNCONF}; do \
227 make DESTDIR=${ISOROOT} \
228 installkernel KERNCONF=$${kernconf} \
229 $${first:+DESTKERNNAME=kernel.$${kernconf}} \
230 $${first:+-DNO_MODULES}; \
231 first=done; \
232 done
bfe20b28 233.endif
c5c5e6fc 234 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
235 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
236 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
237 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86 238
19d86faa
MD
239# Include kernel sources on the release CD (~14MB)
240#
241syssrcs:
66b79064 242.if !defined(WITHOUT_SRCS)
ccbff5d3 243 ( cd ${.CURDIR}/../..; tar -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
66b79064 244.endif
19d86faa 245
8188de86
MD
246customizeiso:
247.for ROOTSKEL in ${ROOTSKELS}
248 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
249.endfor
fbc26094 250 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
0a1628e7 251 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
c751e497 252 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
7249926b 253 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
254.for UPGRADE_ITEM in Makefile \
255 etc.${MACHINE_ARCH} \
256 isdn/Makefile \
257 rc.d/Makefile \
258 periodic/Makefile \
259 periodic/daily/Makefile \
260 periodic/security/Makefile \
261 periodic/weekly/Makefile \
262 periodic/monthly/Makefile
263 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
20585f87 264.endfor
589a5738 265 # setup some things & mount pkgsrc tree
fbc26094
SW
266 cp -p /etc/resolv.conf ${ISOROOT}/etc
267 chroot ${ISOROOT} sh -c "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
589a5738 268 mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap/work
fbc26094
SW
269 mkdir ${ISOROOT}/usr/pkgsrc
270 mount_null ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
271 # bootstrap
589a5738 272 chroot ${ISOROOT} sh -c "cd /usr/pkgsrc/bootstrap; ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
fbc26094 273 # build and install packages
bce110a5 274.for PKG in ${PKGSRC_PACKAGES}
589a5738 275 chroot ${ISOROOT} sh -c "cd /usr/pkgsrc; cd ${PKG}; bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} build install"
8188de86 276.endfor
fbc26094
SW
277 # remove packages which nothing depends on
278 chroot ${ISOROOT} sh -c "pkg_leaves | xargs pkg_delete -R"
279 umount ${ISOROOT}/usr/pkgsrc
280 rmdir ${ISOROOT}/usr/pkgsrc
589a5738 281 rm -rf ${ISOROOT}/usr/pkgobj
fbc26094 282 rm -f ${ISOROOT}/etc/resolv.conf
3652f053
SW
283 makewhatis ${ISOROOT}/usr/local/man
284 makewhatis ${ISOROOT}/usr/pkg/man
6ca9a59c 285
8398ca17
SW
286mklocatedb:
287 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
288 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
289 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
290 /usr/libexec/locate.mklocatedb \
291 -presort >${ISOROOT}/var/db/locate.database )
292
6ca9a59c 293mkiso:
bce110a5 294 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
305c4b68 295 -R -J -V DragonFly-`${.CURDIR}/../tools/gitrev.sh` -o ${ISOFILE} . )
6ca9a59c 296
b9c3e754
MN
297
298mkimg:
fbc26094 299.if make(img)
60b68cbb
MN
300 if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
301
302 echo "determine required image size" > /dev/null; \
303 sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \
e6b76e22
MN
304 echo "add 15% more space as required" > /dev/null; \
305 sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
60b68cbb
MN
306 dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz}; \
307 fdisk -IB -p ${IMGFILE}; \
308 echo "determine free vn device" > /dev/null; \
309 vn=`vnconfig -l | grep "not in use" | head -n 1 | cut -f 1 -d:`; \
310 vnconfig -e -s labels $${vn} ${IMGFILE}; \
311 echo "write standard disklabel" > /dev/null; \
312 disklabel -w -r $${vn}s1 auto; \
313 echo "read disklabel back" > /dev/null; \
314 disklabel -r $${vn}s1 > ${IMGFILE}.label; \
315 echo "determine number of sectors of whole disk" > /dev/null; \
316 secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \
317 echo "and add a: partition" > /dev/null; \
318 echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label; \
319 echo "write modified disklabel back" > /dev/null; \
320 disklabel -R -r $${vn}s1 ${IMGFILE}.label; \
321 rm ${IMGFILE}.label; \
322 echo "write bootsector" > /dev/null; \
323 disklabel -B $${vn}s1; \
324 newfs /dev/$${vn}s1a; \
325 mount /dev/$${vn}s1a ${IMGMNT}; \
326 cpdup -vvv ${ISOROOT} ${IMGMNT}; \
327 echo "fix /etc/fstab" > /dev/null; \
b72c2692
MN
328 echo "${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc/fstab; \
329 echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab; \
bccaed73 330 df ${IMGMNT}; \
60b68cbb
MN
331 umount ${IMGMNT}; \
332 vnconfig -u $${vn}; \
333 rmdir ${IMGMNT}
b9c3e754
MN
334.endif
335
6ca9a59c 336clean:
fbc26094 337 -umount ${ISOROOT}/usr/pkgsrc
6ca9a59c 338 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 339 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 340 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
341
342realclean: clean
3ebedc5e 343 rm -rf ${OBJSYS}/${KERNCONF}
bce110a5
MD
344 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
345 # override location.
346 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
6ca9a59c 347
cc224c64 348fetch:
9b29c40a 349 @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
0a1628e7
MD
350.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
351 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
352.endif
bce110a5
MD
353
354pkgsrc_bootstrap:
355 mkdir -p ${PKGSRC_PKG_PATH}
356.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
357 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
358.endif
359 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
360 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
361
bce110a5
MD
362pkgsrc_cdrecord:
363.if !exists (${PKGBIN_MKISOFS})
20585f87 364 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrtools*
bce110a5 365.endif
cc224c64 366
588a679c 367
cc224c64 368.PHONY: all release installer_release quickrel installer_quickrel realquickrel
9b29c40a
MD
369.PHONY: installer_fetch installer
370.PHONY: quick realquick
cc224c64 371.PHONY: installer_realquickrel check buildworld1 buildworld2
b9c3e754 372.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
d5c58845 373.PHONY: clean realclean fetch
cc224c64 374
6ca9a59c 375.include <bsd.prog.mk>