• [gentoo-dev] [PATCH 0/3] multiprocessing.eclass: consider (GNU)MAKEFLAG

    From Florian Schmaus@21:1/5 to All on Wed Oct 4 15:10:02 2023
    We'd like portage to provide a sane default with of the "makeopts",
    i.e., the maximum number of parallel jobs (--jobs) and the maximum
    load average (--load-average) that build systems should try to
    establish at once.

    However, while --jobs is a pretty standard feature for Make-ish build
    systems, --load-average is not. For example, it is not provided by BSD
    Make. As such, it was decided that portage should set --load-average
    in GNUMAKEFLAGS, instead of MAKEOPTS (see https://marc.info/?l=gentoo-dev&m=169027605717531&w=2 and https://github.com/gentoo/portage/pull/1072).

    As a result, the multiprocessing.eclass should now also try to extract
    the value for --jobs and --load-average not only from MAKEOPTS, but
    also from (GNU)MAKEFLAGS.

    While we add it, we also overhaul multiprocessing.eclass's API by
    providing two new simple methods to extract the values: get_multiprocessing_jobs() and get_multiprocessing_loadavg().

    PR at https://github.com/gentoo/gentoo/pull/32385

    Florian Schmaus (3):
    multiprocessing.eclass: consider (GNU)MAKEFLAGS, add
    get_makeopts_{jobs,loadavg}
    ninja-utils.eclass: use get_makeopts_{jobs,loadavg}
    meson.eclass: use get_makeopts_{jobs,loadavg}

    eclass/meson.eclass | 4 +-
    eclass/multiprocessing.eclass | 40 ++++++++++++++++---
    eclass/ninja-utils.eclass | 3 +-
    eclass/tests/multiprocessing_makeopts_jobs.sh | 24 ++++++++++-
    4 files changed, 61 insertions(+), 10 deletions(-)

    --
    2.41.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Florian Schmaus@21:1/5 to All on Wed Oct 4 15:10:01 2023
    Since --load-average may not be found in other Make implementations
    besides GNU Make, it is potentially found in GNUMAKEFLAGS and not in
    MAKEOPTS.

    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
    eclass/multiprocessing.eclass | 40 ++++++++++++++++---
    eclass/tests/multiprocessing_makeopts_jobs.sh | 24 ++++++++++-
    2 files changed, 57 insertions(+), 7 deletions(-)

    diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass index e55be636a02c..0768e7cb1e1f 100644
    --- a/eclass/multiprocessing.eclass
    +++ b/eclass/multiprocessing.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 1999-2022 Gentoo Authors
    +# Copyright 1999-2023 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: multiprocessing.eclass
    @@ -64,17 +64,36 @@ get_nproc() {
    fi
    }

    +# @FUNCTION: get_all_makeopts
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Returns ${MAKEOPTS} ${GNUMAKEFLAGS} ${MAKEFLAGS}.
    +_get_all_makeopts() {
    + echo "${MAKEOPTS} ${GNUMAKEFLAGS} ${MAKEFLAGS}"
    +}
    +
    +# @FUNCTION: get_makeopts_jobs
    +# @USAGE: [default-jobs]
    +# @DESCRIPTION:
    +# Return the number of jobs extracted from the make options (MAKEOPTS,
    +# GNUMAKEFLAGS, MAKEFLAGS). If the