On Aug 30, 2021, at 14:34, Jim DeLaHunt wrote:

> I am working through the Migration[1] procedure after upgrading my macOS 
> version. I made a list of my installed ports using `port -qv installed`. 
> Curiously, a number of the ports in that list include the notation 
> `requested_variants='+universal'`, even though the port appears to have no 
> +universal variant. For example,
> 
> bison @3.7.6_1+universal requested_variants='+universal' platform='darwin 17' 
> archs='x86_64' date='2021-07-04T14:08:44-0700'
> bison @3.7.6_2+universal (active) requested_variants='+universal' 
> platform='darwin 17' archs='x86_64' date='2021-08-12T18:44:11-0700'
> 
> But there appars to be no +universal variant:
> 
> % port info bison
> bison @3.7.6_2 (devel)
> Sub-ports:            bison-runtime
> 
> Description:          Bison is a general-purpose parser generator that 
> converts an annotated context-free grammar into a deterministic LR
>                       or generalized LR (GLR) parser employing LALR(1) parser 
> tables. As an experimental feature, Bison can also generate
>                       IELR(1) or canonical LR(1) parser tables. Once you are 
> proficient with Bison, you can use it to develop a wide range
>                       of language parsers, from those used in simple desk 
> calculators to complex programming languages.
> Homepage:             https://www.gnu.org/software/bison
> 
> Extract Dependencies: xz
> Library Dependencies: gettext, libiconv, m4
> Runtime Dependencies: bison-runtime
> Platforms:            darwin
> License:              (GPL-3+ or Permissive)
> Maintainers:          none
> % port info --variants bison
> variants:
> 
> Perhaps these +universal request are a relic of the distant past? I have 
> migrated this MacPorts installation forward through several OS versions and 
> multiple computers. It might be that some data originated on a PowerPC mac 
> long ago, when +universal was significant.
> 
> I have on MacPorts 2.7.1 and macOS 10.14 Mojave (just upgrade from 10.13 High 
> Sierra) and a 7-year-old Mac with an intel CPU.
> 
> The buildUniversal wiki page[2] seems to be 8 years old and not relevant to 
> my situation.
> 
> Q1. What does a `+universal` variant request do, on MacPorts 2.7.1 and macOS 
> 10.14 Mojave and a Mac with an intel CPU, if the port does not advertise a 
> `+universal` variant?
> 
> Q2. Is there a `+universal` variant which is built in to MacPorts, even if 
> the port does not advertise a `+universal` variant? MacPorts Guide, 5. 
> Portfile Reference, 5.5.1. User-Selected Variants[3] seems to imply "yes".
> 
> Q3. Are there ports which have a `+universal` variant which is important for 
> my system? How do I find this out, and understand the significance?
> 
> Q4. Should I edit my list of installed ports to remove the `+universal` from 
> the port identifier and requested_variants keyword? For instance, should I 
> change the bison entry from:
> 
> bison @3.7.6_1+universal requested_variants='+universal' platform='darwin 17' 
> archs='x86_64' date='2021-07-04T14:08:44-0700'
> bison @3.7.6_2+universal (active) requested_variants='+universal' 
> platform='darwin 17' archs='x86_64' date='2021-08-12T18:44:11-0700'
> 
> into:
> 
> bison @3.7.6_1 requested_variants='' platform='darwin 17' archs='x86_64' 
> date='2021-07-04T14:08:44-0700'
> bison @3.7.6_2 (active) requested_variants='' platform='darwin 17' 
> archs='x86_64' date='2021-08-12T18:44:11-0700'
> 
> Note: this list of installed ports had some entries with `archs='i386 
> x86_64'`. I already got rid of the `i386` arch entry.
> 
> [1] https://trac.macports.org/wiki/Migration
> [2] https://trac.macports.org/wiki/howto/buildUniversal
> [3] https://guide.macports.org/chunked/reference.variants.html

"Universal" means "build for more than one architecture". Most users don't need 
this for most ports, since most users are only installing their ports on one 
machine (one architecture) to use them on that one machine.

On Mac OS X 10.4 and 10.5, the default set of universal architectures is ppc 
i386.

On Mac OS X 10.6 through macOS 10.13, the default is i386 x86_64.

In macOS 10.14 Apple removed the ability to build i386 software so it is not 
possible to build universal in a default MacPorts install. (There are some 
complicated steps that a couple MacPorts users have identified that may allow 
building universal on 10.14.)

On macOS 10.15 Apple removed the ability to run i386 software so it is not 
possible to build universal.

On macOS 11 and later, the default set of universal architectures is x86_64 
arm64.

In MacPorts 2.7.0, significant changes were made to the universal variant 
feature so that MacPorts would not display the universal variant if it were not 
possible to use it on the current system. The default universal_archs on 10.14 
or 10.15 are set to the single value x86_64, and MacPorts base was enhanced so 
that if the universal_archs contain only a single value, then you will not see 
universal variants even in ports that offer them on other systems.

MacPorts provides a built-in default universal variant for autotools-based 
ports which many ports can use without the portfile needing to write any 
additional code. Some ports use different build systems like cmake and include 
a cmake portgroup to simplify this; that portgroup defines a default universal 
variant appropriate for the cmake build system. Other ports define their own 
totally custom universal variant. If a port has a universal variant, regardless 
of how it came about, "port info" and "port variants" will show it, unless the 
current setting of universal_archs contains only a single entry.

If a universal build of a port is required for another port to work, MacPorts 
will arrange for that to happen automatically. For example, if you had 
installed the wine port on an x86_64 Mac running macOS 10.13 or earlier, it 
would require all of its dependencies to be installed universal, and MacPorts 
would do so automatically. If you're not deliberately installing universal 
variants of ports for other reasons, it is fine and recommended to install 
ports without the universal variant. When migrating, removing "+universal" from 
the ports in your list is reasonable.

The output of "port installed" that you showed above where e.g. bison was 
installed with +universal but archs='x86_64' (only a single arch) makes no 
sense and should be impossible in MacPorts 2.7.0 and later. Previous versions 
of MacPorts would allow this nonsensical non-universal universal variant to be 
displayed and installed, for example if a user on 10.13 or earlier had edited 
macports.conf and changed universal_archs to a single value; when the universal 
variant was initially designed, it was not anticipated that any user would make 
such a change.

MacPorts 2.7.0 also brought the new feature that remembers which variants you 
requested (i.e. by specifying on the command line or in variants.conf when you 
installed a port), as distinct from those variants which a port enables by 
default but that you did not explicitly request. Requested variants are 
preserved across port upgrades. Previous versions of MacPorts preserved all 
enabled variants across port upgrades, even if a port's default variants had 
changed by then.

Reply via email to