1.4 Release branched, HEAD is now 1.5.
[dragonfly.git] / nrelease / Makefile
CommitLineData
d08963d3 1# $DragonFly: src/nrelease/Makefile,v 1.48 2005/12/22 23:23:32 dillon Exp $
6ca9a59c 2#
5b22b655 3
cc224c64
JS
4# compat target
5installer_release: release
6installer_quickrel:
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
d08963d3
MD
130 cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap ${ISOROOT}/tmp/bootstrap
131 chroot ${ISOROOT} csh -c "cd /tmp/bootstrap; ./bootstrap"
132 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
8188de86 133 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 134 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 135 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
136.for UPGRADE_ITEM in Makefile \
137 etc.${MACHINE_ARCH} \
138 isdn/Makefile \
139 rc.d/Makefile \
140 periodic/Makefile \
141 periodic/daily/Makefile \
142 periodic/security/Makefile \
143 periodic/weekly/Makefile \
144 periodic/monthly/Makefile
145 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
146.endfor
bce110a5
MD
147.for PKG in ${PKGSRC_PACKAGES}
148 ${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
8188de86 149.endfor
6ca9a59c 150
8398ca17
SW
151mklocatedb:
152 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
153 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
154 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
155 /usr/libexec/locate.mklocatedb \
156 -presort >${ISOROOT}/var/db/locate.database )
157
6ca9a59c 158mkiso:
bce110a5 159 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
382f1ee3 160 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
161
162clean:
163 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 164 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 165 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
166
167realclean: clean
3ebedc5e 168 rm -rf ${OBJSYS}/${KERNCONF}
bce110a5
MD
169 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
170 # override location.
171 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
6ca9a59c 172
cc224c64
JS
173fetch:
174 mkdir -p ${PKGSRC_PKG_PATH}
bce110a5
MD
175.for PKG in ${PKGSRC_PACKAGES}
176 @${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -n ${PKG} > /dev/null 2>&1 || \
177 (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
178.endfor
179.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
180 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
181.endif
182
183pkgsrc_bootstrap:
184 mkdir -p ${PKGSRC_PKG_PATH}
185.if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
186 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
187.endif
188 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
189 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
190
191pkgsrc_conf:
192.if !exists(/etc/mk.conf)
193 cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
194.else
195 fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
196.endif
197
198pkgsrc_cdrecord:
199.if !exists (${PKGBIN_MKISOFS})
200 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
201.endif
cc224c64
JS
202
203.PHONY: all release installer_release quickrel installer_quickrel realquickrel
bce110a5 204.PHONY: installer_fetch
cc224c64
JS
205.PHONY: installer_realquickrel check buildworld1 buildworld2
206.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
d5c58845 207.PHONY: clean realclean fetch
cc224c64 208
6ca9a59c 209.include <bsd.prog.mk>