3 # Makefile for building releases and release media.
6 # cdrom: Builds release CD-ROM media (disc1.iso)
7 # dvdrom: Builds release DVD-ROM media (dvd1.iso)
8 # memstick: Builds memory stick image (memstick.img)
9 # mini-memstick: Builds minimal memory stick image (mini-memstick.img)
10 # ftp: Sets up FTP distribution area (ftp)
11 # release: Build all media and FTP distribution area
12 # install: Copies all release media into ${DESTDIR}
14 # Variables affecting the build process:
15 # WORLDDIR: location of src tree -- must have built world and default kernel
16 # (by default, the directory above this one)
17 # PORTSDIR: location of ports tree to distribute (default: /usr/ports)
18 # DOCDIR: location of doc tree (default: /usr/doc)
19 # NOPKG: if set, do not distribute third-party packages
20 # NOPORTS: if set, do not distribute ports tree
21 # NOSRC: if set, do not distribute source tree
22 # NODOC: if set, do not generate release documentation
23 # WITH_DVD: if set, generate dvd1.iso
24 # WITH_COMPRESSED_IMAGES: if set, compress installation images with xz(1)
25 # (uncompressed images are not removed)
26 # WITH_VMIMAGES: if set, build virtual machine images with the release
27 # WITH_COMPRESSED_VMIMAGES: if set, compress virtual machine disk images
28 # with xz(1) (extremely time consuming)
29 # TARGET/TARGET_ARCH: architecture of built release
32 WORLDDIR?
= ${.CURDIR
}/..
35 RELNOTES_LANG?
= en_US.ISO8859-1
38 .if
!defined
(TARGET
) || empty
(TARGET
)
41 .if
!defined
(TARGET_ARCH
) || empty
(TARGET_ARCH
)
42 .if
${TARGET} == ${MACHINE}
43 TARGET_ARCH
= ${MACHINE_ARCH}
45 TARGET_ARCH
= ${TARGET}
48 IMAKE
= ${MAKE} TARGET_ARCH
=${TARGET_ARCH} TARGET
=${TARGET}
51 # Define OSRELEASE by using newvars.sh
52 .if
!defined
(OSRELEASE
) || empty
(OSRELEASE
)
53 .for _V in TYPE BRANCH REVISION
54 ${_V}!= eval
$$(awk
'/^${_V}=/{print}' ${.CURDIR
}/..
/sys
/conf
/newvers.sh
); echo
$$${_V}
56 .for _V in
${TARGET_ARCH}
57 .if
!empty
(TARGET
:M
${_V})
58 OSRELEASE
= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}
59 VOLUME_LABEL
= ${REVISION
:C
/[.
-]/_
/g
}_
${BRANCH
:C
/[.
-]/_
/g
}_
${TARGET}
61 OSRELEASE
= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH}
62 VOLUME_LABEL
= ${REVISION
:C
/[.
-]/_
/g
}_
${BRANCH
:C
/[.
-]/_
/g
}_
${TARGET_ARCH}
67 .if
!defined
(VOLUME_LABEL
) || empty
(VOLUME_LABEL
)
68 VOLUME_LABEL
= FreeBSD_Install
71 .if
!exists
(${DOCDIR})
74 .if
!exists
(${PORTSDIR})
80 EXTRA_PACKAGES
+= ports.txz
83 EXTRA_PACKAGES
+= src.txz
86 EXTRA_PACKAGES
+= reldoc
91 .if exists
(${.CURDIR
}/${TARGET}/mkisoimages.sh
)
92 RELEASE_TARGETS
+= cdrom
93 IMAGES
+= disc1.iso bootonly.iso
94 . if defined
(WITH_DVD
) && !empty
(WITH_DVD
)
95 RELEASE_TARGETS
+= dvdrom
99 .if exists
(${.CURDIR
}/${TARGET}/make-memstick.sh
)
100 RELEASE_TARGETS
+= memstick.img
101 RELEASE_TARGETS
+= mini-memstick.img
102 IMAGES
+= memstick.img
103 IMAGES
+= mini-memstick.img
106 VMTARGETS
= vm-base vm-image
107 VMFORMATS?
= vhd vmdk qcow2 raw
110 AZURECONF?
= ${.CURDIR
}/tools
/azure.conf
112 CLEANFILES
= packagesystem
*.txz MANIFEST system
${IMAGES}
113 .if defined
(WITH_COMPRESSED_IMAGES
) && !empty
(WITH_COMPRESSED_IMAGES
)
118 .if defined
(WITH_DVD
) && !empty
(WITH_DVD
)
119 CLEANFILES
+= pkg-stage
121 .if defined
(WITH_VMIMAGES
) && !empty
(WITH_VMIMAGES
)
122 CLEANFILES
+= ${VMBASE}.img
123 . for FORMAT in
${VMFORMATS}
124 CLEANFILES
+= ${VMBASE}.
${FORMAT}
127 CLEANDIRS
= dist ftp release bootonly dvd
128 .if defined
(WITH_VMIMAGES
) && !empty
(WITH_VMIMAGES
)
129 CLEANDIRS
+= ${VMTARGETS}
131 .if exists
(${.CURDIR
}/${TARGET}/mk-azure.sh
)
132 CLEANFILES
+= ${OSRELEASE}.vhd \
133 ${OSRELEASE}.vhd.raw \
139 .
include <bsd.obj.mk
>
144 cd
${WORLDDIR} && ${IMAKE} distributeworld DISTDIR
=${.OBJDIR
}/${DISTDIR}
145 # Set up mergemaster root database
146 sh
${.CURDIR
}/scripts
/mm-mtree.sh
-m
${WORLDDIR} -F \
147 "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D
"${.OBJDIR}/${DISTDIR}/base"
148 etcupdate extract
-B
-M
"TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" \
149 -s
${WORLDDIR} -d
"${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate"
150 # Package all components
151 cd
${WORLDDIR} && ${IMAKE} packageworld DISTDIR
=${.OBJDIR
}/${DISTDIR}
152 mv
${DISTDIR}/*.txz .
156 cd
${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR
=${.OBJDIR
}/${DISTDIR}
157 mv
${DISTDIR}/kernel
*.txz .
160 mkdir
-p
${DISTDIR}/usr
161 ln
-fs
${WORLDDIR} ${DISTDIR}/usr
/src
162 cd
${DISTDIR} && tar cLvJf
${.OBJDIR
}/src.txz
--exclude .svn
--exclude .zfs \
163 --exclude .git
--exclude @
--exclude usr
/src
/release
/dist usr
/src
166 mkdir
-p
${DISTDIR}/usr
167 ln
-fs
${PORTSDIR} ${DISTDIR}/usr
/ports
168 cd
${DISTDIR} && tar cLvJf
${.OBJDIR
}/ports.txz \
169 --exclude .git
--exclude .svn \
170 --exclude usr
/ports
/distfiles
--exclude usr
/ports
/packages \
171 --exclude
'usr/ports/INDEX*' --exclude work usr
/ports
174 cd
${.CURDIR
}/doc
&& ${MAKE} all install clean 'FORMATS=html txt' \
175 INSTALL_COMPRESSED
='' URLS_ABSOLUTE
=YES DOCDIR
=${.OBJDIR
}/rdoc
177 .for i in hardware readme relnotes errata
178 ln
-f rdoc
/${RELNOTES_LANG}/${i}/article.txt reldoc
/${i
:tu
}.TXT
179 ln
-f rdoc
/${RELNOTES_LANG}/${i}/article.html reldoc
/${i
:tu
}.HTM
181 cp rdoc
/${RELNOTES_LANG}/readme
/docbook.css reldoc
183 system
: packagesystem
186 cd
${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
187 DESTDIR
=${.OBJDIR
}/release MK_RESCUE
=no MK_KERNEL_SYMBOLS
=no \
188 MK_PROFILE
=no MK_SENDMAIL
=no MK_TESTS
=no MK_LIB32
=no \
191 mkdir
-p release
/usr
/freebsd-dist
192 for
dist in MANIFEST
$$(ls
*.txz | grep
-v
-- '-dbg'); \
193 do cp
$${dist} release
/usr
/freebsd-dist
; \
195 # Copy documentation, if generated
199 # Set up installation environment
200 ln
-fs
/tmp
/bsdinstall_etc
/resolv.conf release
/etc
/resolv.conf
201 echo sendmail_enable
=\"NONE
\" > release
/etc
/rc.conf
202 echo hostid_enable
=\"NO
\" >> release
/etc
/rc.conf
203 echo debug.witness.trace
=0 >> release
/etc
/sysctl.conf
204 cp
${.CURDIR
}/rc.local release
/etc
207 bootonly
: packagesystem
210 cd
${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
211 DESTDIR
=${.OBJDIR
}/bootonly MK_AMD
=no MK_AT
=no \
212 MK_GAMES
=no MK_GROFF
=no \
213 MK_INSTALLLIB
=no MK_LIB32
=no MK_MAIL
=no \
214 MK_NCP
=no MK_TOOLCHAIN
=no MK_PROFILE
=no \
215 MK_INSTALLIB
=no MK_RESCUE
=no MK_DICT
=no \
216 MK_KERNEL_SYMBOLS
=no MK_TESTS
=no MK_DEBUG_FILES
=no
217 # Copy manifest only (no distfiles) to get checksums
218 mkdir
-p bootonly
/usr
/freebsd-dist
219 cp MANIFEST bootonly
/usr
/freebsd-dist
220 # Copy documentation, if generated
224 # Set up installation environment
225 ln
-fs
/tmp
/bsdinstall_etc
/resolv.conf bootonly
/etc
/resolv.conf
226 echo sendmail_enable
=\"NONE
\" > bootonly
/etc
/rc.conf
227 echo hostid_enable
=\"NO
\" >> bootonly
/etc
/rc.conf
228 echo debug.witness.trace
=0 >> bootonly
/etc
/sysctl.conf
229 cp
${.CURDIR
}/rc.local bootonly
/etc
234 cd
${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
235 DESTDIR
=${.OBJDIR
}/${.TARGET
} MK_RESCUE
=no MK_KERNEL_SYMBOLS
=no \
236 MK_TESTS
=no MK_DEBUG_FILES
=no
238 mkdir
-p
${.TARGET
}/usr
/freebsd-dist
239 for
dist in MANIFEST
$$(ls
*.txz | grep
-v
-- '-dbg'); \
240 do cp
$${dist} ${.TARGET
}/usr
/freebsd-dist
; \
242 # Copy documentation, if generated
244 cp reldoc
/* ${.TARGET
}
246 # Set up installation environment
247 ln
-fs
/tmp
/bsdinstall_etc
/resolv.conf
${.TARGET
}/etc
/resolv.conf
248 echo sendmail_enable
=\"NONE
\" > ${.TARGET
}/etc
/rc.conf
249 echo hostid_enable
=\"NO
\" >> ${.TARGET
}/etc
/rc.conf
250 echo debug.witness.trace
=0 >> ${.TARGET
}/etc
/sysctl.conf
251 cp
${.CURDIR
}/rc.local
${.TARGET
}/etc
254 release.iso
: disc1.iso
256 sh
${.CURDIR
}/${TARGET}/mkisoimages.sh
-b
${VOLUME_LABEL}_CD
${.TARGET
} release
258 dvd1.iso
: dvd pkg-stage
259 sh
${.CURDIR
}/${TARGET}/mkisoimages.sh
-b
${VOLUME_LABEL}_DVD
${.TARGET
} dvd
261 bootonly.iso
: bootonly
262 sh
${.CURDIR
}/${TARGET}/mkisoimages.sh
-b
${VOLUME_LABEL}_BO
${.TARGET
} bootonly
264 memstick
: memstick.img
266 sh
${.CURDIR
}/${TARGET}/make-memstick.sh release
${.TARGET
}
268 mini-memstick
: mini-memstick.img
269 mini-memstick.img
: system
270 sh
${.CURDIR
}/${TARGET}/make-memstick.sh bootonly
${.TARGET
}
272 packagesystem
: base.txz kernel.txz
${EXTRA_PACKAGES}
273 sh
${.CURDIR
}/scripts
/make-manifest.sh
*.txz
> MANIFEST
278 env REPOS_DIR
=${.CURDIR
}/pkg_repos
/ \
279 sh
${.CURDIR
}/scripts
/pkg-stage.sh
280 mkdir
-p
${.OBJDIR
}/dvd
/packages
/repos
/
281 cp
${.CURDIR
}/scripts
/FreeBSD_install_cdrom.conf \
282 ${.OBJDIR
}/dvd
/packages
/repos
/
286 cdrom
: disc1.iso bootonly.iso
291 cp
*.txz MANIFEST ftp
294 ${MAKE} -C
${.CURDIR
} ${.MAKEFLAGS
} obj
295 ${MAKE} -C
${.CURDIR
} ${.MAKEFLAGS
} ${RELEASE_TARGETS}
296 .if defined
(WITH_VMIMAGES
) && !empty
(WITH_VMIMAGES
)
297 ${MAKE} -C
${.CURDIR
} ${.MAKEFLAGS
} ${VMTARGETS}
301 .if defined
(DESTDIR
) && !empty
(DESTDIR
)
304 cp
-a ftp
${DESTDIR}/
306 cp
-p
${I} ${DESTDIR}/${OSRELEASE}-${I}
307 . if defined
(WITH_COMPRESSED_IMAGES
) && !empty
(WITH_COMPRESSED_IMAGES
)
308 ${XZCMD} -k
${DESTDIR}/${OSRELEASE}-${I}
311 cd
${DESTDIR} && sha256
${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
312 cd
${DESTDIR} && md5
${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5
313 .if defined
(WITH_VMIMAGES
) && !empty
(WITH_VMIMAGES
)
314 mkdir
-p
${DESTDIR}/vmimages
315 . for FORMAT in
${VMFORMATS}
316 cp
-p
${VMBASE}.
${FORMAT} \
317 ${DESTDIR}/vmimages
/${OSRELEASE}.
${FORMAT}
319 . if defined
(WITH_COMPRESSED_VMIMAGES
) && !empty
(WITH_COMPRESSED_VMIMAGES
)
320 # This is very time consuming, so defer it after the images are moved to
322 . for FORMAT in
${VMFORMATS}
323 # Don't keep the originals. There is a copy in ${.OBJDIR} if needed.
324 ${XZCMD} ${DESTDIR}/vmimages
/${OSRELEASE}.
${FORMAT}
327 cd
${DESTDIR}/vmimages
&& sha256
${OSRELEASE}* > \
328 ${DESTDIR}/vmimages
/CHECKSUM.SHA256
329 cd
${DESTDIR}/vmimages
&& md5
${OSRELEASE}* > \
330 ${DESTDIR}/vmimages
/CHECKSUM.MD5
334 .if defined
(WITH_VMIMAGES
) && !empty
(WITH_VMIMAGES
)
335 . if exists
(${.CURDIR
}/${TARGET}/mk-vmimage.sh
)
336 env TARGET
=${TARGET} TARGET_ARCH
=${TARGET_ARCH} \
337 ${.CURDIR
}/${TARGET}/mk-vmimage.sh
${.TARGET
} \
338 ${VMBASE}.img
${WORLDDIR} ${.OBJDIR
}/${.TARGET
} ${VMSIZE}
344 .if defined
(WITH_VMIMAGES
) && !empty
(WITH_VMIMAGES
)
345 . if exists
(${.CURDIR
}/${TARGET}/mk-vmimage.sh
)
346 . for FORMAT in
${VMFORMATS}
347 env TARGET
=${TARGET} TARGET_ARCH
=${TARGET_ARCH} \
348 ${.CURDIR
}/${TARGET}/mk-vmimage.sh
${.TARGET
} \
349 ${VMBASE}.img
${FORMAT} ${VMBASE}.
${FORMAT}
356 .if exists
(${.CURDIR
}/${TARGET}/mk-azure.sh
)
357 env TARGET
=${TARGET} TARGET_ARCH
=${TARGET_ARCH} AZURECONF
=${AZURECONF} \
358 ${.CURDIR
}/${TARGET}/mk-azure.sh
${.TARGET
} azure.img \
359 ${WORLDDIR} ${.TARGET
} ${VMSIZE} ${OSRELEASE}.vhd