Update for 2.2.5.
[dragonfly.git] / nrelease / Makefile
CommitLineData
4b08f3df 1# $DragonFly: src/nrelease/Makefile,v 1.66 2007/07/16 21:16:49 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
9f97f66c 18KERNCONF ?= GENERIC
6ca9a59c 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
6a2756b0 26PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.9.0-DEVELOPMENT
cc224c64 27
2157278d 28ENVCMD?= env
cc224c64 29TAR?= tar
cc224c64 30
bce110a5 31PKGSRC_CDRECORD?= cdrecord-2.00.3nb2.tgz
87ed3d6d 32PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20070205
4b08f3df 33CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716
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
2b990685 48ROOTSKELS+= ${.CURDIR}/installer
cc224c64 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
588a679c
SS
106buildworld1 buildworld2:
107 cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//}
6ca9a59c 108
588a679c
SS
109buildkernel1 buildkernel2:
110 cd ${.CURDIR}/..; \
111 first=; \
112 for kernconf in ${KERNCONF}; do \
113 CCVER=${KERNEL_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
114 KERNCONF=$${kernconf} \
115 $${first:+-DNO_MODULES}; \
116 first=done; \
117 done
6ca9a59c 118
5b22b655
MD
119# note that we do not want to mess with any /usr/obj directories not related
120# to buildworld, buildkernel, or nrelease, so we must supply the proper
121# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
122# buildkernel mechanism.
123#
6ca9a59c
MD
124buildiso:
125 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 126 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 127 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
128 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
129 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
dddbd615 130 cp -p ${.CURDIR}/mk.conf.pkgsrc ${ISOROOT}/etc/mk.conf
a0b76df4 131 chroot ${ISOROOT} /usr/bin/newaliases
21aa02d0 132 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
588a679c
SS
133 cd ${.CURDIR}/..; \
134 first=; \
135 for kernconf in ${KERNCONF}; do \
136 make DESTDIR=${ISOROOT} \
137 installkernel KERNCONF=$${kernconf} \
138 $${first:+DESTKERNNAME=kernel.$${kernconf}} \
139 $${first:+-DNO_MODULES}; \
140 first=done; \
141 done
c5c5e6fc 142 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
143 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
144 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
145 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86 146
19d86faa
MD
147# Include kernel sources on the release CD (~14MB)
148#
149syssrcs:
66b79064
MD
150.if !defined(WITHOUT_SRCS)
151 ( cd ${.CURDIR}/../..; tar --exclude CVS -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
152.endif
19d86faa 153
8188de86 154customizeiso:
bce110a5 155 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
0a1628e7 156 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
8188de86
MD
157.for ROOTSKEL in ${ROOTSKELS}
158 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
159.endfor
f6c08bce
MD
160 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
161 cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT} ${ISOROOT}/tmp/bootstrap
0a1628e7 162 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
c751e497 163 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
87ed3d6d 164 mkdir -p ${ISOROOT}/tmp/bootstrap/distfiles # new bootstrap insists in that
f6c08bce 165 chroot ${ISOROOT} csh -c "cd /tmp/bootstrap/bootstrap; ./bootstrap"
d08963d3 166 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
8188de86 167 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 168 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 169 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
170.for UPGRADE_ITEM in Makefile \
171 etc.${MACHINE_ARCH} \
172 isdn/Makefile \
173 rc.d/Makefile \
174 periodic/Makefile \
175 periodic/daily/Makefile \
176 periodic/security/Makefile \
177 periodic/weekly/Makefile \
178 periodic/monthly/Makefile
179 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
180.endfor
bce110a5 181.for PKG in ${PKGSRC_PACKAGES}
2157278d 182 ${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
8188de86 183.endfor
c791834f
JS
184 find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
185 ${PKGBIN_PKG_ADMIN} -K ${ISOROOT}${PKGSRC_DB} rebuild
6ca9a59c 186
8398ca17
SW
187mklocatedb:
188 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
189 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
190 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
191 /usr/libexec/locate.mklocatedb \
192 -presort >${ISOROOT}/var/db/locate.database )
193
6ca9a59c 194mkiso:
bce110a5 195 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
382f1ee3 196 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
197
198clean:
199 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 200 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 201 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
202
203realclean: clean
3ebedc5e 204 rm -rf ${OBJSYS}/${KERNCONF}
bce110a5
MD
205 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
206 # override location.
207 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
6ca9a59c 208
cc224c64
JS
209fetch:
210 mkdir -p ${PKGSRC_PKG_PATH}
bce110a5 211.for PKG in ${PKGSRC_PACKAGES}
a0b76df4 212 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
bce110a5
MD
213 (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
214.endfor
215.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
216 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
217.endif
0a1628e7
MD
218.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
219 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
220.endif
bce110a5
MD
221
222pkgsrc_bootstrap:
223 mkdir -p ${PKGSRC_PKG_PATH}
224.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
225 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
226.endif
227 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
228 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
229
230pkgsrc_conf:
231.if !exists(/etc/mk.conf)
232 cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
233.else
234 fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
235.endif
236
237pkgsrc_cdrecord:
238.if !exists (${PKGBIN_MKISOFS})
239 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
240.endif
cc224c64 241
588a679c 242
cc224c64 243.PHONY: all release installer_release quickrel installer_quickrel realquickrel
bce110a5 244.PHONY: installer_fetch
cc224c64
JS
245.PHONY: installer_realquickrel check buildworld1 buildworld2
246.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
d5c58845 247.PHONY: clean realclean fetch
cc224c64 248
6ca9a59c 249.include <bsd.prog.mk>