Using platforms in 2.8.0

Nils Breunese nils at breun.nl
Tue Nov 1 00:40:23 UTC 2022


Joshua Root <jmr at macports.org> wrote:

> On 2022-10-22 21:56 , Kirill A. Korinsky wrote:
>> I'm asking is there a way to support specified arch inside platform block's condition. Like:
>> platform {aarch64}  {
>> ...
>> }
> 
> You can certainly do things like:
> 
> platform darwin arm {
> ...
> }

I wasn’t aware of this platform variants syntax (https://guide.macports.org/#reference.variants.platform) yet, so today I learned.

I maintain some ports that contain sections that look like this:

----
if {${configure.build_arch} eq "x86_64"} {
	distname		microsoft-jdk-${version}-macOS-x64
	checksums	rmd160	2fc1a89b2310905e0891bb2b1519c8df86998ab7 \
				sha256	22697e9bbf3135c0ef843e7f371fe563ea948c6d464dfc532a7995fe32aebb09 \
				size		187094964
} elseif {${configure.build_arch} eq "arm64"} {
	distname		microsoft-jdk-${version}-macOS-aarch64
	checksums	rmd160	feb696c4ba65ea42b68bb578e5e2de7b41e56669 \
				sha256	c50a20ca8764a5aa54dc0a0cf681d891dadbdccc1051792806d797206d59ba34 \
				size		184695872
}
----

I thought I’d replace such if-elseif sections with declarative platform variant blocks, but I noticed that the arch argument for the platform variant needs to be ‘arm’ instead of ‘arm64’:

----
platform darwin arm {
	distname		microsoft-jdk-${version}-macOS-aarch64
	checksums	rmd160	feb696c4ba65ea42b68bb578e5e2de7b41e56669 \
				sha256	c50a20ca8764a5aa54dc0a0cf681d891dadbdccc1051792806d797206d59ba34 \
				size		184695872
}
----

Why is the arch value for a platform variant not the same as ${configure.build_arch}? What are the valid values for the arch argument of a platform variant block? Can I use ‘platform darwin x86_64 { … }’ for the 64-bit Intel case or is that value also different from ${configure.build_arch}? I don’t have a x86_64 Mac I can use to test this myself.

Nils.


More information about the macports-dev mailing list