Makefile.inc1 release bsd.own.mk: Introduce and use TAR_CMD

Our uses of tar rely on BSDisms, and so do not work in environments
where GNU tar is the default tar. Providing a TAR_CMD variable like
some other commands allows it to be overridden to use bsdtar in such
cases.

Reviewed by:	brooks, delphij, gjb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D35813
main
Jessica Clarke 3 months ago
parent 5e0a749cf1
commit fcf1208158
  1. 24
      Makefile.inc1
  2. 4
      release/Makefile
  3. 2
      share/mk/bsd.own.mk

@ -1491,12 +1491,12 @@ packageworld: .PHONY
.for dist in base ${EXTRA_DISTRIBUTIONS}
.if defined(NO_ROOT)
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
tar cvf - --exclude usr/lib/debug \
${TAR_CMD} cvf - --exclude usr/lib/debug \
@${DESTDIR}/${DISTDIR}/${dist}.meta | \
${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
.else
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
tar cvf - --exclude usr/lib/debug . | \
${TAR_CMD} cvf - --exclude usr/lib/debug . | \
${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
.endif
.endfor
@ -1504,11 +1504,11 @@ packageworld: .PHONY
.for dist in ${DEBUG_DISTRIBUTIONS}
. if defined(NO_ROOT)
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
${TAR_CMD} cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz
. else
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
tar cvLf - usr/lib/debug | \
${TAR_CMD} cvLf - usr/lib/debug | \
${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz
. endif
.endfor
@ -1827,25 +1827,25 @@ packagekernel: .PHONY
.if defined(NO_ROOT)
.if !defined(NO_INSTALLKERNEL)
cd ${DESTDIR}/${DISTDIR}/kernel; \
tar cvf - --exclude '*.debug' \
${TAR_CMD} cvf - --exclude '*.debug' \
@${DESTDIR}/${DISTDIR}/kernel.meta | \
${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
.endif
.if ${MK_DEBUG_FILES} != "no"
cd ${DESTDIR}/${DISTDIR}/kernel; \
tar cvf - --include '*/*/*.debug' \
${TAR_CMD} cvf - --include '*/*/*.debug' \
@${DESTDIR}/${DISTDIR}/kernel.meta | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
.for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - --exclude '*.debug' \
${TAR_CMD} cvf - --exclude '*.debug' \
@${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
.if ${MK_DEBUG_FILES} != "no"
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - --include '*/*/*.debug' \
${TAR_CMD} cvf - --include '*/*/*.debug' \
@${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz
.endif
@ -1854,22 +1854,22 @@ packagekernel: .PHONY
.else
.if !defined(NO_INSTALLKERNEL)
cd ${DESTDIR}/${DISTDIR}/kernel; \
tar cvf - --exclude '*.debug' . | \
${TAR_CMD} cvf - --exclude '*.debug' . | \
${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
.endif
.if ${MK_DEBUG_FILES} != "no"
cd ${DESTDIR}/${DISTDIR}/kernel; \
tar cvf - --include '*/*/*.debug' $$(eval find .) | \
${TAR_CMD} cvf - --include '*/*/*.debug' $$(eval find .) | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
.for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - --exclude '*.debug' . | \
${TAR_CMD} cvf - --exclude '*.debug' . | \
${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
.if ${MK_DEBUG_FILES} != "no"
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - --include '*/*/*.debug' $$(eval find .) | \
${TAR_CMD} cvf - --include '*/*/*.debug' $$(eval find .) | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz
.endif
.endfor

@ -138,14 +138,14 @@ kernel.txz:
src.txz:
mkdir -p ${DISTDIR}/usr
ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
cd ${DISTDIR} && tar cLvf - --exclude .svn --exclude .zfs \
cd ${DISTDIR} && ${TAR_CMD} cLvf - --exclude .svn --exclude .zfs \
--exclude .git --exclude @ --exclude usr/src/release/dist usr/src | \
${XZ_CMD} > ${.OBJDIR}/src.txz
ports.txz:
mkdir -p ${DISTDIR}/usr
ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
cd ${DISTDIR} && tar cLvf - \
cd ${DISTDIR} && ${TAR_CMD} cLvf - \
--exclude .git --exclude .svn \
--exclude usr/ports/distfiles --exclude usr/ports/packages \
--exclude 'usr/ports/INDEX*' --exclude work usr/ports | \

@ -265,6 +265,8 @@ INSTALL_RSYMLINK?= ${INSTALL} ${RSYMLINK}
STRIP?= -s
.endif
TAR_CMD?= tar
COMPRESS_CMD?= gzip -cn
COMPRESS_EXT?= .gz

Loading…
Cancel
Save