A summary for using the Ports Collection in FreeBSD:
Ports are organized by category so if you don't know what category the port is in you have to find it first:
make search name=myport
Sometimes there are too many entries that way. I personally prefer:
find /usr/ports -name myport* -print -depth 2
* when searching since there are often multiple versions of a port available. The depth argument ensures your return results aren't needlessly cluttered with matches you are unlikely to want.
Often, you'll want to do some configuration; software such as Apache and Postgres practically require it. There are three main choices: command line, environment and make configuration files. To get started with the command line:
this will list the default configuration options. If you like the defaults you are ready to compile and install. If not,
will bring up a dialog box where you can select which options you want. (Don't become confused with this and
make configure which configures your port with your chosen options!) This is often sufficient but for some software, like Apache, there is often complex configuration that a simple dialog won't handle. For this, you also should look at the Makefile(s) which will sometimes give you some additional targets for make that will give you more information. To continue the Apache example
will give you information on setting up you chosen modules, thread options and the like. If your port's defaults are mostly fine and you just want to change a few things, you can also just pass key=value pairs like environment variables:
make MYVBL1=MYVAL1 ... install clean
Also, you can set switch options via the
make -D MYVAR -D MYOTHERVAR ... install clean
For complex configuration however the command line won't work well and you're better neither of the first two methods will be effective. In this case you can make a configuration file and pass that to
make with the __MAKE_CONF variable. FreeBSD has a default configuration file:
/etc/make.conf which usually contains information on previously installed ports and other system settings. To begin, create a file with your ports options, call it
~/myport.mk and then combine that file with /etc/make.conf:
cat /etc/make.conf ~/myport.mk >> ~/make.myport.conf
you can then double check your configuration:
make showconfig __MAKE_CONF=~/make.port.conf
and if everything looks good:
make install clean __MAKE_CONF=~/make.myport.conf
BEWARE! If you need to adjust your configuration settings after
make configure or an installation in whole or part you absolutely must clear your configuration first:
Failure to do so will result in unexpected interactions between the ports subsystem, your port's
make defaults and your desired configuration.
That's kind of a lot for a summary, but the complexity of configuration is mostly about the app, not the port. Bash for example, doesn't really have any options.
This is the easy part:
make install clean
or you can
which is just more typing.
That's pretty much it. Obviously there is more you can do such as recursively listing dependencies and configuration options, update with patches and so on. Here I will refer you to the Ports section of the Handbook, the port subsystem's man page (good info on additional make targets) and the
make man page.