xref: /dragonfly/nrelease/Makefile (revision a2f841ed)
1bfe20b28SSascha Wildner# $DragonFly: src/nrelease/Makefile,v 1.90 2008/09/01 21:20:30 swildner Exp $
26ca9a59cSMatthew Dillon#
35b22b655SMatthew Dillon
49b29c40aSMatthew Dillon#########################################################################
59b29c40aSMatthew Dillon#				ENHANCEMENTS	 			#
69b29c40aSMatthew Dillon#########################################################################
79b29c40aSMatthew Dillon
8f4ec1279SSascha Wildner# New method e.g. 'make gui release'.  A series of enhancement
99b29c40aSMatthew Dillon# targes may be specified which set make variables which enhance
109b29c40aSMatthew Dillon# the build in various ways.
119b29c40aSMatthew Dillon#
12b9c3e754SMichael Neumanngui installer img:
139b29c40aSMatthew Dillon
149b29c40aSMatthew Dillon#########################################################################
159b29c40aSMatthew Dillon#				 SETUP		 			#
169b29c40aSMatthew Dillon#########################################################################
179b29c40aSMatthew Dillon
186ca9a59cSMatthew DillonISODIR ?= /usr/release
195ec00f8aSSascha WildnerISOROOT ?= ${ISODIR}/root
206ca9a59cSMatthew DillonOBJSYS= ${.OBJDIR}/../sys
21bfe20b28SSascha Wildner
22bfe20b28SSascha Wildner.if make(gui)
23bfe20b28SSascha WildnerKERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
24bfe20b28SSascha Wildner.else
251d3eb8c5SMatthew DillonKERNCONF ?= GENERIC VKERNEL
26bfe20b28SSascha Wildner.endif
276ca9a59cSMatthew Dillon
28cc224c64SJoerg SonnenbergerPKGSRC_PREFIX?=		/usr/pkg
29bce110a5SMatthew DillonPKGBIN_PKG_ADD?=	${PKGSRC_PREFIX}/sbin/pkg_add
3095b64753SMatthew DillonPKGBIN_PKG_DELETE?=	${PKGSRC_PREFIX}/sbin/pkg_delete
31c791834fSJoerg SonnenbergerPKGBIN_PKG_ADMIN?=	${PKGSRC_PREFIX}/sbin/pkg_admin
32bce110a5SMatthew DillonPKGBIN_MKISOFS?=	${PKGSRC_PREFIX}/bin/mkisofs
33bce110a5SMatthew DillonPKGSRC_PKG_PATH?=	${ISODIR}/packages
34bce110a5SMatthew DillonPKGSRC_DB?=		/var/db/pkg
35af88d908SJustin C. SherrillPKGSRC_BOOTSTRAP_URL?=	http://avalon.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.12.0-RELEASE-BUILD
364b08f3dfSMatthew DillonCVSUP_BOOTSTRAP_KIT?=	cvsup-bootstrap-20070716
37bce110a5SMatthew Dillon
38cc55a235SSimon Schubert# We use env -i in the chroot, so that environment variables won't
39cc55a235SSimon Schubert# disturb any (pkgsrc) build.  This has happened for TARGET_ARCH,
40cc55a235SSimon Schubert# which is used by gmake in completely different context.
41e2dbfa0bSThomas Nikolajsen#
42cc55a235SSimon SchubertCHROOT_CMD?=		env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c
43cc55a235SSimon Schubert
448abe78a1SMatthew Dillon# User may specify extra packages in addition to the defaults
4595b64753SMatthew Dillon#
468abe78a1SMatthew DillonPKGSRC_EXTRA_PACKAGES?=
478abe78a1SMatthew Dillon
488abe78a1SMatthew Dillon# Pkgsrc packages to be built and installed on the release ISO
498abe78a1SMatthew Dillon#
508abe78a1SMatthew DillonPKGSRC_PACKAGES?=	pkgtools/pkg_leaves \
518abe78a1SMatthew Dillon			pkgtools/pkg_tarup \
528abe78a1SMatthew Dillon			devel/scmgit \
53fbc26094SSascha Wildner			net/isc-dhcp4 \
54fbc26094SSascha Wildner			net/isc-dhcpd4 \
558abe78a1SMatthew Dillon			sysutils/cdrtools \
568abe78a1SMatthew Dillon			${PKGSRC_EXTRA_PACKAGES}
57fbc26094SSascha Wildner
58fbc26094SSascha Wildner# pkgsrc options to use when building packages
59fbc26094SSascha Wildner#
609ecb41e5SSascha WildnerPKGSRC_OPTIONS+=	PKG_DEFAULT_OPTIONS='dri inet6'
61fbc26094SSascha Wildner.if !make(gui)
629ecb41e5SSascha WildnerPKGSRC_OPTIONS+=	PKG_OPTIONS.scmgit=-scmgit-gui
63fbc26094SSascha Wildner.endif
648188de86SMatthew Dillon
6595b64753SMatthew Dillon# Even though buildiso wipes the packages, our check target has to run
6695b64753SMatthew Dillon# first and old packages (listed as they appear in pkg_info) must be
6795b64753SMatthew Dillon# cleaned out in order for the pkg_add -n test we use in the check target
6895b64753SMatthew Dillon# to operate properly.
6995b64753SMatthew Dillon#
70fbc26094SSascha WildnerOLD_PKGSRC_PACKAGES?=	cdrtools-2.01.01.27nb1 \
71fbc26094SSascha Wildner			cdrecord-2.00.3nb2 \
72fbc26094SSascha Wildner			bootstrap-kit-20070205 \
73fbc26094SSascha Wildner			dfuibe_installer-1.1.6 \
74fbc26094SSascha Wildner			gettext-lib-0.14.5 \
75fbc26094SSascha Wildner			dfuibe_installer-1.1.7nb1 \
76fbc26094SSascha Wildner			dfuife_curses-1.5 \
77fbc26094SSascha Wildner			gettext-lib-0.14.6 \
78fbc26094SSascha Wildner			gettext-tools-0.14.6nb1 \
79fbc26094SSascha Wildner			libaura-3.1 \
80fbc26094SSascha Wildner			libdfui-4.2 \
81fbc26094SSascha Wildner			libinstaller-5.1 \
82fbc26094SSascha Wildner			bootstrap-kit-20080211 \
83fbc26094SSascha Wildner			cdrtools-ossdvd-2.01.1.36nb2 \
84fbc26094SSascha Wildner			isc-dhcp-base-4.0.0 \
85fbc26094SSascha Wildner			isc-dhcp-server-4.0.0
8695b64753SMatthew Dillon
878188de86SMatthew Dillon# Specify which root skeletons are required, and let the user include
88e2dbfa0bSThomas Nikolajsen# their own.  They are copied into ISODIR during the `customizeiso'
898188de86SMatthew Dillon# target; each overwrites the last.
908188de86SMatthew Dillon#
91fbc26094SSascha WildnerREQ_ROOTSKELS=	${.CURDIR}/root \
92fbc26094SSascha Wildner		${.CURDIR}/installer
93cc224c64SJoerg SonnenbergerROOTSKELS?=	${REQ_ROOTSKELS}
94cc224c64SJoerg Sonnenberger
95fbc26094SSascha Wildner.if make(gui)
96bfe20b28SSascha WildnerISOFILE?=		${ISODIR}/dfly-gui.iso
97b9c3e754SMichael NeumannIMGFILE?=		${ISODIR}/dfly-gui.img
980936984eSMatthew DillonPKGSRC_PACKAGES+=	meta-pkgs/modular-xorg-apps \
990936984eSMatthew Dillon			meta-pkgs/modular-xorg-drivers \
1000936984eSMatthew Dillon			meta-pkgs/modular-xorg-fonts \
1010936984eSMatthew Dillon			meta-pkgs/modular-xorg-libs \
102fbc26094SSascha Wildner			wm/fluxbox \
1030936984eSMatthew Dillon			wm/fvwm \
104fbc26094SSascha Wildner			www/firefox3 \
105fbc26094SSascha Wildner			print/xpdf \
106fbc26094SSascha Wildner			shells/zsh \
107fbc26094SSascha Wildner			editors/emacs \
108fbc26094SSascha Wildner			editors/vim \
109fbc26094SSascha Wildner			chat/pidgin \
110fbc26094SSascha Wildner			chat/irssi \
111fbc26094SSascha Wildner			chat/xchat \
1120936984eSMatthew Dillon			x11/modular-xorg-server \
113fbc26094SSascha Wildner			x11/rxvt-unicode \
114fbc26094SSascha Wildner			x11/eterm \
115fbc26094SSascha Wildner			lang/perl5 \
116fbc26094SSascha Wildner			editors/nano \
117fbc26094SSascha Wildner			shells/bash \
118fbc26094SSascha Wildner			devel/exctags \
119fbc26094SSascha Wildner			archivers/zip \
120fbc26094SSascha Wildner			security/sudo \
121fbc26094SSascha Wildner			www/links-gui \
122fbc26094SSascha Wildner			net/nmap \
123fbc26094SSascha Wildner			net/wget \
124fbc26094SSascha Wildner			fonts/terminus-font \
125fbc26094SSascha Wildner			net/rsync \
126fbc26094SSascha Wildner			sysutils/idesk \
1270936984eSMatthew Dillon			time/asclock \
128fbc26094SSascha Wildner			misc/screen
129bfe20b28SSascha WildnerROOTSKELS+=		${.CURDIR}/gui
130bfe20b28SSascha Wildner.endif
131bfe20b28SSascha Wildner
1323f279b9eSSascha WildnerISOFILE ?= ${ISODIR}/dfly.iso
133b9c3e754SMichael NeumannIMGFILE ?= ${ISODIR}/dfly.img
134b9c3e754SMichael Neumann
13560b68cbbSMichael NeumannIMGMNT ?= ${ISODIR}/mnt
136*a2f841edSMatthew Dillon
137*a2f841edSMatthew Dillon# USB umass now probes starting at da8, so the usb stick is
138*a2f841edSMatthew Dillon# probably sitting on da8.
139*a2f841edSMatthew Dillon#
140*a2f841edSMatthew DillonIMGUSBDEV ?= /dev/da8
1413f279b9eSSascha Wildner
1425b22b655SMatthew Dillon# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
1435b22b655SMatthew Dillon# the additional '/nrelease' manually, as a safety measure.
1445b22b655SMatthew Dillon#
1455b22b655SMatthew DillonNRLOBJDIR?= /usr/obj
1465b22b655SMatthew Dillon
1478188de86SMatthew Dillon#########################################################################
1488188de86SMatthew Dillon#				BASE ISO TARGETS 			#
1498188de86SMatthew Dillon#########################################################################
1506ca9a59cSMatthew Dillon
1517ebbae99SSascha Wildnerrelease:	check clean buildworld1 buildkernel1 \
15203e2a3c5SSascha Wildner		buildiso srcs customizeiso mklocatedb \
1530936984eSMatthew Dillon		mkiso mkimg
1546ca9a59cSMatthew Dillon
1557ebbae99SSascha Wildnerquickrel:	check clean buildworld2 buildkernel2 \
15603e2a3c5SSascha Wildner		buildiso srcs customizeiso mklocatedb \
1570936984eSMatthew Dillon		mkiso mkimg
1588188de86SMatthew Dillon
15903e2a3c5SSascha Wildnerrealquickrel:	check clean \
16003e2a3c5SSascha Wildner		buildiso srcs customizeiso mklocatedb \
1610936984eSMatthew Dillon		mkiso mkimg
1626ca9a59cSMatthew Dillon
16303e2a3c5SSascha Wildnerrestartpkgs:	check customizeiso mklocatedb mkiso mkimg
1645af45f85SMatthew Dillon
1659b29c40aSMatthew Dillonquick:		quickrel
1669b29c40aSMatthew Dillon
1679b29c40aSMatthew Dillonrealquick:	realquickrel
1689b29c40aSMatthew Dillon
1695af45f85SMatthew Dillon
1709b29c40aSMatthew Dillon#########################################################################
1719b29c40aSMatthew Dillon#			   CORE SUPPORT TARGETS 			#
1729b29c40aSMatthew Dillon#########################################################################
1739b29c40aSMatthew Dillon
174d2582113SChris Presseycheck:
1750936984eSMatthew Dillon.if !exists(${PKGBIN_PKG_ADMIN})
1760936984eSMatthew Dillon	@echo "You never bootstrapped pkgsrc on your machine.  You can install it with:"
1770936984eSMatthew Dillon	@echo "    make pkgsrc_bootstrap"
1780936984eSMatthew Dillon.endif
1790a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
1800a1628e7SMatthew Dillon	@echo "The cvsup bootstrap kit is not installed.  You can install it with:"
181f4ec1279SSascha Wildner	@echo "    make fetch"
1820936984eSMatthew Dillon.endif
1830936984eSMatthew Dillon.if !exists (${PKGBIN_MKISOFS})
1840936984eSMatthew Dillon	@echo
1850936984eSMatthew Dillon	@echo "Your machine does not have cdrtools installed.  You can install it with:"
1860936984eSMatthew Dillon	@echo "    make pkgsrc_cdrecord"
1870a1628e7SMatthew Dillon.endif
188fbc26094SSascha Wildner.if !defined(PKGSRC_PATH)
189fbc26094SSascha Wildner	@echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
1905af45f85SMatthew Dillon	@echo "package building.  For example /usr/pkgsrc.  See the Makefile"
1915af45f85SMatthew Dillon	@echo "in /usr if you are unfamiliar with pkgsrc."
1920936984eSMatthew Dillon.endif
1930936984eSMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
1940936984eSMatthew Dillon	@exit 1
1950936984eSMatthew Dillon.endif
1960936984eSMatthew Dillon.if !exists (${PKGBIN_MKISOFS})
1970936984eSMatthew Dillon	@exit 1
1980936984eSMatthew Dillon.endif
1990936984eSMatthew Dillon.if !defined(PKGSRC_PATH)
200fbc26094SSascha Wildner	@exit 1
201fbc26094SSascha Wildner.endif
2022e3f8f38SMatthew Dillon
203588a679cSSimon Schubertbuildworld1 buildworld2:
204f4ec1279SSascha Wildner	cd ${.CURDIR}/..; ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} make -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
2056ca9a59cSMatthew Dillon
206588a679cSSimon Schubertbuildkernel1 buildkernel2:
207bfe20b28SSascha Wildner.if make(gui)
208bfe20b28SSascha Wildner	cd ${.CURDIR}/..; \
209bfe20b28SSascha Wildner	for kernconf in ${KERNCONF}; do \
210448b21e7SSimon Schubert		${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
21182f56cacSSimon Schubert		make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
212bfe20b28SSascha Wildner			KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \
213bfe20b28SSascha Wildner	done
214bfe20b28SSascha Wildner.else
215588a679cSSimon Schubert	cd ${.CURDIR}/..; \
216588a679cSSimon Schubert	first=; \
217588a679cSSimon Schubert	for kernconf in ${KERNCONF}; do \
218448b21e7SSimon Schubert		${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
21982f56cacSSimon Schubert		make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
220588a679cSSimon Schubert			KERNCONF=$${kernconf} \
221588a679cSSimon Schubert			$${first:+-DNO_MODULES}; \
222588a679cSSimon Schubert		first=done; \
223588a679cSSimon Schubert	done
224bfe20b28SSascha Wildner.endif
2256ca9a59cSMatthew Dillon
2265b22b655SMatthew Dillon# note that we do not want to mess with any /usr/obj directories not related
2275b22b655SMatthew Dillon# to buildworld, buildkernel, or nrelease, so we must supply the proper
2285b22b655SMatthew Dillon# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
2295b22b655SMatthew Dillon# buildkernel mechanism.
2305b22b655SMatthew Dillon#
2316ca9a59cSMatthew Dillonbuildiso:
2326ca9a59cSMatthew Dillon	if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
2335b22b655SMatthew Dillon	if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
234f4ec1279SSascha Wildner	( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
235ab64cf06SSimon Schubert	( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
236ab64cf06SSimon Schubert		make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
23721aa02d0SChris Pressey	cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
238bfe20b28SSascha Wildner.if make(gui)
239fbc26094SSascha Wildner	if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi
240bfe20b28SSascha Wildner	cd ${.CURDIR}/..; \
241bfe20b28SSascha Wildner	make installkernel DESTDIR=${ISOROOT} \
242bfe20b28SSascha Wildner	KERNCONF=DFLYLIVE DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
243bfe20b28SSascha Wildner	cd ${.CURDIR}/..; \
244bfe20b28SSascha Wildner	make installkernel DESTDIR=${ISOROOT} \
245bfe20b28SSascha Wildner	KERNCONF=VKERNEL DESTKERNNAME=kernel.VKERNEL -DNO_MODULES KERNCONFDIR=${.CURDIR}/gui/root; \
246bfe20b28SSascha Wildner	cd ${.CURDIR}/..; \
247bfe20b28SSascha Wildner	make installkernel DESTDIR=${ISOROOT}/kernel.smp \
248bfe20b28SSascha Wildner	KERNCONF=DFLYLIVE-SMP DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
249bfe20b28SSascha Wildner	cd ${.CURDIR}/..; \
250bfe20b28SSascha Wildner	make installkernel DESTDIR=${ISOROOT}/kernel.smp \
251bfe20b28SSascha Wildner	KERNCONF=DFLYLIVE-SMP-NOAPIC DESTKERNNAME=kernel.noapic \
252bfe20b28SSascha Wildner		KERNCONFDIR=${.CURDIR}/gui/root -DNO_MODULES;
253bfe20b28SSascha Wildner.else
254588a679cSSimon Schubert	cd ${.CURDIR}/..; \
255588a679cSSimon Schubert	first=; \
256588a679cSSimon Schubert	for kernconf in ${KERNCONF}; do \
257588a679cSSimon Schubert		make DESTDIR=${ISOROOT} \
258588a679cSSimon Schubert			installkernel KERNCONF=$${kernconf} \
259588a679cSSimon Schubert			$${first:+DESTKERNNAME=kernel.$${kernconf}} \
260588a679cSSimon Schubert			$${first:+-DNO_MODULES}; \
261588a679cSSimon Schubert		first=done; \
262588a679cSSimon Schubert	done
263bfe20b28SSascha Wildner.endif
2643f6dbfa9SThomas Nikolajsen	ln -s kernel ${ISOROOT}/boot/kernel.BOOTP
2656ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
2666ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
2676ca9a59cSMatthew Dillon	dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
2688188de86SMatthew Dillon
269e2dbfa0bSThomas Nikolajsen# Release CD: Kernel sources (~16M) and the full pkgsrc tree (~27M)
270c19c746bSMatthew Dillon# Release DVD: Full sources (~90M) and the full pkgsrc tree (~27M)
27119d86faaSMatthew Dillon#
272e2dbfa0bSThomas Nikolajsensrcs:
273e2dbfa0bSThomas Nikolajsen.if !defined(WITHOUT_SRCS)
274e2dbfa0bSThomas Nikolajsen	rm -f ${ISOROOT}/usr/pkgsrc-all.tgz
275e2dbfa0bSThomas Nikolajsen	cd ${PKGSRC_PATH} && tar --exclude distfiles --exclude packages --exclude work --exclude CVS --exclude .git \
276c19c746bSMatthew Dillon		-czf ${ISOROOT}/usr/pkgsrc-all.tgz .
277c19c746bSMatthew Dillon.if make(gui)
278e2dbfa0bSThomas Nikolajsen	rm -f ${ISOROOT}/usr/src-all.tgz
2793617b2c9SSascha Wildner	cd ${.CURDIR}/.. && tar --exclude .git --exclude CVS -s '/^\./src/' \
2803617b2c9SSascha Wildner		-czf ${ISOROOT}/usr/src-all.tgz .
281c19c746bSMatthew Dillon.else
282e2dbfa0bSThomas Nikolajsen	rm -f ${ISOROOT}/usr/src-sys.tgz
2833617b2c9SSascha Wildner	cd ${.CURDIR}/.. && tar --exclude .git --exclude CVS -s '/^\./src/' \
2843617b2c9SSascha Wildner		-czf ${ISOROOT}/usr/src-sys.tgz ./Makefile ./Makefile.inc1 ./sys
285c19c746bSMatthew Dillon.endif
28666b79064SMatthew Dillon.endif
28719d86faaSMatthew Dillon
2885af45f85SMatthew Dillon# Customize the ISO by copying rootskels in reverse priority order,
2895af45f85SMatthew Dillon# building packages, and doing other post-install tasks.
2905af45f85SMatthew Dillon#
2918188de86SMatthew Dilloncustomizeiso:
2925af45f85SMatthew Dillon	# Copy the rootskels.  Allow sources to be owned by someone other
2935af45f85SMatthew Dillon	# then root (as is common when checked out via git).
2945af45f85SMatthew Dillon	#
2958188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS}
2968188de86SMatthew Dillon	cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
2975af45f85SMatthew Dillon	@test -O ${.CURDIR} || echo "chowning copied files to root:wheel"
2985af45f85SMatthew Dillon	@test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel))
2998188de86SMatthew Dillon.endfor
300fbc26094SSascha Wildner	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
3010a1628e7SMatthew Dillon	cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
302c751e497SSascha Wildner	cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/man/man1/cvsup.1 ${ISOROOT}/usr/local/man/man1/cvsup.1
3037249926bSMatthew Dillon	pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
3044fba3387SChris Pressey.for UPGRADE_ITEM in Makefile			\
3054fba3387SChris Pressey		     etc.${MACHINE_ARCH} 	\
3064fba3387SChris Pressey		     isdn/Makefile		\
3074fba3387SChris Pressey		     rc.d/Makefile		\
3084fba3387SChris Pressey		     periodic/Makefile		\
3094fba3387SChris Pressey		     periodic/daily/Makefile	\
3104fba3387SChris Pressey		     periodic/security/Makefile	\
3114fba3387SChris Pressey		     periodic/weekly/Makefile	\
3124fba3387SChris Pressey		     periodic/monthly/Makefile
3134fba3387SChris Pressey	cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
3144fba3387SChris Pressey.endfor
3158abe78a1SMatthew Dillon	#
3168abe78a1SMatthew Dillon	# Setup some things & mount pkgsrc tree.  Use defensive umounts and
3178abe78a1SMatthew Dillon	# rm -rf's to allow restarts.  Allow /usr/pkgsrc to be read-only.
3188abe78a1SMatthew Dillon	#
3198abe78a1SMatthew Dillon	# If we did not get past the bootstrap we clean out the entire
3208abe78a1SMatthew Dillon	# /usr/pkg infrastructure.  Otherwise we attempt to pick up where
3218abe78a1SMatthew Dillon	# we left off.
3228abe78a1SMatthew Dillon	#
323fbc26094SSascha Wildner	cp -p /etc/resolv.conf ${ISOROOT}/etc
324cc55a235SSimon Schubert	${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
3258abe78a1SMatthew Dillon	-@umount ${ISOROOT}/usr/pkgsrc/distfiles
3268abe78a1SMatthew Dillon	-@umount ${ISOROOT}/usr/pkgsrc
3278abe78a1SMatthew Dillon	mkdir -p ${ISODIR}/distfiles
3288abe78a1SMatthew Dillon	rm -rf ${ISOROOT}/usr/pkgobj
3298abe78a1SMatthew Dillon	#
3308abe78a1SMatthew Dillon	# Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable
3318abe78a1SMatthew Dillon	#
3328abe78a1SMatthew Dillon	mkdir -p ${ISOROOT}/usr/pkgobj
3333aa2328eSSimon Schubert	mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap
3348abe78a1SMatthew Dillon	mkdir -p ${ISOROOT}/usr/pkgsrc
335fbc26094SSascha Wildner	mount_null ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
3365af45f85SMatthew Dillon	cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \
3375af45f85SMatthew Dillon	    || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles
3388abe78a1SMatthew Dillon	#
3395af45f85SMatthew Dillon	# Bootstrap, if not already installed, and add licenses needed
340ee3561eeSMatthew Dillon	# for the gui release
3418abe78a1SMatthew Dillon	#
342c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || \
343c19c746bSMatthew Dillon	    rm -rf ${ISOROOT}/usr/pkg ${ISOROOT}/var/db/pkg \
344c19c746bSMatthew Dillon		    ${ISOROOT}/var/db/pkg.refcount
345c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || \
3468abe78a1SMatthew Dillon	    ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap;    \
3478abe78a1SMatthew Dillon		./bootstrap --workdir /usr/pkgobj/bootstrap/work"
348c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || \
349ee3561eeSMatthew Dillon	    echo ".ifdef BSD_PKG_MK	# added by nrelease" \
350ee3561eeSMatthew Dillon		>> ${ISOROOT}/usr/pkg/etc/mk.conf
351c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || \
352ee3561eeSMatthew Dillon	    echo "ACCEPTABLE_LICENSES+=openmotif-license" \
353ee3561eeSMatthew Dillon		>> ${ISOROOT}/usr/pkg/etc/mk.conf
354c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || \
355ee3561eeSMatthew Dillon	    echo "ACCEPTABLE_LICENSES+=vim-license" \
356ee3561eeSMatthew Dillon		>> ${ISOROOT}/usr/pkg/etc/mk.conf
357c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || \
358ee3561eeSMatthew Dillon	    echo ".endif			# added by nrelease" \
359ee3561eeSMatthew Dillon		>> ${ISOROOT}/usr/pkg/etc/mk.conf
360c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || sync
361c19c746bSMatthew Dillon	test -e ${ISODIR}/.didbootstrap || touch ${ISODIR}/.didbootstrap
3628abe78a1SMatthew Dillon	#
3638abe78a1SMatthew Dillon	# Build and install packages, skip packages already installed
3648abe78a1SMatthew Dillon	#
36520585f87SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
3668abe78a1SMatthew Dillon	${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
3678abe78a1SMatthew Dillon	    (bmake WRKOBJDIR=/usr/pkgobj check > /dev/null 2>&1 || \
3688abe78a1SMatthew Dillon	    bmake WRKOBJDIR=/usr/pkgobj ${PKGSRC_OPTIONS} clean build install)"
36920585f87SMatthew Dillon.endfor
3708abe78a1SMatthew Dillon	#
3718abe78a1SMatthew Dillon	# Remove packages which nothing depends on and clean up
3728abe78a1SMatthew Dillon	#
373cc55a235SSimon Schubert	${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
3748abe78a1SMatthew Dillon	-umount ${ISOROOT}/usr/pkgsrc/distfiles
375fbc26094SSascha Wildner	umount ${ISOROOT}/usr/pkgsrc
376fbc26094SSascha Wildner	rmdir ${ISOROOT}/usr/pkgsrc
377589a5738SSascha Wildner	rm -rf ${ISOROOT}/usr/pkgobj
378fbc26094SSascha Wildner	rm -f ${ISOROOT}/etc/resolv.conf
3793652f053SSascha Wildner	makewhatis ${ISOROOT}/usr/local/man
3803652f053SSascha Wildner	makewhatis ${ISOROOT}/usr/pkg/man
3816ca9a59cSMatthew Dillon
3820936984eSMatthew Dillon# So locate works
3830936984eSMatthew Dillon#
3848398ca17SSascha Wildnermklocatedb:
3858398ca17SSascha Wildner	( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
3868398ca17SSascha Wildner		-path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
3878398ca17SSascha Wildner		-prune -o -print | sed -e 's#^${ISOROOT}##g' | \
3888398ca17SSascha Wildner		/usr/libexec/locate.mklocatedb \
3898398ca17SSascha Wildner		-presort >${ISOROOT}/var/db/locate.database )
3908398ca17SSascha Wildner
3916ca9a59cSMatthew Dillonmkiso:
392bce110a5SMatthew Dillon	( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
39374ec6a9dSSascha Wildner		-R -J -o ${ISOFILE} \
39474ec6a9dSSascha Wildner		-V DragonFly-`${.CURDIR}/../tools/gitrev.sh | cut -c -22` . )
3956ca9a59cSMatthew Dillon
396b9c3e754SMichael Neumann
397b9c3e754SMichael Neumannmkimg:
398fbc26094SSascha Wildner.if make(img)
39960b68cbbSMichael Neumann	if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
400b9c3e754SMichael Neumann
40160b68cbbSMichael Neumann	echo "determine required image size" > /dev/null;		\
40260b68cbbSMichael Neumann	sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`;			\
403e6b76e22SMichael Neumann	echo "add 15% more space as required" > /dev/null;		\
404e6b76e22SMichael Neumann	sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`;	\
40560b68cbbSMichael Neumann	dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz};		\
40660b68cbbSMichael Neumann	fdisk -IB -p ${IMGFILE};					\
40760b68cbbSMichael Neumann	echo "determine free vn device" > /dev/null;			\
40860b68cbbSMichael Neumann	vn=`vnconfig -l | grep "not in use" | head -n 1 | cut -f 1 -d:`; \
40960b68cbbSMichael Neumann	vnconfig -e -s labels $${vn} ${IMGFILE}; 			\
41060b68cbbSMichael Neumann	echo "write standard disklabel" > /dev/null;			\
41160b68cbbSMichael Neumann	disklabel -w -r $${vn}s1 auto;					\
41260b68cbbSMichael Neumann	echo "read disklabel back" > /dev/null;				\
41360b68cbbSMichael Neumann	disklabel -r $${vn}s1 > ${IMGFILE}.label;			\
41460b68cbbSMichael Neumann	echo "determine number of sectors of whole disk" > /dev/null; 	\
41560b68cbbSMichael Neumann	secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`;		\
41660b68cbbSMichael Neumann	echo "and add a: partition" > /dev/null;			\
41760b68cbbSMichael Neumann	echo "  a:  $${secs} 0 4.2BSD" >> ${IMGFILE}.label;		\
41860b68cbbSMichael Neumann	echo "write modified disklabel back" > /dev/null;		\
41960b68cbbSMichael Neumann	disklabel -R -r $${vn}s1 ${IMGFILE}.label;			\
42060b68cbbSMichael Neumann	rm ${IMGFILE}.label;						\
42160b68cbbSMichael Neumann	echo "write bootsector" >  /dev/null;				\
42260b68cbbSMichael Neumann	disklabel -B $${vn}s1;						\
42360b68cbbSMichael Neumann	newfs /dev/$${vn}s1a;						\
42460b68cbbSMichael Neumann	mount /dev/$${vn}s1a ${IMGMNT};					\
42560b68cbbSMichael Neumann	cpdup -vvv ${ISOROOT} ${IMGMNT};				\
42660b68cbbSMichael Neumann	echo "fix /etc/fstab" > /dev/null;				\
427b72c2692SMichael Neumann	echo "${IMGUSBDEV}s1a / ufs rw 0 0" > ${IMGMNT}/etc/fstab; 	\
428b72c2692SMichael Neumann	echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab; 	\
429bccaed73SMichael Neumann	df ${IMGMNT};							\
43060b68cbbSMichael Neumann	umount ${IMGMNT};						\
43160b68cbbSMichael Neumann	vnconfig -u $${vn};						\
43260b68cbbSMichael Neumann	rmdir ${IMGMNT}
433b9c3e754SMichael Neumann.endif
434b9c3e754SMichael Neumann
4356ca9a59cSMatthew Dillonclean:
436c19c746bSMatthew Dillon	-umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1
437c19c746bSMatthew Dillon	-umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1
4386ca9a59cSMatthew Dillon	if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
439c19c746bSMatthew Dillon	rm -rf ${ISOROOT}
440c19c746bSMatthew Dillon	rm -rf ${NRLOBJDIR}/nrelease
4418abe78a1SMatthew Dillon	rm -f ${ISODIR}/.didbootstrap
4426ca9a59cSMatthew Dillon
4436ca9a59cSMatthew Dillonrealclean:	clean
4443ebedc5eSMatthew Dillon	rm -rf ${OBJSYS}/${KERNCONF}
4458abe78a1SMatthew Dillon	#
446bce110a5SMatthew Dillon	# do not use PKGSRC_PKG_PATH here, we do not want to destroy an
447bce110a5SMatthew Dillon	# override location.
4488abe78a1SMatthew Dillon	#
449c19c746bSMatthew Dillon	rm -rf ${ISODIR}/packages
450c19c746bSMatthew Dillon	rm -rf ${ISODIR}/distfiles
4516ca9a59cSMatthew Dillon
452cc224c64SJoerg Sonnenbergerfetch:
4539b29c40aSMatthew Dillon	@if [ ! -d ${PKGSRC_PKG_PATH} ]; then mkdir -p ${PKGSRC_PKG_PATH}; fi
4540a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
4550a1628e7SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
4560a1628e7SMatthew Dillon.endif
457bce110a5SMatthew Dillon
458bce110a5SMatthew Dillonpkgsrc_bootstrap:
459bce110a5SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
4600936984eSMatthew Dillon	mkdir -p /usr/release/bootstrap
4610936984eSMatthew Dillon	(cd ${PKGSRC_PATH}/bootstrap; ./bootstrap --workdir /usr/release/bootstrap)
462bce110a5SMatthew Dillon.endif
463bce110a5SMatthew Dillon
464bce110a5SMatthew Dillonpkgsrc_cdrecord:
465bce110a5SMatthew Dillon.if !exists (${PKGBIN_MKISOFS})
4660936984eSMatthew Dillon	(cd ${PKGSRC_PATH}/sysutils/cdrtools; bmake clean build install)
467bce110a5SMatthew Dillon.endif
468cc224c64SJoerg Sonnenberger
469e2dbfa0bSThomas Nikolajsenhelp all:
4705af45f85SMatthew Dillon	@echo "make [gui] release   - complete build from scratch"
4715af45f85SMatthew Dillon	@echo "make [gui] quick     - attempt to do an incremental rebuild"
4725af45f85SMatthew Dillon	@echo "make [gui] realquick - attempt to restart after world & kernel"
4735af45f85SMatthew Dillon	@echo "make [gui] restartpkgs - attempt to restart at the pkg building stage"
4748abe78a1SMatthew Dillon	@echo ""
4758abe78a1SMatthew Dillon	@echo "Extra packages may be specified with PKGSRC_EXTRA_PACKAGES"
476588a679cSSimon Schubert
477e2dbfa0bSThomas Nikolajsen.PHONY: release quickrel realquickrel
478e2dbfa0bSThomas Nikolajsen.PHONY: installer
4799b29c40aSMatthew Dillon.PHONY: quick realquick
480e2dbfa0bSThomas Nikolajsen.PHONY: check buildworld1 buildworld2
481b9c3e754SMichael Neumann.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
48203e2a3c5SSascha Wildner.PHONY: clean realclean fetch help all srcs
483cc224c64SJoerg Sonnenberger
4846ca9a59cSMatthew Dillon.include <bsd.prog.mk>
485