Index: stable/10/share/mk/bsd.port.mk =================================================================== --- stable/10/share/mk/bsd.port.mk (revision 287333) +++ stable/10/share/mk/bsd.port.mk (revision 287334) @@ -1,16 +1,28 @@ # $FreeBSD$ -PORTSDIR?= /usr/ports +.if !defined(PORTSDIR) +# Autodetect if the command is being run in a ports tree that's not rooted +# in the default /usr/ports. The ../../.. case is in case ports ever grows +# a third level. +.for RELPATH in . .. ../.. ../../.. +.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk) +_PORTSDIR= ${.CURDIR}/${RELPATH} +.endif +.endfor +_PORTSDIR?= /usr/ports +PORTSDIR!= realpath ${_PORTSDIR} +.endif + BSDPORTMK?= ${PORTSDIR}/Mk/bsd.port.mk # Needed to keep bsd.own.mk from reading in /etc/src.conf # and setting MK_* variables when building ports. _WITHOUT_SRCCONF= # Enable CTF conversion on request. .if defined(WITH_CTF) .undef NO_CTF .endif .include .include "${BSDPORTMK}" Index: stable/10/share/mk/bsd.port.subdir.mk =================================================================== --- stable/10/share/mk/bsd.port.subdir.mk (revision 287333) +++ stable/10/share/mk/bsd.port.subdir.mk (revision 287334) @@ -1,6 +1,18 @@ # $FreeBSD$ -PORTSDIR?= /usr/ports +.if !defined(PORTSDIR) +# Autodetect if the command is being run in a ports tree that's not rooted +# in the default /usr/ports. The ../../.. case is in case ports ever grows +# a third level. +.for RELPATH in . .. ../.. ../../.. +.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk) +_PORTSDIR= ${.CURDIR}/${RELPATH} +.endif +.endfor +_PORTSDIR?= /usr/ports +PORTSDIR!= realpath ${_PORTSDIR} +.endif + BSDPORTSUBDIRMK?= ${PORTSDIR}/Mk/bsd.port.subdir.mk .include "${BSDPORTSUBDIRMK}" Index: stable/10 =================================================================== --- stable/10 (revision 287333) +++ stable/10 (revision 287334) Property changes on: stable/10 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r272282,272363,272383