silence warnings
[dfdiff.git] / nrelease / Makefile
blobbf844f3895378d35f552dfc7cbc31a7649afdcee
1 # $DragonFly: src/nrelease/Makefile,v 1.80 2008/04/01 20:55:06 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 WITH_LOCAL_INSTALLER=
18 .endif
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.
24 gui installer:
26 warning:
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
33 .if make(gui)
34 WITH_GUI=
35 .endif
36 .if make(installer)
37 WITH_INSTALLER=
38 WITH_LOCAL_INSTALLER=
39 .endif
41 #########################################################################
42 # SETUP #
43 #########################################################################
45 ISODIR ?= /usr/release
46 ISOROOT ?= ${ISODIR}/root
47 OBJSYS= ${.OBJDIR}/../sys
48 KERNCONF ?= GENERIC VKERNEL
50 PKGSRC_PREFIX?= /usr/pkg
51 PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
52 PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
53 PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
54 PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
55 PKGSRC_PKG_PATH?= ${ISODIR}/packages
56 PKGSRC_DB?= /var/db/pkg
57 PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD
59 ENVCMD?= env
60 TAR?= tar
62 PKGSRC_CDRECORD?= cdrtools-ossdvd-2.01.1.36nb2.tgz
63 PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20080211
64 CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716
66 # Default packages to be installed on the release ISO.
68 PKGSRC_PACKAGES?= cdrtools-ossdvd-2.01.1.36nb2.tgz
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.
75 OLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 cdrecord-2.00.3nb2 \
76 bootstrap-kit-20070205
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.
82 REQ_ROOTSKELS= ${.CURDIR}/root
83 ROOTSKELS?= ${REQ_ROOTSKELS}
85 .if defined(WITH_GUI)
86 ISOFILE?= ${ISODIR}/dfly-gui.iso
87 PKGSRC_PACKAGES+= modular-xorg-apps \
88 modular-xorg-drivers \
89 modular-xorg-fonts \
90 modular-xorg-libs \
91 fluxbox
92 ROOTSKELS+= ${.CURDIR}/gui
93 .endif
95 .if defined(WITH_INSTALLER) || defined(WITH_LOCAL_INSTALLER)
96 .if !defined(WITH_LOCAL_INSTALLER)
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.
101 OLD_PKGSRC_PACKAGES+= dfuibe_installer-1.1.6 gettext-lib-0.14.5 \
102 # dfuibe_installer-1.1.7nb1 dfuife_curses-1.5
103 PKGSRC_PACKAGES+= dfuibe_installer-1.1.7nb1.tgz dfuife_curses-1.5.tgz
104 PKGSRC_PACKAGES+= gettext-lib-0.14.6.tgz gettext-tools-0.14.6nb1.tgz
105 PKGSRC_PACKAGES+= libaura-3.1.tgz libdfui-4.2.tgz libinstaller-5.1.tgz
106 .endif
107 ROOTSKELS+= ${.CURDIR}/installer
108 .endif
110 ISOFILE ?= ${ISODIR}/dfly.iso
112 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
113 # the additional '/nrelease' manually, as a safety measure.
115 NRLOBJDIR?= /usr/obj
117 WORLD_CCVER ?= ${CCVER}
118 KERNEL_CCVER ?= ${CCVER}
120 #########################################################################
121 # BASE ISO TARGETS #
122 #########################################################################
124 release: localinstaller check clean buildworld1 buildkernel1 \
125 buildiso syssrcs customizeiso mklocatedb mkiso
127 quickrel: localinstaller check clean buildworld2 buildkernel2 \
128 buildiso syssrcs customizeiso mklocatedb mkiso
130 realquickrel: localinstaller check clean buildiso syssrcs customizeiso mklocatedb mkiso
132 quick: quickrel
134 realquick: realquickrel
136 #########################################################################
137 # CORE SUPPORT TARGETS #
138 #########################################################################
139 localinstaller:
140 .if defined(WITH_LOCAL_INSTALLER)
141 cd ${.CURDIR}/../usr.sbin/installer; make
142 .endif
144 check:
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
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
154 .for PKG in ${PKGSRC_PACKAGES}
155 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
156 (echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo " make [installer] fetch"; exit 1)
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
164 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
165 @echo "The pkgsrc bootstrap kit is not installed. You can install it with:"
166 @echo " make [installer] fetch"
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:"
171 @echo " make [installer] fetch"
172 @exit 1
173 .endif
175 buildworld1 buildworld2:
176 cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//}
178 buildkernel1 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
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.
193 buildiso:
194 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
195 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
196 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
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
201 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
202 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
203 chroot ${ISOROOT} /usr/bin/newaliases
204 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
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
214 ln -s kernel ${ISOROOT}/kernel.BOOTP
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
219 # Include kernel sources on the release CD (~14MB)
221 syssrcs:
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
226 customizeiso:
227 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
228 .for ROOTSKEL in ${ROOTSKELS}
229 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
230 .endfor
231 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
232 cd ${ISOROOT}; tar xvzpf ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz
233 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
234 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
235 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
236 rm -rf `find ${ISOROOT} -type d -name CVS -print`
237 rm -rf ${ISOROOT}/usr/local/share/pristine
238 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
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}
249 .endfor
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.
254 mkdir ${ISOROOT}/tmp/packages
255 mount_null -o ro ${PKGSRC_PKG_PATH} ${ISOROOT}/tmp/packages
256 .for PKG in ${PKGSRC_PACKAGES}
257 ${ENVCMD} PKG_PATH=/tmp/packages chroot ${ISOROOT} ${PKGBIN_PKG_ADD} -I ${PKG}
258 .endfor
259 umount ${ISOROOT}/tmp/packages
260 rmdir ${ISOROOT}/tmp/packages
261 find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
262 chroot ${ISOROOT} ${PKGBIN_PKG_ADMIN} rebuild
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
269 mklocatedb:
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 )
276 mkiso:
277 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
278 -R -J -V DragonFly -o ${ISOFILE} . )
280 clean:
281 -umount ${ISOROOT}/tmp/packages
282 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
283 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
284 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
286 realclean: clean
287 rm -rf ${OBJSYS}/${KERNCONF}
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
292 fetch:
293 @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
294 .for PKG in ${PKGSRC_PACKAGES}
295 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
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
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
305 pkgsrc_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)
313 pkgsrc_cdrecord:
314 .if !exists (${PKGBIN_MKISOFS})
315 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrtools*
316 .endif
319 .PHONY: all release installer_release quickrel installer_quickrel realquickrel
320 .PHONY: installer_fetch installer
321 .PHONY: quick realquick
322 .PHONY: installer_realquickrel check buildworld1 buildworld2
323 .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
324 .PHONY: clean realclean fetch
326 .include <bsd.prog.mk>