Include kernel sources on the release CD.
[dragonfly.git] / nrelease / Makefile
CommitLineData
19d86faa 1# $DragonFly: src/nrelease/Makefile,v 1.55 2006/07/08 03:19:30 dillon Exp $
6ca9a59c 2#
5b22b655 3
cc224c64
JS
4# compat target
5installer_release: release
f6c08bce 6installer_quickrel: quickrel
cc224c64 7installer_realquickrel: realquickrel
bce110a5 8installer_fetch: fetch
cc224c64 9
bce110a5 10.if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel) || make(installer_fetch)
cc224c64
JS
11WITH_INSTALLER=
12.endif
13
6ca9a59c
MD
14ISODIR ?= /usr/release
15ISOFILE ?= ${ISODIR}/dfly.iso
16ISOROOT = ${ISODIR}/root
17OBJSYS= ${.OBJDIR}/../sys
18KERNCONF ?= GENERIC
19
cc224c64 20PKGSRC_PREFIX?= /usr/pkg
bce110a5 21PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
c791834f 22PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
bce110a5
MD
23PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
24PKGSRC_PKG_PATH?= ${ISODIR}/packages
25PKGSRC_DB?= /var/db/pkg
a0b76df4 26PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.4.4-RELEASE-BUILD
cc224c64 27
2157278d 28ENVCMD?= env
cc224c64 29TAR?= tar
cc224c64 30
bce110a5
MD
31PKGSRC_CDRECORD?= cdrecord-2.00.3nb2.tgz
32PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20051221
0a1628e7 33CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20051229
bce110a5
MD
34
35PKGSRC_PACKAGES?= cdrecord-2.00.3nb2.tgz
8188de86
MD
36
37# Specify which root skeletons are required, and let the user include
38# their own. They are copied into ISODIR during the `pkgcustomizeiso'
39# target; each overwrites the last.
40#
41REQ_ROOTSKELS= ${.CURDIR}/root
cc224c64
JS
42ROOTSKELS?= ${REQ_ROOTSKELS}
43
44.if defined(WITH_INSTALLER)
a0b76df4
MD
45PKGSRC_PACKAGES+= dfuibe_installer-1.1.6a.tgz dfuife_curses-1.5.tgz
46PKGSRC_PACKAGES+= gettext-lib-0.14.5.tgz libaura-3.1.tgz \
47 libdfui-4.2.tgz libinstaller-5.1.tgz
cc224c64
JS
48ROOTSKELS+= installer
49.endif
8188de86 50
5b22b655
MD
51# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
52# the additional '/nrelease' manually, as a safety measure.
53#
54NRLOBJDIR?= /usr/obj
55
acc392b5
JS
56WORLD_CCVER ?= ${CCVER}
57KERNEL_CCVER ?= ${CCVER}
58
8188de86
MD
59#########################################################################
60# BASE ISO TARGETS #
61#########################################################################
62
63release: check clean buildworld1 buildkernel1 \
19d86faa 64 buildiso syssrcs customizeiso mklocatedb mkiso
8188de86
MD
65
66quickrel: check clean buildworld2 buildkernel2 \
19d86faa 67 buildiso syssrcs customizeiso mklocatedb mkiso
2e3f8f38 68
19d86faa 69realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso
6ca9a59c 70
d2582113 71check:
bce110a5
MD
72.if !exists(${PKGBIN_PKG_ADD})
73 @echo "Unable to find ${PKGBIN_PKG_ADD}. You can use the following"
74 @echo "command to bootstrap pkgsrc:"
75 @echo " make pkgsrc_bootstrap"
76 @exit 1
77.endif
78.if !exists(/etc/mk.conf)
79 @echo "You do not have an /etc/mk.conf. You can use the following"
80 @echo "command to install one. Otherwise pkgsrc defaults will not"
81 @echo "point to the right place:"
82 @echo " make pkgsrc_conf"
83 @exit 1
84.endif
85.for PKG in ${PKGSRC_PACKAGES}
a0b76df4 86 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
bce110a5
MD
87 (echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo " make [installer_]fetch"; exit 1)
88.endfor
89.if !exists(${PKGBIN_MKISOFS})
90 @echo "mkisofs is not installed. It is part of the cdrecord package."
91 @echo "You can install it with:"
92 @echo " make pkgsrc_cdrecord"
93 @exit 1
94.endif
0a1628e7
MD
95.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
96 @echo "The pkgsrc bootstrap kit is not installed. You can install it with:"
97 @echo " make [installer_]fetch"
98 @exit 1
99.endif
100.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
101 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
102 @echo " make [installer_]fetch"
103 @exit 1
104.endif
2e3f8f38 105
6ca9a59c 106buildworld1:
c3f3fe6d 107 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
6ca9a59c
MD
108
109buildworld2:
82a1be39 110 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
6ca9a59c
MD
111
112buildkernel1:
c3f3fe6d 113 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
6ca9a59c
MD
114
115buildkernel2:
82a1be39 116 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
6ca9a59c 117
5b22b655
MD
118# note that we do not want to mess with any /usr/obj directories not related
119# to buildworld, buildkernel, or nrelease, so we must supply the proper
120# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
121# buildkernel mechanism.
122#
6ca9a59c
MD
123buildiso:
124 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 125 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 126 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
127 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
128 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
dddbd615 129 cp -p ${.CURDIR}/mk.conf.pkgsrc ${ISOROOT}/etc/mk.conf
a0b76df4 130 chroot ${ISOROOT} /usr/bin/newaliases
21aa02d0 131 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
6ca9a59c
MD
132 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
133 installkernel KERNCONF=${KERNCONF} )
c5c5e6fc 134 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
135 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
136 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
137 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86 138
19d86faa
MD
139# Include kernel sources on the release CD (~14MB)
140#
141syssrcs:
142 ( cd ${.CURDIR}/../..; tar czf ${ISOROOT}/usr/src.tgz src/Makefile src/Makefile.inc1 src/sys )
143
8188de86 144customizeiso:
bce110a5 145 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
0a1628e7 146 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
8188de86
MD
147.for ROOTSKEL in ${ROOTSKELS}
148 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
149.endfor
f6c08bce
MD
150 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
151 cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT} ${ISOROOT}/tmp/bootstrap
0a1628e7 152 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
f6c08bce 153 chroot ${ISOROOT} csh -c "cd /tmp/bootstrap/bootstrap; ./bootstrap"
d08963d3 154 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
8188de86 155 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 156 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 157 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
158.for UPGRADE_ITEM in Makefile \
159 etc.${MACHINE_ARCH} \
160 isdn/Makefile \
161 rc.d/Makefile \
162 periodic/Makefile \
163 periodic/daily/Makefile \
164 periodic/security/Makefile \
165 periodic/weekly/Makefile \
166 periodic/monthly/Makefile
167 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
168.endfor
bce110a5 169.for PKG in ${PKGSRC_PACKAGES}
2157278d 170 ${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
8188de86 171.endfor
c791834f
JS
172 find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
173 ${PKGBIN_PKG_ADMIN} -K ${ISOROOT}${PKGSRC_DB} rebuild
6ca9a59c 174
8398ca17
SW
175mklocatedb:
176 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
177 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
178 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
179 /usr/libexec/locate.mklocatedb \
180 -presort >${ISOROOT}/var/db/locate.database )
181
6ca9a59c 182mkiso:
bce110a5 183 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
382f1ee3 184 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
185
186clean:
187 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 188 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 189 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
190
191realclean: clean
3ebedc5e 192 rm -rf ${OBJSYS}/${KERNCONF}
bce110a5
MD
193 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
194 # override location.
195 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
6ca9a59c 196
cc224c64
JS
197fetch:
198 mkdir -p ${PKGSRC_PKG_PATH}
bce110a5 199.for PKG in ${PKGSRC_PACKAGES}
a0b76df4 200 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
bce110a5
MD
201 (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
202.endfor
203.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
204 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
205.endif
0a1628e7
MD
206.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
207 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
208.endif
bce110a5
MD
209
210pkgsrc_bootstrap:
211 mkdir -p ${PKGSRC_PKG_PATH}
212.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
213 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
214.endif
215 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
216 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
217
218pkgsrc_conf:
219.if !exists(/etc/mk.conf)
220 cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
221.else
222 fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
223.endif
224
225pkgsrc_cdrecord:
226.if !exists (${PKGBIN_MKISOFS})
227 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
228.endif
cc224c64
JS
229
230.PHONY: all release installer_release quickrel installer_quickrel realquickrel
bce110a5 231.PHONY: installer_fetch
cc224c64
JS
232.PHONY: installer_realquickrel check buildworld1 buildworld2
233.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
d5c58845 234.PHONY: clean realclean fetch
cc224c64 235
6ca9a59c 236.include <bsd.prog.mk>