diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -539,6 +539,12 @@ # installed. # Useful for dynamically generated data files. # +# By default, a port install its package and all its subpacakges. +# Set the following to install only a subset of the port +# +# TARGET_SUBPACKAGES +# - A comma separated list of subpackages to install. +# # Default targets and their behaviors: # # fetch - Retrieves missing ${DISTFILES} and ${PATCHFILES} for this @@ -4858,17 +4864,43 @@ STAGE_ARGS= -N . endif -. for sp in ${_PKGS} +# Identify which subpackage needs to be installed +_IPKGS= +. if empty(TARGET_SUBPACKAGES) +_IPKGS= ${_PKGS} +. else +_TARGET_SUBPACKAGES= ${TARGET_SUBPACKAGES:S/,/ /g} +. for sp in ${_TARGET_SUBPACKAGES} +. if ${sp} == "main" +_IPKGS+= ${PKGBASE} +. else +_IPKGS+= ${PKGBASE}-${sp} +. endif +. endfor +. endif +# Add additional targets for subpackage dependency +. for sp in ${SUBPACKAGES} +. for dep in ${SELF_DEPENDS.${sp}} +. if ${dep} == "main" +_DEPPKGS.${_PKGS.${sp}}+= fake-pkg.${PKGBASE} +. else +_DEPPKGS.${_PKGS.${sp}}+= fake-pkg.${PKGBASE}-${dep} +. endif +. endfor +. endfor +. for sp in ${_IPKGS} fake-pkg: fake-pkg.${sp} -fake-pkg.${sp}: ${_PLIST}.${sp} +. endfor +. for sp in ${_PKGS} +fake-pkg.${sp}: ${_PLIST}.${sp} ${_DEPPKGS.${sp}} . if defined(INSTALLS_DEPENDS) . if !defined(NO_PKG_REGISTER) - @${ECHO_MSG} "===> Registering installation for ${PKGNAME} as automatic" + @${ECHO_MSG} "===> Registering installation for ${PKGNAME${_SP.${sp}}} as automatic" . endif @${SETENV} ${PKG_ENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_REGISTER} -d ${STAGE_ARGS} -m ${METADIR}.${sp} -f ${_PLIST}.${sp} . else . if !defined(NO_PKG_REGISTER) - @${ECHO_MSG} "===> Registering installation for ${PKGNAME}" + @${ECHO_MSG} "===> Registering installation for ${PKGNAME${_SP.${sp}}}" . endif @${SETENV} ${PKG_ENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_REGISTER} ${STAGE_ARGS} -m ${METADIR}.${sp} -f ${_PLIST}.${sp} . endif