From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-dev+bounces-80490-garchives=archives.gentoo.org@lists.gentoo.org>
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 1074E139694
	for <garchives@archives.gentoo.org>; Fri,  5 May 2017 15:35:56 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id CA8EDE0D30;
	Fri,  5 May 2017 15:35:46 +0000 (UTC)
Received: from mail-pf0-x22b.google.com (mail-pf0-x22b.google.com [IPv6:2607:f8b0:400e:c00::22b])
	(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 6D431E0CD5
	for <gentoo-dev@lists.gentoo.org>; Fri,  5 May 2017 15:35:46 +0000 (UTC)
Received: by mail-pf0-x22b.google.com with SMTP id q20so4409078pfg.0
        for <gentoo-dev@lists.gentoo.org>; Fri, 05 May 2017 08:35:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=sender:date:from:to:subject:message-id:mail-followup-to
         :mime-version:content-disposition:user-agent;
        bh=KEtwoiJTbVRZNCV0OocScOJxJhB0qoFKuCQHs2LhMjY=;
        b=GTbSBCjttpLdjjVFYY70zlcuVvY6tjE3p1bPmdzVlBOucowwnT212ebyd0fCCoJ3mQ
         Faafii19MUeSSKqjqcfKGIurag4d7VfOFJhu6ba9CFx+FH2te6m5U55GkWG20ukeRUy9
         AeBqv4jD1kT+dp4j6+CarIz2aN12CCOj7A1qRsf8wM3aYyvP9qCB32kYf4TjhRAwfwuZ
         JEXu8DM6ZtyRLNohhnSHSmvCUCzn+gIoWnFT9ZC5siacq6OGCdg89HnRXpYdT730PZxK
         bVzFdx6iyzMPQHCg9tSwWAAZiv6Qs4oNtwXD+LY+AyhBbAyt+h7IkjP9KI6rdYbZSVcG
         b1Rg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:sender:date:from:to:subject:message-id
         :mail-followup-to:mime-version:content-disposition:user-agent;
        bh=KEtwoiJTbVRZNCV0OocScOJxJhB0qoFKuCQHs2LhMjY=;
        b=TaBcIleJeMnmqHxh5K70tG2aqwIVrsVR9EOHVnKMdi99Hr4hgcwt7vAH8iUKskRlDr
         V3H5o2tiupZKbjpmOrMsF/uaB4J/KlNtQbRQ7YHKZeMK4LfmUPbIbzmW+6wzkvQ8gV7F
         dhL6zsLfnwTVY4pNcX+sLhGXstWRNBvZ6ocJ77sJRxoDHKBE73Nlqg3sPpnRwTv5/Tgx
         0yjWzDM0tgTMcZ4kbroSTCf7dpQGGk+m5vfKnvHQnyb9bQ/vpZuHgREcALfD7rbNUNG0
         rQ95YgNbUev6MykKma0abh7synaV5ursCryFInV5c5MvBQxZYIDbu01PXDvG7AGTkDT5
         h3Hw==
X-Gm-Message-State: AN3rC/78iAj68vjLn0kl2suCX8nat0usGv3wj2CFEtB74V4U5JI9lE7g
	z4+BXRqEWZC4yjyf
X-Received: by 10.84.233.196 with SMTP id m4mr35082546pln.177.1493998545253;
        Fri, 05 May 2017 08:35:45 -0700 (PDT)
Received: from linux1 (cpe-66-68-34-247.austin.res.rr.com. [66.68.34.247])
        by smtp.gmail.com with ESMTPSA id 66sm4090656pgd.47.2017.05.05.08.35.44
        for <gentoo-dev@lists.gentoo.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 05 May 2017 08:35:44 -0700 (PDT)
Sender: William Hubbs <w.d.hubbs@gmail.com>
Received: (nullmailer pid 2414 invoked by uid 1000);
	Fri, 05 May 2017 15:35:43 -0000
Date: Fri, 5 May 2017 10:35:43 -0500
From: William Hubbs <williamh@gentoo.org>
To: gentoo development <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] meson.eclass third draft
Message-ID: <20170505153543.GA2377@linux1>
Mail-Followup-To: gentoo development <gentoo-dev@lists.gentoo.org>
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@lists.gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="p4qYPpj5QlsIQJ0K"
Content-Disposition: inline
User-Agent: Mutt/1.5.24 (2015-08-30)
X-Archives-Salt: af79bedb-da63-4e32-b00c-68e5cf841516
X-Archives-Hash: f2631650863f35ef12a41b7792cb5db7


