pci intr config: 'j' is the pin index we want to skip.
[dragonfly.git] / nrelease / Makefile
CommitLineData
bfe20b28 1# $DragonFly: src/nrelease/Makefile,v 1.90 2008/09/01 21:20:30 swildner Exp $
6ca9a59c 2#
5b22b655 3
9b29c40a
MD
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
cc224c64 14
f4ec1279 15# New method e.g. 'make gui release'. A series of enhancement
9b29c40a
MD
16# targes may be specified which set make variables which enhance
17# the build in various ways.
18#
b9c3e754 19gui installer img:
9b29c40a
MD
20
21warning:
22 @echo "WARNING: The installer_* targets are now obsolete, please"
f4ec1279 23 @echo "use 'make blah' instead of 'make installer_blah'"
9b29c40a
MD
24 @echo ""
25 @echo "will continue in 10 seconds"
26 @sleep 10
27
9b29c40a
MD
28#########################################################################
29# SETUP #
30#########################################################################
31
6ca9a59c 32ISODIR ?= /usr/release
5ec00f8a 33ISOROOT ?= ${ISODIR}/root
6ca9a59c 34OBJSYS= ${.OBJDIR}/../sys
bfe20b28
SW
35
36.if make(gui)
37KERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
38.else
1d3eb8c5 39KERNCONF ?= GENERIC VKERNEL
bfe20b28 40.endif
6ca9a59c 41
cc224c64 42PKGSRC_PREFIX?= /usr/pkg
bce110a5 43PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
95b64753 44PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
c791834f 45PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
bce110a5
MD
46PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
47PKGSRC_PKG_PATH?= ${ISODIR}/packages
48PKGSRC_DB?= /var/db/pkg
18b332b2 49PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD
4b08f3df 50CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20070716
bce110a5 51
cc55a235
SS
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
fbc26094 57# pkgsrc packages to be built and installed on the release ISO
95b64753 58#
fbc26094
SW
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
8188de86 70
95b64753
MD
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#
fbc26094
SW
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
95b64753 92
8188de86
MD
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#
fbc26094
SW
97REQ_ROOTSKELS= ${.CURDIR}/root \
98 ${.CURDIR}/installer
cc224c64
JS
99ROOTSKELS?= ${REQ_ROOTSKELS}
100
fbc26094 101.if make(gui)
3f279b9e 102ISOFILE?= ${ISODIR}/dfly-gui.iso
b9c3e754 103IMGFILE?= ${ISODIR}/dfly-gui.img
fbc26094
SW
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
3f279b9e
SW
132ROOTSKELS+= ${.CURDIR}/gui
133.endif
134
3f279b9e 135ISOFILE ?= ${ISODIR}/dfly.iso
b9c3e754
MN
136IMGFILE ?= ${ISODIR}/dfly.img
137
60b68cbb 138IMGMNT ?= ${ISODIR}/mnt
b9c3e754 139IMGUSBDEV ?= /dev/da0
3f279b9e 140
5b22b655
MD
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
8188de86
MD
146#########################################################################
147# BASE ISO TARGETS #
148#########################################################################
149
7ebbae99 150release: check clean buildworld1 buildkernel1 \
b9c3e754 151 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
8188de86 152
7ebbae99 153quickrel: check clean buildworld2 buildkernel2 \
b9c3e754 154 buildiso syssrcs customizeiso mklocatedb mkiso mkimg
2e3f8f38 155
b9c3e754
MN
156realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso \
157 mkimg
6ca9a59c 158
9b29c40a
MD
159quick: quickrel
160
161realquick: realquickrel
162
163#########################################################################
164# CORE SUPPORT TARGETS #
165#########################################################################
166
d2582113 167check:
0a1628e7
MD
168.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
169 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
f4ec1279 170 @echo " make fetch"
0a1628e7
MD
171 @exit 1
172.endif
fbc26094
SW
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
2e3f8f38 178
588a679c 179buildworld1 buildworld2:
f4ec1279 180 cd ${.CURDIR}/..; ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} make -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
6ca9a59c 181
588a679c 182buildkernel1 buildkernel2:
bfe20b28
SW
183.if make(gui)
184 cd ${.CURDIR}/..; \
185 for kernconf in ${KERNCONF}; do \
448b21e7 186 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
82f56cac 187 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
bfe20b28
SW
188 KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \
189 done
190.else
588a679c
SS
191 cd ${.CURDIR}/..; \
192 first=; \
193 for kernconf in ${KERNCONF}; do \
448b21e7 194 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
82f56cac 195 make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
588a679c
SS
196 KERNCONF=$${kernconf} \
197 $${first:+-DNO_MODULES}; \
198 first=done; \
199 done
bfe20b28 200.endif
6ca9a59c 201
5b22b655
MD
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#
6ca9a59c
MD
207buildiso:
208 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 209 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
f4ec1279 210 ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
211 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
212 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
21aa02d0 213 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
bfe20b28 214.if make(gui)
fbc26094 215 if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi
bfe20b28
SW
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
588a679c
SS
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
bfe20b28 239.endif
c5c5e6fc 240 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
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
8188de86 244
19d86faa
MD
245# Include kernel sources on the release CD (~14MB)
246#
247syssrcs:
66b79064 248.if !defined(WITHOUT_SRCS)
ccbff5d3 249 ( cd ${.CURDIR}/../..; tar -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
66b79064 250.endif
19d86faa 251
8188de86
MD
252customizeiso:
253.for ROOTSKEL in ${ROOTSKELS}
254 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
255.endfor
fbc26094 256 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
0a1628e7 257 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
c751e497 258 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
7249926b 259 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
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}
20585f87 270.endfor
589a5738 271 # setup some things & mount pkgsrc tree
fbc26094 272 cp -p /etc/resolv.conf ${ISOROOT}/etc
cc55a235 273 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
589a5738 274 mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap/work
fbc26094
SW
275 mkdir ${ISOROOT}/usr/pkgsrc
276 mount_null ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
cc55a235 277
fbc26094 278 # bootstrap
cc55a235 279 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
fbc26094 280 # build and install packages
bce110a5 281.for PKG in ${PKGSRC_PACKAGES}
cc55a235 282 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} build install"
8188de86 283.endfor
fbc26094 284 # remove packages which nothing depends on
cc55a235 285 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
fbc26094
SW
286 umount ${ISOROOT}/usr/pkgsrc
287 rmdir ${ISOROOT}/usr/pkgsrc
589a5738 288 rm -rf ${ISOROOT}/usr/pkgobj
fbc26094 289 rm -f ${ISOROOT}/etc/resolv.conf
3652f053
SW
290 makewhatis ${ISOROOT}/usr/local/man
291 makewhatis ${ISOROOT}/usr/pkg/man
6ca9a59c 292
8398ca17
SW
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
6ca9a59c 300mkiso:
bce110a5 301 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
74ec6a9d
SW
302 -R -J -o ${ISOFILE} \
303 -V DragonFly-`${.CURDIR}/../tools/gitrev.sh | cut -c -22` . )
6ca9a59c 304
b9c3e754
MN
305
306mkimg:
fbc26094 307.if make(img)
60b68cbb
MN
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`; \
e6b76e22
MN
312 echo "add 15% more space as required" > /dev/null; \
313 sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
60b68cbb
MN
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; \
b72c2692
MN
336 echo "${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc/fstab; \
337 echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab; \
bccaed73 338 df ${IMGMNT}; \
60b68cbb
MN
339 umount ${IMGMNT}; \
340 vnconfig -u $${vn}; \
341 rmdir ${IMGMNT}
b9c3e754
MN
342.endif
343
6ca9a59c 344clean:
fbc26094 345 -umount ${ISOROOT}/usr/pkgsrc
6ca9a59c 346 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 347 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 348 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
349
350realclean: clean
3ebedc5e 351 rm -rf ${OBJSYS}/${KERNCONF}
bce110a5
MD
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
6ca9a59c 355
cc224c64 356fetch:
9b29c40a 357 @if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
0a1628e7
MD
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
bce110a5
MD
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
bce110a5
MD
370pkgsrc_cdrecord:
371.if !exists (${PKGBIN_MKISOFS})
20585f87 372 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrtools*
bce110a5 373.endif
cc224c64 374
588a679c 375
cc224c64 376.PHONY: all release installer_release quickrel installer_quickrel realquickrel
9b29c40a
MD
377.PHONY: installer_fetch installer
378.PHONY: quick realquick
cc224c64 379.PHONY: installer_realquickrel check buildworld1 buildworld2
b9c3e754 380.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
d5c58845 381.PHONY: clean realclean fetch
cc224c64 382
6ca9a59c 383.include <bsd.prog.mk>