Instead of requiring the user to specify where their ports tree root is,
search for Mk/bsd.port.mk starting from the current directory.  This will
still default to /usr/ports, and allow the user to override.
Details
Apply diff, use a ports tree not in /usr/ports without specifying PORTSDIR,
and see that the correct Mk files are used.  Also test the previously
supported cases, they should not be affected.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
- No Lint Coverage 
- Unit
- No Test Coverage 
Event Timeline
I could change this to use make conditionals instead and to explicitly check only .. and ../.. since those are the only reasonable cases really supported by ports right now.
Here's a simpler one with less subshells: http://people.freebsd.org/~bdrewery/patches/auto-portsdir2.txt
| share/mk/bsd.port.mk | ||
|---|---|---|
| 5 | At least use $${PWD} here. | |
| share/mk/bsd.port.mk | ||
|---|---|---|
| 7 | Perhaps to avoid POLA this should say "Using $$curdir for PORTSDIR" to stderr. | |
Updated version that doesn't use a shell callout.
This will only search up 2 levels at most.  It also (on top of my comment)
searches the current directory, which is required because ports/Makefile
includes <bsd.port.subdir.mk>.
Tested both with and without an existing /usr/ports.