Bug 262162

Summary: Mk/bsd.port.mk: Add USES_${ARCH} support
Product: Ports & Packages Reporter: Robert Clausecker <fuz>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Open ---    
Severity: Affects Some People CC: koobs, ports-bugs
Priority: --- Keywords: feature, needs-patch
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261247

Description Robert Clausecker freebsd_committer freebsd_triage 2022-02-24 00:43:22 UTC
It is currently very awkward to register USES that depend on architecture.  This is a use case that pops up every once in a while (e.g. when a port requires a certain build tools only on some architectures).  See e.g. bug #261247.

This is because USES cannot be set after <bsd.port.pre.mk> is included, but
including that is required to access the ARCH macro.  A possible workaround
is using a construct like

    USES+=${ARCH:Mamd64:S/amd64/something}

but that's hard to read and quite ugly.  As a solution, the ports infrastructure
should provide a macro USES_${ARCH} that if set is added to USES, permitting the definition of architecture specific USES.  For example, this could be achieved by placing

    USES+=${USES_${ARCH}}

after the definition of ARCH and before evaluation of USES in bsd.port.mk.