Skip to contentSkip to conversation

flex wrapper returns wrong version

PATCH Superseded Martin Jansa 2 participants 4 messages May 9, 2013 – May 10, 2013

lore
Share & tools
lore
#0 lore raw

Flex wrapper was added with:
commit d835488c526aa61163ade503c6586eaa59509a07

Author: Kevin Tian <[email protected]>
Date:   Wed Jan 5 10:26:36 2011 +0800

flex-native: create a wrapper script for sstate installation

flex-native encodes M4 staging path in its binary, which breaks sstate installation in a new build environment. Use create_wrapper to create a wrapper script which explicitly set M4 environmental variable to the new path

and --version returns basename $0 --version, so in my case:
sysroots/x86_64-linux/usr/bin/flex --version flex.real 2.5.35

Which isn't parsed correctly e.g. in newer webkit

|   Could NOT find FLEX: Found unsuitable version "flex.real 2.5.35", but
|   required is at least "2.5.34" (found
|   /OE/shr-core/tmp-eglibc/sysroots/x86_64-linux/usr/bin/flex)

we can probably work around it by changing regexp in /sysroots/x86_64-linux/usr/share/cmake-2.8/Modules/FindFLEX.cmake

but it would be nice to fix it in flex.

Cheers,

#1 lore raw

PATCH 1/1 flex: fix reported executable name caused by OE wrapper

---
 meta/recipes-devtools/flex/flex.inc                 | 15 ++++++++++++++-
 .../flex/flex/drop.suffix.from.wrapper.patch        | 21 +++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/flex/flex/drop.suffix.from.wrapper.patch
meta/recipes-devtools/flex/flex.inc +14 -1
index 517db16..344b716 100644
@@ -6,10 +6,23 @@ HOMEPAGE = "http://sourceforge.net/projects/flex/"
 SECTION = "devel"
 LICENSE = "BSD"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 "
+SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 \
+           file://drop.suffix.from.wrapper.patch \
+"
 
 inherit autotools gettext
 
+# drop building doc, there is openembedded-core/scripts/help2man
+# but that just returns exit 1 and flex.1 is immediately removed:
+# openembedded-core/scripts/help2man --name='the fast lexical analyser generator' \
+# --section=`echo $i | sed -e 's/.*\.\([^.]*\)$/\1/'` \
+#  ../flex > $i || rm -f $i ; \
+# and do_install fails, it wasn't failing before, because flex.1 included in
+# release tarbal was valid until we patched main.c in drop.suffix.from.wrapper.patch
+do_configure_prepend() {
+	sed -i "/^\s*doc /d" Makefile.am
+}
+
 M4 = "${bindir}/m4"
 M4_class-native = "${STAGING_BINDIR_NATIVE}/m4"
 
meta/recipes-devtools/flex/flex/drop.suffix.from.wrapper.patch new file +21 -0
new file mode 100644
index 0000000..9bbd088
@@ -0,0 +1,21 @@
+Upstream probably doesn't expect wrappers like we create for flex.
+
+This also fixes disabled C_plus_plus functions in flex++ if we ever create wrapper for flex++.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Martin Jansa <[email protected]>
+
+--- flex-2.5.35/main.c.orig	2013-05-09 15:19:34.619281743 +0200
++++ flex-2.5.35/main.c	2013-05-09 15:19:10.216280868 +0200
+@@ -984,6 +984,10 @@
+ 	/* Enable C++ if program name ends with '+'. */
+ 	program_name = basename2 (argv[0], 0);
+ 
++	/* Drop trailing .real suffix if it's there */
++	if (strstr(program_name, ".real") != NULL && strstr(program_name, ".real") - program_name == strlen(program_name) - 5)
++	    program_name[strlen (program_name) - 5] = '\0';
++
+ 	if (program_name[0] != '\0' &&
+ 	    program_name[strlen (program_name) - 1] == '+')
+ 		C_plus_plus = true;
Signature · 1 line
1.8.2.1
#2 lore raw

Re: [PATCH] flex: fix reported executable name caused by OE wrapper

Quoted 21 lines · Martin Jansa
---
  meta/recipes-devtools/flex/flex.inc                 | 15 ++++++++++++++-
  .../flex/flex/drop.suffix.from.wrapper.patch        | 21 +++++++++++++++++++++
  2 files changed, 35 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-devtools/flex/flex/drop.suffix.from.wrapper.patch

meta/recipes-devtools/flex/flex.inc +3 -1
index 517db16..344b716 100644
@@ -6,10 +6,23 @@ HOMEPAGE = "http://sourceforge.net/projects/flex/"
  SECTION = "devel"
  LICENSE = "BSD"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 "
+SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 \
+           file://drop.suffix.from.wrapper.patch \
+"
 
  inherit autotools gettext

meta/recipes-devtools/flex/flex.inc HOMEPAGE = "http://sourceforge.net/projects/flex/" · line 23

