pci intr config: 'j' is the pin index we want to skip.
[dragonfly.git] / nrelease / Makefile
... / ...
CommitLineData
1# $DragonFly: src/nrelease/Makefile,v 1.90 2008/09/01 21:20:30 swildner Exp $
2#
3
4#########################################################################
5# ENHANCEMENTS #
6#########################################################################
7
8# These targets are now obsolete and should not be used
9#
10installer_release: warning release
11installer_quickrel: warning quickrel
12installer_realquickrel: warning realquickrel
13installer_fetch: warning fetch
14
15# New method e.g. 'make gui release'. A series of enhancement
16# targes may be specified which set make variables which enhance
17# the build in various ways.
18#
19gui installer img:
20
21warning:
22 @echo "WARNING: The installer_* targets are now obsolete, please"
23 @echo "use 'make blah' instead of 'make installer_blah'"
24 @echo ""
25 @echo "will continue in 10 seconds"
26 @sleep 10
27
28#########################################################################
29# SETUP #
30#########################################################################
31
32ISODIR ?= /usr/release
33ISOROOT ?= ${ISODIR}/root
34OBJSYS= ${.OBJDIR}/../sys
35
36.if make(gui)
37KERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
38.else
39KERNCONF ?= GENERIC VKERNEL
40.endif
41
42PKGSRC_PREFIX?= /usr/pkg
43PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
44PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
45PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
46PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
47PKGSRC_PKG_PATH?= ${ISODIR}/packages
48PKGSRC_DB?= /var/db/pkg
49PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD
50CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716
51
52# We use env -i in the chroot, so that environment variables won't
53# disturb any (pkgsrc) build. This has happened for TARGET_ARCH,
54# which is used by gmake in completely different context.
55CHROOT_CMD?= env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c
56
57# pkgsrc packages to be built and installed on the release ISO
58#
59PKGSRC_PACKAGES?= devel/scmgit \
60 net/isc-dhcp4 \
61 net/isc-dhcpd4 \
62 pkgtools/pkg_leaves \
63 sysutils/cdrtools
64
65# pkgsrc options to use when building packages
66#
67.if !make(gui)
68PKGSRC_OPTIONS?= PKG_OPTIONS.scmgit=-scmgit-gui
69.endif
70
71# Even though buildiso wipes the packages, our check target has to run
72# first and old packages (listed as they appear in pkg_info) must be
73# cleaned out in order for the pkg_add -n test we use in the check target
74# to operate properly.
75#
76OLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 \
77 cdrecord-2.00.3nb2 \
78 bootstrap-kit-20070205 \
79 dfuibe_installer-1.1.6 \
80 gettext-lib-0.14.5 \
81 dfuibe_installer-1.1.7nb1 \
82 dfuife_curses-1.5 \
83 gettext-lib-0.14.6 \
84 gettext-tools-0.14.6nb1 \
85 libaura-3.1 \
86 libdfui-4.2 \
87 libinstaller-5.1 \
88 bootstrap-kit-20080211 \
89 cdrtools-ossdvd-2.01.1.36nb2 \
90 isc-dhcp-base-4.0.0 \
91 isc-dhcp-server-4.0.0
92
93# Specify which root skeletons are required, and let the user include
94# their own. They are copied into ISODIR during the `pkgcustomizeiso'
95# target; each overwrites the last.
96#
97REQ_ROOTSKELS= ${.CURDIR}/root \
98 ${.CURDIR}/installer
99ROOTSKELS?= ${REQ_ROOTSKELS}
100
101.if make(gui)
102ISOFILE?= ${ISODIR}/dfly-gui.iso
103IMGFILE?= ${ISODIR}/dfly-gui.img
104PKGSRC_PACKAGES+= meta/modular-xorg-apps \
105 meta/modular-xorg-drivers \
106 meta/modular-xorg-fonts \
107 meta/modular-xorg-libs \
108 wm/fluxbox \
109 www/firefox3 \
110 print/xpdf \
111 shells/zsh \
112 editors/emacs \
113 editors/vim \
114 chat/pidgin \
115 chat/irssi \
116 chat/xchat \
117 x11/rxvt-unicode \
118 x11/eterm \
119 lang/perl5 \
120 editors/nano \
121 shells/bash \
122 devel/exctags \
123 archivers/zip \
124 security/sudo \
125 www/links-gui \
126 net/nmap \
127 net/wget \
128 fonts/terminus-font \
129 net/rsync \
130 sysutils/idesk \
131 misc/screen
132ROOTSKELS+= ${.CURDIR}/gui
133.endif
134
135ISOFILE ?= ${ISODIR}/dfly.iso
136IMGFILE ?= ${ISODIR}/dfly.img
137
138IMGMNT ?= ${ISODIR}/mnt
139IMGUSBDEV ?= /dev/da0
140
141# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
142# the additional '/nrelease' manually, as a safety measure.
143#
144NRLOBJDIR?= /usr/obj
145
146#########################################################################
147# BASE ISO TARGETS #
148#########################################################################
149
150release: check clean buildworld1 buildkernel1 \
151 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
152
153quickrel: check clean buildworld2 buildkernel2 \
154 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
155
156realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso \
157 mkimg
158
159quick: quickrel
160
161realquick: realquickrel
162
163#########################################################################
164# CORE SUPPORT TARGETS #
165#########################################################################
166
167check:
168.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
169 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
170 @echo " make fetch"
171 @exit 1
172.endif
173.if !defined(PKGSRC_PATH)
174 @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
175 @echo "package building."
176 @exit 1
177.endif
178
179buildworld1 buildworld2:
180 cd ${.CURDIR}/..; ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} make -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
181
182buildkernel1 buildkernel2:
183.if make(gui)
184 cd ${.CURDIR}/..; \
185 for kernconf in ${KERNCONF}; do \
186 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
187 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
188 KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \
189 done
190.else
191 cd ${.CURDIR}/..; \
192 first=; \
193 for kernconf in ${KERNCONF}; do \
194 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
195 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
196 KERNCONF=$${kernconf} \
197 $${first:+-DNO_MODULES}; \
198 first=done; \
199 done
200.endif
201
202# note that we do not want to mess with any /usr/obj directories not related
203# to buildworld, buildkernel, or nrelease, so we must supply the proper
204# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
205# buildkernel mechanism.
206#
207buildiso:
208 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
209 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
210 ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
211 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
212 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
213 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
214.if make(gui)
215 if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi
216 cd ${.CURDIR}/..; \
217 make installkernel DESTDIR=${ISOROOT} \
218 KERNCONF=DFLYLIVE DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
219 cd ${.CURDIR}/..; \
220 make installkernel DESTDIR=${ISOROOT} \
221 KERNCONF=VKERNEL DESTKERNNAME=kernel.VKERNEL -DNO_MODULES KERNCONFDIR=${.CURDIR}/gui/root; \
222 cd ${.CURDIR}/..; \
223 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
224 KERNCONF=DFLYLIVE-SMP DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
225 cd ${.CURDIR}/..; \
226 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
227 KERNCONF=DFLYLIVE-SMP-NOAPIC DESTKERNNAME=kernel.noapic \
228 KERNCONFDIR=${.CURDIR}/gui/root -DNO_MODULES;
229.else
230 cd ${.CURDIR}/..; \
231 first=; \
232 for kernconf in ${KERNCONF}; do \
233 make DESTDIR=${ISOROOT} \
234 installkernel KERNCONF=$${kernconf} \
235 $${first:+DESTKERNNAME=kernel.$${kernconf}} \
236 $${first:+-DNO_MODULES}; \
237 first=done; \
238 done
239.endif
240 ln -s kernel ${ISOROOT}/kernel.BOOTP
241 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
242 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
243 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
244
245# Include kernel sources on the release CD (~14MB)
246#
247syssrcs:
248.if !defined(WITHOUT_SRCS)
249 ( cd ${.CURDIR}/../..; tar -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
250.endif
251
252customizeiso:
253.for ROOTSKEL in ${ROOTSKELS}
254 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
255.endfor
256 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
257 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
258 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
259 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
260.for UPGRADE_ITEM in Makefile \
261 etc.${MACHINE_ARCH} \
262 isdn/Makefile \
263 rc.d/Makefile \
264 periodic/Makefile \
265 periodic/daily/Makefile \
266 periodic/security/Makefile \
267 periodic/weekly/Makefile \
268 periodic/monthly/Makefile
269 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
270.endfor
271 # setup some things & mount pkgsrc tree
272 cp -p /etc/resolv.conf ${ISOROOT}/etc
273 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
274 mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap/work
275 mkdir ${ISOROOT}/usr/pkgsrc
276 mount_null ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
277
278 # bootstrap
279 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
280 # build and install packages
281.for PKG in ${PKGSRC_PACKAGES}
282 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} build install"
283.endfor
284 # remove packages which nothing depends on
285 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
286 umount ${ISOROOT}/usr/pkgsrc
287 rmdir ${ISOROOT}/usr/pkgsrc
288 rm -rf ${ISOROOT}/usr/pkgobj
289 rm -f ${ISOROOT}/etc/resolv.conf
290 makewhatis ${ISOROOT}/usr/local/man
291 makewhatis ${ISOROOT}/usr/pkg/man
292
293mklocatedb:
294 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
295 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
296 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
297 /usr/libexec/locate.mklocatedb \
298 -presort >${ISOROOT}/var/db/locate.database )
299
300mkiso:
301 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
302 -R -J -o ${ISOFILE} \
303 -V DragonFly-`${.CURDIR}/../tools/gitrev.sh | cut -c -22` . )
304
305
306mkimg:
307.if make(img)
308 if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
309
310 echo "determine required image size" > /dev/null; \
311 sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \
312 echo "add 15% more space as required" > /dev/null; \
313 sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
314 dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz}; \
315 fdisk -IB -p ${IMGFILE}; \
316 echo "determine free vn device" > /dev/null; \
317 vn=`vnconfig -l | grep "not in use" | head -n 1 | cut -f 1 -d:`; \
318 vnconfig -e -s labels $${vn} ${IMGFILE}; \
319 echo "write standard disklabel" > /dev/null; \
320 disklabel -w -r $${vn}s1 auto; \
321 echo "read disklabel back" > /dev/null; \
322 disklabel -r $${vn}s1 > ${IMGFILE}.label; \
323 echo "determine number of sectors of whole disk" > /dev/null; \
324 secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \
325 echo "and add a: partition" > /dev/null; \
326 echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label; \
327 echo "write modified disklabel back" > /dev/null; \
328 disklabel -R -r $${vn}s1 ${IMGFILE}.label; \
329 rm ${IMGFILE}.label; \
330 echo "write bootsector" > /dev/null; \
331 disklabel -B $${vn}s1; \
332 newfs /dev/$${vn}s1a; \
333 mount /dev/$${vn}s1a ${IMGMNT}; \
334 cpdup -vvv ${ISOROOT} ${IMGMNT}; \
335 echo "fix /etc/fstab" > /dev/null; \
336 echo "${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc/fstab; \
337 echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab; \
338 df ${IMGMNT}; \
339 umount ${IMGMNT}; \
340 vnconfig -u $${vn}; \
341 rmdir ${IMGMNT}
342.endif
343
344clean:
345 -umount ${ISOROOT}/usr/pkgsrc
346 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
347 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
348 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
349
350realclean: clean
351 rm -rf ${OBJSYS}/${KERNCONF}
352 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
353 # override location.
354 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
355
356fetch:
357 @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
358.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
359 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
360.endif
361
362pkgsrc_bootstrap:
363 mkdir -p ${PKGSRC_PKG_PATH}
364.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
365 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
366.endif
367 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
368 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
369
370pkgsrc_cdrecord:
371.if !exists (${PKGBIN_MKISOFS})
372 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrtools*
373.endif
374
375
376.PHONY: all release installer_release quickrel installer_quickrel realquickrel
377.PHONY: installer_fetch installer
378.PHONY: quick realquick
379.PHONY: installer_realquickrel check buildworld1 buildworld2
380.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
381.PHONY: clean realclean fetch
382
383.include <bsd.prog.mk>