--p4qYPpj5QlsIQJ0K
Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx"
Content-Disposition: inline


--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

All,

here is the third (and hopefully final) draft of meson.eclass. I am
leaving the code in for the cross support but commented so all I need to
do later is add toolchain-funcs back to inherit and uncomment the code
once I know how to write the cross file, which shouldn't take too long.
I added a link to the documentation for it in the comments.

Thanks,

William


--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="meson.eclass"

# Copyright 2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: meson.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
# @BLURB: common ebuild functions for meson-based packages
# @DESCRIPTION:
#
# @EXAMPLE:
# Typical ebuild using meson.eclass:
#
# @CODE
# EAPI=6
#
# inherit meson
#
# ...
#
# src_configure() {
# 	local emesonargs=(
# 		-Dqt4=$(usex qt4 true false)
# 		-Dthreads=$(usex threads true false)
# 		-Dtiff=$(usex tiff true false)
# 	)
# 	meson_src_configure
# }
#
# ...
#
# @CODE

case ${EAPI:-0} in
	6) ;;
	*) die "EAPI=${EAPI} is not supported" ;;
esac

EXPORT_FUNCTIONS src_configure src_compile src_test src_install

if [[ -z ${_MESON_ECLASS} ]]; then
_MESON_ECLASS=1

	inherit ninja-utils

DEPEND=">=dev-util/meson-0.39.1
	>=dev-util/ninja-1.7.2"

# @ECLASS-VARIABLE: BUILD_DIR
# @DEFAULT_UNSET
# @DESCRIPTION:
# Build directory, location where all generated files should be placed.
# If this isn't set, it defaults to ${WORKDIR}/${P}-build.

# @ECLASS-VARIABLE: EMESON_SOURCE
# @DEFAULT_UNSET
# @DESCRIPTION:
# The location of the source files for the project;this is the source
# directory to pass to meson.
# If this isn't set, it defaults to ${S}

# @VARIABLE: emesonargs
# @DEFAULT_UNSET
# @DESCRIPTION:
# Optional meson arguments as Bash array; this should be defined before
# calling meson_src_configure.

# create a cross file for meson
# fixme: populate one instead of just touching it
# _meson_create_cross_file() {
#	http://mesonbuild.com/Cross-compilation.html
#	touch "${T}"/meson.crossfile
# }

# @FUNCTION: meson_src_configure
# @DESCRIPTION:
# this is the meson_src_configure function
meson_src_configure() {
	debug-print-function ${FUNCNAME} "$@"

	# Common args
	local mesonargs=(
		--buildtype plain
		--libdir "$(get_libdir)"
		--localstatedir "${EPREFIX}/var/lib"
		--prefix "${EPREFIX}"/usr
		--sysconfdir "${EPREFIX}/etc"
		)

#	if tc-is-cross-compiler; then
#		_meson_create_cross_file || die "unable to write meson cross file"
#		mesonargs+=(
#			--cross-file "${T}"/meson.crossfile
#		)
#	fi

	# Append additional arguments from ebuild
	mesonargs+=("${emesonargs[@]}")

	BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
	set -- meson "${mesonargs[@]}" "$@" \
		"${EMESON_SOURCE:-${S}}" "${BUILD_DIR}"
	echo "$@"
	"$@" || die
}

# @FUNCTION: meson_src_compile
# @DESCRIPTION:
# This is the meson_src_compile function.
meson_src_compile() {
	debug-print-function ${FUNCNAME} "$@"

	eninja -v -C "${BUILD_DIR}"
}

# @FUNCTION: meson_src_test
# @DESCRIPTION:
# this is the meson_src_test function.
meson_src_test() {
	debug-print-function ${FUNCNAME} "$@"

	eninja -v -C "${BUILD_DIR}" test
}

# @FUNCTION: meson_src_install
# @DESCRIPTION:
# this is the meson_src_install function.
meson_src_install() {
	debug-print-function ${FUNCNAME} "$@"

	DESTDIR="${D}" eninja -v -C "${BUILD_DIR}" install || die
}

fi

--zYM0uCDKw75PZbzx--

--p4qYPpj5QlsIQJ0K
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQTVeuxEZo4uUHOkQAluVBb0MMRlOAUCWQybyQAKCRBuVBb0MMRl
ODO1AKCG5Ii32Ct5Ybm3w/hemquKKYQ5bACfWyfCANUmwJo8VTYkaD67oehpuds=
=LM/5
-----END PGP SIGNATURE-----

--p4qYPpj5QlsIQJ0K--