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