diff options
author | will <will@FreeBSD.org> | 2014-10-01 20:52:08 +0000 |
---|---|---|
committer | will <will@FreeBSD.org> | 2014-10-01 20:52:08 +0000 |
commit | b98c483e82dda6c959e86013ad94b93b6b79ec73 (patch) | |
tree | 13c44117865897e8c39051d474a12891a6bbc95d /share | |
parent | a74e992d46af3caf22eae106b9627987fb1d6468 (diff) | |
download | FreeBSD-src-b98c483e82dda6c959e86013ad94b93b6b79ec73.zip FreeBSD-src-b98c483e82dda6c959e86013ad94b93b6b79ec73.tar.gz |
Revise r272363 by collapsing the tests into a for loop.
This has the side effect of ensuring that realpath is also run for the
nominal case of PORTSDIR=/usr/ports (assuming .CURDIR is a ports directory
that relies on /usr/ports but is not rooted in it). This ensures that any
generated PORTSDIR used is always the actual location.
Submitted by: jkim (different implementation)
Diffstat (limited to 'share')
-rw-r--r-- | share/mk/bsd.port.mk | 16 | ||||
-rw-r--r-- | share/mk/bsd.port.subdir.mk | 16 |
2 files changed, 12 insertions, 20 deletions
diff --git a/share/mk/bsd.port.mk b/share/mk/bsd.port.mk index 0800c71..4f73d12 100644 --- a/share/mk/bsd.port.mk +++ b/share/mk/bsd.port.mk @@ -4,17 +4,13 @@ # 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. -.if exists(${.CURDIR}/Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR} -.elif exists(${.CURDIR}/../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/.. -.elif exists(${.CURDIR}/../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../.. -.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../../.. -.else -PORTSDIR= /usr/ports +.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 diff --git a/share/mk/bsd.port.subdir.mk b/share/mk/bsd.port.subdir.mk index 55a1a7e..8e608a1 100644 --- a/share/mk/bsd.port.subdir.mk +++ b/share/mk/bsd.port.subdir.mk @@ -4,17 +4,13 @@ # 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. -.if exists(${.CURDIR}/Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR} -.elif exists(${.CURDIR}/../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/.. -.elif exists(${.CURDIR}/../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../.. -.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../../.. -.else -PORTSDIR= /usr/ports +.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 |