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