# Installing ports, using an alternate dir for "work"



## blak3mill3r (Aug 13, 2011)

Hello, thanks for reading...

I'm playing with speeding up building ports.

I want to see if there's any benefit to putting the "work" dir in memory.

I tried this, in /etc/make.conf


```
WRKDIR=/memdisk/portwork
```

/memdisk is the mounted memory filesystem (mfs). /memdisk/portwork exists and is writable and all ... I was thinking that /memdisk/portwork would have subdirs for each port which is building. I tested it with a few ports and it seemed to work. Then I tried to build the x11-wm/hs-xmonad port. Built some deps including ghc fine ... but then it fails like this:


```
===>   Returning to build of hs-mtl-2.0.1.0_1
===>  Configuring for hs-mtl-2.0.1.0_1
cd: can't cd to /memdisk/portwork/mtl-2.0.1.0
*** Error code 2

Stop in /usr/ports/devel/hs-mtl.
*** Error code 1

Stop in /usr/ports/x11-wm/hs-xmonad.
```



Okay, so it can't cd to /memdisk/portwork/mtl-2.0.1.0  ... which sounds reasonable as that dir did not exist when I looked for it immediately after the build failed. The thing is, I discovered that if I simply re-run make it works. Since I did not try to build this port's build dependencies before changing make.conf I do not know if the hiccup which requires that I run 'make' twice for hs-xmonad is because of setting alternate WRKDIR. Is this what WRKDIR is for? Is one of these ports not respecting WRKDIR, or maybe I am going about this the Wrong Way and if so can anyone recommend a Right Way? :stud

Thanks very much in advance for any suggestions or clarification!


----------



## phoenix (Aug 13, 2011)

When in doubt, read the ports(7) man page.  

The option you want is actually *WRKDIRPREFIX*


----------



## Simba7 (Aug 16, 2011)

Thanks. This will help on my remote NFS systems (via VPN) so I don't saturate my bandwidth constantly.


----------

