Ticket #115 (closed enhancement: fixed)
Opened 6 years ago
Last modified 1 year ago
create a macro for parallel make
Reported by: stick Assigned to: RpmTickets Priority: minor Milestone: rpm-4.12.0 Component: rpm Version: RPM Development Keywords: Cc:
Description
Distributions uses these macros for parallel make: - Fedora make %{?_smp_mflags} - openSUSE: make %{?jobs:-j%jobs}
We could unify notation (%{?_smp_mflags} works on openSUSE too) and add a definition to RPM upstream (maybe %make for parallel make and %make_single for single?)
Change History
12/04/09 17:54:31 changed by stick
- priority changed from major to minor.
12/22/09 00:18:33 changed by jengelh
We should be using at least %_smp_mflags
; the hardcoded use of
%{?jobs:-j%jobs}
in specfiles "forces" the use of -jXX
, which is
in conflict when one wants to use -lXX
instead, for example.
(“Parallel building, preferably, but I get to choose how things are scheduled.”)
%make
and %make_single
seems ok.
01/22/14 10:34:04 changed by pmatilai
- status changed from new to closed.
- resolution set to fixed.
Duh, been intending to do something about this about umphteen times but always gotten sidetracked or had second thoughts how to go about it. Anyway, I just pushed two changes that I think solve this and some other related issues quite nicely:
https://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=356fd73a7b24fd5fdcc093639c12dfd60f35d681 https://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=89df36524bace71decee4ab4f979d4ffb449c9a7
Where you previously invoked "make" with assorted parallel-build magic, you now just use "%make_build" which takes care of the parallel switches. The other change is to allow specifying the maximum numer of CPU's to use, which can be set on system, user or spec-level if desireable. This allows it to be used for overall resource control in addition to handling the special case of buggy makefiles (whether a truly serialized build is required or parallel builds beyond some value of N are buggy), and is nicely greppable too. So a spec might look something like this:
# foo-1.2 has buggy makefiles preventing parallel build
%global _smp_ncups_max 1
[...]
%build
%make_build
%install
%make_install
In addition to the parallel build issues, the "make" command to use can be overridden with %make macro throughout the spec (previously %make_install honored %make but typically specs dont use that but invoke "make" directly). Plus it can be enhanced for other things as its not specific to the parallel-build issues, and should help cross-distro unification by hiding the details from specs.
01/22/14 11:18:05 changed by pmatilai
Ehm, just spotted a typo (ncups) in the above comment. The spec snippet should of course be
# foo-1.2 has buggy makefiles preventing parallel build
%global _smp_ncpus_max 1
[...]
%build
%make_build
%install
%make_install
09/16/14 11:07:31 changed by pmatilai
- milestone set to rpm-4.12.0.