xref: /dragonfly/nrelease/Makefile (revision 19d86faa)
1*19d86faaSMatthew Dillon# $DragonFly: src/nrelease/Makefile,v 1.55 2006/07/08 03:19:30 dillon 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
22c791834fSJoerg SonnenbergerPKGBIN_PKG_ADMIN?=	${PKGSRC_PREFIX}/sbin/pkg_admin
23bce110a5SMatthew DillonPKGBIN_MKISOFS?=	${PKGSRC_PREFIX}/bin/mkisofs
24bce110a5SMatthew DillonPKGSRC_PKG_PATH?=	${ISODIR}/packages
25bce110a5SMatthew DillonPKGSRC_DB?=		/var/db/pkg
26a0b76df4SMatthew DillonPKGSRC_BOOTSTRAP_URL?=	http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.4.4-RELEASE-BUILD
27cc224c64SJoerg Sonnenberger
282157278dSSimon SchubertENVCMD?=	env
29cc224c64SJoerg SonnenbergerTAR?=	tar
30cc224c64SJoerg Sonnenberger
31bce110a5SMatthew DillonPKGSRC_CDRECORD?=	cdrecord-2.00.3nb2.tgz
32bce110a5SMatthew DillonPKGSRC_BOOTSTRAP_KIT?=	bootstrap-kit-20051221
330a1628e7SMatthew DillonCVSUP_BOOTSTRAP_KIT?=	cvsup-bootstrap-20051229
34bce110a5SMatthew Dillon
35bce110a5SMatthew DillonPKGSRC_PACKAGES?=	cdrecord-2.00.3nb2.tgz
368188de86SMatthew Dillon
378188de86SMatthew Dillon# Specify which root skeletons are required, and let the user include
388188de86SMatthew Dillon# their own.  They are copied into ISODIR during the `pkgcustomizeiso'
398188de86SMatthew Dillon# target; each overwrites the last.
408188de86SMatthew Dillon#
418188de86SMatthew DillonREQ_ROOTSKELS= ${.CURDIR}/root
42cc224c64SJoerg SonnenbergerROOTSKELS?=	${REQ_ROOTSKELS}
43cc224c64SJoerg Sonnenberger
44cc224c64SJoerg Sonnenberger.if defined(WITH_INSTALLER)
45a0b76df4SMatthew DillonPKGSRC_PACKAGES+=	dfuibe_installer-1.1.6a.tgz dfuife_curses-1.5.tgz
46a0b76df4SMatthew DillonPKGSRC_PACKAGES+=	gettext-lib-0.14.5.tgz libaura-3.1.tgz \
47a0b76df4SMatthew Dillon			libdfui-4.2.tgz libinstaller-5.1.tgz
48cc224c64SJoerg SonnenbergerROOTSKELS+=		installer
49cc224c64SJoerg Sonnenberger.endif
508188de86SMatthew Dillon
515b22b655SMatthew Dillon# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
525b22b655SMatthew Dillon# the additional '/nrelease' manually, as a safety measure.
535b22b655SMatthew Dillon#
545b22b655SMatthew DillonNRLOBJDIR?= /usr/obj
555b22b655SMatthew Dillon
56acc392b5SJoerg SonnenbergerWORLD_CCVER ?= ${CCVER}
57acc392b5SJoerg SonnenbergerKERNEL_CCVER ?= ${CCVER}
58acc392b5SJoerg Sonnenberger
598188de86SMatthew Dillon#########################################################################
608188de86SMatthew Dillon#				BASE ISO TARGETS 			#
618188de86SMatthew Dillon#########################################################################
626ca9a59cSMatthew Dillon
638188de86SMatthew Dillonrelease:	check clean buildworld1 buildkernel1 \
64*19d86faaSMatthew Dillon		buildiso syssrcs customizeiso mklocatedb mkiso
656ca9a59cSMatthew Dillon
668188de86SMatthew Dillonquickrel:	check clean buildworld2 buildkernel2 \
67*19d86faaSMatthew Dillon		buildiso syssrcs customizeiso mklocatedb mkiso
688188de86SMatthew Dillon
69*19d86faaSMatthew Dillonrealquickrel:	check clean buildiso syssrcs customizeiso mklocatedb mkiso
706ca9a59cSMatthew Dillon
71d2582113SChris Presseycheck:
72bce110a5SMatthew Dillon.if !exists(${PKGBIN_PKG_ADD})
73bce110a5SMatthew Dillon	@echo "Unable to find ${PKGBIN_PKG_ADD}.  You can use the following"
74bce110a5SMatthew Dillon	@echo "command to bootstrap pkgsrc:"
75bce110a5SMatthew Dillon	@echo "    make pkgsrc_bootstrap"
76bce110a5SMatthew Dillon	@exit 1
77bce110a5SMatthew Dillon.endif
78bce110a5SMatthew Dillon.if !exists(/etc/mk.conf)
79bce110a5SMatthew Dillon	@echo "You do not have an /etc/mk.conf.  You can use the following"
80bce110a5SMatthew Dillon	@echo "command to install one.  Otherwise pkgsrc defaults will not"
81bce110a5SMatthew Dillon	@echo "point to the  right place:"
82bce110a5SMatthew Dillon	@echo "    make pkgsrc_conf"
83bce110a5SMatthew Dillon	@exit 1
84bce110a5SMatthew Dillon.endif
85bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
86a0b76df4SMatthew Dillon	@${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
87bce110a5SMatthew Dillon		(echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo "    make [installer_]fetch"; exit 1)
88bce110a5SMatthew Dillon.endfor
89bce110a5SMatthew Dillon.if !exists(${PKGBIN_MKISOFS})
90bce110a5SMatthew Dillon	@echo "mkisofs is not installed.  It is part of the cdrecord package."
91bce110a5SMatthew Dillon	@echo "You can install it with:"
92bce110a5SMatthew Dillon	@echo "    make pkgsrc_cdrecord"
93bce110a5SMatthew Dillon	@exit 1
94bce110a5SMatthew Dillon.endif
950a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
960a1628e7SMatthew Dillon	@echo "The pkgsrc bootstrap kit is not installed.  You can install it with:"
970a1628e7SMatthew Dillon	@echo "    make [installer_]fetch"
980a1628e7SMatthew Dillon	@exit 1
990a1628e7SMatthew Dillon.endif
1000a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
1010a1628e7SMatthew Dillon	@echo "The cvsup bootstrap kit is not installed.  You can install it with:"
1020a1628e7SMatthew Dillon	@echo "    make [installer_]fetch"
1030a1628e7SMatthew Dillon	@exit 1
1040a1628e7SMatthew Dillon.endif
1052e3f8f38SMatthew Dillon
1066ca9a59cSMatthew Dillonbuildworld1:
107c3f3fe6dSMatthew Dillon	( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
1086ca9a59cSMatthew Dillon
1096ca9a59cSMatthew Dillonbuildworld2:
11082a1be39SSascha Wildner	( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
1116ca9a59cSMatthew Dillon
1126ca9a59cSMatthew Dillonbuildkernel1:
113c3f3fe6dSMatthew Dillon	( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
1146ca9a59cSMatthew Dillon
1156ca9a59cSMatthew Dillonbuildkernel2:
11682a1be39SSascha Wildner	( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
1176ca9a59cSMatthew Dillon
1185b22b655SMatthew Dillon# note that we do not want to mess with any /usr/obj directories not related
1195b22b655SMatthew Dillon# to buildworld, buildkernel, or nrelease, so we must supply the proper
1205b22b655SMatthew Dillon# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
1215b22b655SMatthew Dillon# buildkernel mechanism.
1225b22b655SMatthew Dillon#
1236ca9a59cSMatthew Dillonbuildiso:
1246ca9a59cSMatthew Dillon	if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
1255b22b655SMatthew Dillon	if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
1266ca9a59cSMatthew Dillon	( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
127ab64cf06SSimon Schubert	( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
128ab64cf06SSimon Schubert		make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
129dddbd615SMatthew Dillon	cp -p ${.CURDIR}/mk.conf.pkgsrc ${ISOROOT}/etc/mk.conf
130a0b76df4SMatthew Dillon	chroot ${ISOROOT} /usr/bin/newaliases
13121aa02d0SChris Pressey	cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
1326ca9a59cSMatthew Dillon	( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
1336ca9a59cSMatthew Dillon		installkernel KERNCONF=${KERNCONF} )
134c5c5e6fcSSimon Schubert	ln -s kernel ${ISOROOT}/kernel.BOOTP
1356ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
1366ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
1376ca9a59cSMatthew Dillon	dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
1388188de86SMatthew Dillon
139*19d86faaSMatthew Dillon# Include kernel sources on the release CD (~14MB)
140*19d86faaSMatthew Dillon#
141*19d86faaSMatthew Dillonsyssrcs:
142*19d86faaSMatthew Dillon	( cd ${.CURDIR}/../..; tar czf ${ISOROOT}/usr/src.tgz src/Makefile src/Makefile.inc1 src/sys )
143*19d86faaSMatthew Dillon
1448188de86SMatthew Dilloncustomizeiso:
145bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
1460a1628e7SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
1478188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS}
1488188de86SMatthew Dillon	cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
1498188de86SMatthew Dillon.endfor
150f6c08bceSMatthew Dillon	rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
151f6c08bceSMatthew Dillon	cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT} ${ISOROOT}/tmp/bootstrap
1520a1628e7SMatthew Dillon	cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
153f6c08bceSMatthew Dillon	chroot ${ISOROOT} csh -c "cd /tmp/bootstrap/bootstrap; ./bootstrap"
154d08963d3SMatthew Dillon	rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
1558188de86SMatthew Dillon	rm -rf `find ${ISOROOT} -type d -name CVS -print`
15621aa02d0SChris Pressey	rm -rf ${ISOROOT}/usr/local/share/pristine
1577249926bSMatthew Dillon	pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
1584fba3387SChris Pressey.for UPGRADE_ITEM in Makefile			\
1594fba3387SChris Pressey		     etc.${MACHINE_ARCH} 	\
1604fba3387SChris Pressey		     isdn/Makefile		\
1614fba3387SChris Pressey		     rc.d/Makefile		\
1624fba3387SChris Pressey		     periodic/Makefile		\
1634fba3387SChris Pressey		     periodic/daily/Makefile	\
1644fba3387SChris Pressey		     periodic/security/Makefile	\
1654fba3387SChris Pressey		     periodic/weekly/Makefile	\
1664fba3387SChris Pressey		     periodic/monthly/Makefile
1674fba3387SChris Pressey	cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
1684fba3387SChris Pressey.endfor
169bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
1702157278dSSimon Schubert	${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
1718188de86SMatthew Dillon.endfor
172c791834fSJoerg Sonnenberger	find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
173c791834fSJoerg Sonnenberger	${PKGBIN_PKG_ADMIN} -K ${ISOROOT}${PKGSRC_DB} rebuild
1746ca9a59cSMatthew Dillon
1758398ca17SSascha Wildnermklocatedb:
1768398ca17SSascha Wildner	( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
1778398ca17SSascha Wildner		-path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
1788398ca17SSascha Wildner		-prune -o -print | sed -e 's#^${ISOROOT}##g' | \
1798398ca17SSascha Wildner		/usr/libexec/locate.mklocatedb \
1808398ca17SSascha Wildner		-presort >${ISOROOT}/var/db/locate.database )
1818398ca17SSascha Wildner
1826ca9a59cSMatthew Dillonmkiso:
183bce110a5SMatthew Dillon	( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
184382f1ee3SMatthew Dillon		-R -J -V DragonFly -o ${ISOFILE} . )
1856ca9a59cSMatthew Dillon
1866ca9a59cSMatthew Dillonclean:
1876ca9a59cSMatthew Dillon	if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
1888188de86SMatthew Dillon	if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
1895b22b655SMatthew Dillon	if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
1906ca9a59cSMatthew Dillon
1916ca9a59cSMatthew Dillonrealclean:	clean
1923ebedc5eSMatthew Dillon	rm -rf ${OBJSYS}/${KERNCONF}
193bce110a5SMatthew Dillon	# do not use PKGSRC_PKG_PATH here, we do not want to destroy an
194bce110a5SMatthew Dillon	# override location.
195bce110a5SMatthew Dillon	if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
1966ca9a59cSMatthew Dillon
197cc224c64SJoerg Sonnenbergerfetch:
198cc224c64SJoerg Sonnenberger	mkdir -p ${PKGSRC_PKG_PATH}
199bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
200a0b76df4SMatthew Dillon	@${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
201bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
202bce110a5SMatthew Dillon.endfor
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
2060a1628e7SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
2070a1628e7SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
2080a1628e7SMatthew Dillon.endif
209bce110a5SMatthew Dillon
210bce110a5SMatthew Dillonpkgsrc_bootstrap:
211bce110a5SMatthew Dillon	mkdir -p ${PKGSRC_PKG_PATH}
212bce110a5SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
213bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
214bce110a5SMatthew Dillon.endif
215bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
216bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
217bce110a5SMatthew Dillon
218bce110a5SMatthew Dillonpkgsrc_conf:
219bce110a5SMatthew Dillon.if !exists(/etc/mk.conf)
220bce110a5SMatthew Dillon	cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
221bce110a5SMatthew Dillon.else
222bce110a5SMatthew Dillon	fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
223bce110a5SMatthew Dillon.endif
224bce110a5SMatthew Dillon
225bce110a5SMatthew Dillonpkgsrc_cdrecord:
226bce110a5SMatthew Dillon.if !exists (${PKGBIN_MKISOFS})
227bce110a5SMatthew Dillon	${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
228bce110a5SMatthew Dillon.endif
229cc224c64SJoerg Sonnenberger
230cc224c64SJoerg Sonnenberger.PHONY: all release installer_release quickrel installer_quickrel realquickrel
231bce110a5SMatthew Dillon.PHONY: installer_fetch
232cc224c64SJoerg Sonnenberger.PHONY: installer_realquickrel check buildworld1 buildworld2
233cc224c64SJoerg Sonnenberger.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
234d5c58845SMatthew Dillon.PHONY: clean realclean fetch
235cc224c64SJoerg Sonnenberger
2366ca9a59cSMatthew Dillon.include <bsd.prog.mk>
237