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