From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja
Date: Tue, 16 May 2017 19:12:44 +0200 [thread overview]
Message-ID: <1494954764.1591.2.camel@gentoo.org> (raw)
In-Reply-To: <20170430202830.12974-1-mgorny@gentoo.org>
[-- 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 --]
prev parent reply other threads:[~2017-05-16 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Michał Górny [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1494954764.1591.2.camel@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox