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
://pkgbox.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
61 PKGSRC_OPTIONS?
= PKG_OPTIONS.scmgit
=-scmgit-gui
64 # Even though buildiso wipes the packages, our check target has to run
65 # first and old packages (listed as they appear in pkg_info) must be
66 # cleaned out in order for the pkg_add -n test we use in the check target
67 # to operate properly.
69 OLD_PKGSRC_PACKAGES?
= cdrtools-2.01
.01.27nb1 \
71 bootstrap-kit-20070205 \
72 dfuibe_installer-1.1
.6 \
74 dfuibe_installer-1.1
.7nb1 \
77 gettext-tools-0.14
.6nb1 \
81 bootstrap-kit-20080211 \
82 cdrtools-ossdvd-2.01
.1.36nb2 \
86 # Specify which root skeletons are required, and let the user include
87 # their own. They are copied into ISODIR during the `customizeiso'
88 # target; each overwrites the last.
90 REQ_ROOTSKELS
= ${.CURDIR
}/root \
92 ROOTSKELS?
= ${REQ_ROOTSKELS}
95 ISOFILE?
= ${ISODIR}/dfly-gui.iso
96 IMGFILE?
= ${ISODIR}/dfly-gui.img
97 PKGSRC_PACKAGES
+= meta-pkgs
/modular-xorg-apps \
98 meta-pkgs
/modular-xorg-drivers \
99 meta-pkgs
/modular-xorg-fonts \
100 meta-pkgs
/modular-xorg-libs \
111 x11
/modular-xorg-server \
123 fonts
/terminus-font \
128 ROOTSKELS
+= ${.CURDIR
}/gui
131 ISOFILE ?
= ${ISODIR}/dfly.iso
132 IMGFILE ?
= ${ISODIR}/dfly.img
134 IMGMNT ?
= ${ISODIR}/mnt
135 IMGUSBDEV ?
= /dev
/da0
137 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
138 # the additional '/nrelease' manually, as a safety measure.
142 #########################################################################
144 #########################################################################
146 release
: check clean buildworld1 buildkernel1 \
147 buildiso srcs customizeiso mkaliases mklocatedb \
150 quickrel
: check clean buildworld2 buildkernel2 \
151 buildiso srcs customizeiso mkaliases mklocatedb \
154 realquickrel
: check clean buildiso srcs customizeiso \
155 mkaliases mklocatedb \
158 restartpkgs
: check customizeiso mkaliases mklocatedb mkiso mkimg
162 realquick
: realquickrel
165 #########################################################################
166 # CORE SUPPORT TARGETS #
167 #########################################################################
170 .if
!exists
(${PKGBIN_PKG_ADMIN})
171 @echo
"You never bootstrapped pkgsrc on your machine. You can install it with:"
172 @echo
" make pkgsrc_bootstrap"
174 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
175 @echo
"The cvsup bootstrap kit is not installed. You can install it with:"
178 .if
!exists
(${PKGBIN_MKISOFS})
180 @echo
"Your machine does not have cdrtools installed. You can install it with:"
181 @echo
" make pkgsrc_cdrecord"
183 .if
!defined
(PKGSRC_PATH
)
184 @echo
"Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
185 @echo
"package building. For example /usr/pkgsrc. See the Makefile"
186 @echo
"in /usr if you are unfamiliar with pkgsrc."
188 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
191 .if
!exists
(${PKGBIN_MKISOFS})
194 .if
!defined
(PKGSRC_PATH
)
198 buildworld1 buildworld2
:
199 cd
${.CURDIR
}/..
; ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} make
-DWANT_INSTALLER
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//}
201 buildkernel1 buildkernel2
:
204 for kernconf in
${KERNCONF}; do \
205 ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} \
206 make
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//} \
207 KERNCONF
=$${kernconf} KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
212 for kernconf in
${KERNCONF}; do \
213 ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} \
214 make
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//} \
215 KERNCONF
=$${kernconf} \
216 $${first
:+-DNO_MODULES
}; \
221 # note that we do not want to mess with any /usr/obj directories not related
222 # to buildworld, buildkernel, or nrelease, so we must supply the proper
223 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
224 # buildkernel mechanism.
227 if
[ ! -d
${ISOROOT} ]; then mkdir
-p
${ISOROOT}; fi
228 if
[ ! -d
${NRLOBJDIR}/nrelease
]; then mkdir
-p
${NRLOBJDIR}/nrelease
; fi
229 ( cd
${.CURDIR
}/..
; make
-DWANT_INSTALLER DESTDIR
=${ISOROOT} installworld
)
230 ( cd
${.CURDIR
}/..
/etc
; MAKEOBJDIRPREFIX
=${NRLOBJDIR}/nrelease \
231 make
-m
${.CURDIR
}/..
/share
/mk DESTDIR
=${ISOROOT} distribution
)
232 cpdup
${ISOROOT}/etc
${ISOROOT}/etc.hdd
234 if
[ ! -d
${ISOROOT}/kernel.smp
/boot
]; then mkdir
-p
${ISOROOT}/kernel.smp
/boot
; fi
236 make installkernel DESTDIR
=${ISOROOT} \
237 KERNCONF
=DFLYLIVE DESTKERNNAME
=kernel KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
239 make installkernel DESTDIR
=${ISOROOT} \
240 KERNCONF
=VKERNEL DESTKERNNAME
=kernel.VKERNEL
-DNO_MODULES KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
242 make installkernel DESTDIR
=${ISOROOT}/kernel.smp \
243 KERNCONF
=DFLYLIVE-SMP DESTKERNNAME
=kernel KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
245 make installkernel DESTDIR
=${ISOROOT}/kernel.smp \
246 KERNCONF
=DFLYLIVE-SMP-NOAPIC DESTKERNNAME
=kernel.noapic \
247 KERNCONFDIR
=${.CURDIR
}/gui
/root
-DNO_MODULES
;
251 for kernconf in
${KERNCONF}; do \
252 make DESTDIR
=${ISOROOT} \
253 installkernel KERNCONF
=$${kernconf} \
254 $${first
:+DESTKERNNAME
=kernel.
$${kernconf}} \
255 $${first
:+-DNO_MODULES
}; \
259 ln
-s kernel
${ISOROOT}/boot
/kernel.BOOTP
260 mtree
-deU
-f
${.CURDIR
}/..
/etc
/mtree
/BSD.local.
dist -p
${ISOROOT}/usr
/local
/
261 mtree
-deU
-f
${.CURDIR
}/..
/etc
/mtree
/BSD.var.
dist -p
${ISOROOT}/var
262 dev_mkdb
-f
${ISOROOT}/var
/run
/dev.db
${ISOROOT}/dev
264 # Release CD: Kernel sources (~16M) and the full pkgsrc tree (~27M)
265 # Release DVD: Full sources (~90M) and the full pkgsrc tree (~27M)
268 .if
!defined
(WITHOUT_SRCS
)
269 rm -f
${ISOROOT}/usr
/pkgsrc-all.tgz
270 cd
${PKGSRC_PATH} && tar --exclude distfiles
--exclude packages
--exclude work
--exclude CVS
--exclude .git \
271 -czf
${ISOROOT}/usr
/pkgsrc-all.tgz .
273 rm -f
${ISOROOT}/usr
/src-all.tgz
274 cd
${.CURDIR
}/..
/..
&& tar --exclude .git
--exclude CVS \
275 -czf
${ISOROOT}/usr
/src-all.tgz src
277 rm -f
${ISOROOT}/usr
/src-sys.tgz
278 cd
${.CURDIR
}/..
/..
&& tar --exclude .git
--exclude CVS \
279 -czf
${ISOROOT}/usr
/src-sys.tgz src
/Makefile src
/Makefile.inc1 src
/sys
283 # Customize the ISO by copying rootskels in reverse priority order,
284 # building packages, and doing other post-install tasks.
287 # Copy the rootskels. Allow sources to be owned by someone other
288 # then root (as is common when checked out via git).
290 .for ROOTSKEL in
${ROOTSKELS}
291 cpdup
-X cpignore
-o
${ROOTSKEL} ${ISOROOT}
292 @
test -O
${.CURDIR
} || echo
"chowning copied files to root:wheel"
293 @
test -O
${.CURDIR
} ||
((cd
${ROOTSKEL} && find .
) | fgrep
-v cpignore |
(cd
${ISOROOT} && xargs chown root
:wheel
))
295 (cd
${PKGSRC_PKG_PATH}; tar xzpf
${CVSUP_BOOTSTRAP_KIT}.tgz
)
296 cp
-p
${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr
/local
/bin
/cvsup
${ISOROOT}/usr
/local
/bin
/cvsup
297 cp
-p
${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr
/local
/man
/man1
/cvsup
.1 ${ISOROOT}/usr
/local
/man
/man1
/cvsup
.1
298 pwd_mkdb
-p
-d
${ISOROOT}/etc
${ISOROOT}/etc
/master.passwd
299 .for UPGRADE_ITEM in Makefile \
300 etc.
${MACHINE_ARCH} \
304 periodic
/daily
/Makefile \
305 periodic
/security
/Makefile \
306 periodic
/weekly
/Makefile \
307 periodic
/monthly
/Makefile
308 cp
-R
${.CURDIR
}/..
/etc
/${UPGRADE_ITEM} ${ISOROOT}/etc
/${UPGRADE_ITEM}
311 # Setup some things & mount pkgsrc tree. Use defensive umounts and
312 # rm -rf's to allow restarts. Allow /usr/pkgsrc to be read-only.
314 # If we did not get past the bootstrap we clean out the entire
315 # /usr/pkg infrastructure. Otherwise we attempt to pick up where
318 cp
-p
/etc
/resolv.conf
${ISOROOT}/etc
319 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
320 -@umount
${ISOROOT}/usr
/pkgsrc
/distfiles
321 -@umount
${ISOROOT}/usr
/pkgsrc
322 mkdir
-p
${ISODIR}/distfiles
323 rm -rf
${ISOROOT}/usr
/pkgobj
325 # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable
327 mkdir
-p
${ISOROOT}/usr
/pkgobj
328 mkdir
-p
${ISOROOT}/usr
/pkgobj
/bootstrap
/work
329 mkdir
-p
${ISOROOT}/usr
/pkgsrc
330 mount_null
${PKGSRC_PATH} ${ISOROOT}/usr
/pkgsrc
331 cp
/etc
/shells
${ISOROOT}/usr
/pkgsrc
/distfiles
/.
test > /dev
/null
2>&1 \
332 || mount_null
${ISODIR}/distfiles
${ISOROOT}/usr
/pkgsrc
/distfiles
334 # Bootstrap, if not already installed, and add licenses needed
335 # for the gui release
337 test -e
${ISODIR}/.didbootstrap || \
338 rm -rf
${ISOROOT}/usr
/pkg
${ISOROOT}/var
/db
/pkg \
339 ${ISOROOT}/var
/db
/pkg.refcount
340 test -e
${ISODIR}/.didbootstrap || \
341 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; \
342 ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
343 test -e
${ISODIR}/.didbootstrap || \
344 echo
".ifdef BSD_PKG_MK # added by nrelease" \
345 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
346 test -e
${ISODIR}/.didbootstrap || \
347 echo
"ACCEPTABLE_LICENSES+=openmotif-license" \
348 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
349 test -e
${ISODIR}/.didbootstrap || \
350 echo
"ACCEPTABLE_LICENSES+=vim-license" \
351 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
352 test -e
${ISODIR}/.didbootstrap || \
353 echo
".endif # added by nrelease" \
354 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
355 test -e
${ISODIR}/.didbootstrap || sync
356 test -e
${ISODIR}/.didbootstrap || touch
${ISODIR}/.didbootstrap
358 # Build and install packages, skip packages already installed
360 .for PKG in
${PKGSRC_PACKAGES}
361 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
362 (bmake WRKOBJDIR=/usr/pkgobj check > /dev/null 2>&1 || \
363 bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} clean build install)"
366 # Remove packages which nothing depends on and clean up
368 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
369 -umount
${ISOROOT}/usr
/pkgsrc
/distfiles
370 umount
${ISOROOT}/usr
/pkgsrc
371 rmdir
${ISOROOT}/usr
/pkgsrc
372 rm -rf
${ISOROOT}/usr
/pkgobj
373 rm -f
${ISOROOT}/etc
/resolv.conf
374 makewhatis
${ISOROOT}/usr
/local
/man
375 makewhatis
${ISOROOT}/usr
/pkg
/man
377 # So a CD boot does not complain about a missing aliases database
380 ${CHROOT_CMD} "newaliases"
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 newfs
/dev
/$${vn}s1a
; \
424 mount
/dev
/$${vn}s1a
${IMGMNT}; \
425 cpdup
-vvv
${ISOROOT} ${IMGMNT}; \
426 echo
"fix /etc/fstab" > /dev
/null
; \
427 echo
"${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc
/fstab
; \
428 echo
"proc /proc procfs rw 0 0" >> ${IMGMNT}/etc
/fstab
; \
431 vnconfig
-u
$${vn}; \
436 -umount
${ISOROOT}/usr
/pkgsrc
/distfiles
> /dev
/null
2>&1
437 -umount
${ISOROOT}/usr
/pkgsrc
> /dev
/null
2>&1
438 if
[ -d
${ISOROOT} ]; then chflags
-R noschg
${ISOROOT}; fi
440 rm -rf
${NRLOBJDIR}/nrelease
441 rm -f
${ISODIR}/.didbootstrap
444 rm -rf
${OBJSYS}/${KERNCONF}
446 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
449 rm -rf
${ISODIR}/packages
450 rm -rf
${ISODIR}/distfiles
453 @if
[ ! -d
${PKGSRC_PKG_PATH} ]; then mkdir
-p
${PKGSRC_PKG_PATH}; fi
454 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
455 (cd
${PKGSRC_PKG_PATH}; fetch
${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
459 .if
!exists
(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz
)
460 mkdir
-p
/usr
/release
/bootstrap
461 (cd
${PKGSRC_PATH}/bootstrap
; .
/bootstrap
--workdir
/usr
/release
/bootstrap
)
465 .if
!exists
(${PKGBIN_MKISOFS})
466 (cd
${PKGSRC_PATH}/sysutils
/cdrtools
; bmake
clean build
install)
470 @echo
"make [gui] release - complete build from scratch"
471 @echo
"make [gui] quick - attempt to do an incremental rebuild"
472 @echo
"make [gui] realquick - attempt to restart after world & kernel"
473 @echo
"make [gui] restartpkgs - attempt to restart at the pkg building stage"
475 @echo
"Extra packages may be specified with PKGSRC_EXTRA_PACKAGES"
477 .PHONY
: release quickrel realquickrel
479 .PHONY
: quick realquick
480 .PHONY
: check buildworld1 buildworld2
481 .PHONY
: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
482 .PHONY
: clean realclean fetch help
all mkaliases srcs
484 .
include <bsd.prog.mk
>