* [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja
@ 2017-04-30 20:28 Michał Górny
2017-04-30 20:28 ` [gentoo-dev] [PATCH 2/4] cmake-utils.eclass: Use eninja from ninja-utils Michał Górny
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Michał Górny @ 2017-04-30 20:28 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
eclass/ninja-utils.eclass | 57 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 eclass/ninja-utils.eclass
diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
new file mode 100644
index 000000000000..69216176ba61
--- /dev/null
+++ b/eclass/ninja-utils.eclass
@@ -0,0 +1,57 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: ninja-utils.eclass
+# @MAINTAINER:
+# Michał Górny <mgorny@gentoo.org>
+# Mike Gilbert <floppym@gentoo.org>
+# @AUTHOR:
+# Michał Górny <mgorny@gentoo.org>
+# Mike Gilbert <floppym@gentoo.org>
+# @BLURB: common bits to run dev-util/ninja builder
+# @DESCRIPTION:
+# This eclass provides a single function -- eninja -- that can be used
+# to run the ninja builder alike emake. It does not define any
+# dependencies, you need to depend on dev-util/ninja yourself. Since
+# ninja is rarely used stand-alone, most of the time this eclass will
+# be used indirectly by the eclasses for other build systems (CMake,
+# Meson).
+
+if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
+
+case ${EAPI:-0} in
+ 0|1|3) die "EAPI=${EAPI:-0} is not supported (too old)";;
+ # copied from cmake-utils
+ 2|4|5|6) ;;
+ *) die "EAPI=${EAPI} is not yet supported" ;;
+esac
+
+# @ECLASS-VARIABLE: NINJAOPTS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The default set of options to pass to Ninja. Similar to MAKEOPTS,
+# supposed to be set in make.conf. If unset, eninja() will convert
+# MAKEOPTS instead.
+
+inherit multiprocessing
+
+# @FUNCTION: eninja
+# @USAGE: [<args>...]
+# @DESCRIPTION:
+# Call Ninja, passing the NINJAOPTS (or converted MAKEOPTS), followed
+# by the supplied arguments. This function dies if ninja fails. Starting
+# with EAPI 6, it also supports being called via 'nonfatal'.
+eninja() {
+ local nonfatal_args=()
+ [[ ${EAPI:-0} != [245] ]] && nonfatal_args+=( -n )
+
+ if [[ -z ${NINJAOPTS+set} ]]; then
+ NINJAOPTS="-j$(makeopts_jobs) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
+ fi
+ set -- ninja -v ${NINJAOPTS} "$@"
+ echo "$@" >&2
+ "$@" || die "${nonfatal_args[@]}" "${*} failed"
+}
+
+_NINJA_UTILS_ECLASS=1
+fi
--
2.13.0.rc1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 2/4] cmake-utils.eclass: Use eninja from ninja-utils
2017-04-30 20:28 [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
@ 2017-04-30 20:28 ` Michał Górny
2017-04-30 20:28 ` [gentoo-dev] [PATCH 3/4] www-client/chromium: " Michał Górny
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2017-04-30 20:28 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
eclass/cmake-utils.eclass | 52 +++--------------------------------------------
1 file changed, 3 insertions(+), 49 deletions(-)
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 07f719a62a8c..2b3c8d933d1a 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -116,7 +116,8 @@ case ${EAPI} in
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
-inherit toolchain-funcs multilib flag-o-matic eutils multiprocessing versionator
+inherit toolchain-funcs multilib ninja-utils flag-o-matic eutils \
+ multiprocessing versionator
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
@@ -680,44 +681,6 @@ enable_cmake-utils_src_compile() {
cmake-utils_src_make "$@"
}
-_ninjaopts_from_makeopts() {
- if [[ ${NINJAOPTS+set} == set ]]; then
- return 0
- fi
- local ninjaopts=()
- set -- ${MAKEOPTS}
- while (( $# )); do
- case $1 in
- -j|-l)
- if [[ $# -eq 1 || $2 == -* ]]; then
- if [[ $1 == -j ]]; then
- # absurdly high job limit
- ninjaopts+=( $1 9999 )
- else # -l
- # remove load limit (like make does for -l)
- ninjaopts+=( $1 0 )
- fi
- shift 1
- else
- ninjaopts+=( $1 $2 )
- shift 2
- fi
- ;;
- -j*|-l*)
- ninjaopts+=( $1 )
- shift 1
- ;;
- -k)
- # -k 0 = any number of tasks can fail
- ninjaopts+=( $1 0 )
- shift 1
- ;;
- *) shift ;;
- esac
- done
- export NINJAOPTS="${ninjaopts[*]}"
-}
-
# @FUNCTION: _cmake_ninja_src_make
# @INTERNAL
# @DESCRIPTION:
@@ -727,16 +690,7 @@ _cmake_ninja_src_make() {
[[ -e build.ninja ]] || die "build.ninja not found. Error during configure stage."
- _ninjaopts_from_makeopts
-
- if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
- set -- ninja ${NINJAOPTS} -v "$@"
- else
- set -- ninja ${NINJAOPTS} "$@"
- fi
-
- echo "$@"
- "$@" || die
+ eninja "$@"
}
# @FUNCTION: _cmake_emake_src_make
--
2.13.0.rc1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 3/4] www-client/chromium: Use eninja from ninja-utils
2017-04-30 20:28 [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
2017-04-30 20:28 ` [gentoo-dev] [PATCH 2/4] cmake-utils.eclass: Use eninja from ninja-utils Michał Górny
@ 2017-04-30 20:28 ` Michał Górny
2017-05-01 11:17 ` Paweł Hajdan, Jr.
2017-04-30 20:28 ` [gentoo-dev] [PATCH 4/4] sys-apps/systemd: " Michał Górny
2017-05-16 17:12 ` [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
3 siblings, 1 reply; 6+ messages in thread
From: Michał Górny @ 2017-04-30 20:28 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
www-client/chromium/chromium-59.0.3067.0.ebuild | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/www-client/chromium/chromium-59.0.3067.0.ebuild b/www-client/chromium/chromium-59.0.3067.0.ebuild
index fb975c22b0cd..ac00f473bf45 100644
--- a/www-client/chromium/chromium-59.0.3067.0.ebuild
+++ b/www-client/chromium/chromium-59.0.3067.0.ebuild
@@ -8,7 +8,7 @@ CHROMIUM_LANGS="am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he
hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr
sv sw ta te th tr uk vi zh-CN zh-TW"
-inherit check-reqs chromium-2 eutils gnome2-utils flag-o-matic multilib multiprocessing pax-utils portability python-any-r1 readme.gentoo-r1 toolchain-funcs versionator virtualx xdg-utils
+inherit check-reqs chromium-2 eutils gnome2-utils flag-o-matic multilib ninja-utils pax-utils portability python-any-r1 readme.gentoo-r1 toolchain-funcs versionator virtualx xdg-utils
DESCRIPTION="Open-source version of Google Chrome web browser"
HOMEPAGE="http://chromium.org/"
@@ -503,23 +503,6 @@ src_configure() {
out/Release/gn gen --args="${myconf_gn}" out/Release || die
}
-eninja() {
- if [[ -z ${NINJAOPTS+set} ]]; then
- local jobs=$(makeopts_jobs)
- local loadavg=$(makeopts_loadavg)
-
- if [[ ${MAKEOPTS} == *-j* && ${jobs} != 999 ]]; then
- NINJAOPTS+=" -j ${jobs}"
- fi
- if [[ ${MAKEOPTS} == *-l* && ${loadavg} != 999 ]]; then
- NINJAOPTS+=" -l ${loadavg}"
- fi
- fi
- set -- ninja -v ${NINJAOPTS} "$@"
- echo "$@"
- "$@"
-}
-
src_compile() {
local ninja_targets="chrome chromedriver"
if use suid; then
--
2.13.0.rc1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 4/4] sys-apps/systemd: Use eninja from ninja-utils
2017-04-30 20:28 [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
2017-04-30 20:28 ` [gentoo-dev] [PATCH 2/4] cmake-utils.eclass: Use eninja from ninja-utils Michał Górny
2017-04-30 20:28 ` [gentoo-dev] [PATCH 3/4] www-client/chromium: " Michał Górny
@ 2017-04-30 20:28 ` Michał Górny
2017-05-16 17:12 ` [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
3 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2017-04-30 20:28 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
sys-apps/systemd/systemd-9999.ebuild | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/sys-apps/systemd/systemd-9999.ebuild b/sys-apps/systemd/systemd-9999.ebuild
index 7ff69d75cc9a..b4e1f943a599 100644
--- a/sys-apps/systemd/systemd-9999.ebuild
+++ b/sys-apps/systemd/systemd-9999.ebuild
@@ -13,7 +13,7 @@ fi
PYTHON_COMPAT=( python{3_4,3_5,3_6} )
-inherit bash-completion-r1 linux-info multilib-minimal multiprocessing pam python-any-r1 systemd toolchain-funcs udev user
+inherit bash-completion-r1 linux-info multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user
DESCRIPTION="System and service manager for Linux"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
@@ -271,15 +271,6 @@ multilib_src_configure() {
"$@" || die
}
-eninja() {
- if [[ -z ${NINJAOPTS+set} ]]; then
- NINJAOPTS="-j $(makeopts_jobs) -l $(makeopts_loadavg "${MAKEOPTS}" 0)"
- fi
- set -- ninja -v ${NINJAOPTS} "$@"
- echo "$@"
- "$@" || die
-}
-
multilib_src_compile() {
eninja
}
--
2.13.0.rc1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja
2017-04-30 20:28 [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
` (2 preceding siblings ...)
2017-04-30 20:28 ` [gentoo-dev] [PATCH 4/4] sys-apps/systemd: " Michał Górny
@ 2017-05-16 17:12 ` Michał Górny
3 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2017-05-16 17:12 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2496 bytes --]
On nie, 2017-04-30 at 22:28 +0200, Michał Górny wrote:
> ---
> eclass/ninja-utils.eclass | 57 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 57 insertions(+)
> create mode 100644 eclass/ninja-utils.eclass
>
> diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
> new file mode 100644
> index 000000000000..69216176ba61
> --- /dev/null
> +++ b/eclass/ninja-utils.eclass
> @@ -0,0 +1,57 @@
> +# Copyright 1999-2017 Gentoo Foundation
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# @ECLASS: ninja-utils.eclass
> +# @MAINTAINER:
> +# Michał Górny <mgorny@gentoo.org>
> +# Mike Gilbert <floppym@gentoo.org>
> +# @AUTHOR:
> +# Michał Górny <mgorny@gentoo.org>
> +# Mike Gilbert <floppym@gentoo.org>
> +# @BLURB: common bits to run dev-util/ninja builder
> +# @DESCRIPTION:
> +# This eclass provides a single function -- eninja -- that can be used
> +# to run the ninja builder alike emake. It does not define any
> +# dependencies, you need to depend on dev-util/ninja yourself. Since
> +# ninja is rarely used stand-alone, most of the time this eclass will
> +# be used indirectly by the eclasses for other build systems (CMake,
> +# Meson).
> +
> +if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
> +
> +case ${EAPI:-0} in
> + 0|1|3) die "EAPI=${EAPI:-0} is not supported (too old)";;
> + # copied from cmake-utils
> + 2|4|5|6) ;;
> + *) die "EAPI=${EAPI} is not yet supported" ;;
> +esac
> +
> +# @ECLASS-VARIABLE: NINJAOPTS
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# The default set of options to pass to Ninja. Similar to MAKEOPTS,
> +# supposed to be set in make.conf. If unset, eninja() will convert
> +# MAKEOPTS instead.
> +
> +inherit multiprocessing
> +
> +# @FUNCTION: eninja
> +# @USAGE: [<args>...]
> +# @DESCRIPTION:
> +# Call Ninja, passing the NINJAOPTS (or converted MAKEOPTS), followed
> +# by the supplied arguments. This function dies if ninja fails. Starting
> +# with EAPI 6, it also supports being called via 'nonfatal'.
> +eninja() {
> + local nonfatal_args=()
> + [[ ${EAPI:-0} != [245] ]] && nonfatal_args+=( -n )
> +
> + if [[ -z ${NINJAOPTS+set} ]]; then
> + NINJAOPTS="-j$(makeopts_jobs) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
> + fi
> + set -- ninja -v ${NINJAOPTS} "$@"
> + echo "$@" >&2
> + "$@" || die "${nonfatal_args[@]}" "${*} failed"
> +}
> +
> +_NINJA_UTILS_ECLASS=1
> +fi
Committed.
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-16 17:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-30 20:28 [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
2017-04-30 20:28 ` [gentoo-dev] [PATCH 2/4] cmake-utils.eclass: Use eninja from ninja-utils Michał Górny
2017-04-30 20:28 ` [gentoo-dev] [PATCH 3/4] www-client/chromium: " Michał Górny
2017-05-01 11:17 ` Paweł Hajdan, Jr.
2017-04-30 20:28 ` [gentoo-dev] [PATCH 4/4] sys-apps/systemd: " Michał Górny
2017-05-16 17:12 ` [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox