# Is there a way to tell a port to install to another location



## jnbek (Sep 29, 2012)

Well the title really says it all, but I would like to install lang/go from ports but I would like to have it's destination directory prefix to be /opt/go instead of the default /usr/local is there a flag that can be specified in the make install clean command or some special knob to put for it in /etc/make.conf or maybe /usr/local/etc/pkgtools.conf ( I don't remember seeing anything like it in pkgtools.conf, but in case I missed it...) The reason for wanting this is, there are ALOT of go packages that aren't managed in ports, I would like to install Go to /opt/go/ as it would make it extremely easy to prune out the crufty modules by simply rm -r /opt/go/ then portupgrade -fcv lang/go to start over fresh. At least until FreeBSD Ports gets some port maintainers from the Go Team. Anyways, any thoughts?


----------



## wblock@ (Sep 29, 2012)

See this section of the Porter's Handbook: http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/porting-prefix.html.


----------



## jnbek (Sep 29, 2012)

w000t that works, thanks!!


----------



## jnbek (Sep 29, 2012)

For the benefit of anyone coming to this thread wondering what the solution was:

```
.if ${.CURDIR:M*/lang/go}
     PREFIX=/opt
 .endif
```
I put that into /etc/make.conf and make install clean installed nicely to /opt/go.


----------



## kpa (Sep 29, 2012)

Be careful with mixing two different PREFIX locations. The LOCALBASE directory is used for searching existing installed software when compiling a port. If the lang/go port was a dependency for another port you would like to install under OPT you would have to set LOCALBASE to /opt and that in turn would possibly require more dependencies installed under /opt. It could get really complicated fast.


----------



## jnbek (Sep 29, 2012)

@ kpa good to know, I'll keep watch for that.


----------

