Meeting with bug: #409471 suggested that some ebuilds could benefit from expanding -march=native to the actual flags the compiler use. Cannot suggest where to use it at the moment, but implementation was simple enough and possibly someone on this list could have a use for it.

# @FUNCTION: gcc-native-flags
# @USAGE: [CC compiler]
# @RETURN: 1st march 2nd mtune >=3rd flags
gcc-native-flags()

gcc-native-flags can take an argument, the compiler to use, then return something in the form:
-march=corei7-avx -mtune=generic -mcx16 [...] --param=l2-cache-size=8192

issues so far:
1) "--param l2-cache-size=8192" become "--param=l2-cache-size=8192", notice the space become an "=", this work and indeed I've encountered broken packages that didn't compile with -param\ ... form
2) what to do if $CC is not gcc / how to check cc is gcc
3) there are redundant flags, they are kept for simplicity
4) array usage is not really needed, just being a port of a python version it was natural this way ;-)
5) better name?

#409471  "dev-python/pypy-1.8-r1 CFLAGS=-march=native fails to compile"
https://bugs.gentoo.org/show_bug.cgi?id=409471

the attached file could be launched as is, it fake inherit some eclass and calls the function with available gcc

thanks,
Francesco Riosa

Attachment: hw-cflags.sh
Description: application/shellscript

Reply via email to