* [gentoo-dev] meson.eclass second draft
@ 2017-05-04 23:48 William Hubbs
2017-05-05 1:36 ` [gentoo-dev] " Jonathan Callen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: William Hubbs @ 2017-05-04 23:48 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1: Type: text/plain, Size: 286 bytes --]
All,
here is meson.eclass after the changes from the first posting.
Mgorny, I don't quite understand your question about the install command:
DESTDIR="${ED}" eninja -v -c install
I think it is ok, I don't think DESTDIR= has any bearing on EPREFIX.
Here's the attachment.
William
[-- Attachment #1.2: meson.eclass --]
[-- Type: text/plain, Size: 2869 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 toolchain-funcs
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() {
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="${ED}" eninja -v -C "${BUILD_DIR}" install || die
}
fi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gentoo-dev] Re: meson.eclass second draft
2017-05-04 23:48 [gentoo-dev] meson.eclass second draft William Hubbs
@ 2017-05-05 1:36 ` Jonathan Callen
2017-05-05 1:50 ` Jonathan Callen
2017-05-05 6:27 ` [gentoo-dev] " Mart Raudsepp
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Callen @ 2017-05-05 1:36 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1: Type: text/plain, Size: 1071 bytes --]
On 05/04/2017 07:48 PM, William Hubbs wrote:
> All,
>
> here is meson.eclass after the changes from the first posting.
>
> Mgorny, I don't quite understand your question about the install command:
>
> DESTDIR="${ED}" eninja -v -c install
>
> I think it is ok, I don't think DESTDIR= has any bearing on EPREFIX.
>
> Here's the attachment.
>
> William
>
You need to set DESTDIR="${D}" when you pass --prefix="${EPREFIX}"/usr
(or equivalent), otherwise, you will install files to
${EPREFIX}/${EPREFIX}/usr. As Prefix expects files in ${EPREFIX}/usr,
etc., this will cause issues on all Prefix systems (specifically,
Portage will error out if it detects any file installed into $D that is
outside of $ED or the directory $ED/$EPREFIX existing at all (when
$EPREFIX != "")).
The only time that it is generally appropriate to set DESTDIR="${ED}" is
when dealing with broken build systems that force a prefix of exactly
"/usr" and don't allow the user to change it (or even force files into
"/bin", "/etc", etc.).
--
Jonathan Callen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 862 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gentoo-dev] Re: meson.eclass second draft
2017-05-04 23:48 [gentoo-dev] meson.eclass second draft William Hubbs
2017-05-05 1:36 ` [gentoo-dev] " Jonathan Callen
@ 2017-05-05 1:50 ` Jonathan Callen
2017-05-05 6:27 ` [gentoo-dev] " Mart Raudsepp
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Callen @ 2017-05-05 1:50 UTC (permalink / raw
To: Gentoo Dev
[-- Attachment #1.1: Type: text/plain, Size: 1140 bytes --]
On 05/04/2017 07:48 PM, William Hubbs wrote:
> All,
>
> here is meson.eclass after the changes from the first posting.
>
> Mgorny, I don't quite understand your question about the install command:
>
> DESTDIR="${ED}" eninja -v -c install
>
> I think it is ok, I don't think DESTDIR= has any bearing on EPREFIX.
>
> Here's the attachment.
>
> William
>
You need to set DESTDIR="${D}" when you pass --prefix="${EPREFIX}"/usr
(or equivalent), otherwise, you will install files to
${EPREFIX}/${EPREFIX}/usr. As Prefix expects files in ${EPREFIX}/usr,
etc., this will cause issues on all Prefix systems (specifically,
Portage will error out if it detects any file installed into $D that is
outside of $ED or the directory $ED/$EPREFIX existing at all (when
$EPREFIX != "")).
The only time that it is generally appropriate to set DESTDIR="${ED}" is
when dealing with broken build systems that force a prefix of exactly
"/usr" and don't allow the user to change it (or even force files into
"/bin", "/etc", etc.).
[Resent because it appears the first message didn't get through.]
--
Jonathan Callen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-dev] meson.eclass second draft
2017-05-04 23:48 [gentoo-dev] meson.eclass second draft William Hubbs
2017-05-05 1:36 ` [gentoo-dev] " Jonathan Callen
2017-05-05 1:50 ` Jonathan Callen
@ 2017-05-05 6:27 ` Mart Raudsepp
2 siblings, 0 replies; 4+ messages in thread
From: Mart Raudsepp @ 2017-05-05 6:27 UTC (permalink / raw
To: gentoo-dev
Ühel kenal päeval, N, 04.05.2017 kell 18:48, kirjutas William Hubbs:
> if tc-is-cross-compiler; then
> _meson_create_cross_file || die "unable to write
> meson cross file"
> mesonargs+=(
> --cross-file "${T}"/meson.crossfile
> )
> fi
I'm not sure we should bother with such code in the eclass when the
_meson_create_cross_file doesn't do anything useful yet.
Of course once that functionality is added, we can see in this draft
how it'd be hooked up, but I don't see a reason to put it into the tree
with this near no-op.
And until this is no-op and not really functional when put into the
tree, we shouldn't encourage porting non-9999 versions to use meson
instead of an old build system (if still present), if the old one does
support more seamless cross-compilation via e.g crossdev. This is
important for things like udev probably, but less so for end-user
applications in the GNOME stack for example and many of those could
probably start using meson.eclass without the cross-file functionality
hooked in yet (or design a new iteration of gnome2.eclass on top of
it).
Mart
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-05 6:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-04 23:48 [gentoo-dev] meson.eclass second draft William Hubbs
2017-05-05 1:36 ` [gentoo-dev] " Jonathan Callen
2017-05-05 1:50 ` Jonathan Callen
2017-05-05 6:27 ` [gentoo-dev] " Mart Raudsepp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox