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
136 IMGUSBDEV ?
= /dev
/da0
138 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
139 # the additional '/nrelease' manually, as a safety measure.
143 #########################################################################
145 #########################################################################
147 release
: check clean buildworld1 buildkernel1 \
148 buildiso srcs customizeiso mklocatedb \
151 quickrel
: check clean buildworld2 buildkernel2 \
152 buildiso srcs customizeiso mklocatedb \
155 realquickrel
: check clean \
156 buildiso srcs customizeiso mklocatedb \
159 restartpkgs
: check customizeiso mklocatedb mkiso mkimg
163 realquick
: realquickrel
166 #########################################################################
167 # CORE SUPPORT TARGETS #
168 #########################################################################
171 .if
!exists
(${PKGBIN_PKG_ADMIN})
172 @echo
"You never bootstrapped pkgsrc on your machine. You can install it with:"
173 @echo
" make pkgsrc_bootstrap"
175 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
176 @echo
"The cvsup bootstrap kit is not installed. You can install it with:"
179 .if
!exists
(${PKGBIN_MKISOFS})
181 @echo
"Your machine does not have cdrtools installed. You can install it with:"
182 @echo
" make pkgsrc_cdrecord"
184 .if
!defined
(PKGSRC_PATH
)
185 @echo
"Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
186 @echo
"package building. For example /usr/pkgsrc. See the Makefile"
187 @echo
"in /usr if you are unfamiliar with pkgsrc."
189 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
192 .if
!exists
(${PKGBIN_MKISOFS})
195 .if
!defined
(PKGSRC_PATH
)
199 buildworld1 buildworld2
:
200 cd
${.CURDIR
}/..
; ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} make
-DWANT_INSTALLER
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//}
202 buildkernel1 buildkernel2
:
205 for kernconf in
${KERNCONF}; do \
206 ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} \
207 make
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//} \
208 KERNCONF
=$${kernconf} KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
213 for kernconf in
${KERNCONF}; do \
214 ${WORLD_CCVER
:C
/^..
*$/WORLD_CCVER
=/}${WORLD_CCVER} \
215 make
${.TARGET
:C
/build
(.
*)2/quick\
1/:C
/1//} \
216 KERNCONF
=$${kernconf} \
217 $${first
:+-DNO_MODULES
}; \
222 # note that we do not want to mess with any /usr/obj directories not related
223 # to buildworld, buildkernel, or nrelease, so we must supply the proper
224 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
225 # buildkernel mechanism.
228 if
[ ! -d
${ISOROOT} ]; then mkdir
-p
${ISOROOT}; fi
229 if
[ ! -d
${NRLOBJDIR}/nrelease
]; then mkdir
-p
${NRLOBJDIR}/nrelease
; fi
230 ( cd
${.CURDIR
}/..
; make
-DWANT_INSTALLER DESTDIR
=${ISOROOT} installworld
)
231 ( cd
${.CURDIR
}/..
/etc
; MAKEOBJDIRPREFIX
=${NRLOBJDIR}/nrelease \
232 make
-m
${.CURDIR
}/..
/share
/mk DESTDIR
=${ISOROOT} distribution
)
233 cpdup
${ISOROOT}/etc
${ISOROOT}/etc.hdd
235 if
[ ! -d
${ISOROOT}/kernel.smp
/boot
]; then mkdir
-p
${ISOROOT}/kernel.smp
/boot
; fi
237 make installkernel DESTDIR
=${ISOROOT} \
238 KERNCONF
=DFLYLIVE DESTKERNNAME
=kernel KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
240 make installkernel DESTDIR
=${ISOROOT} \
241 KERNCONF
=VKERNEL DESTKERNNAME
=kernel.VKERNEL
-DNO_MODULES KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
243 make installkernel DESTDIR
=${ISOROOT}/kernel.smp \
244 KERNCONF
=DFLYLIVE-SMP DESTKERNNAME
=kernel KERNCONFDIR
=${.CURDIR
}/gui
/root
; \
246 make installkernel DESTDIR
=${ISOROOT}/kernel.smp \
247 KERNCONF
=DFLYLIVE-SMP-NOAPIC DESTKERNNAME
=kernel.noapic \
248 KERNCONFDIR
=${.CURDIR
}/gui
/root
-DNO_MODULES
;
252 for kernconf in
${KERNCONF}; do \
253 make DESTDIR
=${ISOROOT} \
254 installkernel KERNCONF
=$${kernconf} \
255 $${first
:+DESTKERNNAME
=kernel.
$${kernconf}} \
256 $${first
:+-DNO_MODULES
}; \
260 ln
-s kernel
${ISOROOT}/boot
/kernel.BOOTP
261 mtree
-deU
-f
${.CURDIR
}/..
/etc
/mtree
/BSD.local.
dist -p
${ISOROOT}/usr
/local
/
262 mtree
-deU
-f
${.CURDIR
}/..
/etc
/mtree
/BSD.var.
dist -p
${ISOROOT}/var
263 dev_mkdb
-f
${ISOROOT}/var
/run
/dev.db
${ISOROOT}/dev
265 # Release CD: Kernel sources (~16M) and the full pkgsrc tree (~27M)
266 # Release DVD: Full sources (~90M) and the full pkgsrc tree (~27M)
269 .if
!defined
(WITHOUT_SRCS
)
270 rm -f
${ISOROOT}/usr
/pkgsrc-all.tgz
271 cd
${PKGSRC_PATH} && tar --exclude distfiles
--exclude packages
--exclude work
--exclude CVS
--exclude .git \
272 -czf
${ISOROOT}/usr
/pkgsrc-all.tgz .
274 rm -f
${ISOROOT}/usr
/src-all.tgz
275 cd
${.CURDIR
}/..
&& tar --exclude .git
--exclude CVS
-s
'/^\./src/' \
276 -czf
${ISOROOT}/usr
/src-all.tgz .
278 rm -f
${ISOROOT}/usr
/src-sys.tgz
279 cd
${.CURDIR
}/..
&& tar --exclude .git
--exclude CVS
-s
'/^\./src/' \
280 -czf
${ISOROOT}/usr
/src-sys.tgz .
/Makefile .
/Makefile.inc1 .
/sys
284 # Customize the ISO by copying rootskels in reverse priority order,
285 # building packages, and doing other post-install tasks.
288 # Copy the rootskels. Allow sources to be owned by someone other
289 # then root (as is common when checked out via git).
291 .for ROOTSKEL in
${ROOTSKELS}
292 cpdup
-X cpignore
-o
${ROOTSKEL} ${ISOROOT}
293 @
test -O
${.CURDIR
} || echo
"chowning copied files to root:wheel"
294 @
test -O
${.CURDIR
} ||
((cd
${ROOTSKEL} && find .
) | fgrep
-v cpignore |
(cd
${ISOROOT} && xargs chown root
:wheel
))
296 (cd
${PKGSRC_PKG_PATH}; tar xzpf
${CVSUP_BOOTSTRAP_KIT}.tgz
)
297 cp
-p
${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr
/local
/bin
/cvsup
${ISOROOT}/usr
/local
/bin
/cvsup
298 cp
-p
${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr
/local
/man
/man1
/cvsup
.1 ${ISOROOT}/usr
/local
/man
/man1
/cvsup
.1
299 pwd_mkdb
-p
-d
${ISOROOT}/etc
${ISOROOT}/etc
/master.passwd
300 .for UPGRADE_ITEM in Makefile \
301 etc.
${MACHINE_ARCH} \
305 periodic
/daily
/Makefile \
306 periodic
/security
/Makefile \
307 periodic
/weekly
/Makefile \
308 periodic
/monthly
/Makefile
309 cp
-R
${.CURDIR
}/..
/etc
/${UPGRADE_ITEM} ${ISOROOT}/etc
/${UPGRADE_ITEM}
312 # Setup some things & mount pkgsrc tree. Use defensive umounts and
313 # rm -rf's to allow restarts. Allow /usr/pkgsrc to be read-only.
315 # If we did not get past the bootstrap we clean out the entire
316 # /usr/pkg infrastructure. Otherwise we attempt to pick up where
319 cp
-p
/etc
/resolv.conf
${ISOROOT}/etc
320 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
321 -@umount
${ISOROOT}/usr
/pkgsrc
/distfiles
322 -@umount
${ISOROOT}/usr
/pkgsrc
323 mkdir
-p
${ISODIR}/distfiles
324 rm -rf
${ISOROOT}/usr
/pkgobj
326 # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable
328 mkdir
-p
${ISOROOT}/usr
/pkgobj
329 mkdir
-p
${ISOROOT}/usr
/pkgobj
/bootstrap
330 mkdir
-p
${ISOROOT}/usr
/pkgsrc
331 mount_null
${PKGSRC_PATH} ${ISOROOT}/usr
/pkgsrc
332 cp
/etc
/shells
${ISOROOT}/usr
/pkgsrc
/distfiles
/.
test > /dev
/null
2>&1 \
333 || mount_null
${ISODIR}/distfiles
${ISOROOT}/usr
/pkgsrc
/distfiles
335 # Bootstrap, if not already installed, and add licenses needed
336 # for the gui release
338 test -e
${ISODIR}/.didbootstrap || \
339 rm -rf
${ISOROOT}/usr
/pkg
${ISOROOT}/var
/db
/pkg \
340 ${ISOROOT}/var
/db
/pkg.refcount
341 test -e
${ISODIR}/.didbootstrap || \
342 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; \
343 ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
344 test -e
${ISODIR}/.didbootstrap || \
345 echo
".ifdef BSD_PKG_MK # added by nrelease" \
346 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
347 test -e
${ISODIR}/.didbootstrap || \
348 echo
"ACCEPTABLE_LICENSES+=openmotif-license" \
349 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
350 test -e
${ISODIR}/.didbootstrap || \
351 echo
"ACCEPTABLE_LICENSES+=vim-license" \
352 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
353 test -e
${ISODIR}/.didbootstrap || \
354 echo
".endif # added by nrelease" \
355 >> ${ISOROOT}/usr
/pkg
/etc
/mk.conf
356 test -e
${ISODIR}/.didbootstrap || sync
357 test -e
${ISODIR}/.didbootstrap || touch
${ISODIR}/.didbootstrap
359 # Build and install packages, skip packages already installed
361 .for PKG in
${PKGSRC_PACKAGES}
362 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
363 (bmake WRKOBJDIR=/usr/pkgobj check > /dev/null 2>&1 || \
364 bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} clean build install)"
367 # Remove packages which nothing depends on and clean up
369 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
370 -umount
${ISOROOT}/usr
/pkgsrc
/distfiles
371 umount
${ISOROOT}/usr
/pkgsrc
372 rmdir
${ISOROOT}/usr
/pkgsrc
373 rm -rf
${ISOROOT}/usr
/pkgobj
374 rm -f
${ISOROOT}/etc
/resolv.conf
375 makewhatis
${ISOROOT}/usr
/local
/man
376 makewhatis
${ISOROOT}/usr
/pkg
/man
381 ( find
-s
${ISOROOT} -path
${ISOROOT}/tmp
-or \
382 -path
${ISOROOT}/usr
/tmp
-or
-path
${ISOROOT}/var
/tmp \
383 -prune
-o
-print | sed
-e
's#^${ISOROOT}##g' | \
384 /usr
/libexec
/locate.mklocatedb \
385 -presort
>${ISOROOT}/var
/db
/locate.database
)
388 ( cd
${ISOROOT}; ${PKGBIN_MKISOFS} -b boot
/cdboot
-no-emul-boot \
389 -R
-J
-o
${ISOFILE} \
390 -V DragonFly-
`${.CURDIR}/../tools/gitrev.sh | cut -c -22` .
)
395 if
[ ! -d
${IMGMNT} ]; then mkdir
-p
${IMGMNT}; fi
397 echo
"determine required image size" > /dev
/null
; \
398 sz
=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \
399 echo
"add 15% more space as required" > /dev
/null
; \
400 sz
=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
401 dd if
=/dev
/zero of
=${IMGFILE} bs
=1m count
=$${sz}; \
402 fdisk
-IB
-p
${IMGFILE}; \
403 echo
"determine free vn device" > /dev
/null
; \
404 vn
=`vnconfig -l | grep "not in use" | head -n 1 | cut -f 1 -d:`; \
405 vnconfig
-e
-s labels
$${vn} ${IMGFILE}; \
406 echo
"write standard disklabel" > /dev
/null
; \
407 disklabel
-w
-r
$${vn}s1 auto
; \
408 echo
"read disklabel back" > /dev
/null
; \
409 disklabel
-r
$${vn}s1
> ${IMGFILE}.label
; \
410 echo
"determine number of sectors of whole disk" > /dev
/null
; \
411 secs
=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \
412 echo
"and add a: partition" > /dev
/null
; \
413 echo
" a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label
; \
414 echo
"write modified disklabel back" > /dev
/null
; \
415 disklabel
-R
-r
$${vn}s1
${IMGFILE}.label
; \
416 rm ${IMGFILE}.label
; \
417 echo
"write bootsector" > /dev
/null
; \
418 disklabel
-B
$${vn}s1
; \
419 newfs
/dev
/$${vn}s1a
; \
420 mount
/dev
/$${vn}s1a
${IMGMNT}; \
421 cpdup
-vvv
${ISOROOT} ${IMGMNT}; \
422 echo
"fix /etc/fstab" > /dev
/null
; \
423 echo
"${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc
/fstab
; \
424 echo
"proc /proc procfs rw 0 0" >> ${IMGMNT}/etc
/fstab
; \
427 vnconfig
-u
$${vn}; \
432 -umount
${ISOROOT}/usr
/pkgsrc
/distfiles
> /dev
/null
2>&1
433 -umount
${ISOROOT}/usr
/pkgsrc
> /dev
/null
2>&1
434 if
[ -d
${ISOROOT} ]; then chflags
-R noschg
${ISOROOT}; fi
436 rm -rf
${NRLOBJDIR}/nrelease
437 rm -f
${ISODIR}/.didbootstrap
440 rm -rf
${OBJSYS}/${KERNCONF}
442 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
445 rm -rf
${ISODIR}/packages
446 rm -rf
${ISODIR}/distfiles
449 @if
[ ! -d
${PKGSRC_PKG_PATH} ]; then mkdir
-p
${PKGSRC_PKG_PATH}; fi
450 .if
!exists
(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
451 (cd
${PKGSRC_PKG_PATH}; fetch
${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz
)
455 .if
!exists
(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz
)
456 mkdir
-p
/usr
/release
/bootstrap
457 (cd
${PKGSRC_PATH}/bootstrap
; .
/bootstrap
--workdir
/usr
/release
/bootstrap
)
461 .if
!exists
(${PKGBIN_MKISOFS})
462 (cd
${PKGSRC_PATH}/sysutils
/cdrtools
; bmake
clean build
install)
466 @echo
"make [gui] release - complete build from scratch"
467 @echo
"make [gui] quick - attempt to do an incremental rebuild"
468 @echo
"make [gui] realquick - attempt to restart after world & kernel"
469 @echo
"make [gui] restartpkgs - attempt to restart at the pkg building stage"
471 @echo
"Extra packages may be specified with PKGSRC_EXTRA_PACKAGES"
473 .PHONY
: release quickrel realquickrel
475 .PHONY
: quick realquick
476 .PHONY
: check buildworld1 buildworld2
477 .PHONY
: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
478 .PHONY
: clean realclean fetch help
all srcs
480 .
include <bsd.prog.mk
>