Convert to mdoc.
[dragonfly/vkernel-mp.git] / nrelease / Makefile
blobcc7c7abe47c536488c301908ceaa4e49a657f938
1 # $DragonFly: src/nrelease/Makefile,v 1.57 2006/12/11 21:54:22 dillon Exp $
4 # compat target
5 installer_release: release
6 installer_quickrel: quickrel
7 installer_realquickrel: realquickrel
8 installer_fetch: fetch
10 .if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel) || make(installer_fetch)
11 WITH_INSTALLER=
12 .endif
14 ISODIR ?= /usr/release
15 ISOFILE ?= ${ISODIR}/dfly.iso
16 ISOROOT = ${ISODIR}/root
17 OBJSYS= ${.OBJDIR}/../sys
18 KERNCONF ?= GENERIC
20 PKGSRC_PREFIX?= /usr/pkg
21 PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
22 PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
23 PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
24 PKGSRC_PKG_PATH?= ${ISODIR}/packages
25 PKGSRC_DB?= /var/db/pkg
26 PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.4.4-RELEASE-BUILD
28 ENVCMD?= env
29 TAR?= tar
31 PKGSRC_CDRECORD?= cdrecord-2.00.3nb2.tgz
32 PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20051221
33 CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20051229
35 PKGSRC_PACKAGES?= cdrecord-2.00.3nb2.tgz
37 # Specify which root skeletons are required, and let the user include
38 # their own. They are copied into ISODIR during the `pkgcustomizeiso'
39 # target; each overwrites the last.
41 REQ_ROOTSKELS= ${.CURDIR}/root
42 ROOTSKELS?= ${REQ_ROOTSKELS}
44 .if defined(WITH_INSTALLER)
45 PKGSRC_PACKAGES+= dfuibe_installer-1.1.6a.tgz dfuife_curses-1.5.tgz
46 PKGSRC_PACKAGES+= gettext-lib-0.14.5.tgz libaura-3.1.tgz \
47 libdfui-4.2.tgz libinstaller-5.1.tgz
48 ROOTSKELS+= ${.CURDIR}/installer
49 .endif
51 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
52 # the additional '/nrelease' manually, as a safety measure.
54 NRLOBJDIR?= /usr/obj
56 WORLD_CCVER ?= ${CCVER}
57 KERNEL_CCVER ?= ${CCVER}
59 #########################################################################
60 # BASE ISO TARGETS #
61 #########################################################################
63 release: check clean buildworld1 buildkernel1 \
64 buildiso syssrcs customizeiso mklocatedb mkiso
66 quickrel: check clean buildworld2 buildkernel2 \
67 buildiso syssrcs customizeiso mklocatedb mkiso
69 realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso
71 check:
72 .if !exists(${PKGBIN_PKG_ADD})
73 @echo "Unable to find ${PKGBIN_PKG_ADD}. You can use the following"
74 @echo "command to bootstrap pkgsrc:"
75 @echo " make pkgsrc_bootstrap"
76 @exit 1
77 .endif
78 .if !exists(/etc/mk.conf)
79 @echo "You do not have an /etc/mk.conf. You can use the following"
80 @echo "command to install one. Otherwise pkgsrc defaults will not"
81 @echo "point to the right place:"
82 @echo " make pkgsrc_conf"
83 @exit 1
84 .endif
85 .for PKG in ${PKGSRC_PACKAGES}
86 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
87 (echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo " make [installer_]fetch"; exit 1)
88 .endfor
89 .if !exists(${PKGBIN_MKISOFS})
90 @echo "mkisofs is not installed. It is part of the cdrecord package."
91 @echo "You can install it with:"
92 @echo " make pkgsrc_cdrecord"
93 @exit 1
94 .endif
95 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
96 @echo "The pkgsrc bootstrap kit is not installed. You can install it with:"
97 @echo " make [installer_]fetch"
98 @exit 1
99 .endif
100 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
101 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
102 @echo " make [installer_]fetch"
103 @exit 1
104 .endif
106 buildworld1:
107 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
109 buildworld2:
110 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
112 buildkernel1:
113 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
115 buildkernel2:
116 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
118 # note that we do not want to mess with any /usr/obj directories not related
119 # to buildworld, buildkernel, or nrelease, so we must supply the proper
120 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
121 # buildkernel mechanism.
123 buildiso:
124 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
125 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
126 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
127 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
128 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
129 cp -p ${.CURDIR}/mk.conf.pkgsrc ${ISOROOT}/etc/mk.conf
130 chroot ${ISOROOT} /usr/bin/newaliases
131 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
132 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
133 installkernel KERNCONF=${KERNCONF} )
134 ln -s kernel ${ISOROOT}/kernel.BOOTP
135 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
136 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
137 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
139 # Include kernel sources on the release CD (~14MB)
141 syssrcs:
142 .if !defined(WITHOUT_SRCS)
143 ( cd ${.CURDIR}/../..; tar --exclude CVS -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
144 .endif
146 customizeiso:
147 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
148 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
149 .for ROOTSKEL in ${ROOTSKELS}
150 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
151 .endfor
152 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
153 cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT} ${ISOROOT}/tmp/bootstrap
154 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
155 chroot ${ISOROOT} csh -c "cd /tmp/bootstrap/bootstrap; ./bootstrap"
156 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
157 rm -rf `find ${ISOROOT} -type d -name CVS -print`
158 rm -rf ${ISOROOT}/usr/local/share/pristine
159 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
160 .for UPGRADE_ITEM in Makefile \
161 etc.${MACHINE_ARCH} \
162 isdn/Makefile \
163 rc.d/Makefile \
164 periodic/Makefile \
165 periodic/daily/Makefile \
166 periodic/security/Makefile \
167 periodic/weekly/Makefile \
168 periodic/monthly/Makefile
169 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
170 .endfor
171 .for PKG in ${PKGSRC_PACKAGES}
172 ${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
173 .endfor
174 find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
175 ${PKGBIN_PKG_ADMIN} -K ${ISOROOT}${PKGSRC_DB} rebuild
177 mklocatedb:
178 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
179 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
180 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
181 /usr/libexec/locate.mklocatedb \
182 -presort >${ISOROOT}/var/db/locate.database )
184 mkiso:
185 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
186 -R -J -V DragonFly -o ${ISOFILE} . )
188 clean:
189 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
190 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
191 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
193 realclean: clean
194 rm -rf ${OBJSYS}/${KERNCONF}
195 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
196 # override location.
197 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
199 fetch:
200 mkdir -p ${PKGSRC_PKG_PATH}
201 .for PKG in ${PKGSRC_PACKAGES}
202 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
203 (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
204 .endfor
205 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
206 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
207 .endif
208 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
209 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
210 .endif
212 pkgsrc_bootstrap:
213 mkdir -p ${PKGSRC_PKG_PATH}
214 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
215 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
216 .endif
217 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
218 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
220 pkgsrc_conf:
221 .if !exists(/etc/mk.conf)
222 cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
223 .else
224 fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
225 .endif
227 pkgsrc_cdrecord:
228 .if !exists (${PKGBIN_MKISOFS})
229 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
230 .endif
232 .PHONY: all release installer_release quickrel installer_quickrel realquickrel
233 .PHONY: installer_fetch
234 .PHONY: installer_realquickrel check buildworld1 buildworld2
235 .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
236 .PHONY: clean realclean fetch
238 .include <bsd.prog.mk>