diff --git a/Mk/bsd.commands.mk b/Mk/bsd.commands.mk index 4548490..d7158b5 100644 --- a/Mk/bsd.commands.mk +++ b/Mk/bsd.commands.mk @@ -128,5 +128,6 @@ PKG_VERSION?= ${PKG_BIN} version PKG_CREATE?= ${PKG_BIN} create PKG_ADD?= ${PKG_BIN} add PKG_QUERY?= ${PKG_BIN} query +PKG_INSTALL?= ${PKG_BIN} install -y .endif diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 46ecb1e..04ca3bd 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1037,6 +1037,12 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # if an existing package is not present. # USE_PACKAGE_DEPENDS_ONLY # - Like USE_PACKAGE_DEPENDS, but do not fallback on source. +# USE_REPO_DEPENDS +# - Try to install dependencies from package repositories +# instead of building the port from scratch. Fall back on +# source if the package is not available in the repository. +# USE_REPO_DEPENDS_ONLY +# - Like USE_REPO_DEPENDS, but do not fallback on source. # INSTALL_AS_USER # - Define this to install as the current user, intended # for systems where you have no root access. @@ -4360,14 +4366,28 @@ _INSTALL_DEPENDS= \ else \ ${PKG_ADD} -A $${subpkgfile}; \ fi; \ + success="YES"; \ elif [ -n "${USE_PACKAGE_DEPENDS_ONLY}" -a "$${target}" = "${DEPENDS_TARGET}" ]; then \ ${ECHO_MSG} "===> ${PKGNAME} depends on package: $${subpkgfile} - not found"; \ ${ECHO_MSG} "===> USE_PACKAGE_DEPENDS_ONLY set - not building missing dependency from source"; \ exit 1; \ - else \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \ fi; \ - else \ + fi; \ + if [ -n "${USE_REPO_DEPENDS}" -o -n "${USE_REPO_DEPENDS_ONLY}" -a "$$target" = "${DEPENDS_TARGET}" -a -z "$$success" ]; then \ + subpkgname=`(cd $$dir; ${MAKE} $$depends_args -V PKGNAME)`; \ + subpkgname=$${subpkgname%-*} ; \ + ${ECHO_MSG} "===> Installing package $${subpkgname} from repository"; \ + if ! ${PKG_INSTALL} -A $${subpkgname}; then \ + if [ -n "${USE_REPO_DEPENDS_ONLY}" ]; then \ + ${ECHO_MSG} "===> ${PKGNAME} depends on package: $${subpkgname} - not found"; \ + ${ECHO_MSG} "===> USE_REPO_DEPENDS_ONLY set - not building missing dependency from source"; \ + exit 1; \ + fi; \ + else; \ + success="YES"; \ + fi; \ + fi; \ + if [ -z "$$success" ]; then \ (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \ fi; \ ${ECHO_MSG} "===> Returning to build of ${PKGNAME}";