- Tack pfi.conf onto the end of rc.conf later (only after pfi.conf
[dragonfly.git] / nrelease / Makefile
CommitLineData
3b4d7f2d 1# $DragonFly: src/nrelease/Makefile,v 1.27 2005/03/03 22:57:39 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 \
42 buildiso customizeiso pkgaddiso mkiso
43
44quickrel: check clean buildworld2 buildkernel2 \
45 buildiso customizeiso pkgaddiso mkiso
46
47realquickrel: check clean \
48 buildiso customizeiso pkgaddiso mkiso
6ca9a59c 49
8188de86
MD
50#########################################################################
51# ISO TARGETS WITH INSTALLER #
52#########################################################################
6ca9a59c 53
ec68b4b6
CP
54INSTALLER_PKGS= libaura-2.0 libdfui-3.0 libinstaller-4.0 \
55 dfuibe_installer-1.1.4 dfuife_curses-1.3 \
56 thttpd-notimeout-2.24 dfuife_cgi-1.2
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
17d0fefe 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
MD
88 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
89 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz. This is"; \
90 echo "typically accomplished by cd'ing into the appropriate"; \
7ac6de67 91 echo "port and typing 'make installer_fetchpkgs'"; \
8188de86
MD
92 echo ""; \
93 echo "If you are trying to build the installer, the"; \
94 echo "required packages can be obtained from:"; \
a0ecab1b 95 echo "http://www.bsdinstaller.org/packages/"; \
8188de86
MD
96 exit 1; \
97 fi
98.endfor
99 @echo "check: all preqs found"
6ca9a59c 100
2e3f8f38 101fetchpkgs:
bf9b513b 102.for PKG in ${REL_PACKAGES}
2e3f8f38
MD
103 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
104 cd ${PACKAGES_LOC} && \
105 echo "fetching ${PKG}..." && \
106 fetch http://www.bsdinstaller.org/packages/${PKG}.tgz; \
107 fi
108.endfor
109
6ca9a59c 110buildworld1:
c3f3fe6d 111 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
6ca9a59c
MD
112
113buildworld2:
c3f3fe6d 114 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make -DNOTOOLS -DNOCLEAN buildworld )
6ca9a59c
MD
115
116buildkernel1:
c3f3fe6d 117 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
6ca9a59c
MD
118
119buildkernel2:
c3f3fe6d 120 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make -DNOCLEAN buildkernel KERNCONF=${KERNCONF} )
6ca9a59c 121
5b22b655
MD
122# note that we do not want to mess with any /usr/obj directories not related
123# to buildworld, buildkernel, or nrelease, so we must supply the proper
124# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
125# buildkernel mechanism.
126#
6ca9a59c
MD
127buildiso:
128 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 129 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 130 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
5b22b655 131 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease make DESTDIR=${ISOROOT} distribution )
21aa02d0 132 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
6ca9a59c
MD
133 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
134 installkernel KERNCONF=${KERNCONF} )
26ef3385 135 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
136 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
137 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
138 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86
MD
139
140customizeiso:
141.for ROOTSKEL in ${ROOTSKELS}
142 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
143.endfor
144 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 145 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 146 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
8188de86
MD
147
148pkgcleaniso:
149 rm -f ${ISOROOT}/tmp/chrootscript
150 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 151.for PKG in ${REL_PACKAGES}
8188de86
MD
152 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
153.endfor
154 chmod a+x ${ISOROOT}/tmp/chrootscript
155 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
156 rm ${ISOROOT}/tmp/chrootscript
157
158pkgaddiso:
159 rm -f ${ISOROOT}/tmp/chrootscript
160 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 161.for PKG in ${REL_PACKAGES}
8188de86
MD
162 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz
163 echo "echo 'Installing package ${PKG}...'" >> ${ISOROOT}/tmp/chrootscript
164 echo "pkg_add /tmp/${PKG}.tgz" >> ${ISOROOT}/tmp/chrootscript
165.endfor
166 chmod a+x ${ISOROOT}/tmp/chrootscript
167 chroot ${ISOROOT}/ /tmp/chrootscript
168 rm ${ISOROOT}/tmp/chrootscript
bf9b513b 169.for PKG in ${REL_PACKAGES}
8188de86
MD
170 rm -f ${ISOROOT}/tmp/${PKG}.tgz
171.endfor
6ca9a59c
MD
172
173mkiso:
174 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \
382f1ee3 175 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
176
177clean:
178 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 179 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 180 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
181
182realclean: clean
3ebedc5e 183 rm -rf ${OBJSYS}/${KERNCONF}
6ca9a59c
MD
184
185.include <bsd.prog.mk>