Use M_ZERO instead of bzero().
[dragonfly.git] / nrelease / Makefile
CommitLineData
dc861544 1# $DragonFly: src/nrelease/Makefile,v 1.79 2008/03/25 22:55:38 dave 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
bce110a5 15.if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel) || make(installer_fetch)
cc224c64 16WITH_INSTALLER=
dc861544 17WITH_LOCAL_INSTALLER=
cc224c64
JS
18.endif
19
9b29c40a
MD
20# New method e.g. 'make installer fetch'. A series of enhancement
21# targes may be specified which set make variables which enhance
22# the build in various ways.
23#
3f279b9e 24gui installer:
9b29c40a
MD
25
26warning:
27 @echo "WARNING: The installer_* targets are now obsolete, please"
28 @echo "use 'make installer blah' instead of 'make installer_blah'"
29 @echo ""
30 @echo "will continue in 10 seconds"
31 @sleep 10
32
3f279b9e
SW
33.if make(gui)
34WITH_GUI=
35.endif
9b29c40a
MD
36.if make(installer)
37WITH_INSTALLER=
dc861544 38WITH_LOCAL_INSTALLER=
9b29c40a
MD
39.endif
40
41#########################################################################
42# SETUP #
43#########################################################################
44
6ca9a59c 45ISODIR ?= /usr/release
6ca9a59c
MD
46ISOROOT = ${ISODIR}/root
47OBJSYS= ${.OBJDIR}/../sys
1d3eb8c5 48KERNCONF ?= GENERIC VKERNEL
6ca9a59c 49
cc224c64 50PKGSRC_PREFIX?= /usr/pkg
bce110a5 51PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
95b64753 52PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
c791834f 53PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
bce110a5
MD
54PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
55PKGSRC_PKG_PATH?= ${ISODIR}/packages
56PKGSRC_DB?= /var/db/pkg
356095db 57PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD
cc224c64 58
2157278d 59ENVCMD?= env
cc224c64 60TAR?= tar
cc224c64 61
356095db
MD
62PKGSRC_CDRECORD?= cdrtools-ossdvd-2.01.1.36nb2.tgz
63PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20080211
4b08f3df 64CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716
bce110a5 65
95b64753
MD
66# Default packages to be installed on the release ISO.
67#
356095db 68PKGSRC_PACKAGES?= cdrtools-ossdvd-2.01.1.36nb2.tgz
8188de86 69
95b64753
MD
70# Even though buildiso wipes the packages, our check target has to run
71# first and old packages (listed as they appear in pkg_info) must be
72# cleaned out in order for the pkg_add -n test we use in the check target
73# to operate properly.
74#
356095db
MD
75OLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 cdrecord-2.00.3nb2 \
76 bootstrap-kit-20070205
95b64753 77
8188de86
MD
78# Specify which root skeletons are required, and let the user include
79# their own. They are copied into ISODIR during the `pkgcustomizeiso'
80# target; each overwrites the last.
81#
82REQ_ROOTSKELS= ${.CURDIR}/root
cc224c64
JS
83ROOTSKELS?= ${REQ_ROOTSKELS}
84
3f279b9e
SW
85.if defined(WITH_GUI)
86ISOFILE?= ${ISODIR}/dfly-gui.iso
87PKGSRC_PACKAGES+= modular-xorg-apps \
88 modular-xorg-drivers \
89 modular-xorg-fonts \
90 modular-xorg-libs \
91 fluxbox
92ROOTSKELS+= ${.CURDIR}/gui
93.endif
94
dc861544
DH
95.if defined(WITH_INSTALLER) || defined(WITH_LOCAL_INSTALLER)
96.if !defined(WITH_LOCAL_INSTALLER)
356095db
MD
97# note: the old dfuibe_install and curses depend on the old gettext and
98# must be removed for the old gettext to be removed. The new dfuibe install
99# and curses are named the same as the old.
100#
101OLD_PKGSRC_PACKAGES+= dfuibe_installer-1.1.6 gettext-lib-0.14.5 \
dc861544 102# dfuibe_installer-1.1.7nb1 dfuife_curses-1.5
95b64753 103PKGSRC_PACKAGES+= dfuibe_installer-1.1.7nb1.tgz dfuife_curses-1.5.tgz
356095db
MD
104PKGSRC_PACKAGES+= gettext-lib-0.14.6.tgz gettext-tools-0.14.6nb1.tgz
105PKGSRC_PACKAGES+= libaura-3.1.tgz libdfui-4.2.tgz libinstaller-5.1.tgz
dc861544 106.endif
2b990685 107ROOTSKELS+= ${.CURDIR}/installer
cc224c64 108.endif
8188de86 109
3f279b9e
SW
110ISOFILE ?= ${ISODIR}/dfly.iso
111
5b22b655
MD
112# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
113# the additional '/nrelease' manually, as a safety measure.
114#
115NRLOBJDIR?= /usr/obj
116
acc392b5
JS
117WORLD_CCVER ?= ${CCVER}
118KERNEL_CCVER ?= ${CCVER}
119
8188de86
MD
120#########################################################################
121# BASE ISO TARGETS #
122#########################################################################
123
dc861544 124release: localinstaller check clean buildworld1 buildkernel1 \
19d86faa 125 buildiso syssrcs customizeiso mklocatedb mkiso
8188de86 126
dc861544 127quickrel: localinstaller check clean buildworld2 buildkernel2 \
19d86faa 128 buildiso syssrcs customizeiso mklocatedb mkiso
2e3f8f38 129
dc861544 130realquickrel: localinstaller check clean buildiso syssrcs customizeiso mklocatedb mkiso
6ca9a59c 131
9b29c40a
MD
132quick: quickrel
133
134realquick: realquickrel
135
136#########################################################################
137# CORE SUPPORT TARGETS #
138#########################################################################
dc861544
DH
139localinstaller:
140.if defined(WITH_LOCAL_INSTALLER)
141 cd ${.CURDIR}/../usr.sbin/installer; make
142.endif
9b29c40a 143
d2582113 144check:
bce110a5
MD
145.if !exists(${PKGBIN_PKG_ADD})
146 @echo "Unable to find ${PKGBIN_PKG_ADD}. You can use the following"
147 @echo "command to bootstrap pkgsrc:"
148 @echo " make pkgsrc_bootstrap"
149 @exit 1
150.endif
95b64753
MD
151.for PKG in ${OLD_PKGSRC_PACKAGES}
152 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_DELETE} -K ${ISOROOT}/var/db/pkg ${PKG} > /dev/null 2>&1 || exit 0
153.endfor
bce110a5 154.for PKG in ${PKGSRC_PACKAGES}
a0b76df4 155 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
cbbd7681 156 (echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo " make [installer] fetch"; exit 1)
bce110a5
MD
157.endfor
158.if !exists(${PKGBIN_MKISOFS})
159 @echo "mkisofs is not installed. It is part of the cdrecord package."
160 @echo "You can install it with:"
161 @echo " make pkgsrc_cdrecord"
162 @exit 1
163.endif
0a1628e7
MD
164.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
165 @echo "The pkgsrc bootstrap kit is not installed. You can install it with:"
cbbd7681 166 @echo " make [installer] fetch"
0a1628e7
MD
167 @exit 1
168.endif
169.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
170 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
cbbd7681 171 @echo " make [installer] fetch"
0a1628e7
MD
172 @exit 1
173.endif
2e3f8f38 174
588a679c
SS
175buildworld1 buildworld2:
176 cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//}
6ca9a59c 177
588a679c
SS
178buildkernel1 buildkernel2:
179 cd ${.CURDIR}/..; \
180 first=; \
181 for kernconf in ${KERNCONF}; do \
182 CCVER=${KERNEL_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
183 KERNCONF=$${kernconf} \
184 $${first:+-DNO_MODULES}; \
185 first=done; \
186 done
6ca9a59c 187
5b22b655
MD
188# note that we do not want to mess with any /usr/obj directories not related
189# to buildworld, buildkernel, or nrelease, so we must supply the proper
190# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
191# buildkernel mechanism.
192#
6ca9a59c
MD
193buildiso:
194 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 195 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 196 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
dc861544
DH
197.if defined(WITH_LOCAL_INSTALLER)
198 ( cd ${.CURDIR}/../usr.sbin/installer; make DESTDIR=${ISOROOT} install )
199 ( cd ${.CURDIR}/../share/installer; make DESTDIR=${ISOROOT} install )
200.endif
ab64cf06
SS
201 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
202 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
a0b76df4 203 chroot ${ISOROOT} /usr/bin/newaliases
21aa02d0 204 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
588a679c
SS
205 cd ${.CURDIR}/..; \
206 first=; \
207 for kernconf in ${KERNCONF}; do \
208 make DESTDIR=${ISOROOT} \
209 installkernel KERNCONF=$${kernconf} \
210 $${first:+DESTKERNNAME=kernel.$${kernconf}} \
211 $${first:+-DNO_MODULES}; \
212 first=done; \
213 done
c5c5e6fc 214 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
215 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
216 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
217 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86 218
19d86faa
MD
219# Include kernel sources on the release CD (~14MB)
220#
221syssrcs:
66b79064
MD
222.if !defined(WITHOUT_SRCS)
223 ( cd ${.CURDIR}/../..; tar --exclude CVS -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
224.endif
19d86faa 225
8188de86 226customizeiso:
0a1628e7 227 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
8188de86
MD
228.for ROOTSKEL in ${ROOTSKELS}
229 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
230.endfor
f6c08bce 231 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
20585f87 232 cd ${ISOROOT}; tar xvzpf ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz
0a1628e7 233 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
c751e497 234 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
d08963d3 235 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
8188de86 236 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 237 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 238 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
239.for UPGRADE_ITEM in Makefile \
240 etc.${MACHINE_ARCH} \
241 isdn/Makefile \
242 rc.d/Makefile \
243 periodic/Makefile \
244 periodic/daily/Makefile \
245 periodic/security/Makefile \
246 periodic/weekly/Makefile \
247 periodic/monthly/Makefile
248 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
20585f87 249.endfor
fb92f9a7
SW
250 # There seems to be no reliable way to install a package to a target
251 # directory prefix so we mount_null our package directory into the
252 # ISO root and do the install chrooted.
20585f87 253 #
20585f87 254 mkdir ${ISOROOT}/tmp/packages
fb92f9a7 255 mount_null -o ro ${PKGSRC_PKG_PATH} ${ISOROOT}/tmp/packages
bce110a5 256.for PKG in ${PKGSRC_PACKAGES}
90741959 257 ${ENVCMD} PKG_PATH=/tmp/packages chroot ${ISOROOT} ${PKGBIN_PKG_ADD} -I ${PKG}
8188de86 258.endfor
fb92f9a7
SW
259 umount ${ISOROOT}/tmp/packages
260 rmdir ${ISOROOT}/tmp/packages
c791834f 261 find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
20585f87 262 chroot ${ISOROOT} ${PKGBIN_PKG_ADMIN} rebuild
3f279b9e
SW
263.if defined(WITH_GUI)
264.for FONT in 75dpi 100dpi misc Type1 TTF
265 chroot ${ISOROOT} /usr/pkg/bin/mkfontdir /usr/pkg/lib/X11/fonts/${FONT}
266.endfor
267.endif
6ca9a59c 268
8398ca17
SW
269mklocatedb:
270 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
271 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
272 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
273 /usr/libexec/locate.mklocatedb \
274 -presort >${ISOROOT}/var/db/locate.database )
275
6ca9a59c 276mkiso:
bce110a5 277 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
382f1ee3 278 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
279
280clean:
a77a7712 281 -umount ${ISOROOT}/tmp/packages
6ca9a59c 282 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 283 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 284 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
285
286realclean: clean
3ebedc5e 287 rm -rf ${OBJSYS}/${KERNCONF}
bce110a5
MD
288 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
289 # override location.
290 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
6ca9a59c 291
cc224c64 292fetch:
9b29c40a 293 @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
bce110a5 294.for PKG in ${PKGSRC_PACKAGES}
a0b76df4 295 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
bce110a5
MD
296 (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
297.endfor
298.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
299 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
300.endif
0a1628e7
MD
301.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
302 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
303.endif
bce110a5
MD
304
305pkgsrc_bootstrap:
306 mkdir -p ${PKGSRC_PKG_PATH}
307.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
308 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
309.endif
310 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
311 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
312
bce110a5
MD
313pkgsrc_cdrecord:
314.if !exists (${PKGBIN_MKISOFS})
20585f87 315 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrtools*
bce110a5 316.endif
cc224c64 317
588a679c 318
cc224c64 319.PHONY: all release installer_release quickrel installer_quickrel realquickrel
9b29c40a
MD
320.PHONY: installer_fetch installer
321.PHONY: quick realquick
cc224c64
JS
322.PHONY: installer_realquickrel check buildworld1 buildworld2
323.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
d5c58845 324.PHONY: clean realclean fetch
cc224c64 325
6ca9a59c 326.include <bsd.prog.mk>