Patchwork [1/1] flex: fix m4 issue on target

login
register
mail settings
Submitter Laurentiu Palcu
Date Nov. 5, 2013, 2:58 p.m.
Message ID <f61f1d9fc224cc017996769e23b08d0af13f3722.1383663447.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/61163/
State New
Headers show

Comments

Laurentiu Palcu - Nov. 5, 2013, 2:58 p.m.
Flex needs m4 to run (see below) and, since the create_wrapper
introduces a bash dependency, export the right m4 path when /etc/profile
is sourced by the shell.

Snippet from the flex documentation:
"The macro processor m4 must be installed wherever flex is installed.
<...>
m4 is only required at the time you run flex."

[YOCTO #5329]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/recipes-devtools/flex/flex.inc |    7 +++++++
 1 file changed, 7 insertions(+)
Enrico Scholz - Nov. 5, 2013, 4:16 p.m.
Laurentiu Palcu
<laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> writes:

> Flex needs m4 to run (see below) and, since the create_wrapper
> introduces a bash dependency, export the right m4 path when /etc/profile
> is sourced by the shell.
>
> Snippet from the flex documentation:
> "The macro processor m4 must be installed wherever flex is installed.
> <...>
> m4 is only required at the time you run flex."

Content at profile.d/ won't be evaluated when program is started without
a shell (e.g. by 'execlp("flex", "flex", ...)').  


> [YOCTO #5329]

This should be solved by defining a correct path for the m4 binary at
build time.

EXTRA_OECONF += " ac_cv_path_M4=${M4}"
EXTRA_OEMAKE += " m4=${M4_class-native}"

is probably a better solution.



Enrico
Laurentiu Palcu - Nov. 6, 2013, 10:39 a.m.
Hi Enrico,

On Tue, Nov 05, 2013 at 05:16:45PM +0100, Enrico Scholz wrote:
> 
> 
> Laurentiu Palcu
> <laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> writes:
> 
> > Flex needs m4 to run (see below) and, since the create_wrapper
> > introduces a bash dependency, export the right m4 path when /etc/profile
> > is sourced by the shell.
> >
> > Snippet from the flex documentation:
> > "The macro processor m4 must be installed wherever flex is installed.
> > <...>
> > m4 is only required at the time you run flex."
> 
> Content at profile.d/ won't be evaluated when program is started without
> a shell (e.g. by 'execlp("flex", "flex", ...)').  
> 
> 
> > [YOCTO #5329]
> 
> This should be solved by defining a correct path for the m4 binary at
> build time.
> 
> EXTRA_OECONF += " ac_cv_path_M4=${M4}"
> EXTRA_OEMAKE += " m4=${M4_class-native}"
This is, indeed, a better solution for the target issue. But, I don't
think we can remove the wrapper scripts for native/nativesdk packages
(as you suggested in bugzilla). And the reason for that are those guys
using sstate from build machines. They'll end up with flex searching for
m4 in a path belonging to the build machine.

I'll prepare a v2.

Laurentiu
> 
> is probably a better solution.
> 
> 
> 
> Enrico
>

Patch

diff --git a/meta/recipes-devtools/flex/flex.inc b/meta/recipes-devtools/flex/flex.inc
index 43f1dda..eed2908 100644
--- a/meta/recipes-devtools/flex/flex.inc
+++ b/meta/recipes-devtools/flex/flex.inc
@@ -13,6 +13,11 @@  inherit autotools gettext
 M4 = "${bindir}/m4"
 M4_class-native = "${STAGING_BINDIR_NATIVE}/m4"
 
+do_install_append_class-target() {
+	install -d ${D}${sysconfdir}/profile.d
+	echo "export M4=${M4}" > ${D}${sysconfdir}/profile.d/flex.sh
+}
+
 do_install_append_class-native() {
 	create_wrapper ${D}/${bindir}/flex M4=${M4}
 }
@@ -20,3 +25,5 @@  do_install_append_class-native() {
 do_install_append_class-nativesdk() {
 	create_wrapper ${D}/${bindir}/flex M4=${M4}
 }
+
+RDEPENDS_${PN} += "m4"