1 # $DragonFly: src/nrelease/Makefile,v 1.90 2008/09/01 21:20:30 swildner Exp $
4 #########################################################################
6 #########################################################################
8 # New method e.g. 'make gui release'. A series of enhancement
9 # targes may be specified which set make variables which enhance
10 # the build in various ways.
14 #########################################################################
16 #########################################################################
18 ISODIR ?
= /usr
/release
19 ISOROOT ?
= ${ISODIR}/root
20 OBJSYS
= ${.OBJDIR
}/..
/sys
23 KERNCONF ?
= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
25 KERNCONF ?
= GENERIC VKERNEL
28 PKGSRC_PREFIX?
= /usr
/pkg
29 PKGBIN_PKG_ADD?
= ${PKGSRC_PREFIX}/sbin
/pkg_add
30 PKGBIN_PKG_DELETE?
= ${PKGSRC_PREFIX}/sbin
/pkg_delete
31 PKGBIN_PKG_ADMIN?
= ${PKGSRC_PREFIX}/sbin
/pkg_admin
32 PKGBIN_MKISOFS?
= ${PKGSRC_PREFIX}/bin
/mkisofs
33 PKGSRC_PKG_PATH?
= ${ISODIR}/packages
34 PKGSRC_DB?
= /var
/db
/pkg
35 PKGSRC_BOOTSTRAP_URL?
= http
://avalon.dragonflybsd.org
/DragonFly-pkgsrc-packages
/i386
/1.12.0-RELEASE-BUILD
36 CVSUP_BOOTSTRAP_KIT?
= cvsup-bootstrap-20070716
38 # We use env -i in the chroot, so that environment variables won't
39 # disturb any (pkgsrc) build. This has happened for TARGET_ARCH,
40 # which is used by gmake in completely different context.
42 CHROOT_CMD?
= env
-i CCVER
=${CCVER
:Q
} /usr
/sbin
/chroot
${ISOROOT} sh
-c
44 # User may specify extra packages in addition to the defaults
46 PKGSRC_EXTRA_PACKAGES?
=
48 # Pkgsrc packages to be built and installed on the release ISO
50 PKGSRC_PACKAGES?
= pkgtools
/pkg_leaves \
56 ${PKGSRC_EXTRA_PACKAGES}
58 # pkgsrc options to use when building packages
60 PKGSRC_OPTIONS
+= PKG_DEFAULT_OPTIONS
='dri inet6'
62 PKGSRC_OPTIONS
+= PKG_OPTIONS.scmgit
=-scmgit-gui
65 # Even though buildiso wipes the packages, our check target has to run
66 # first and old packages (listed as they appear in pkg_info) must be
67 # cleaned out in order for the pkg_add -n test we use in the check target
68 # to operate properly.
70 OLD_PKGSRC_PACKAGES?
= cdrtools-2.01
.01.27nb1 \
72 bootstrap-kit-20070205 \
73 dfuibe_installer-1.1
.6 \
75 dfuibe_installer-1.1
.7nb1 \
78 gettext-tools-0.14
.6nb1 \
82 bootstrap-kit-20080211 \
83 cdrtools-ossdvd-2.01
.1.36nb2 \
87 # Specify which root skeletons are required, and let the user include
88 # their own. They are copied into ISODIR during the `customizeiso'
89 # target; each overwrites the last.
91 REQ_ROOTSKELS
= ${.CURDIR
}/root \
93 ROOTSKELS?
= ${REQ_ROOTSKELS}
96 ISOFILE?
= ${ISODIR}/dfly-gui.iso
97 IMGFILE?
= ${ISODIR}/dfly-gui.img
98 PKGSRC_PACKAGES
+= meta-pkgs
/modular-xorg-apps \
99 meta-pkgs
/modular-xorg-drivers \
100 meta-pkgs
/modular-xorg-fonts \
101 meta-pkgs
/modular-xorg-libs \
112 x11
/modular-xorg-server \
124 fonts
/terminus-font \
129 ROOTSKELS
+= ${.CURDIR
}/gui
132 ISOFILE ?
= ${ISODIR}/dfly.iso
133 IMGFILE ?
= ${ISODIR}/dfly.img
135 IMGMNT ?
= ${ISODIR}/mnt
137 # USB umass now probes starting at da8, so the usb stick is
138 # probably sitting on da8.
140 IMGUSBDEV ?
= /dev
/da8
142 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
143 # the additional '/nrelease' manually, as a safety measure.
147 #########################################################################
149 #########################################################################
151 release
: check clean buildworld1 buildkernel1 \
152 buildiso srcs customizeiso mklocatedb \
155 quickrel
: check clean buildworld2 buildkernel2 \
156 buildiso srcs customizeiso mklocatedb \
159 realquickrel
: check clean \
160 buildiso srcs customizeiso mklocatedb \
163 restartpkgs
: check customizeiso mklocatedb mkiso mkimg
167 realquick
: realquickrel
170 #########################################################################
171 # CORE SUPPORT TARGETS #
172 #########################################################################
175 .if
!exists
(${PKGBIN_PKG_ADMIN})
176 @echo
"You never bootstrapped pkgsrc on your machine. You can install it with:"
177 @echo
" make pkgsrc_bootstrap"
179 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
180 @echo
"The cvsup bootstrap kit is not installed. You can install it with:"
183 .if
!exists
(${PKGBIN_MKISOFS})
185 @echo
"Your machine does not have cdrtools installed. You can install it with:"
186 @echo
" make pkgsrc_cdrecord"
188 .if
!defined
(PKGSRC_PATH
)
189 @echo
"Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
190 @echo
"package building. For example /usr/pkgsrc. See the Makefile"
191 @echo
"in /usr if you are unfamiliar with pkgsrc."
193 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
196 .if
!exists
(${PKGBIN_MKISOFS})
199 .if
!defined
(PKGSRC_PATH
)
203 buildworld1 buildworld2
:
204 cd
${.CURDIR
}/..
; ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} make
-DWANT_INSTALLER
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//}
206 buildkernel1 buildkernel2
:
209 for kernconf in
${KERNCONF}; do \
210 ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} \
211 make
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//} \
212 KERNCONF
=$${kernconf} KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
217 for kernconf in
${KERNCONF}; do \
218 ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} \
219 make
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//} \
220 KERNCONF
=$${kernconf} \
221 $${first
:+-DNO_MODULES
}; \
226 # note that we do not want to mess with any /usr/obj directories not related
227 # to buildworld, buildkernel, or nrelease, so we must supply the proper
228 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
229 # buildkernel mechanism.
232 if
[ ! -d
${ISOROOT} ]; then mkdir
-p
${ISOROOT}; fi
233 if
[ ! -d
${NRLOBJDIR}/nrelease
]; then mkdir
-p
${NRLOBJDIR}/nrelease
; fi
234 ( cd
${.CURDIR
}/..
; make
-DWANT_INSTALLER DESTDIR
=${ISOROOT} installworld
)
235 ( cd
${.CURDIR
}/..
/etc
; MAKEOBJDIRPREFIX
=${NRLOBJDIR}/nrelease \
236 make
-m
${.CURDIR
}/..
/share
/mk DESTDIR
=${ISOROOT} distribution
)
237 cpdup
${ISOROOT}/etc
${ISOROOT}/etc.hdd
239 if
[ ! -d
${ISOROOT}/kernel.smp
/boot
]; then mkdir
-p
${ISOROOT}/kernel.smp
/boot
; fi
241 make installkernel DESTDIR
=${ISOROOT} \
242 KERNCONF
=DFLYLIVE DESTKERNNAME
=kernel KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
244 make installkernel DESTDIR
=${ISOROOT} \
245 KERNCONF
=VKERNEL DESTKERNNAME
=kernel.VKERNEL
-DNO_MODULES KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
247 make installkernel DESTDIR
=${ISOROOT}/kernel.smp \
248 KERNCONF
=DFLYLIVE-SMP DESTKERNNAME
=kernel KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
250 make installkernel DESTDIR
=${ISOROOT}/kernel.smp \
251 KERNCONF
=DFLYLIVE-SMP-NOAPIC DESTKERNNAME
=kernel.noapic \
252 KERNCONFDIR
=${.CURDIR
}/gui
/root
-DNO_MODULES
;
256 for kernconf in
${KERNCONF}; do \
257 make DESTDIR
=${ISOROOT} \
258 installkernel KERNCONF
=$${kernconf} \
259 $${first
:+DESTKERNNAME
=kernel.
$${kernconf}} \
260 $${first
:+-DNO_MODULES
}; \
264 ln
-s kernel
${ISOROOT}/boot
/kernel.BOOTP
265 mtree
-deU
-f
${.CURDIR
}/..
/etc
/mtree
/BSD.local.
dist -p
${ISOROOT}/usr
/local
/
266 mtree
-deU
-f
${.CURDIR
}/..
/etc
/mtree
/BSD.var.
dist -p
${ISOROOT}/var
267 dev_mkdb
-f
${ISOROOT}/var
/run
/dev.db
${ISOROOT}/dev
269 # Release CD: Kernel sources (~16M) and the full pkgsrc tree (~27M)
270 # Release DVD: Full sources (~90M) and the full pkgsrc tree (~27M)
273 .if
!defined
(WITHOUT_SRCS
)
274 rm -f
${ISOROOT}/usr
/pkgsrc-all.tgz
275 cd
${PKGSRC_PATH} && tar --exclude distfiles
--exclude packages
--exclude work
--exclude CVS
--exclude .git \
276 -czf
${ISOROOT}/usr
/pkgsrc-all.tgz .
278 rm -f
${ISOROOT}/usr
/src-all.tgz
279 cd
${.CURDIR
}/..
&& tar --exclude .git
--exclude CVS
-s
'/^\./src/' \
280 -czf
${ISOROOT}/usr
/src-all.tgz .
282 rm -f
${ISOROOT}/usr
/src-sys.tgz
283 cd
${.CURDIR
}/..
&& tar --exclude .git
--exclude CVS
-s
'/^\./src/' \
284 -czf
${ISOROOT}/usr
/src-sys.tgz .
/Makefile .
/Makefile.inc1 .
/sys
288 # Customize the ISO by copying rootskels in reverse priority order,
289 # building packages, and doing other post-install tasks.
292 # Copy the rootskels. Allow sources to be owned by someone other
293 # then root (as is common when checked out via git).
295 .for ROOTSKEL in
${ROOTSKELS}
296 cpdup
-X cpignore
-o
${ROOTSKEL} ${ISOROOT}
297 @
test -O
${.CURDIR
} || echo
"chowning copied files to root:wheel"
298 @
test -O
${.CURDIR
} ||
((cd
${ROOTSKEL} && find .
) | fgrep
-v cpignore |
(cd
${ISOROOT} && xargs chown root
:wheel
))
300 (cd
${PKGSRC_PKG_PATH}; tar xzpf
${CVSUP_BOOTSTRAP_KIT}.tgz
)
301 cp
-p
${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr
/local
/bin
/cvsup
${ISOROOT}/usr
/local
/bin
/cvsup
302 cp
-p
${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr
/local
/man
/man1
/cvsup
.1 ${ISOROOT}/usr
/local
/man
/man1
/cvsup
.1
303 pwd_mkdb
-p
-d
${ISOROOT}/etc
${ISOROOT}/etc
/master.passwd
304 .for UPGRADE_ITEM in Makefile \
305 etc.
${MACHINE_ARCH} \
309 periodic
/daily
/Makefile \
310 periodic
/security
/Makefile \
311 periodic
/weekly
/Makefile \
312 periodic
/monthly
/Makefile
313 cp
-R
${.CURDIR
}/..
/etc
/${UPGRADE_ITEM} ${ISOROOT}/etc
/${UPGRADE_ITEM}
316 # Setup some things & mount pkgsrc tree. Use defensive umounts and
317 # rm -rf's to allow restarts. Allow /usr/pkgsrc to be read-only.
319 # If we did not get past the bootstrap we clean out the entire
320 # /usr/pkg infrastructure. Otherwise we attempt to pick up where
323 cp
-p
/etc
/resolv.conf
${ISOROOT}/etc
324 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
325 -@umount
${ISOROOT}/usr
/pkgsrc
/distfiles
326 -@umount
${ISOROOT}/usr
/pkgsrc
327 mkdir
-p
${ISODIR}/distfiles
328 rm -rf
${ISOROOT}/usr
/pkgobj
330 # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable
332 mkdir
-p
${ISOROOT}/usr
/pkgobj
333 mkdir
-p
${ISOROOT}/usr
/pkgobj
/bootstrap
334 mkdir
-p
${ISOROOT}/usr
/pkgsrc
335 mount_null
${PKGSRC_PATH} ${ISOROOT}/usr
/pkgsrc
336 cp
/etc
/shells
${ISOROOT}/usr
/pkgsrc
/distfiles
/.
test > /dev
/null
2>&1 \
337 || mount_null
${ISODIR}/distfiles
${ISOROOT}/usr
/pkgsrc
/distfiles
339 # Bootstrap, if not already installed, and add licenses needed
340 # for the gui release
342 test -e
${ISODIR}/.didbootstrap || \
343 rm -rf
${ISOROOT}/usr
/pkg
${ISOROOT}/var
/db
/pkg \
344 ${ISOROOT}/var
/db
/pkg.refcount
345 test -e
${ISODIR}/.didbootstrap || \
346 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; \
347 ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
348 test -e
${ISODIR}/.didbootstrap || \
349 echo
".ifdef BSD_PKG_MK # added by nrelease" \
350 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
351 test -e
${ISODIR}/.didbootstrap || \
352 echo
"ACCEPTABLE_LICENSES+=openmotif-license" \
353 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
354 test -e
${ISODIR}/.didbootstrap || \
355 echo
"ACCEPTABLE_LICENSES+=vim-license" \
356 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
357 test -e
${ISODIR}/.didbootstrap || \
358 echo
".endif # added by nrelease" \
359 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
360 test -e
${ISODIR}/.didbootstrap || sync
361 test -e
${ISODIR}/.didbootstrap || touch
${ISODIR}/.didbootstrap
363 # Build and install packages, skip packages already installed
365 .for PKG in
${PKGSRC_PACKAGES}
366 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
367 (bmake WRKOBJDIR=/usr/pkgobj check > /dev/null 2>&1 || \
368 bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} clean build install)"
371 # Remove packages which nothing depends on and clean up
373 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
374 -umount
${ISOROOT}/usr
/pkgsrc
/distfiles
375 umount
${ISOROOT}/usr
/pkgsrc
376 rmdir
${ISOROOT}/usr
/pkgsrc
377 rm -rf
${ISOROOT}/usr
/pkgobj
378 rm -f
${ISOROOT}/etc
/resolv.conf
379 makewhatis
${ISOROOT}/usr
/local
/man
380 makewhatis
${ISOROOT}/usr
/pkg
/man
385 ( find
-s
${ISOROOT} -path
${ISOROOT}/tmp
-or \
386 -path
${ISOROOT}/usr
/tmp
-or
-path
${ISOROOT}/var
/tmp \
387 -prune
-o
-print | sed
-e
's#^${ISOROOT}##g' | \
388 /usr
/libexec
/locate.mklocatedb \
389 -presort
>${ISOROOT}/var
/db
/locate.database
)
392 ( cd
${ISOROOT}; ${PKGBIN_MKISOFS} -b boot
/cdboot
-no-emul-boot \
393 -R
-J
-o
${ISOFILE} \
394 -V DragonFly-
`${.CURDIR}/../tools/gitrev.sh | cut -c -22` .
)
399 if
[ ! -d
${IMGMNT} ]; then mkdir
-p
${IMGMNT}; fi
401 echo
"determine required image size" > /dev
/null
; \
402 sz
=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \
403 echo
"add 15% more space as required" > /dev
/null
; \
404 sz
=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
405 dd if
=/dev
/zero of
=${IMGFILE} bs
=1m count
=$${sz}; \
406 fdisk
-IB
-p
${IMGFILE}; \
407 echo
"determine free vn device" > /dev
/null
; \
408 vn
=`vnconfig -l | grep "not in use" | head -n 1 | cut -f 1 -d:`; \
409 vnconfig
-e
-s labels
$${vn} ${IMGFILE}; \
410 echo
"write standard disklabel" > /dev
/null
; \
411 disklabel
-w
-r
$${vn}s1 auto
; \
412 echo
"read disklabel back" > /dev
/null
; \
413 disklabel
-r
$${vn}s1
> ${IMGFILE}.label
; \
414 echo
"determine number of sectors of whole disk" > /dev
/null
; \
415 secs
=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \
416 echo
"and add a: partition" > /dev
/null
; \
417 echo
" a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label
; \
418 echo
"write modified disklabel back" > /dev
/null
; \
419 disklabel
-R
-r
$${vn}s1
${IMGFILE}.label
; \
420 rm ${IMGFILE}.label
; \
421 echo
"write bootsector" > /dev
/null
; \
422 disklabel
-B
$${vn}s1
; \
423 boot0cfg
-B
-o noupdate
$${vn}; \
424 newfs
/dev
/$${vn}s1a
; \
425 mount
/dev
/$${vn}s1a
${IMGMNT}; \
426 cpdup
-vvv
${ISOROOT} ${IMGMNT}; \
427 echo
"fix /etc/fstab" > /dev
/null
; \
428 echo
"${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc
/fstab
; \
429 echo
"proc /proc procfs rw 0 0" >> ${IMGMNT}/etc
/fstab
; \
432 vnconfig
-u
$${vn}; \
437 -umount
${ISOROOT}/usr
/pkgsrc
/distfiles
> /dev
/null
2>&1
438 -umount
${ISOROOT}/usr
/pkgsrc
> /dev
/null
2>&1
439 if
[ -d
${ISOROOT} ]; then chflags
-R noschg
${ISOROOT}; fi
441 rm -rf
${NRLOBJDIR}/nrelease
442 rm -f
${ISODIR}/.didbootstrap
445 rm -rf
${OBJSYS}/${KERNCONF}
447 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
450 rm -rf
${ISODIR}/packages
451 rm -rf
${ISODIR}/distfiles
454 @if
[ ! -d
${PKGSRC_PKG_PATH} ]; then mkdir
-p
${PKGSRC_PKG_PATH}; fi
455 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
456 (cd
${PKGSRC_PKG_PATH}; fetch
${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
460 .if
!exists
(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz
)
461 mkdir
-p
/usr
/release
/bootstrap
462 (cd
${PKGSRC_PATH}/bootstrap
; .
/bootstrap
--workdir
/usr
/release
/bootstrap
)
466 .if
!exists
(${PKGBIN_MKISOFS})
467 (cd
${PKGSRC_PATH}/sysutils
/cdrtools
; bmake
clean build
install)
471 @echo
"make [gui] release - complete build from scratch"
472 @echo
"make [gui] quick - attempt to do an incremental rebuild"
473 @echo
"make [gui] realquick - attempt to restart after world & kernel"
474 @echo
"make [gui] restartpkgs - attempt to restart at the pkg building stage"
476 @echo
"Extra packages may be specified with PKGSRC_EXTRA_PACKAGES"
478 .PHONY
: release quickrel realquickrel
480 .PHONY
: quick realquick
481 .PHONY
: check buildworld1 buildworld2
482 .PHONY
: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
483 .PHONY
: clean realclean fetch help
all srcs
485 .
include <bsd.prog.mk
>