summaryrefslogtreecommitdiffstats
path: root/release/Makefile.bsdinstall
blob: 181d281ede115c1bc954aeecc9f396822fbcad8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# $FreeBSD$
#
# Makefile for building releases and release media.
# 
# User-driven targets:
#  cdrom: Builds release CD-ROM media (release.iso)
#  ftp: Sets up FTP distribution area (ftp)
#  release: Build all media and FTP distribution area
#
# Variables affecting the build process:
#  WORLDDIR: location of src tree -- must have built world and default kernel
#            (by default, the directory above this one) 
#  PORTSDIR: location of ports tree to distribute (default: /usr/ports)
#  NOPORTS:  if set, do not distribute ports tree
#  NOSRC:    if set, do not distribute source tree
#  TARGET/TARGET_ARCH: architecture of built release 
#

WORLDDIR?=	${.CURDIR}/..
PORTSDIR?=	/usr/ports

TARGET_ARCH?=	${MACHINE_ARCH}
.if ${TARGET_ARCH} == ${MACHINE_ARCH}
TARGET?=	${MACHINE}
.else
TARGET?=	${TARGET_ARCH}
.endif
IMAKE=		${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
DISTDIR=	${.OBJDIR}/dist

EXTRA_PACKAGES= 
.if !defined(NOPORTS)
EXTRA_PACKAGES+= ports.txz
.endif
.if !defined(NOSRC)
EXTRA_PACKAGES+= src.txz
.endif

.include <bsd.obj.mk>

base.txz:
	-mkdir ${DISTDIR}
	cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${DISTDIR}
# Set up mergemaster root database
	sh ${.CURDIR}/scripts/mm-mtree.sh -F "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${DISTDIR}/base"
	cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${DISTDIR}
	mv ${DISTDIR}/*.txz ${.OBJDIR}

kernel.txz:
	-mkdir ${DISTDIR}
	cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${DISTDIR}
	mv ${DISTDIR}/kernel.txz ${.OBJDIR}

src.txz:
	-mkdir -p ${DISTDIR}/usr
	ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude CVS usr/src

ports.txz:
	-mkdir -p ${DISTDIR}/usr
	ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz --exclude usr/ports/distfiles --exclude usr/ports/packages --exclude 'usr/ports/INDEX*' usr/ports

system: packagesystem
# Install system
	-mkdir ${.OBJDIR}/release
	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution DESTDIR=${.OBJDIR}/release
	-rm ${.OBJDIR}/release/boot/kernel/*.symbols
# Copy distfiles
	mkdir ${.OBJDIR}/release/usr/freebsd-dist
	cp ${.OBJDIR}/*.txz ${.OBJDIR}/release/usr/freebsd-dist
# Set up installation environment
	ln -s /tmp/bsdinstall_etc/resolv.conf ${.OBJDIR}/release/etc/resolv.conf
	echo sendmail_enable=\"NONE\" > ${.OBJDIR}/release/etc/rc.conf
	echo hostid_enable=\"NO\" >> ${.OBJDIR}/release/etc/rc.conf
	touch ${.OBJDIR}/release/etc/fstab
	cp ${.CURDIR}/rc.local ${.OBJDIR}/release/etc
	touch ${.OBJDIR}/${.TARGET}

release.iso: system
	echo kernel_options=\"-C\" > ${.OBJDIR}/release/boot/loader.conf
	sh /usr/src/release/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.OBJDIR}/release.iso ${.OBJDIR}/release
	rm ${.OBJDIR}/release/boot/loader.conf

packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
	touch ${.OBJDIR}/${.TARGET}

cdrom: release.iso
ftp: packagesystem
	mkdir ${.OBJDIR}/ftp
	cp ${.OBJDIR}/*.txz ${.OBJDIR}/ftp

release: cdrom ftp

clean:
	chflags -R noschg ${.OBJDIR}
	rm -rf ${.OBJDIR}/dist ${.OBJDIR}/ftp
	rm -f packagesystem
	rm -f ${.OBJDIR}/*.txz
	rm -f system
	rm -rf ${.OBJDIR}/release
	rm -f ${.OBJDIR}/release.iso
	rm -f ${.OBJDIR}/*.txz

OpenPOWER on IntegriCloud