| |
@@ -2331,18 +2331,33 @@
|
| |
%make_build
|
| |
....
|
| |
|
| |
- This generally speeds up builds and especially on SMP machines.
|
| |
+ This will pass appropriate flags to build in parallel
|
| |
+ and set useful verbosity flags.
|
| |
|
| |
- Do make sure, however, that the package builds cleanly this way
|
| |
- as some make files do not support parallel building.
|
| |
- Therefore you should consider adding
|
| |
+ === Constraining Build Parallelism
|
| |
|
| |
- ....
|
| |
- %_smp_mflags -j3
|
| |
- ....
|
| |
+ The `%constrain_build` macro can be used near the top of the spec file
|
| |
+ to constrain build parallelism.
|
| |
+ When called with no arguments, the CPU count will be reduced to one.
|
| |
+ The `+-c+` option will set the CPU count to a given value:
|
| |
+
|
| |
+ %constrain_build -c 4
|
| |
+
|
| |
+ will force the build to use at most four CPUs.
|
| |
+
|
| |
+ The `+-m+` option allows you to specify the amount of memory
|
| |
+ in megabytes which a single build thread takes.
|
| |
+ The macro will divide the total amount of memory in the system
|
| |
+ by this value and set the CPU count to the result (rounded down).
|
| |
+ On a machine with 32GB of memory:
|
| |
+
|
| |
+ %constrain_build -m 10000
|
| |
+
|
| |
+ will set the CPU count to three.
|
| |
|
| |
- to your `+~/.rpmmacros+` file -- even on UP machines --
|
| |
- as this will expose most of these errors.
|
| |
+ This macro will influence anything which considers the value of
|
| |
+ `%_smp_build_ncpus` including
|
| |
+ `%make_build`, `%cmake_build` and `%meson_build`.
|
| |
|
| |
== Scriptlets
|
| |
|
| |
This adds a small subsection to the section on parallel make which documents the %constrain_build macro.
Currently this macro exists in rawhide, but after testing I will backport it through Fedora and EPEL. (It uses features from RPM 4.17 so this does require a little work.) So this shouldn't be merged right now.
As an aside, I'm curious as to which buildsystems this doesn't affect. I'm pretty sure it doesn't change what
%pyproject_wheel
does. I think Perl just uses%make_build
. Rust seems to incorporate%_smp_mflags
, as does ninja, so they should work. should work. I've no idea at all about go.