Quoted 10 lines
meta/recipes-devtools/flex/flex.inc +9 -0
 
+# drop building doc, there is openembedded-core/scripts/help2man
+# but that just returns exit 1 and flex.1 is immediately removed:
+# openembedded-core/scripts/help2man --name='the fast lexical analyser generator' \
+# --section=`echo $i | sed -e 's/.*\.\([^.]*\)$/\1/'` \
+#  ../flex > $i || rm -f $i ; \
+# and do_install fails, it wasn't failing before, because flex.1 included in
+# release tarbal was valid until we patched main.c in drop.suffix.from.wrapper.patch
+do_configure_prepend() {
+	sed -i "/^\s*doc /d" Makefile.am

I think this needs a ${S} in front of the Makefile.am otherwise it's not found since we are doing the configure in ${B}

Thanks
Sau!

Quoted 33 lines
meta/recipes-devtools/flex/flex.inc +2 -0
+}
+
  M4 = "${bindir}/m4"
  M4_class-native = "${STAGING_BINDIR_NATIVE}/m4"
 
meta/recipes-devtools/flex/flex/drop.suffix.from.wrapper.patch new file +21 -0
new file mode 100644
index 0000000..9bbd088
@@ -0,0 +1,21 @@
+Upstream probably doesn't expect wrappers like we create for flex.
+
+This also fixes disabled C_plus_plus functions in flex++ if we ever create wrapper for flex++.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Martin Jansa <[email protected]>
+
+--- flex-2.5.35/main.c.orig	2013-05-09 15:19:34.619281743 +0200
++++ flex-2.5.35/main.c	2013-05-09 15:19:10.216280868 +0200
+@@ -984,6 +984,10 @@
+ 	/* Enable C++ if program name ends with '+'. */
+ 	program_name = basename2 (argv[0], 0);
+
++	/* Drop trailing .real suffix if it's there */
++	if (strstr(program_name, ".real") != NULL && strstr(program_name, ".real") - program_name == strlen(program_name) - 5)
++	    program_name[strlen (program_name) - 5] = '\0';
++
+ 	if (program_name[0] != '\0' &&
+ 	    program_name[strlen (program_name) - 1] == '+')
+ 		C_plus_plus = true;
#3 lore raw

PATCH v2 1/1 flex: fix reported executable name caused by OE wrapper

---
 meta/recipes-devtools/flex/flex.inc                 | 15 ++++++++++++++-
 .../flex/flex/drop.suffix.from.wrapper.patch        | 21 +++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/flex/flex/drop.suffix.from.wrapper.patch
meta/recipes-devtools/flex/flex.inc +14 -1
index 517db16..02a66cf 100644
@@ -6,10 +6,23 @@ HOMEPAGE = "http://sourceforge.net/projects/flex/"
 SECTION = "devel"
 LICENSE = "BSD"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 "
+SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 \
+           file://drop.suffix.from.wrapper.patch \
+"
 
 inherit autotools gettext
 
+# drop building doc, there is openembedded-core/scripts/help2man
+# but that just returns exit 1 and flex.1 is immediately removed:
+# openembedded-core/scripts/help2man --name='the fast lexical analyser generator' \
+# --section=`echo $i | sed -e 's/.*\.\([^.]*\)$/\1/'` \
+#  ../flex > $i || rm -f $i ; \
+# and do_install fails, it wasn't failing before, because flex.1 included in
+# release tarbal was valid until we patched main.c in drop.suffix.from.wrapper.patch
+do_configure_prepend() {
+	sed -i "/^\s*doc /d" ${S}/Makefile.am
+}
+
 M4 = "${bindir}/m4"
 M4_class-native = "${STAGING_BINDIR_NATIVE}/m4"
 
meta/recipes-devtools/flex/flex/drop.suffix.from.wrapper.patch new file +21 -0
new file mode 100644
index 0000000..9bbd088
@@ -0,0 +1,21 @@
+Upstream probably doesn't expect wrappers like we create for flex.
+
+This also fixes disabled C_plus_plus functions in flex++ if we ever create wrapper for flex++.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Martin Jansa <[email protected]>
+
+--- flex-2.5.35/main.c.orig	2013-05-09 15:19:34.619281743 +0200
++++ flex-2.5.35/main.c	2013-05-09 15:19:10.216280868 +0200
+@@ -984,6 +984,10 @@
+ 	/* Enable C++ if program name ends with '+'. */
+ 	program_name = basename2 (argv[0], 0);
+ 
++	/* Drop trailing .real suffix if it's there */
++	if (strstr(program_name, ".real") != NULL && strstr(program_name, ".real") - program_name == strlen(program_name) - 5)
++	    program_name[strlen (program_name) - 5] = '\0';
++
+ 	if (program_name[0] != '\0' &&
+ 	    program_name[strlen (program_name) - 1] == '+')
+ 		C_plus_plus = true;
Signature · 1 line
1.8.2.1