Enable multi-threaded xz(1) compression, after r278433.

Allow multi-threaded xz(1) to be turned off by specifying
NO_XZTHREADS, and allow number of threads to be overridden
by specifying XZ_THREADS=N.

MFC after:	1 week
X-MFC-needs:	r278433
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber 2015-02-09 10:42:27 +00:00
parent 7bdb2409ca
commit 7ffa77fa95
2 changed files with 16 additions and 2 deletions

View File

@ -33,6 +33,9 @@
# with xz(1) (extremely time consuming) # with xz(1) (extremely time consuming)
# WITH_CLOUDWARE: if set, build cloud hosting disk images with the release # WITH_CLOUDWARE: if set, build cloud hosting disk images with the release
# TARGET/TARGET_ARCH: architecture of built release # TARGET/TARGET_ARCH: architecture of built release
# XZ_FLAGS: Additional arguments to pass to xz(1)
# XZ_THREADS: Number of xz(1) threads to use
# NO_XZTHREADS: Disable multi-threaded xz(1) compression
# #
WORLDDIR?= ${.CURDIR}/.. WORLDDIR?= ${.CURDIR}/..
@ -40,6 +43,8 @@ PORTSDIR?= /usr/ports
DOCDIR?= /usr/doc DOCDIR?= /usr/doc
RELNOTES_LANG?= en_US.ISO8859-1 RELNOTES_LANG?= en_US.ISO8859-1
XZCMD?= /usr/bin/xz XZCMD?= /usr/bin/xz
XZ_FLAGS?=
XZ_THREADS?=
.if !defined(TARGET) || empty(TARGET) .if !defined(TARGET) || empty(TARGET)
TARGET= ${MACHINE} TARGET= ${MACHINE}
@ -58,6 +63,15 @@ DISTDIR= dist
FREEBSD_VERSION!= awk '/^\#define __FreeBSD_version/ {print $$3}' \ FREEBSD_VERSION!= awk '/^\#define __FreeBSD_version/ {print $$3}' \
${.CURDIR}/../sys/sys/param.h ${.CURDIR}/../sys/sys/param.h
.if !defined(NO_XZTHREADS) && empty(XZ_THREADS)
XZ_THREADS= 0
.else
XZ_THREADS= ${XZ_THREADS}
.endif
.if !empty(XZ_THREADS)
XZ_FLAGS+= -T ${XZ_THREADS}
.endif
# Define OSRELEASE by using newvars.sh # Define OSRELEASE by using newvars.sh
.if !defined(OSRELEASE) || empty(OSRELEASE) .if !defined(OSRELEASE) || empty(OSRELEASE)
.for _V in TYPE BRANCH REVISION .for _V in TYPE BRANCH REVISION
@ -299,7 +313,7 @@ release-install:
.for I in ${IMAGES} .for I in ${IMAGES}
cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
. if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) . if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES)
${XZCMD} -k ${DESTDIR}/${OSRELEASE}-${I} ${XZCMD} ${XZ_FLAGS} -k ${DESTDIR}/${OSRELEASE}-${I}
. endif . endif
.endfor .endfor
cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256

View File

@ -101,7 +101,7 @@ vm-install:
# the DESTDIR. # the DESTDIR.
. for FORMAT in ${VMFORMATS} . for FORMAT in ${VMFORMATS}
# Don't keep the originals. There is a copy in ${.OBJDIR} if needed. # Don't keep the originals. There is a copy in ${.OBJDIR} if needed.
${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} ${XZCMD} ${XZ_FLAGS} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
. endfor . endfor
. endif . endif
cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \ cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \