| |
@@ -738,7 +738,34 @@
|
| |
[#compiler]
|
| |
== Compiler
|
| |
|
| |
- Fedora uses gcc as the compiler (for all languages that gcc supports). Packages may only build with an alternative compiler to gcc if upstream does not support gcc.
|
| |
+ Fedora packages should default to using gcc as the compiler (for all languages that gcc supports) or clang if upstream does not support building with gcc. However, if there is a good technical reason, packagers may choose not to use the default compiler. Examples of valid technical reasons to not use the default compiler, include but are not limited to:
|
| |
+
|
| |
+ * The default compiler cannot build a package correctly.
|
| |
+ * The packager needs to disable a compiler feature (e.g. LTO) in order for the default compiler to correctly compile their package.
|
| |
+ * The default compiler takes significantly longer to build a package.
|
| |
+ * The default compiler is missing a feature that would benefit the package.
|
| |
+
|
| |
+ Packagers choosing to use a non-default compiler should document the reason for this decision in a comment in the spec file.
|
| |
+
|
| |
+ == Compiler macros
|
| |
+
|
| |
+ If clang is being used to build a package, packagers must set the %toolchain macro to clang:
|
| |
+
|
| |
+ ....
|
| |
+ %global toolchain clang
|
| |
+ ....
|
| |
+
|
| |
+ This ensures that Fedora's clang-specific compiler flags are used when compiling.
|
| |
+
|
| |
+ If a packager wants to use conditional macros in a spec file to make it easier to switch between two different compilers, then the following macros names should be used:
|
| |
+
|
| |
+ ....
|
| |
+ %bcond_with toolchain_clang
|
| |
+ %bcond_with toolchain_gcc
|
| |
+ ....
|
| |
+
|
| |
+ Packagers may also use the %build_cc, %build_cxx, or %build_cpp macros in the spec file in place of hard-coding the compiler name. The values of these variables are controled by setting the %toolchain macro to either clang or gcc.
|
| |
+
|
| |
|
| |
== Compiler flags
|
| |
|
| |
https://fedoraproject.org/wiki/Changes/CompilerPolicy
This is a proposed change to the compiler policy to go along with the Fedora change proposal: https://fedoraproject.org/wiki/Changes/CompilerPolicy
It should not be merged unless the change proposal is accepted.