New install, how should I set my macports.conf

Ryan Schmidt ryandesign at
Fri Jan 22 16:59:41 PST 2010

On Jan 22, 2010, at 18:20, Scott Haneda wrote:

> For reasons that are too silly to repeat, I am now sitting on a clean 10.6 updated install, with a new MacPorts, and zero ports installed.  I will be installing all my ports new and clean.
> In macports.conf I see:
>    # CPU architecture to compile for. Defaults to i386 or ppc on Mac OS X 10.5
>    # and earlier, depending on the CPU type detected at runtime. On Mac OS X 10.6
>    # the default is x86_64 if the CPU supports it, i386 otherwise.
>    #build_arch                     i386
> And also:
>    # Options for Universal Binaries (+universal variant)
>    # machine architectures
>    universal_archs         x86_64 i386
> This is a MacBook that I use for development, 1.83 Intel Core 2 Duo
> I am thinking I want to build UB for everything.  This just seems better in the long run.  I will run into the problems of some ports not being able to support it, and can work to solve those problems, or file tickets to get them solved.  Is this a good or bad idea?

I personally do this (x86_64 i386 universal) since I must in order to build wine. But as you say some ports will not build this way at this time, so watch out and be prepared to retry without universal. (sudo port clean problemport && sudo port install problemport -universal)

> Would I just delete the i386 string from the "universal_archs"?

No... that would leave your universal_archs with just "x86_64", and a single architecture kind of by definition wouldn't be universal. You would leave universal_archs as it is and build your ports with the +universal variant so they are built for x86_64 and i386.

> I add +universal to most oft the ports I installed in the past, which sometimes got me into trouble, as for example, with php5-mcrypt, I had to also rebuild the entire chain that it was dependent on.  
> Where do I define that I need not remember to add +universal, and it will be the default, and is that even a good idea?

variants.conf. I do this, as indicated above.

> Why is "build_arch" commented out in the conf above?

Who knows. When a value in macports.conf is commented, the default is used. As explained above that comment, the default build_arch is x86_64 on Snow Leopard on machines like yours that support it.

In MacPorts 1.9 this line will no longer ship commented out; it'll ship enabled and set to the default value for your system. This change was already made in trunk awhile ago.

> Looking for suggestions on the pros and cons.  I am also fine with just leaving things are they are, but it is my understanding that means my builds are only good for this machine or very similar machines.

I would say MacPorts builds are always only good for this machine or very similar machines. Certainly the major OS version (10.4, 10.5, 10.6) and CPU architecture (ppc, ppc64, i386, x86_64) must match.

> I am still at a loss, for example, with my memteter Portfile, which does not have a +universal variant.  What would happen under an install of that port, where I add +univeral?  I assume it will just ignore that and build it for this architecture.

memtester has no universal variant because it sets "use_configure no". Therefore it will build for build_arch.

> But then I look at `port info mtr` and see it has:
> Variants:             darwin_10, universal
> But looking at the Portfile, these are the only things I see different to me:
> configure.args-append --without-gtk
> platform darwin 10 {
>    configure.env-append LIBS=-lresolv
> }
> Is that all I have to do, is add in some appended args and will get universal?  I suspect I need to go back to the source, and read through it and see what it takes to build memtester out universal, but I am still at a loss as to what is generating the "Variants: darwin_10, universal" line.

mtr has a universal variant because it does not contain the lines "use_configure no" or "universal_variant no" and therefore inherits the default universal variant defined in MacPorts base which works for most autoconf-based software.

mtr has a darwin_10 variant because it contains a section "platform darwin 10".

To create a universal variant for ports that aren't standard and can't use MacPorts' built-in universal variant, simply define one:

variant universal {
	[do whatever's necessary to build universal]

It may be instructive to grep existing portfiles for "variant universal" to see what they do.

More information about the macports-users mailing list