diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index 3a2560aabf..6943e59b0b 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @FUNCTION: __save_ebuild_env @@ -24,6 +24,9 @@ __save_ebuild_env() { unset PYTHONPATH fi fi + + # Discard stale GNU Make POSIX Jobserver flags. + unset MAKEFLAGS fi # misc variables inherited from the calling environment diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py index 21bf993170..10c303477f 100644 --- a/lib/portage/__init__.py +++ b/lib/portage/__init__.py @@ -1,4 +1,4 @@ -# Copyright 1998-2023 Gentoo Authors +# Copyright 1998-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # pylint: disable=ungrouped-imports @@ -657,6 +657,7 @@ def create_trees( # environment to apply to the config that's associated # with ROOT != "/", so pass a nearly empty dict for the env parameter. env_sequence = ( + "MAKEFLAGS", "PATH", "PORTAGE_GRPNAME", "PORTAGE_REPOSITORIES", diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py b/lib/portage/package/ebuild/_config/special_env_vars.py index 1a66192c96..55e5111ef0 100644 --- a/lib/portage/package/ebuild/_config/special_env_vars.py +++ b/lib/portage/package/ebuild/_config/special_env_vars.py @@ -1,4 +1,4 @@ -# Copyright 2010-2021 Gentoo Authors +# Copyright 2010-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ( @@ -112,6 +112,7 @@ "FEATURES", "FILESDIR", "HOME", + "MAKEFLAGS", "MERGE_TYPE", "NOCOLOR", "NO_COLOR", diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py index 403836b80b..1f7d506bc7 100644 --- a/lib/portage/package/ebuild/doebuild.py +++ b/lib/portage/package/ebuild/doebuild.py @@ -598,11 +598,12 @@ def doebuild_environment( ) mysettings.features.remove(feature) - if "MAKEOPTS" not in mysettings: + # MAKEOPTS conflicts with MAKEFLAGS, so skip this if MAKEFLAGS exists. + if "MAKEOPTS" not in mysettings and "MAKEFLAGS" not in mysettings: nproc = get_cpu_count() if nproc: mysettings["MAKEOPTS"] = "-j%d" % (nproc) - if "GNUMAKEFLAGS" not in mysettings and "MAKEFLAGS" not in mysettings: + if "GNUMAKEFLAGS" not in mysettings: mysettings["GNUMAKEFLAGS"] = ( f"--load-average {nproc} --output-sync=line" ) diff --git a/man/make.conf.5 b/man/make.conf.5 index 21ae09e574..9af563a5c8 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -1,4 +1,4 @@ -.TH "MAKE.CONF" "5" "Jan 2024" "Portage @VERSION@" "Portage" +.TH "MAKE.CONF" "5" "Aug 2024" "Portage @VERSION@" "Portage" .SH "NAME" make.conf \- custom settings for Portage .SH "SYNOPSIS" @@ -948,6 +948,14 @@ Setting this and other *FLAGS variables arbitrarily may cause compile or runtime failures. Bug reports submitted when nonstandard values are enabled for these flags may be closed as INVALID. .TP +.B MAKEFLAGS +Use this variable instead of \fBMAKEOPTS\fR if you want to inject a +centralized job server for make. In this case \fBMAKEOPTS\fR should be +unset or else it can cause the make jobserver mode to reset. Include +a \fB--jobserver-auth=fifo:PATH\fR flag to specify the path of the +centralized jobserver fifo, which needs to be readable and writable by +the portage group when userpriv is enabled. +.TP .B MAKEOPTS Use this variable if you want to use parallel make. For example, if you have a dual\-processor system, set this variable to "\-j2" or "\-j3" for