- Better handling of a given(-p) invalid port number.
[dragonfly.git] / nrelease / Makefile
CommitLineData
755f2cbd 1# $DragonFly: src/nrelease/Makefile,v 1.24 2005/01/27 19:42:32 dillon 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#
14REQ_PACKAGES= cdrtools-2.0.3_3 cvsup-without-gui-16.1h
15PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES}
16PACKAGES_LOC?= /usr/ports/packages/All
17
18# Specify which root skeletons are required, and let the user include
19# their own. They are copied into ISODIR during the `pkgcustomizeiso'
20# target; each overwrites the last.
21#
22REQ_ROOTSKELS= ${.CURDIR}/root
23ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS}
24
5b22b655
MD
25# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
26# the additional '/nrelease' manually, as a safety measure.
27#
28NRLOBJDIR?= /usr/obj
29
acc392b5
JS
30WORLD_CCVER ?= ${CCVER}
31KERNEL_CCVER ?= ${CCVER}
32
8188de86
MD
33#########################################################################
34# BASE ISO TARGETS #
35#########################################################################
36
37release: check clean buildworld1 buildkernel1 \
38 buildiso customizeiso pkgaddiso mkiso
39
40quickrel: check clean buildworld2 buildkernel2 \
41 buildiso customizeiso pkgaddiso mkiso
42
43realquickrel: check clean \
44 buildiso customizeiso pkgaddiso mkiso
6ca9a59c 45
8188de86
MD
46#########################################################################
47# ISO TARGETS WITH INSTALLER #
48#########################################################################
6ca9a59c 49
28f232b0 50INSTALLER_PKGS= libaura-1.0 libdfui-2.0 libinstaller-2.0 \
21aa02d0 51 dfuibe_installer-1.1.2 dfuife_curses-1.1 \
413f4c52 52 thttpd-notimeout-2.24 dfuife_cgi-1.1
8188de86
MD
53INSTALLER_SKELS= installer
54
10dd2a9b
CP
55INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS} ${EXTRA_PACKAGES}" \
56 EXTRA_ROOTSKELS="${INSTALLER_SKELS} ${EXTRA_ROOTSKELS}"
8188de86
MD
57
58installer_check:
59 @${INSTALLER_ENV} ${MAKE} check
60
2e3f8f38
MD
61installer_fetchpkgs:
62 @${INSTALLER_ENV} ${MAKE} fetchpkgs
63
8188de86
MD
64installer_release:
65 ${INSTALLER_ENV} ${MAKE} release
66
67installer_quickrel:
68 ${INSTALLER_ENV} ${MAKE} quickrel
69
70installer_realquickrel:
71 ${INSTALLER_ENV} ${MAKE} realquickrel
72
73#########################################################################
74# HELPER TARGETS #
75#########################################################################
6ca9a59c 76
17d0fefe 77check:
8188de86 78 @if [ ! -f /usr/local/bin/mkisofs ]; then \
755f2cbd
MD
79 echo "You need to install the sysutils/cdrtools port for"; \
80 echo "this target"; \
8188de86
MD
81 exit 1; \
82 fi
83.for PKG in ${PACKAGES}
84 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
85 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz. This is"; \
86 echo "typically accomplished by cd'ing into the appropriate"; \
7ac6de67 87 echo "port and typing 'make installer_fetchpkgs'"; \
8188de86
MD
88 echo ""; \
89 echo "If you are trying to build the installer, the"; \
90 echo "required packages can be obtained from:"; \
a0ecab1b 91 echo "http://www.bsdinstaller.org/packages/"; \
8188de86
MD
92 exit 1; \
93 fi
94.endfor
95 @echo "check: all preqs found"
6ca9a59c 96
2e3f8f38
MD
97fetchpkgs:
98.for PKG in ${PACKAGES}
99 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
100 cd ${PACKAGES_LOC} && \
101 echo "fetching ${PKG}..." && \
102 fetch http://www.bsdinstaller.org/packages/${PKG}.tgz; \
103 fi
104.endfor
105
6ca9a59c 106buildworld1:
c3f3fe6d 107 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
6ca9a59c
MD
108
109buildworld2:
c3f3fe6d 110 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make -DNOTOOLS -DNOCLEAN buildworld )
6ca9a59c
MD
111
112buildkernel1:
c3f3fe6d 113 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
6ca9a59c
MD
114
115buildkernel2:
c3f3fe6d 116 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make -DNOCLEAN buildkernel KERNCONF=${KERNCONF} )
6ca9a59c 117
5b22b655
MD
118# note that we do not want to mess with any /usr/obj directories not related
119# to buildworld, buildkernel, or nrelease, so we must supply the proper
120# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
121# buildkernel mechanism.
122#
6ca9a59c
MD
123buildiso:
124 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 125 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 126 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
5b22b655 127 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease make DESTDIR=${ISOROOT} distribution )
21aa02d0 128 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
6ca9a59c
MD
129 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
130 installkernel KERNCONF=${KERNCONF} )
26ef3385 131 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
132 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
133 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
134 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86
MD
135
136customizeiso:
137.for ROOTSKEL in ${ROOTSKELS}
138 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
139.endfor
140 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 141 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 142 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
8188de86
MD
143
144pkgcleaniso:
145 rm -f ${ISOROOT}/tmp/chrootscript
146 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
147.for PKG in ${PACKAGES}
148 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
149.endfor
150 chmod a+x ${ISOROOT}/tmp/chrootscript
151 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
152 rm ${ISOROOT}/tmp/chrootscript
153
154pkgaddiso:
155 rm -f ${ISOROOT}/tmp/chrootscript
156 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
157.for PKG in ${PACKAGES}
158 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz
159 echo "echo 'Installing package ${PKG}...'" >> ${ISOROOT}/tmp/chrootscript
160 echo "pkg_add /tmp/${PKG}.tgz" >> ${ISOROOT}/tmp/chrootscript
161.endfor
162 chmod a+x ${ISOROOT}/tmp/chrootscript
163 chroot ${ISOROOT}/ /tmp/chrootscript
164 rm ${ISOROOT}/tmp/chrootscript
165.for PKG in ${PACKAGES}
166 rm -f ${ISOROOT}/tmp/${PKG}.tgz
167.endfor
6ca9a59c
MD
168
169mkiso:
170 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \
382f1ee3 171 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
172
173clean:
174 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 175 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 176 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
177
178realclean: clean
3ebedc5e 179 rm -rf ${OBJSYS}/${KERNCONF}
6ca9a59c
MD
180
181.include <bsd.prog.mk>