Update filename in comments.
[dragonfly.git] / nrelease / Makefile
... / ...
CommitLineData
1# $DragonFly: src/nrelease/Makefile,v 1.38 2005/07/14 07:35:52 corecode Exp $
2#
3
4ISODIR ?= /usr/release
5ISOFILE ?= ${ISODIR}/dfly.iso
6ISOROOT = ${ISODIR}/root
7OBJSYS= ${.OBJDIR}/../sys
8KERNCONF ?= GENERIC
9
10# Specify which packages are required on the ISO, and let the user
11# specify additional packages to include. During the `pkgaddiso'
12# target, the packages are obtained from PACKAGES_LOC.
13#
14REQ_PACKAGES= cdrtools-2.01 cvsup-without-gui-16.1h
15REL_PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES}
16.if defined(PACKAGES)
17PACKAGES_LOC?= ${PACKAGES}/All
18.else
19PACKAGES_LOC?= /usr/ports/packages/All
20.endif
21
22# Specify which root skeletons are required, and let the user include
23# their own. They are copied into ISODIR during the `pkgcustomizeiso'
24# target; each overwrites the last.
25#
26REQ_ROOTSKELS= ${.CURDIR}/root
27ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS}
28
29# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
30# the additional '/nrelease' manually, as a safety measure.
31#
32NRLOBJDIR?= /usr/obj
33
34WORLD_CCVER ?= ${CCVER}
35KERNEL_CCVER ?= ${CCVER}
36
37#########################################################################
38# BASE ISO TARGETS #
39#########################################################################
40
41release: check clean buildworld1 buildkernel1 \
42 buildiso customizeiso pkgaddiso mklocatedb mkiso
43
44quickrel: check clean buildworld2 buildkernel2 \
45 buildiso customizeiso pkgaddiso mklocatedb mkiso
46
47realquickrel: check clean \
48 buildiso customizeiso pkgaddiso mklocatedb mkiso
49
50#########################################################################
51# ISO TARGETS WITH INSTALLER #
52#########################################################################
53
54INSTALLER_PKGS= libaura-3.1 libdfui-4.1 libinstaller-5.1 \
55 dfuibe_installer-1.1.6 dfuife_curses-1.5 \
56 thttpd-notimeout-2.24 dfuife_cgi-1.4
57INSTALLER_SKELS= installer
58
59INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS} ${EXTRA_PACKAGES}" \
60 EXTRA_ROOTSKELS="${INSTALLER_SKELS} ${EXTRA_ROOTSKELS}"
61
62installer_check:
63 @${INSTALLER_ENV} ${MAKE} check
64
65installer_fetchpkgs:
66 @${INSTALLER_ENV} ${MAKE} fetchpkgs
67
68installer_release:
69 ${INSTALLER_ENV} ${MAKE} release
70
71installer_quickrel:
72 ${INSTALLER_ENV} ${MAKE} quickrel
73
74installer_realquickrel:
75 ${INSTALLER_ENV} ${MAKE} realquickrel
76
77#########################################################################
78# HELPER TARGETS #
79#########################################################################
80
81check:
82 @if [ ! -f /usr/local/bin/mkisofs ]; then \
83 echo "You need to install the sysutils/cdrtools port for"; \
84 echo "this target"; \
85 exit 1; \
86 fi
87.for PKG in ${REL_PACKAGES}
88 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
89 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz."; \
90 echo "(Perhaps you need to download or build it first?)"; \
91 echo ""; \
92 echo "If you are trying to build the installer, the"; \
93 echo "required packages can be obtained from:"; \
94 echo ""; \
95 echo " http://www.bsdinstaller.org/packages/"; \
96 echo ""; \
97 echo "They can be automatically downloaded by issuing"; \
98 echo "'make installer_fetchpkgs' from this directory."; \
99 echo ""; \
100 exit 1; \
101 fi
102.endfor
103 @echo "check: all preqs found"
104
105fetchpkgs:
106.for PKG in ${REL_PACKAGES}
107 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
108 cd ${PACKAGES_LOC} && \
109 echo "fetching ${PKG}..." && \
110 fetch http://www.bsdinstaller.org/packages/${PKG}.tgz; \
111 fi
112.endfor
113
114buildworld1:
115 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
116
117buildworld2:
118 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
119
120buildkernel1:
121 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
122
123buildkernel2:
124 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
125
126# note that we do not want to mess with any /usr/obj directories not related
127# to buildworld, buildkernel, or nrelease, so we must supply the proper
128# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
129# buildkernel mechanism.
130#
131buildiso:
132 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
133 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
134 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
135 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
136 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
137 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
138 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
139 installkernel KERNCONF=${KERNCONF} )
140 ln -s kernel ${ISOROOT}/kernel.BOOTP
141 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
142 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
143 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
144
145customizeiso:
146.for ROOTSKEL in ${ROOTSKELS}
147 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
148.endfor
149 rm -rf `find ${ISOROOT} -type d -name CVS -print`
150 rm -rf ${ISOROOT}/usr/local/share/pristine
151 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
152
153pkgcleaniso:
154 rm -f ${ISOROOT}/tmp/chrootscript
155 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
156.for PKG in ${REL_PACKAGES}
157 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
158.endfor
159 chmod a+x ${ISOROOT}/tmp/chrootscript
160 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
161 rm ${ISOROOT}/tmp/chrootscript
162
163pkgaddiso:
164 rm -f ${ISOROOT}/tmp/chrootscript
165 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
166.for PKG in ${REL_PACKAGES}
167 if [ ! -d ${ISOROOT}/var/db/pkg/${PKG} ]; then \
168 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz; \
169 echo "echo 'Installing package ${PKG}...' && \\" >> \
170 ${ISOROOT}/tmp/chrootscript; \
171 echo "pkg_add /tmp/${PKG}.tgz && \\" >> \
172 ${ISOROOT}/tmp/chrootscript; \
173 fi
174.endfor
175 echo "echo 'All packages added successfully!'" >> \
176 ${ISOROOT}/tmp/chrootscript
177 chmod a+x ${ISOROOT}/tmp/chrootscript
178 chroot ${ISOROOT}/ /tmp/chrootscript
179 rm ${ISOROOT}/tmp/chrootscript
180.for PKG in ${REL_PACKAGES}
181 rm -f ${ISOROOT}/tmp/${PKG}.tgz
182.endfor
183
184mklocatedb:
185 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
186 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
187 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
188 /usr/libexec/locate.mklocatedb \
189 -presort >${ISOROOT}/var/db/locate.database )
190
191mkiso:
192 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \
193 -R -J -V DragonFly -o ${ISOFILE} . )
194
195clean:
196 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
197 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
198 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
199
200realclean: clean
201 rm -rf ${OBJSYS}/${KERNCONF}
202
203.include <bsd.prog.mk>