meson: ensure out-of-tree build when under externalsrc/devtool

Submitted by Chris Laplante via lists.openembedded.org on Oct. 7, 2020, 4:45 p.m. | Patch ID: 177039

Details

Message ID 20201007164534.123373-1-chris.laplante@agilent.com
State New
Headers show

Commit Message

Avoids the error:
| ERROR: Source and build directories must not be the same. Create a pristine build directory.

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 meta/classes/meson.bbclass | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 83aa854b7e..1b4b244018 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -6,6 +6,9 @@  DEPENDS_append = " meson-native ninja-native"
 B = "${WORKDIR}/build"
 do_configure[cleandirs] = "${B}"
 
+CLASSOVERRIDE .= ":class-meson"
+EXTERNALSRC_BUILD_class-meson = "${WORKDIR}/build"
+
 # Where the meson.build build configuration is
 MESON_SOURCEPATH = "${S}"
 

Comments

Joshua Watt Oct. 7, 2020, 7:41 p.m.
On 10/7/20 11:45 AM, Chris Laplante via lists.openembedded.org wrote:
> Avoids the error:
> | ERROR: Source and build directories must not be the same. Create a pristine build directory.
>
> Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
> ---
>   meta/classes/meson.bbclass | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
> index 83aa854b7e..1b4b244018 100644
> --- a/meta/classes/meson.bbclass
> +++ b/meta/classes/meson.bbclass
> @@ -6,6 +6,9 @@ DEPENDS_append = " meson-native ninja-native"
>   B = "${WORKDIR}/build"
>   do_configure[cleandirs] = "${B}"
>   
> +CLASSOVERRIDE .= ":class-meson"
> +EXTERNALSRC_BUILD_class-meson = "${WORKDIR}/build"
> +
Why is devtool telling the recipe to do an in-tree build? It seems like 
it should be consistent with externalsrc.bbclass, which works fine for 
meson because it always does an out-of-tree build. FWIW, this would 
*also* be a problem when using waf.bbclass, but I suspect no one cares 
too much about that :)
>   # Where the meson.build build configuration is
>   MESON_SOURCEPATH = "${S}"
>   
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#143095): https://lists.openembedded.org/g/openembedded-core/message/143095
Mute This Topic: https://lists.openembedded.org/mt/77366190/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
> +CLASSOVERRIDE .= ":class-meson"

> +EXTERNALSRC_BUILD_class-meson = "${WORKDIR}/build"

> +

> Why is devtool telling the recipe to do an in-tree build? It seems like it should

> be consistent with externalsrc.bbclass, which works fine for meson because

> it always does an out-of-tree build. FWIW, this would *also* be a problem

> when using waf.bbclass, but I suspect no one cares too much about that :)


I have no idea why devtool does it (in general), but it does (see poky/scripts/lib/devtool/__init__.py, the "use_external_build" method). Granted I'm using zeus, but my experience is not the same as yours so far - my meson recipe tries to build in the source directory. 

Chris
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#143136): https://lists.openembedded.org/g/openembedded-core/message/143136
Mute This Topic: https://lists.openembedded.org/mt/77366190/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
Joshua Watt Oct. 8, 2020, 5:28 p.m.
On Thu, Oct 8, 2020 at 12:22 PM chris.laplante@agilent.com
<chris.laplante@agilent.com> wrote:
>
> > +CLASSOVERRIDE .= ":class-meson"
> > +EXTERNALSRC_BUILD_class-meson = "${WORKDIR}/build"
> > +
> > Why is devtool telling the recipe to do an in-tree build? It seems like it should
> > be consistent with externalsrc.bbclass, which works fine for meson because
> > it always does an out-of-tree build. FWIW, this would *also* be a problem
> > when using waf.bbclass, but I suspect no one cares too much about that :)
>
> I have no idea why devtool does it (in general), but it does (see poky/scripts/lib/devtool/__init__.py, the "use_external_build" method). Granted I'm using zeus, but my experience is not the same as yours so far - my meson recipe tries to build in the source directory.

Ah, sorry. I wasn't quite clear in what I was asking :) Yes, what you
are seeing is the expected behavior because devotol is setting
EXTERNALSRC_BUILD for the recipe. My question is why devtool is doing
that at all? The default behavior in externalsrc.bbclass (and thus,
what you would get if devtool *didn't* set EXTERNALSRC_BUILD), is to
force an out of tree build by setting B to a subdirectory of
${WORKDIR}. It seems more and more like out-of-tree builds are the
norm, so instead of changing everywhere (waf, meson, et al.) to work
around devtool doing an in-tree build, can we remove devtool setting
EXTERNALSRC_BUILD so that it defaults to an out-of-tree build?

>
> Chris
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#143137): https://lists.openembedded.org/g/openembedded-core/message/143137
Mute This Topic: https://lists.openembedded.org/mt/77366190/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
> > I have no idea why devtool does it (in general), but it does (see

> poky/scripts/lib/devtool/__init__.py, the "use_external_build" method).

> Granted I'm using zeus, but my experience is not the same as yours so far -

> my meson recipe tries to build in the source directory.

> 

> Ah, sorry. I wasn't quite clear in what I was asking :) Yes, what you are seeing

> is the expected behavior because devotol is setting EXTERNALSRC_BUILD for

> the recipe. My question is why devtool is doing that at all? The default

> behavior in externalsrc.bbclass (and thus, what you would get if devtool

> *didn't* set EXTERNALSRC_BUILD), is to force an out of tree build by setting

> B to a subdirectory of ${WORKDIR}. It seems more and more like out-of-tree

> builds are the norm, so instead of changing everywhere (waf, meson, et al.)

> to work around devtool doing an in-tree build, can we remove devtool

> setting EXTERNALSRC_BUILD so that it defaults to an out-of-tree build?


No problem, I understand now :). Yes, I'd certainly be in favor of defaulting to out-of-tree builds. I'll pull Paul in here to see if he has any objections. 

Chris
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#143139): https://lists.openembedded.org/g/openembedded-core/message/143139
Mute This Topic: https://lists.openembedded.org/mt/77366190/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-