From: orbea <orbea@riseup.net>
samurai is a ninja-compatible build tool written in C which
works with cmake, meson and other users of ninja.
It is feature-complete and supports most of the same options
as ninja.
Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/cmake.eclass | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 59e5b60957c2..7ad0f6a7d45e 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -136,7 +136,7 @@ case ${CMAKE_MAKEFILE_GENERATOR} in
BDEPEND="sys-devel/make"
;;
ninja)
- BDEPEND="dev-util/ninja"
+ BDEPEND="${NINJA_DEPEND}"
;;
*)
eerror "Unknown value for \${CMAKE_MAKEFILE_GENERATOR}"
@@ -365,7 +365,7 @@ cmake_src_prepare() {
# if ninja is enabled but not installed, the build could fail
# this could happen if ninja is manually enabled (eg. make.conf) but not installed
- if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]] && ! has_version -b dev-util/ninja; then
+ if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]] && ! has_version -b "${NINJA_DEPEND}"; then
eerror "CMAKE_MAKEFILE_GENERATOR is set to ninja, but ninja is not installed."
die "Please install dev-util/ninja or unset CMAKE_MAKEFILE_GENERATOR."
fi
@@ -703,12 +703,17 @@ cmake_src_test() {
# @DESCRIPTION:
# Function for installing the package. Automatically detects the build type.
cmake_src_install() {
+ local generator=${CMAKE_MAKEFILE_GENERATOR}
+ case ${CMAKE_MAKEFILE_GENERATOR} in
+ ninja) generator="eninja" ;;
+ esac
+
debug-print-function ${FUNCNAME} "$@"
_cmake_check_build_dir
pushd "${BUILD_DIR}" > /dev/null || die
- DESTDIR="${D}" ${CMAKE_MAKEFILE_GENERATOR} install "$@" ||
- die "died running ${CMAKE_MAKEFILE_GENERATOR} install"
+ DESTDIR="${D}" ${generator} install "$@" ||
+ die "died running ${generator} install"
popd > /dev/null || die
if [[ ${EAPI} == 7 ]]; then
From: orbea <orbea@riseup.net>
samurai is a ninja-compatible build tool written in C which
works with cmake, meson and other users of ninja.
It is feature-complete and supports most of the same options
as ninja.
Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/ninja-utils.eclass | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
index c5f34934192f..67f7a6b5e8a7 100644
--- a/eclass/ninja-utils.eclass
+++ b/eclass/ninja-utils.eclass
@@ -26,6 +26,15 @@ esac
if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
_NINJA_UTILS_ECLASS=1
+# @ECLASS_VARIABLE: NINJA
+# @PRE_INHERIT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specify a compatible ninja implementation to be used by eninja.
+# At this point only "ninja" and "samu" are supported.
+# The default is set to "ninja".
+: ${NINJA:=ninja}
+
# @ECLASS_VARIABLE: NINJAOPTS
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -35,6 +44,19 @@ _NINJA_UTILS_ECLASS=1
inherit multiprocessing
+case "${NINJA}" in
+ ninja) + NINJA_DEPEND=">=dev-util/ninja-1.8.2" + ;;
+ samu) + NINJA_DEPEND="dev-util/samurai" + ;;
+ *)
+ eerror "Unknown value for \${NINJA}" + die "Value ${NINJA} is not supported" + ;;
+esac
+
From: orbea <orbea@riseup.net>
samurai is a ninja-compatible build tool written in C which
works with cmake, meson and other users of ninja.
It is feature-complete and supports most of the same options
as ninja.
Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/ninja-utils.eclass | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
index c5f34934192f..67f7a6b5e8a7 100644
--- a/eclass/ninja-utils.eclass
+++ b/eclass/ninja-utils.eclass
@@ -26,6 +26,15 @@ esac
if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
_NINJA_UTILS_ECLASS=1
+# @ECLASS_VARIABLE: NINJA
+# @PRE_INHERIT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specify a compatible ninja implementation to be used by eninja.
+# At this point only "ninja" and "samu" are supported.
+# The default is set to "ninja".
+: ${NINJA:=ninja}
# @ECLASS_VARIABLE: NINJAOPTS
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -35,6 +44,19 @@ _NINJA_UTILS_ECLASS=1
inherit multiprocessing
+case "${NINJA}" in
+ ninja)
+ NINJA_DEPEND=">=dev-util/ninja-1.8.2"
+ ;;
+ samu)
+ NINJA_DEPEND="dev-util/samurai"
+ ;;
+ *)
+ eerror "Unknown value for \${NINJA}"
+ die "Value ${NINJA} is not supported"
+ ;;
+esac
On Mon, 9 May 2022 10:59:03 -0400
Mike Gilbert <floppym@gentoo.org> wrote:
The NINJA environment variable is used directly by meson and may
contain an absolute path. I don't think it makes sense to restrict
possible values to just "ninja" and "samu". That will make it more difficult for users to override it with a local copy of either tool,
or to use a different implementation should someone write one in the future.
It might make sense to introduce a different eclass variable to
control NINJA_DEPEND and the default value for NINJA.
The game antares (https://github.com/arescentral/antares) has a custom
python based build system that also respects the NINJA variable.
Your point is a good one, but I'm unsure how this would work? The NINJA_DEPEND variable has to be set to a valid package elsewhere in the eclass scripts, for example the 'has_version -b' check in the cmake
eclass.
Allowing the user to set an arbitrary value will require they also
being able to set NINJA_DEPEND to a correct value. In some of these
cases there may not be an applicable ebuild to set it to even. Maybe
I'm missing something, but this seems like a good way to complicate the process and possibly introduce pebkac. Maybe it would be preferable to
just add additional ninja implementations to the list as they are
available?
Also if its just testing local versions I think it could be worked
around by setting the PATH and / or using symlinks? A user could
create a dummy ebuild as well.
From: orbea <orbea@riseup.net>
samurai is a ninja-compatible build tool written in C which
works with cmake, meson and other users of ninja.
It is feature-complete and supports most of the same options
as ninja.
Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/ninja-utils.eclass | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
index c5f34934192f..67f7a6b5e8a7 100644
--- a/eclass/ninja-utils.eclass
+++ b/eclass/ninja-utils.eclass
@@ -26,6 +26,15 @@ esac
if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
_NINJA_UTILS_ECLASS=1
+# @ECLASS_VARIABLE: NINJA
+# @PRE_INHERIT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specify a compatible ninja implementation to be used by eninja.
+# At this point only "ninja" and "samu" are supported.
+# The default is set to "ninja".
+: ${NINJA:=ninja}
+
# @ECLASS_VARIABLE: NINJAOPTS
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -35,6 +44,19 @@ _NINJA_UTILS_ECLASS=1
inherit multiprocessing
+case "${NINJA}" in
+ ninja)
+ NINJA_DEPEND=">=dev-util/ninja-1.8.2"
+ ;;
+ samu)
+ NINJA_DEPEND="dev-util/samurai"
+ ;;
+ *)
+ eerror "Unknown value for \${NINJA}"
+ die "Value ${NINJA} is not supported"
+ ;;
+esac
+
# @FUNCTION: eninja
# @USAGE: [<args>...]
# @DESCRIPTION:
@@ -48,7 +70,7 @@ eninja() {
if [[ -z ${NINJAOPTS+set} ]]; then
NINJAOPTS="-j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
fi
- set -- ninja -v ${NINJAOPTS} "$@"
+ set -- "${NINJA}" -v ${NINJAOPTS} "$@"
echo "$@" >&2
"$@" || die "${nonfatal_args[@]}" "${*} failed"
}
--
2.35.1
On 2022-05-08 23:07, Sam James wrote:
From: orbea <orbea@riseup.net>
samurai is a ninja-compatible build tool written in C which
works with cmake, meson and other users of ninja.
It is feature-complete and supports most of the same options
as ninja.
Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/ninja-utils.eclass | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
index c5f34934192f..67f7a6b5e8a7 100644
--- a/eclass/ninja-utils.eclass
+++ b/eclass/ninja-utils.eclass
@@ -26,6 +26,15 @@ esac
if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
_NINJA_UTILS_ECLASS=1
+# @ECLASS_VARIABLE: NINJA
+# @PRE_INHERIT
How about making it @USER_VARIABLE instead? Because it's more likely to
be set in make.conf rather than in an ebuild.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 53:23:06 |
Calls: | 10,397 |
Calls today: | 5 |
Files: | 14,067 |
Messages: | 6,417,394 |
Posted today: | 1 |