Fix the installer_quickrel target. Also fix the pkgsrc bootstrap, not
[dragonfly.git] / nrelease / Makefile
CommitLineData
f6c08bce 1# $DragonFly: src/nrelease/Makefile,v 1.49 2005/12/23 20:29:57 dillon Exp $
6ca9a59c 2#
5b22b655 3
cc224c64
JS
4# compat target
5installer_release: release
f6c08bce 6installer_quickrel: quickrel
cc224c64 7installer_realquickrel: realquickrel
bce110a5 8installer_fetch: fetch
cc224c64 9
bce110a5 10.if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel) || make(installer_fetch)
cc224c64
JS
11WITH_INSTALLER=
12.endif
13
6ca9a59c
MD
14ISODIR ?= /usr/release
15ISOFILE ?= ${ISODIR}/dfly.iso
16ISOROOT = ${ISODIR}/root
17OBJSYS= ${.OBJDIR}/../sys
18KERNCONF ?= GENERIC
19
cc224c64 20PKGSRC_PREFIX?= /usr/pkg
bce110a5
MD
21PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
22PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
23PKGSRC_PKG_PATH?= ${ISODIR}/packages
24PKGSRC_DB?= /var/db/pkg
25PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.4.0-RELEASE-BUILD
cc224c64
JS
26
27ENV?= env
28TAR?= tar
cc224c64 29
bce110a5
MD
30PKGSRC_CDRECORD?= cdrecord-2.00.3nb2.tgz
31PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20051221
32
33PKGSRC_PACKAGES?= cdrecord-2.00.3nb2.tgz
8188de86
MD
34
35# Specify which root skeletons are required, and let the user include
36# their own. They are copied into ISODIR during the `pkgcustomizeiso'
37# target; each overwrites the last.
38#
39REQ_ROOTSKELS= ${.CURDIR}/root
cc224c64
JS
40ROOTSKELS?= ${REQ_ROOTSKELS}
41
42.if defined(WITH_INSTALLER)
bce110a5
MD
43PKGSRC_PACKAGES+= dfuibe_installer-1.1.6.tgz dfuife_curses-1.5.tgz
44PKGSRC_PACKAGES+= gettext-lib-0.11.5nb6.tgz libaura-3.1.tgz \
45 libdfui-4.1.tgz libinstaller-5.1.tgz
cc224c64
JS
46ROOTSKELS+= installer
47.endif
8188de86 48
5b22b655
MD
49# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
50# the additional '/nrelease' manually, as a safety measure.
51#
52NRLOBJDIR?= /usr/obj
53
acc392b5
JS
54WORLD_CCVER ?= ${CCVER}
55KERNEL_CCVER ?= ${CCVER}
56
8188de86
MD
57#########################################################################
58# BASE ISO TARGETS #
59#########################################################################
60
61release: check clean buildworld1 buildkernel1 \
cc224c64 62 buildiso customizeiso mklocatedb mkiso
8188de86
MD
63
64quickrel: check clean buildworld2 buildkernel2 \
cc224c64 65 buildiso customizeiso mklocatedb mkiso
2e3f8f38 66
cc224c64 67realquickrel: check clean buildiso customizeiso mklocatedb mkiso
6ca9a59c 68
d2582113 69check:
bce110a5
MD
70.if !exists(${PKGBIN_PKG_ADD})
71 @echo "Unable to find ${PKGBIN_PKG_ADD}. You can use the following"
72 @echo "command to bootstrap pkgsrc:"
73 @echo " make pkgsrc_bootstrap"
74 @exit 1
75.endif
76.if !exists(/etc/mk.conf)
77 @echo "You do not have an /etc/mk.conf. You can use the following"
78 @echo "command to install one. Otherwise pkgsrc defaults will not"
79 @echo "point to the right place:"
80 @echo " make pkgsrc_conf"
81 @exit 1
82.endif
83.for PKG in ${PKGSRC_PACKAGES}
84 @${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -n ${PKG} > /dev/null 2>&1 || \
85 (echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo " make [installer_]fetch"; exit 1)
86.endfor
87.if !exists(${PKGBIN_MKISOFS})
88 @echo "mkisofs is not installed. It is part of the cdrecord package."
89 @echo "You can install it with:"
90 @echo " make pkgsrc_cdrecord"
91 @exit 1
92.endif
2e3f8f38 93
6ca9a59c 94buildworld1:
c3f3fe6d 95 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
6ca9a59c
MD
96
97buildworld2:
82a1be39 98 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
6ca9a59c
MD
99
100buildkernel1:
c3f3fe6d 101 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
6ca9a59c
MD
102
103buildkernel2:
82a1be39 104 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
6ca9a59c 105
5b22b655
MD
106# note that we do not want to mess with any /usr/obj directories not related
107# to buildworld, buildkernel, or nrelease, so we must supply the proper
108# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
109# buildkernel mechanism.
110#
6ca9a59c
MD
111buildiso:
112 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 113 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 114 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
115 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
116 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
21aa02d0 117 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
6ca9a59c
MD
118 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
119 installkernel KERNCONF=${KERNCONF} )
c5c5e6fc 120 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
121 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
122 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
123 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86
MD
124
125customizeiso:
bce110a5 126 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
8188de86
MD
127.for ROOTSKEL in ${ROOTSKELS}
128 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
129.endfor
f6c08bce
MD
130 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
131 cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT} ${ISOROOT}/tmp/bootstrap
132 chroot ${ISOROOT} csh -c "cd /tmp/bootstrap/bootstrap; ./bootstrap"
d08963d3 133 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
8188de86 134 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 135 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 136 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
137.for UPGRADE_ITEM in Makefile \
138 etc.${MACHINE_ARCH} \
139 isdn/Makefile \
140 rc.d/Makefile \
141 periodic/Makefile \
142 periodic/daily/Makefile \
143 periodic/security/Makefile \
144 periodic/weekly/Makefile \
145 periodic/monthly/Makefile
146 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
147.endfor
bce110a5
MD
148.for PKG in ${PKGSRC_PACKAGES}
149 ${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
8188de86 150.endfor
6ca9a59c 151
8398ca17
SW
152mklocatedb:
153 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
154 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
155 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
156 /usr/libexec/locate.mklocatedb \
157 -presort >${ISOROOT}/var/db/locate.database )
158
6ca9a59c 159mkiso:
bce110a5 160 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
382f1ee3 161 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
162
163clean:
164 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 165 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 166 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
167
168realclean: clean
3ebedc5e 169 rm -rf ${OBJSYS}/${KERNCONF}
bce110a5
MD
170 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
171 # override location.
172 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
6ca9a59c 173
cc224c64
JS
174fetch:
175 mkdir -p ${PKGSRC_PKG_PATH}
bce110a5
MD
176.for PKG in ${PKGSRC_PACKAGES}
177 @${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -n ${PKG} > /dev/null 2>&1 || \
178 (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
179.endfor
180.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
181 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
182.endif
183
184pkgsrc_bootstrap:
185 mkdir -p ${PKGSRC_PKG_PATH}
186.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
187 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
188.endif
189 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
190 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
191
192pkgsrc_conf:
193.if !exists(/etc/mk.conf)
194 cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
195.else
196 fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
197.endif
198
199pkgsrc_cdrecord:
200.if !exists (${PKGBIN_MKISOFS})
201 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
202.endif
cc224c64
JS
203
204.PHONY: all release installer_release quickrel installer_quickrel realquickrel
bce110a5 205.PHONY: installer_fetch
cc224c64
JS
206.PHONY: installer_realquickrel check buildworld1 buildworld2
207.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
d5c58845 208.PHONY: clean realclean fetch
cc224c64 209
6ca9a59c 210.include <bsd.prog.mk>