How to use ports?

Hi,

I have a few questions about the use of Ports. There are still some things I'm having trouble with. Hopefully you guys can help me out. I have a Gentoo background and I'm used to working with Portage, so I will do some comparing along the way.
  • When compiling a package, several options can be enabled/disabled. In Portage I can enable/disable these compile options with USE-flags. And Portage will remember what USE-flags I used when a package was compiled. So when I have to update, I know I'm not forgetting to enable/disable certain compile options. Can Ports do this for me as well? If so, how? If not, how do I know I'm not going to mess up a package, let's say Apache or PHP, when I have to recompile, or compile an update?
  • When I enable an option when I want to (re)compile a package, say LDAP support in Apache, Portage will see if some of the dependencies need to be recompiled with certain option enabled, in order to make it work and to avoid compilation errors. Can Ports do this for me? If so, how does it work? If not, how can I figure out what dependencies might cause trouble?
  • I like to install precompiled packages with pkg_add whenever I can. But some packages I have to compile, because the precompiled package is missing the options I need. When I want to update installed ports, there is no way for me to see what I installed with pkg_add and what I compiled. Is there any way to distinguish these packages, so I know when to install an update from package, or to compile the update?
  • When installing a package with Portage, I can ask for a list of all the dependencies that Portage intents to install. So I know exactly what is going on. If cececary, I can enable/disable some compile options, to prevent the installation of a package I don't want. Can Ports do this? If so, how. If not, how can I see what is going to be installed and why? And how can I tweak this, so I can prevent the installation of certain packages?
  • In all cases, keep in mind I prefer to install precompiled pakcages. So I need to know how to handle those as well.
  • All tips and pointers how to keep my FreeBSD system healthy and running smooth are most welcome.
Thanks in advance! :)
 
mariourk said:
*) When compiling a package, several options can be enabled/disabled. In Portage I can enable/disable these compile options with USE-flags. And Portage will remember what USE-flags I used when a package was compiled. So when I have to update, I know I'm not forgetting to enable/disable certain compile options. Can Ports do this for me as well? If so, how? If not, how do I know I'm not going to mess up a package, let's say Apache or PHP, when I have to recompile, or compile an update?
You can set the various WITH_ and WITHOUT_ options in /etc/make.conf. Options chosen during the dialog are stored in /var/db/ports/ and are reused every time you build that port.

*) When I enable an option when I want to (re)compile a package, say LDAP support in Apache, Portage will see if some of the dependencies need to be recompiled with certain option enabled, in order to make it work and to avoid compilation errors. Can Ports do this for me? If so, how does it work? If not, how can I figure out what dependencies might cause trouble?
Yes, knowing which port options cause problems and which don't is a matter of experience and knowing what you are doing.

*) I like to install precompiled packages with pkg_add whenever I can. But some packages I have to compile, because the precompiled package is missing the options I need. When I want to update installed ports, there is no way for me to see what I installed with pkg_add and what I compiled. Is there any way to distinguish these packages, so I know when to install an update from package, or to compile the update?
There is no difference between a package and a port. A package is simply a pre-compiled port.

*) When installing a package with Portage, I can ask for a list of all the dependencies that Portage intents to install. So I know exactly what is going on. If cececary, I can enable/disable some compile options, to prevent the installation of a package I don't want. Can Ports do this? If so, how. If not, how can I see what is going to be installed and why? And how can I tweak this, so I can prevent the installation of certain packages?
Packages are compiled using the default port options, they cannot be changed after the fact. You can see what dependencies a package has with pkg_info(1).

*) In all cases, keep in mind I prefer to install precompiled pakcages. So I need to know how to handle those as well.

*) All tips and pointers how to keep my FreeBSD system healthy and running smooth are most welcome.
Read the handbook.
 
You can set the various WITH_ and WITHOUT_ options in /etc/make.conf. Options chosen during the dialog are stored in /var/db/ports/ and are reused every time you build that port.
Where can I find what WITH_ and WITHOUT_ options I can use?

Yes, knowing which port options cause problems and which don't is a matter of experience and knowing what you are doing.
In other words, NO. In case I do run into trouble, is there a procedure to figure out what is causing the problem, in order to fix it?

There is no difference between a package and a port. A package is simply a pre-compiled port.
I know. But the precompiled packages do not always have the options include I need. Which means I have to compile that package. In case of an update, I have to know I compiled the packages and didn't use pkg_add. I could keep notes, but I figured there was a better way to do this.

Packages are compiled using the default port options, they cannot be changed after the fact. You can see what dependencies a package has with pkg_info(1).
With packages, I ment ports. The ones that need to be compiled. In that case the options can be changed and so do the dependencies. After doing a make config, I would like to see a list of the dependencies that the port I'm trying to install is going to need. If I'm talking nonsense, please enlighten me :)


Read the handbook.
I did. But not everything is clear to me. So I ask my questions here :)
 
mariourk said:
Where can I find what WITH_ and WITHOUT_ options I can use?
Read the port's Makefile. Some knobs are mentioned in /usr/ports/KNOBS.

In other words, NO. In case I do run into trouble, is there a procedure to figure out what is causing the problem, in order to fix it?
Choose the default options and see if it builds.

I know. But the precompiled packages do not always have the options include I need. Which means I have to compile that package. In case of an update, I have to know I compiled the packages and didn't use pkg_add. I could keep notes, but I figured there was a better way to do this.
Sorry, as said, there is no difference between an installed package and an installed port.


With packages, I ment ports. The ones that need to be compiled. In that case the options can be changed and so do the dependencies. After doing a make config, I would like to see a list of the dependencies that the port I'm trying to install is going to need. If I'm talking nonsense, please enlighten me :)
# make all-depends-list see ports(7).

I did. But not everything is clear to me. So I ask my questions here :)
No problem ;)
 
Very helpful, thank you! :)

One more question though:

Choose the default options and see if it builds.

How do I reset the configuration options to the default settings? Lets say I've been messing around with a port, enabling and disabling all kinds of options. At some point I want to start fresh, but don't know the default options anymore. Can I reset everything to the default settings?
 
Back
Top