Merge from vendor branch SENDMAIL:
[dragonfly.git] / nrelease / Makefile
CommitLineData
0272b808 1# $DragonFly: src/nrelease/Makefile,v 1.34 2005/04/19 04:20:27 cpressey Exp $
6ca9a59c 2#
5b22b655 3
6ca9a59c
MD
4ISODIR ?= /usr/release
5ISOFILE ?= ${ISODIR}/dfly.iso
6ISOROOT = ${ISODIR}/root
7OBJSYS= ${.OBJDIR}/../sys
8KERNCONF ?= GENERIC
9
8188de86
MD
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#
3b4d7f2d 14REQ_PACKAGES= cdrtools-2.01 cvsup-without-gui-16.1h
bf9b513b
JS
15REL_PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES}
16.if defined(PACKAGES)
17PACKAGES_LOC?= ${PACKAGES}/All
18.else
8188de86 19PACKAGES_LOC?= /usr/ports/packages/All
bf9b513b 20.endif
8188de86
MD
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
5b22b655
MD
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
acc392b5
JS
34WORLD_CCVER ?= ${CCVER}
35KERNEL_CCVER ?= ${CCVER}
36
8188de86
MD
37#########################################################################
38# BASE ISO TARGETS #
39#########################################################################
40
41release: check clean buildworld1 buildkernel1 \
8398ca17 42 buildiso customizeiso pkgaddiso mklocatedb mkiso
8188de86
MD
43
44quickrel: check clean buildworld2 buildkernel2 \
8398ca17 45 buildiso customizeiso pkgaddiso mklocatedb mkiso
8188de86
MD
46
47realquickrel: check clean \
8398ca17 48 buildiso customizeiso pkgaddiso mklocatedb mkiso
6ca9a59c 49
8188de86
MD
50#########################################################################
51# ISO TARGETS WITH INSTALLER #
52#########################################################################
6ca9a59c 53
e94931c5
MD
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
8188de86
MD
57INSTALLER_SKELS= installer
58
10dd2a9b
CP
59INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS} ${EXTRA_PACKAGES}" \
60 EXTRA_ROOTSKELS="${INSTALLER_SKELS} ${EXTRA_ROOTSKELS}"
8188de86
MD
61
62installer_check:
63 @${INSTALLER_ENV} ${MAKE} check
64
2e3f8f38
MD
65installer_fetchpkgs:
66 @${INSTALLER_ENV} ${MAKE} fetchpkgs
67
8188de86
MD
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#########################################################################
6ca9a59c 80
d2582113 81check:
8188de86 82 @if [ ! -f /usr/local/bin/mkisofs ]; then \
755f2cbd
MD
83 echo "You need to install the sysutils/cdrtools port for"; \
84 echo "this target"; \
8188de86
MD
85 exit 1; \
86 fi
bf9b513b 87.for PKG in ${REL_PACKAGES}
8188de86 88 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
16d62894
CP
89 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz."; \
90 echo "(Perhaps you need to download or build it first?)"; \
8188de86
MD
91 echo ""; \
92 echo "If you are trying to build the installer, the"; \
93 echo "required packages can be obtained from:"; \
16d62894
CP
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 ""; \
8188de86
MD
100 exit 1; \
101 fi
102.endfor
103 @echo "check: all preqs found"
6ca9a59c 104
2e3f8f38 105fetchpkgs:
bf9b513b 106.for PKG in ${REL_PACKAGES}
2e3f8f38
MD
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
6ca9a59c 114buildworld1:
c3f3fe6d 115 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
6ca9a59c
MD
116
117buildworld2:
c3f3fe6d 118 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make -DNOTOOLS -DNOCLEAN buildworld )
6ca9a59c
MD
119
120buildkernel1:
c3f3fe6d 121 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
6ca9a59c
MD
122
123buildkernel2:
c3f3fe6d 124 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make -DNOCLEAN buildkernel KERNCONF=${KERNCONF} )
6ca9a59c 125
5b22b655
MD
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#
6ca9a59c
MD
131buildiso:
132 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 133 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 134 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
5b22b655 135 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease make DESTDIR=${ISOROOT} distribution )
21aa02d0 136 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
6ca9a59c
MD
137 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
138 installkernel KERNCONF=${KERNCONF} )
26ef3385 139 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
140 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
141 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
142 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86
MD
143
144customizeiso:
145.for ROOTSKEL in ${ROOTSKELS}
146 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
147.endfor
148 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 149 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 150 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
8188de86
MD
151
152pkgcleaniso:
153 rm -f ${ISOROOT}/tmp/chrootscript
154 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 155.for PKG in ${REL_PACKAGES}
8188de86
MD
156 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
157.endfor
158 chmod a+x ${ISOROOT}/tmp/chrootscript
159 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
160 rm ${ISOROOT}/tmp/chrootscript
161
162pkgaddiso:
163 rm -f ${ISOROOT}/tmp/chrootscript
164 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 165.for PKG in ${REL_PACKAGES}
0272b808
CP
166 if [ ! -d ${ISOROOT}/var/db/pkg/${PKG} ]; then \
167 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz; \
168 echo "echo 'Installing package ${PKG}...' && \\" >> \
169 ${ISOROOT}/tmp/chrootscript; \
170 echo "pkg_add /tmp/${PKG}.tgz && \\" >> \
171 ${ISOROOT}/tmp/chrootscript; \
172 fi
8188de86 173.endfor
0272b808
CP
174 echo "echo 'All packages added successfully!'" >> \
175 ${ISOROOT}/tmp/chrootscript
8188de86
MD
176 chmod a+x ${ISOROOT}/tmp/chrootscript
177 chroot ${ISOROOT}/ /tmp/chrootscript
178 rm ${ISOROOT}/tmp/chrootscript
bf9b513b 179.for PKG in ${REL_PACKAGES}
8188de86
MD
180 rm -f ${ISOROOT}/tmp/${PKG}.tgz
181.endfor
6ca9a59c 182
8398ca17
SW
183mklocatedb:
184 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
185 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
186 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
187 /usr/libexec/locate.mklocatedb \
188 -presort >${ISOROOT}/var/db/locate.database )
189
6ca9a59c
MD
190mkiso:
191 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \
382f1ee3 192 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
193
194clean:
195 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 196 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 197 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
198
199realclean: clean
3ebedc5e 200 rm -rf ${OBJSYS}/${KERNCONF}
6ca9a59c
MD
201
202.include <bsd.prog.mk>