From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5E034139694 for ; Tue, 16 May 2017 17:13:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9A7D821C102; Tue, 16 May 2017 17:12:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 438FA21C09D for ; Tue, 16 May 2017 17:12:50 +0000 (UTC) Received: from pomiot (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id D1BEC3413B7; Tue, 16 May 2017 17:12:48 +0000 (UTC) Message-ID: <1494954764.1591.2.camel@gentoo.org> Subject: Re: [gentoo-dev] [PATCH 1/4] ninja-utils.eclass: Add a new eclass to handle calling ninja From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Date: Tue, 16 May 2017 19:12:44 +0200 In-Reply-To: <20170430202830.12974-1-mgorny@gentoo.org> References: <20170430202830.12974-1-mgorny@gentoo.org> Organization: Gentoo Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-oBRv3ip2RiYsMXJKRyuZ" X-Mailer: Evolution 3.22.6 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 X-Archives-Salt: ea2c8709-5da5-4711-b536-c60320735152 X-Archives-Hash: 85c7a7043d8c5b3f3c891a05ec4e9ce0 --=-oBRv3ip2RiYsMXJKRyuZ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On nie, 2017-04-30 at 22:28 +0200, Micha=C5=82 G=C3=B3rny wrote: > --- > eclass/ninja-utils.eclass | 57 +++++++++++++++++++++++++++++++++++++++++= ++++++ > 1 file changed, 57 insertions(+) > create mode 100644 eclass/ninja-utils.eclass >=20 > 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=C5=82 G=C3=B3rny > +# Mike Gilbert > +# @AUTHOR: > +# Micha=C5=82 G=C3=B3rny > +# Mike Gilbert > +# @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=3D${EAPI:-0} is not supported (too old)";; > + # copied from cmake-utils > + 2|4|5|6) ;; > + *) die "EAPI=3D${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: [...] > +# @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=3D() > + [[ ${EAPI:-0} !=3D [245] ]] && nonfatal_args+=3D( -n ) > + > + if [[ -z ${NINJAOPTS+set} ]]; then > + NINJAOPTS=3D"-j$(makeopts_jobs) -l$(makeopts_loadavg "${MAKEOPTS}" 0)" > + fi > + set -- ninja -v ${NINJAOPTS} "$@" > + echo "$@" >&2 > + "$@" || die "${nonfatal_args[@]}" "${*} failed" > +} > + > +_NINJA_UTILS_ECLASS=3D1 > +fi Committed. --=20 Best regards, Micha=C5=82 G=C3=B3rny --=-oBRv3ip2RiYsMXJKRyuZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQKTBAABCgB9FiEEXr8g+Zb7PCLMb8pAur8dX/jIEQoFAlkbMw1fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDVF QkYyMEY5OTZGQjNDMjJDQzZGQ0E0MEJBQkYxRDVGRjhDODExMEEACgkQur8dX/jI EQrEOQ//Vqwro3XM3wnZtvVxMxcqyieOmMp2qpjd+IPuVRjPcURW4GQXRcuepWCf 0wrEJ8bRositTKKMZa2/GIhUg6T/bf/J7aIZnDZS2L0OYkpmh0gB+xzeeZ5C0Jnb ml6SPfvL1HtKX7OW4sXOHRPAm5QyA7KZJKKT3KS1xeJof+IN/IorJdT8BpL3ay0I gLx5OkiX01yha6C4SkRQMxCGrf5aYNlFXaLcU+iQjf7AIRz9x8Ea5qF5i7vmxS4E LPjP1rCIbjguoxvSg1dcWzrbkLMmFKC8DF+q7IF0yK3ROmZuAeyG+rhb5mn9U7Ul bN97qUwYdJsCJvLZPctyFR5s29+e/3KvFUVFuTYCYsEujW6dUhGa6EtXM+CZ2kmn m2n7N3TaGFU7mQIzi6YL2vMyi0grDKHb73TuxlPaPkN/oHm9g6NIfB6o7T/p9dFT cAFn5QzARWX8qnlOQbUBKjwcGIqLJ1D6ynQRB1zJl06mHACAj+W/znXyMpLTusoL zWtEthYceO1dQOXjlEUGAn5xLdFAvri/BwuOM9wZj5yiQFUb2VTIN0rwD0kHeg+v wCI9pzyMaI2ncLBemjgUf+Xoud6kDhRhZ+ivfBKYt82/otUS5wOwKVga+U58UXuE E7OlPMx06vI6iwIglJMI6HLNvD0IfnAr6Be+Ee2prw4x/BZjrFw= =HHyn -----END PGP SIGNATURE----- --=-oBRv3ip2RiYsMXJKRyuZ--