xref: /dragonfly/nrelease/Makefile (revision d08963d3)
1*d08963d3SMatthew Dillon# $DragonFly: src/nrelease/Makefile,v 1.48 2005/12/22 23:23:32 dillon Exp $
26ca9a59cSMatthew Dillon#
35b22b655SMatthew Dillon
4cc224c64SJoerg Sonnenberger# compat target
5cc224c64SJoerg Sonnenbergerinstaller_release: release
6cc224c64SJoerg Sonnenbergerinstaller_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
27cc224c64SJoerg SonnenbergerENV?=	env
28cc224c64SJoerg SonnenbergerTAR?=	tar
29cc224c64SJoerg Sonnenberger
30bce110a5SMatthew DillonPKGSRC_CDRECORD?=	cdrecord-2.00.3nb2.tgz
31bce110a5SMatthew DillonPKGSRC_BOOTSTRAP_KIT?=	bootstrap-kit-20051221
32bce110a5SMatthew Dillon
33bce110a5SMatthew DillonPKGSRC_PACKAGES?=	cdrecord-2.00.3nb2.tgz
348188de86SMatthew Dillon
358188de86SMatthew Dillon# Specify which root skeletons are required, and let the user include
368188de86SMatthew Dillon# their own.  They are copied into ISODIR during the `pkgcustomizeiso'
378188de86SMatthew Dillon# target; each overwrites the last.
388188de86SMatthew Dillon#
398188de86SMatthew DillonREQ_ROOTSKELS= ${.CURDIR}/root
40cc224c64SJoerg SonnenbergerROOTSKELS?=	${REQ_ROOTSKELS}
41cc224c64SJoerg Sonnenberger
42cc224c64SJoerg Sonnenberger.if defined(WITH_INSTALLER)
43bce110a5SMatthew DillonPKGSRC_PACKAGES+=	dfuibe_installer-1.1.6.tgz dfuife_curses-1.5.tgz
44bce110a5SMatthew DillonPKGSRC_PACKAGES+=	gettext-lib-0.11.5nb6.tgz libaura-3.1.tgz \
45bce110a5SMatthew Dillon			libdfui-4.1.tgz libinstaller-5.1.tgz
46cc224c64SJoerg SonnenbergerROOTSKELS+=		installer
47cc224c64SJoerg Sonnenberger.endif
488188de86SMatthew Dillon
495b22b655SMatthew Dillon# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
505b22b655SMatthew Dillon# the additional '/nrelease' manually, as a safety measure.
515b22b655SMatthew Dillon#
525b22b655SMatthew DillonNRLOBJDIR?= /usr/obj
535b22b655SMatthew Dillon
54acc392b5SJoerg SonnenbergerWORLD_CCVER ?= ${CCVER}
55acc392b5SJoerg SonnenbergerKERNEL_CCVER ?= ${CCVER}
56acc392b5SJoerg Sonnenberger
578188de86SMatthew Dillon#########################################################################
588188de86SMatthew Dillon#				BASE ISO TARGETS 			#
598188de86SMatthew Dillon#########################################################################
606ca9a59cSMatthew Dillon
618188de86SMatthew Dillonrelease:	check clean buildworld1 buildkernel1 \
62cc224c64SJoerg Sonnenberger		buildiso customizeiso mklocatedb mkiso
636ca9a59cSMatthew Dillon
648188de86SMatthew Dillonquickrel:	check clean buildworld2 buildkernel2 \
65cc224c64SJoerg Sonnenberger		buildiso customizeiso mklocatedb mkiso
668188de86SMatthew Dillon
67cc224c64SJoerg Sonnenbergerrealquickrel:	check clean buildiso customizeiso mklocatedb mkiso
686ca9a59cSMatthew Dillon
69d2582113SChris Presseycheck:
70bce110a5SMatthew Dillon.if !exists(${PKGBIN_PKG_ADD})
71bce110a5SMatthew Dillon	@echo "Unable to find ${PKGBIN_PKG_ADD}.  You can use the following"
72bce110a5SMatthew Dillon	@echo "command to bootstrap pkgsrc:"
73bce110a5SMatthew Dillon	@echo "    make pkgsrc_bootstrap"
74bce110a5SMatthew Dillon	@exit 1
75bce110a5SMatthew Dillon.endif
76bce110a5SMatthew Dillon.if !exists(/etc/mk.conf)
77bce110a5SMatthew Dillon	@echo "You do not have an /etc/mk.conf.  You can use the following"
78bce110a5SMatthew Dillon	@echo "command to install one.  Otherwise pkgsrc defaults will not"
79bce110a5SMatthew Dillon	@echo "point to the  right place:"
80bce110a5SMatthew Dillon	@echo "    make pkgsrc_conf"
81bce110a5SMatthew Dillon	@exit 1
82bce110a5SMatthew Dillon.endif
83bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
84bce110a5SMatthew Dillon	@${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -n ${PKG} > /dev/null 2>&1 || \
85bce110a5SMatthew Dillon		(echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo "    make [installer_]fetch"; exit 1)
86bce110a5SMatthew Dillon.endfor
87bce110a5SMatthew Dillon.if !exists(${PKGBIN_MKISOFS})
88bce110a5SMatthew Dillon	@echo "mkisofs is not installed.  It is part of the cdrecord package."
89bce110a5SMatthew Dillon	@echo "You can install it with:"
90bce110a5SMatthew Dillon	@echo "    make pkgsrc_cdrecord"
91bce110a5SMatthew Dillon	@exit 1
92bce110a5SMatthew Dillon.endif
932e3f8f38SMatthew Dillon
946ca9a59cSMatthew Dillonbuildworld1:
95c3f3fe6dSMatthew Dillon	( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
966ca9a59cSMatthew Dillon
976ca9a59cSMatthew Dillonbuildworld2:
9882a1be39SSascha Wildner	( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
996ca9a59cSMatthew Dillon
1006ca9a59cSMatthew Dillonbuildkernel1:
101c3f3fe6dSMatthew Dillon	( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
1026ca9a59cSMatthew Dillon
1036ca9a59cSMatthew Dillonbuildkernel2:
10482a1be39SSascha Wildner	( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
1056ca9a59cSMatthew Dillon
1065b22b655SMatthew Dillon# note that we do not want to mess with any /usr/obj directories not related
1075b22b655SMatthew Dillon# to buildworld, buildkernel, or nrelease, so we must supply the proper
1085b22b655SMatthew Dillon# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
1095b22b655SMatthew Dillon# buildkernel mechanism.
1105b22b655SMatthew Dillon#
1116ca9a59cSMatthew Dillonbuildiso:
1126ca9a59cSMatthew Dillon	if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
1135b22b655SMatthew Dillon	if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
1146ca9a59cSMatthew Dillon	( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
115ab64cf06SSimon Schubert	( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
116ab64cf06SSimon Schubert		make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
11721aa02d0SChris Pressey	cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
1186ca9a59cSMatthew Dillon	( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
1196ca9a59cSMatthew Dillon		installkernel KERNCONF=${KERNCONF} )
120c5c5e6fcSSimon Schubert	ln -s kernel ${ISOROOT}/kernel.BOOTP
1216ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
1226ca9a59cSMatthew Dillon	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
1236ca9a59cSMatthew Dillon	dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
1248188de86SMatthew Dillon
1258188de86SMatthew Dilloncustomizeiso:
126bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
1278188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS}
1288188de86SMatthew Dillon	cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
1298188de86SMatthew Dillon.endfor
130*d08963d3SMatthew Dillon	cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap ${ISOROOT}/tmp/bootstrap
131*d08963d3SMatthew Dillon	chroot ${ISOROOT} csh -c "cd /tmp/bootstrap; ./bootstrap"
132*d08963d3SMatthew Dillon	rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
1338188de86SMatthew Dillon	rm -rf `find ${ISOROOT} -type d -name CVS -print`
13421aa02d0SChris Pressey	rm -rf ${ISOROOT}/usr/local/share/pristine
1357249926bSMatthew Dillon	pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
1364fba3387SChris Pressey.for UPGRADE_ITEM in Makefile			\
1374fba3387SChris Pressey		     etc.${MACHINE_ARCH} 	\
1384fba3387SChris Pressey		     isdn/Makefile		\
1394fba3387SChris Pressey		     rc.d/Makefile		\
1404fba3387SChris Pressey		     periodic/Makefile		\
1414fba3387SChris Pressey		     periodic/daily/Makefile	\
1424fba3387SChris Pressey		     periodic/security/Makefile	\
1434fba3387SChris Pressey		     periodic/weekly/Makefile	\
1444fba3387SChris Pressey		     periodic/monthly/Makefile
1454fba3387SChris Pressey	cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
1464fba3387SChris Pressey.endfor
147bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
148bce110a5SMatthew Dillon	${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
1498188de86SMatthew Dillon.endfor
1506ca9a59cSMatthew Dillon
1518398ca17SSascha Wildnermklocatedb:
1528398ca17SSascha Wildner	( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
1538398ca17SSascha Wildner		-path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
1548398ca17SSascha Wildner		-prune -o -print | sed -e 's#^${ISOROOT}##g' | \
1558398ca17SSascha Wildner		/usr/libexec/locate.mklocatedb \
1568398ca17SSascha Wildner		-presort >${ISOROOT}/var/db/locate.database )
1578398ca17SSascha Wildner
1586ca9a59cSMatthew Dillonmkiso:
159bce110a5SMatthew Dillon	( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
160382f1ee3SMatthew Dillon		-R -J -V DragonFly -o ${ISOFILE} . )
1616ca9a59cSMatthew Dillon
1626ca9a59cSMatthew Dillonclean:
1636ca9a59cSMatthew Dillon	if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
1648188de86SMatthew Dillon	if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
1655b22b655SMatthew Dillon	if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
1666ca9a59cSMatthew Dillon
1676ca9a59cSMatthew Dillonrealclean:	clean
1683ebedc5eSMatthew Dillon	rm -rf ${OBJSYS}/${KERNCONF}
169bce110a5SMatthew Dillon	# do not use PKGSRC_PKG_PATH here, we do not want to destroy an
170bce110a5SMatthew Dillon	# override location.
171bce110a5SMatthew Dillon	if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
1726ca9a59cSMatthew Dillon
173cc224c64SJoerg Sonnenbergerfetch:
174cc224c64SJoerg Sonnenberger	mkdir -p ${PKGSRC_PKG_PATH}
175bce110a5SMatthew Dillon.for PKG in ${PKGSRC_PACKAGES}
176bce110a5SMatthew Dillon	@${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -n ${PKG} > /dev/null 2>&1 || \
177bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
178bce110a5SMatthew Dillon.endfor
179bce110a5SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
180bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
181bce110a5SMatthew Dillon.endif
182bce110a5SMatthew Dillon
183bce110a5SMatthew Dillonpkgsrc_bootstrap:
184bce110a5SMatthew Dillon	mkdir -p ${PKGSRC_PKG_PATH}
185bce110a5SMatthew Dillon.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
186bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
187bce110a5SMatthew Dillon.endif
188bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
189bce110a5SMatthew Dillon	(cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
190bce110a5SMatthew Dillon
191bce110a5SMatthew Dillonpkgsrc_conf:
192bce110a5SMatthew Dillon.if !exists(/etc/mk.conf)
193bce110a5SMatthew Dillon	cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
194bce110a5SMatthew Dillon.else
195bce110a5SMatthew Dillon	fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
196bce110a5SMatthew Dillon.endif
197bce110a5SMatthew Dillon
198bce110a5SMatthew Dillonpkgsrc_cdrecord:
199bce110a5SMatthew Dillon.if !exists (${PKGBIN_MKISOFS})
200bce110a5SMatthew Dillon	${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
201bce110a5SMatthew Dillon.endif
202cc224c64SJoerg Sonnenberger
203cc224c64SJoerg Sonnenberger.PHONY: all release installer_release quickrel installer_quickrel realquickrel
204bce110a5SMatthew Dillon.PHONY: installer_fetch
205cc224c64SJoerg Sonnenberger.PHONY: installer_realquickrel check buildworld1 buildworld2
206cc224c64SJoerg Sonnenberger.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
207d5c58845SMatthew Dillon.PHONY: clean realclean fetch
208cc224c64SJoerg Sonnenberger
2096ca9a59cSMatthew Dillon.include <bsd.prog.mk>
210