diff -ruN Mk/Uses/bundle.mk Mk/Uses/bundle.mk --- Mk1/Uses/bundle.mk 1969-12-31 16:00:00.000000000 -0800 +++ Mk2/Uses/bundle.mk 2015-12-28 21:07:39.075782000 -0800 @@ -0,0 +1,35 @@ +# $FreeBSD$ +# +# Provide support for the bundled projects +# +# Feature: bundle +# Usage: USES=bundle +# +# MAINTAINER: portmgr@FreeBSD.org + +# BUNDLE - set of bundled submodules in the form directory:group +# that will be extracted under WRKSRC. +# Extracted submodules should be present in DISTFILES. +# BUNDLE_ROOT - The root path for the bundle. Default: WRKSRC +# BUNDLE_MKDIR - Create bundle directories. Default: no + +.if !defined(_INCLUDE_USES_BUNDLE_MK) +_INCLUDE_USES_BUNDLE_MK= yes + +BUNDLE_ROOT?=${WRKSRC} +BUNDLE_MKDIR?=no + +_USES_extract+= 900:do-bundle +do-bundle: + @${ECHO} "===> Extracting bundled submodules for ${PKGNAME}" +.for b in ${BUNDLE:C@.*:@@} + @[ ${BUNDLE_MKDIR} != yes ] || ${MKDIR} "${BUNDLE_ROOT}/${BUNDLE:M*\:${b}:C@:.*@@}" + @[ -d "${BUNDLE_ROOT}/${BUNDLE:M*\:${b}:C@:.*@@}" ] || (${ECHO} "No directory for the bundle '${b}': >>${BUNDLE_ROOT}/${BUNDLE:M*\:${b}:C@:.*@@}<<" && return 1) + @[ -n "${DISTFILES:M*\:${b}:C@:.*@@}" ] || (${ECHO} "No distfile for the bundle '${b}': ${DISTFILES:M*\:${b}:C@:.*@@}" && return 1) + @${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/${DISTFILES:M*\:${b}:C@:.*@@} \ + -C ${BUNDLE_ROOT}/${BUNDLE:M*\:${b}:C@:.*@@} --strip 1; +.endfor + +EXTRACT_ONLY=${DISTFILES:N*\:*} + +.endif