# automatically install dependency as package rather than build



## kpedersen (Aug 27, 2010)

Hello,

Whilst playing about with the ports collection (in preparation to port wxmotif and opencde) I have come up with a small requirement that I do not know if the system supports.

If I type "make" to begin building a port, is there a way for me to specify an environmental variable to a folder containing packages (probably a mount point to the DVD) so that it can install the dependencies as packages rather than building everything?

Because it does seem a pain to have to compile GTK+ from source when there is a perfectly good copy on the DVD.

Has anyone done this before?

Best Regards,

Karsten


----------



## graudeejs (Aug 27, 2010)

sysutils/portmaster can do what you want (don't know correct option since I compile everything, but you will find it in manual portmaster(8))

I think portupgrade could also do that, but I'm not sure
There was thread about this recently


----------



## SirDice (Aug 27, 2010)

killasmurf86 said:
			
		

> I think portupgrade could also do that, but I'm not sure


It does, with the -P or -PP option. See portupgrade(1).

Another option is to just pkg_add them before starting make in a port. A port will only build and install it's dependencies if they're not installed.


----------



## phoenix (Aug 27, 2010)

Install the package if it exists, otherwise build the port:
`# portmaster --packages portcategory/portname`

Install the package; if it doesn't exist, stop with an error:
`# portmaster --packages-only portcategory/portname`

Install the package if it's a newer version than what's installed even if it's not the latest version, otherwise build the port:
`# portmaster --packages-if-newer portcategory/portname`

And, the one you are looking for; use packages for build dependencies, install all other dependencies as ports:
`# portmaster --packages-build portcategory/portname`

Portmaster is a wonderful tool.


----------

