From: William Hubbs <williamh@gentoo.org>
To: gentoo development <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] meson.eclass third draft
Date: Fri, 5 May 2017 10:35:43 -0500 [thread overview]
Message-ID: <20170505153543.GA2377@linux1> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 369 bytes --]
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
[-- Attachment #1.2: meson.eclass --]
[-- Type: text/plain, Size: 2910 bytes --]
# 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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next reply other threads:[~2017-05-05 15:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-05 15:35 William Hubbs [this message]
2017-05-05 16:24 ` [gentoo-dev] meson.eclass third draft Mike Gilbert
2017-05-05 16:31 ` William Hubbs
2017-05-05 16:55 ` Michał Górny
2017-05-05 17:18 ` William L. Thomson Jr.
2017-05-05 18:05 ` William L. Thomson Jr.
2017-05-05 18:20 ` Erik Närström
2017-05-05 18:31 ` William L. Thomson Jr.
2017-05-05 18:55 ` Erik Närström
[not found] ` <20170505143117.13b54da3@o-sinc.com>
2017-05-05 18:38 ` [gentoo-dev] OT Copyright -> " William L. Thomson Jr.
2017-05-05 19:13 ` Erik Närström
2017-05-05 18:31 ` [gentoo-dev] " William L. Thomson Jr.
2017-05-21 1:07 ` William Hubbs
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=20170505153543.GA2377@linux1 \
--to=williamh@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