Add LTO option (Link Time Optimization) as USES macro?

Daniel Engberg daniel.engberg.lists at pyret.net
Fri Oct 4 19:51:23 UTC 2019


Hi,

I apologize beforehand if this topic has been discussioned earlier but I 
couldn't find anything related topic looking at the archive.

I've noticed that several ports have "support" added for lto either by 
manually implementing it in the Makefile or it gets silently enabled by 
default. Would be a bad idea to implement it as a USES macro with 
arguments that adds lto as an option and leaves it off by default unless 
set otherwise in the Makefile?

Example:

USES= LTO

Would add toggle using helpers that passes --enable-lto/--disable-lto if 
GNU_CONFIGURE is defined, -DENABLE_LTO:BOOL=true if USES= cmake is 
defined and so on

Possible arguments:

cflags			- if upstream doesn't provide a way to enable lto
arch/archs (amd64 etc)	- Add it only for specific archs
on			- Enabled it by default

Best regards,
Daniel


More information about the freebsd-ports mailing list