xref: /dragonfly/nrelease/Makefile (revision 2157278d)
1*2157278dSSimon Schubert# $DragonFly: src/nrelease/Makefile,v 1.52 2006/03/09 22:16:40 corecode Exp $
26ca9a59cSMatthew Dillon#
35b22b655SMatthew Dillon
4cc224c64SJoerg Sonnenberger# compat target
5cc224c64SJoerg Sonnenbergerinstaller_release: release
6f6c08bceSMatthew Dilloninstaller_quickrel: quickrel
7cc224c64SJoerg Sonnenbergerinstaller_realquickrel: realquickrel
8bce110a5SMatthew Dilloninstaller_fetch: fetch
9cc224c64SJoerg Sonnenberger
10bce110a5SMatthew Dillon.if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel) || make(installer_fetch)
11cc224c64SJoerg SonnenbergerWITH_INSTALLER=
12cc224c64SJoerg Sonnenberger.endif
13cc224c64SJoerg Sonnenberger
146ca9a59cSMatthew DillonISODIR ?= /usr/release
156ca9a59cSMatthew DillonISOFILE ?= ${ISODIR}/dfly.iso
166ca9a59cSMatthew DillonISOROOT = ${ISODIR}/root
176ca9a59cSMatthew DillonOBJSYS= ${.OBJDIR}/../sys
186ca9a59cSMatthew DillonKERNCONF ?= GENERIC
196ca9a59cSMatthew Dillon
20cc224c64SJoerg SonnenbergerPKGSRC_PREFIX?=		/usr/pkg
21bce110a5SMatthew DillonPKGBIN_PKG_ADD?=	${PKGSRC_PREFIX}/sbin/pkg_add
22bce110a5SMatthew DillonPKGBIN_MKISOFS?=	${PKGSRC_PREFIX}/bin/mkisofs
23bce110a5SMatthew DillonPKGSRC_PKG_PATH?=	${ISODIR}/packages
24bce110a5SMatthew DillonPKGSRC_DB?=		/var/db/pkg
25bce110a5SMatthew DillonPKGSRC_BOOTSTRAP_URL?=	http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.4.0-RELEASE-BUILD
26cc224c64SJoerg Sonnenberger
27*2157278dSSimon SchubertENVCMD?=	env
28cc224c64SJoerg SonnenbergerTAR?=	tar
29cc224c64SJoerg Sonnenberger
30bce110a5SMatthew DillonPKGSRC_CDRECORD?=	cdrecord-2.00.3nb2.tgz
31bce110a5SMatthew DillonPKGSRC_BOOTSTRAP_KIT?=	bootstrap-kit-20051221
320a1628e7SMatthew DillonCVSUP_BOOTSTRAP_KIT?=	cvsup-bootstrap-20051229
33bce110a5SMatthew Dillon
34bce110a5SMatthew DillonPKGSRC_PACKAGES?=	cdrecord-2.00.3nb2.tgz
358188de86SMatthew Dillon
368188de86SMatthew Dillon# Specify which root skeletons are required, and let the user include
378188de86SMatthew Dillon# their own.  They are copied into ISODIR during the `pkgcustomizeiso'
388188de86SMatthew Dillon# target; each overwrites the last.
398188de86SMatthew Dillon#
408188de86SMatthew DillonREQ_ROOTSKELS= ${.CURDIR}/root
41cc224c64SJoerg SonnenbergerROOTSKELS?=	${REQ_ROOTSKELS}
42cc224c64SJoerg Sonnenberger
43cc224c64SJoerg Sonnenberger.if defined(WITH_INSTALLER)
44bce110a5SMatthew DillonPKGSRC_PACKAGES+=	dfuibe_installer-1.1.6.tgz dfuife_curses-1.5.tgz
45bce110a5SMatthew DillonPKGSRC_PACKAGES+=	gettext-lib-0.11.5nb6.tgz libaura-3.1.tgz \
46bce110a5SMatthew Dillon			libdfui-4.1.tgz libinstaller-5.1.tgz
47cc224c64SJoerg SonnenbergerROOTSKELS+=		installer
48cc224c64SJoerg Sonnenberger.endif
498188de86SMatthew Dillon
505b22b655SMatthew Dillon# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
515b22b655SMatthew Dillon# the additional '/nrelease' manually, as a safety measure.
525b22b655SMatthew Dillon#
535b22b655SMatthew DillonNRLOBJDIR?= /usr/obj
545b22b655SMatthew Dillon
55acc392b5SJoerg SonnenbergerWORLD_CCVER ?= ${CCVER}
56acc392b5SJoerg SonnenbergerKERNEL_CCVER ?= ${CCVER}
57acc392b5SJoerg Sonnenberger
588188de86SMatthew Dillon#########################################################################
598188de86SMatthew Dillon#				BASE ISO TARGETS 			#
608188de86SMatthew Dillon#########################################################################
616ca9a59cSMatthew Dillon
628188de86SMatthew Dillonrelease:	check clean buildworld1 buildkernel1 \
63cc224c64SJoerg Sonnenberger		buildiso customizeiso mklocatedb mkiso
646ca9a59cSMatthew Dillon
658188de86SMatthew Dillonquickrel:	check clean buildworld2 buildkernel2 \
66cc224c64SJoerg Sonnenberger		buildiso customizeiso mklocatedb mkiso
678188de86SMatthew Dillon
68cc224c64SJoerg Sonnenbergerrealquickrel:	check clean buildiso customizeiso mklocatedb mkiso
696ca9a59cSMatthew Dillon
70d2582113SChris Presseycheck:
71bce110a5SMatthew Dillon.if !exists(${PKGBIN_PKG_ADD})
72bce110a5SMatthew Dillon	@echo "Unable to find ${PKGBIN_PKG_ADD}.  You can use the following"
73bce110a5SMatthew Dillon	@echo "command to bootstrap pkgsrc:"
74bce110a5SMatthew Dillon	@echo "    make pkgsrc_bootstrap"
75bce110a5SMatthew Dillon	@exit 1
76bce110a5SMatthew Dillon.endif
77bce110a5SMatthew Dillon.if !exists(/etc/mk.conf)
78bce110a5SMatthew Dillon	@echo "You do not have an /etc/mk.conf.  You can use the following"
79bce110a5SMatthew Dillon	@echo "command to install one.  Otherwise pkgsrc defaults will not"
80bce110a5SMatthew Dillon	@echo "point to the  right place:"
81bce110a5SMatthew Dillon	@echo "    make pkgsrc_conf"
82bce110a5SMatthew Dillon	@exit 1
83bce110a5SMatthew Dillon.endif
84bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
85*2157278dSSimon Schubert	@${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -n ${PKG} > /dev/null 2>&1 || \
86bce110a5SMatthew Dillon		(echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo "    make [installer_]fetch"; exit 1)
87bce110a5SMatthew Dillon.endfor
88bce110a5SMatthew Dillon.if !exists(${PKGBIN_MKISOFS})
89bce110a5SMatthew Dillon	@echo "mkisofs is not installed.  It is part of the cdrecord package."
90bce110a5SMatthew Dillon	@echo "You can install it with:"
91bce110a5SMatthew Dillon	@echo "    make pkgsrc_cdrecord"
92bce110a5SMatthew Dillon	@exit 1
93bce110a5SMatthew Dillon.endif
940a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
950a1628e7SMatthew Dillon	@echo "The pkgsrc bootstrap kit is not installed.  You can install it with:"
960a1628e7SMatthew Dillon	@echo "    make [installer_]fetch"
970a1628e7SMatthew Dillon	@exit 1
980a1628e7SMatthew Dillon.endif
990a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
1000a1628e7SMatthew Dillon	@echo "The cvsup bootstrap kit is not installed.  You can install it with:"
1010a1628e7SMatthew Dillon	@echo "    make [installer_]fetch"
1020a1628e7SMatthew Dillon	@exit 1
1030a1628e7SMatthew Dillon.endif
1042e3f8f38SMatthew Dillon
1056ca9a59cSMatthew Dillonbuildworld1:
106c3f3fe6dSMatthew Dillon	( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
1076ca9a59cSMatthew Dillon
1086ca9a59cSMatthew Dillonbuildworld2:
10982a1be39SSascha Wildner	( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
1106ca9a59cSMatthew Dillon
1116ca9a59cSMatthew Dillonbuildkernel1:
112c3f3fe6dSMatthew Dillon	( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
1136ca9a59cSMatthew Dillon
1146ca9a59cSMatthew Dillonbuildkernel2:
11582a1be39SSascha Wildner	( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
1166ca9a59cSMatthew Dillon
1175b22b655SMatthew Dillon# note that we do not want to mess with any /usr/obj directories not related
1185b22b655SMatthew Dillon# to buildworld, buildkernel, or nrelease, so we must supply the proper
1195b22b655SMatthew Dillon# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
1205b22b655SMatthew Dillon# buildkernel mechanism.
1215b22b655SMatthew Dillon#
1226ca9a59cSMatthew Dillonbuildiso:
1236ca9a59cSMatthew Dillon	if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
1245b22b655SMatthew Dillon	if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
1256ca9a59cSMatthew Dillon	( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
126ab64cf06SSimon Schubert	( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
127ab64cf06SSimon Schubert		make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
128dddbd615SMatthew Dillon	cp -p ${.CURDIR}/mk.conf.pkgsrc ${ISOROOT}/etc/mk.conf
12921aa02d0SChris Pressey	cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
1306ca9a59cSMatthew Dillon	( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
1316ca9a59cSMatthew Dillon		installkernel KERNCONF=${KERNCONF} )
132c5c5e6fcSSimon Schubert	ln -s kernel ${ISOROOT}/kernel.BOOTP
1336ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
1346ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
1356ca9a59cSMatthew Dillon	dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
1368188de86SMatthew Dillon
1378188de86SMatthew Dilloncustomizeiso:
138bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
1390a1628e7SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
1408188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS}
1418188de86SMatthew Dillon	cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
1428188de86SMatthew Dillon.endfor
143f6c08bceSMatthew Dillon	rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
144f6c08bceSMatthew Dillon	cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT} ${ISOROOT}/tmp/bootstrap
1450a1628e7SMatthew Dillon	cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
146f6c08bceSMatthew Dillon	chroot ${ISOROOT} csh -c "cd /tmp/bootstrap/bootstrap; ./bootstrap"
147d08963d3SMatthew Dillon	rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
1488188de86SMatthew Dillon	rm -rf `find ${ISOROOT} -type d -name CVS -print`
14921aa02d0SChris Pressey	rm -rf ${ISOROOT}/usr/local/share/pristine
1507249926bSMatthew Dillon	pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
1514fba3387SChris Pressey.for UPGRADE_ITEM in Makefile			\
1524fba3387SChris Pressey		     etc.${MACHINE_ARCH} 	\
1534fba3387SChris Pressey		     isdn/Makefile		\
1544fba3387SChris Pressey		     rc.d/Makefile		\
1554fba3387SChris Pressey		     periodic/Makefile		\
1564fba3387SChris Pressey		     periodic/daily/Makefile	\
1574fba3387SChris Pressey		     periodic/security/Makefile	\
1584fba3387SChris Pressey		     periodic/weekly/Makefile	\
1594fba3387SChris Pressey		     periodic/monthly/Makefile
1604fba3387SChris Pressey	cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
1614fba3387SChris Pressey.endfor
162bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
163*2157278dSSimon Schubert	${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
1648188de86SMatthew Dillon.endfor
1656ca9a59cSMatthew Dillon
1668398ca17SSascha Wildnermklocatedb:
1678398ca17SSascha Wildner	( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
1688398ca17SSascha Wildner		-path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
1698398ca17SSascha Wildner		-prune -o -print | sed -e 's#^${ISOROOT}##g' | \
1708398ca17SSascha Wildner		/usr/libexec/locate.mklocatedb \
1718398ca17SSascha Wildner		-presort >${ISOROOT}/var/db/locate.database )
1728398ca17SSascha Wildner
1736ca9a59cSMatthew Dillonmkiso:
174bce110a5SMatthew Dillon	( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
175382f1ee3SMatthew Dillon		-R -J -V DragonFly -o ${ISOFILE} . )
1766ca9a59cSMatthew Dillon
1776ca9a59cSMatthew Dillonclean:
1786ca9a59cSMatthew Dillon	if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
1798188de86SMatthew Dillon	if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
1805b22b655SMatthew Dillon	if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
1816ca9a59cSMatthew Dillon
1826ca9a59cSMatthew Dillonrealclean:	clean
1833ebedc5eSMatthew Dillon	rm -rf ${OBJSYS}/${KERNCONF}
184bce110a5SMatthew Dillon	# do not use PKGSRC_PKG_PATH here, we do not want to destroy an
185bce110a5SMatthew Dillon	# override location.
186bce110a5SMatthew Dillon	if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
1876ca9a59cSMatthew Dillon
188cc224c64SJoerg Sonnenbergerfetch:
189cc224c64SJoerg Sonnenberger	mkdir -p ${PKGSRC_PKG_PATH}
190bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
191*2157278dSSimon Schubert	@${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -n ${PKG} > /dev/null 2>&1 || \
192bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
193bce110a5SMatthew Dillon.endfor
194bce110a5SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
195bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
196bce110a5SMatthew Dillon.endif
1970a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
1980a1628e7SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
1990a1628e7SMatthew Dillon.endif
200bce110a5SMatthew Dillon
201bce110a5SMatthew Dillonpkgsrc_bootstrap:
202bce110a5SMatthew Dillon	mkdir -p ${PKGSRC_PKG_PATH}
203bce110a5SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
204bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
205bce110a5SMatthew Dillon.endif
206bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
207bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
208bce110a5SMatthew Dillon
209bce110a5SMatthew Dillonpkgsrc_conf:
210bce110a5SMatthew Dillon.if !exists(/etc/mk.conf)
211bce110a5SMatthew Dillon	cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
212bce110a5SMatthew Dillon.else
213bce110a5SMatthew Dillon	fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
214bce110a5SMatthew Dillon.endif
215bce110a5SMatthew Dillon
216bce110a5SMatthew Dillonpkgsrc_cdrecord:
217bce110a5SMatthew Dillon.if !exists (${PKGBIN_MKISOFS})
218bce110a5SMatthew Dillon	${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
219bce110a5SMatthew Dillon.endif
220cc224c64SJoerg Sonnenberger
221cc224c64SJoerg Sonnenberger.PHONY: all release installer_release quickrel installer_quickrel realquickrel
222bce110a5SMatthew Dillon.PHONY: installer_fetch
223cc224c64SJoerg Sonnenberger.PHONY: installer_realquickrel check buildworld1 buildworld2
224cc224c64SJoerg Sonnenberger.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
225d5c58845SMatthew Dillon.PHONY: clean realclean fetch
226cc224c64SJoerg Sonnenberger
2276ca9a59cSMatthew Dillon.include <bsd.prog.mk>
228