Skip to contentSkip to conversation

flex/bison: Don't hardcode M4 path

PATCH In review Colin Walters 3 participants 4 messages Jan 3, 2012 – Jan 4, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flex/bison: Don't hardcode M4 path

The flex and bison configure scripts use AC_PATH_PROG to get a full path to m4 and embed this in config.h (and then to the generated binary), but this blows up when the m4 binary is in a temporary staging directory.

Since we are always shipping GNU m4, just set M4=m4 at configure time so we don't use a hardcoded path.

This is an equivalent to what already exists in autoconf.bb.

From d33924d0de58e25bce73e5b4d61983fe0c1d0119 Mon Sep 17 00:00:00 2001
From: Colin Walters <[email protected]>
Date: Tue, 3 Jan 2012 18:47:32 -0500
Subject: [PATCH] flex/bison: Don't hardcode M4 path

The flex and bison configure scripts use AC_PATH_PROG to get a full path to m4 and embed this in config.h (and then to the generated binary), but this blows up when the m4 binary is in a temporary staging directory.

Since we are always shipping GNU m4, just set M4=m4 at configure time so we don't use a hardcoded path.

This is an equivalent to what already exists in autoconf.bb.

---
 meta/recipes-devtools/bison/bison_2.5.bb |   10 ++++------
 meta/recipes-devtools/flex/flex.inc      |    7 ++++---
 2 files changed, 8 insertions(+), 9 deletions(-)
meta/recipes-devtools/bison/bison_2.5.bb +4 -6
index c5113cd..0536dd4 100644
@@ -21,16 +21,14 @@ SRC_URI = "${BASE_SRC_URI} \
 SRC_URI[md5sum] = "687e1dcd29452789d34eaeea4c25abe4"
 SRC_URI[sha256sum] = "722def46e4a19a5b7a579ef30db1965f86c37c1a20a5f0113743a2e4399f7c99"
 
+# We don't want to hardcode the m4 path since it will be found
+# in the staging directory.
+EXTRA_OECONF = " M4=m4"
+
 DEPENDS_virtclass-native = "gettext-minimal-native"
 SRC_URI_virtclass-native = "${BASE_SRC_URI}"
 
 inherit autotools gettext
 acpaths = "-I ${S}/m4"
 
-do_install_append_virtclass-native() {
-	create_wrapper ${D}/${bindir}/bison \
-		M4=${STAGING_BINDIR_NATIVE}/m4 \
-		BISON_PKGDATADIR=${STAGING_DATADIR_NATIVE}/bison
-}
-#bison-native encodes the staging M4 path
 BBCLASSEXTEND = "native"
meta/recipes-devtools/flex/flex.inc +4 -3
index 01f7571..a913d21 100644
@@ -10,6 +10,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 "
 
 inherit autotools gettext
 
-do_install_append_virtclass-native() {
-	create_wrapper ${D}/${bindir}/flex M4=${STAGING_BINDIR_NATIVE}/m4
-}
+# We don't want to hardcode the m4 path since it will be found
+# in the staging directory.
+EXTRA_OECONF = " M4=m4"
+
Signature · 1 line
1.7.6.4
#1 lore raw
Quoted 11 lines

The flex and bison configure scripts use AC_PATH_PROG to get a full path to m4 and embed this in config.h (and then to the generated binary), but this blows up when the m4 binary is in a temporary staging directory.

Since we are always shipping GNU m4, just set M4=m4 at configure time so we don't use a hardcoded path.

This is an equivalent to what already exists in autoconf.bb.

This should really be posted to [email protected].

Sau!

Quoted 35 lines

0001-flex-bison-Don-t-hardcode-M4-path.patch

Quoted 1 line

From d33924d0de58e25bce73e5b4d61983fe0c1d0119 Mon Sep 17 00:00:00 2001

From: Colin Walters <[email protected]>
Date: Tue, 3 Jan 2012 18:47:32 -0500
Subject: [PATCH] flex/bison: Don't hardcode M4 path

The flex and bison configure scripts use AC_PATH_PROG to get a full path to m4 and embed this in config.h (and then to the generated binary), but this blows up when the m4 binary is in a temporary staging directory.

Since we are always shipping GNU m4, just set M4=m4 at configure time so we don't use a hardcoded path.

This is an equivalent to what already exists in autoconf.bb.

---
 meta/recipes-devtools/bison/bison_2.5.bb |   10 ++++------
 meta/recipes-devtools/flex/flex.inc      |    7 ++++---
 2 files changed, 8 insertions(+), 9 deletions(-)
meta/recipes-devtools/bison/bison_2.5.bb +4 -0
index c5113cd..0536dd4 100644
@@ -21,16 +21,14 @@ SRC_URI = "${BASE_SRC_URI} \
 SRC_URI[md5sum] = "687e1dcd29452789d34eaeea4c25abe4"
 SRC_URI[sha256sum] = "722def46e4a19a5b7a579ef30db1965f86c37c1a20a5f0113743a2e4399f7c99"
 
+# We don't want to hardcode the m4 path since it will be found
+# in the staging directory.
+EXTRA_OECONF = " M4=m4"
+
 DEPENDS_virtclass-native = "gettext-minimal-native"

meta/recipes-devtools/bison/bison_2.5.bb SRC_URI = "${BASE_SRC_URI} \ · line 34

Quoted 10 lines
meta/recipes-devtools/bison/bison_2.5.bb +0 -5
 SRC_URI_virtclass-native = "${BASE_SRC_URI}"
 
 inherit autotools gettext
 acpaths = "-I ${S}/m4"
 
-do_install_append_virtclass-native() {
-	create_wrapper ${D}/${bindir}/bison \
-		M4=${STAGING_BINDIR_NATIVE}/m4 \
-		BISON_PKGDATADIR=${STAGING_DATADIR_NATIVE}/bison
-}

Don't you loose the setting of BISON_PKGDATADIR in this case? Does that need to be poart of the EXTRA_OECONF?

Sau!

Quoted 26 lines
meta/recipes-devtools/bison/bison_2.5.bb +0 -1
-#bison-native encodes the staging M4 path
 BBCLASSEXTEND = "native"
meta/recipes-devtools/flex/flex.inc +4 -4
index 01f7571..a913d21 100644
@@ -10,6 +10,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 "
 
 inherit autotools gettext
 
-do_install_append_virtclass-native() {
-	create_wrapper ${D}/${bindir}/flex M4=${STAGING_BINDIR_NATIVE}/m4
-}
+# We don't want to hardcode the m4 path since it will be found
+# in the staging directory.
+EXTRA_OECONF = " M4=m4"
+
-- 1.7.6.4

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

#2 lore raw
Quoted 5 lines · Saul Wold
Quoted 5 lines

The flex and bison configure scripts use AC_PATH_PROG to get a full path to m4 and embed this in config.h (and then to the generated binary), but this blows up when the m4 binary is in a temporary staging directory.

Quoted 7 lines
Quoted 6 lines

Since we are always shipping GNU m4, just set M4=m4 at configure time so we don't use a hardcoded path.

This is an equivalent to what already exists in autoconf.bb.

This should really be posted to [email protected].

I CC'd, hopefully won't be rejected as I'm not yet a subscriber.

Quoted 2 lines

Don't you loose the setting of BISON_PKGDATADIR in this case? Does that need to be poart of the EXTRA_OECONF?

Good catch - I'll double check, but I doubt it's necessary. From the bison source:

char const *
compute_pkgdatadir (void)
{
char const *pkgdatadir = getenv ("BISON_PKGDATADIR"); return pkgdatadir ? pkgdatadir : PKGDATADIR;
}

For us though PKGDATADIR should be enough I think.

#3 lore raw
Quoted 22 lines · Colin Walters
Quoted 5 lines · Saul Wold
Quoted 5 lines

The flex and bison configure scripts use AC_PATH_PROG to get a full path to m4 and embed this in config.h (and then to the generated binary), but this blows up when the m4 binary is in a temporary staging directory.

Quoted 7 lines
Quoted 6 lines

Since we are always shipping GNU m4, just set M4=m4 at configure time so we don't use a hardcoded path.

This is an equivalent to what already exists in autoconf.bb.

This should really be posted to [email protected].

I CC'd, hopefully won't be rejected as I'm not yet a subscriber.

Quoted 2 lines

Don't you loose the setting of BISON_PKGDATADIR in this case? Does that need to be poart of the EXTRA_OECONF?

Good catch - I'll double check, but I doubt it's necessary. From the bison source:

Quoted 8 lines

char const *
compute_pkgdatadir (void)
{
char const *pkgdatadir = getenv ("BISON_PKGDATADIR"); return pkgdatadir ? pkgdatadir : PKGDATADIR;
}

For us though PKGDATADIR should be enough I think.

For on target device development, yes. For use in bison-native, its not enough unfortunately as it gets added into the sstate packages and those may end up installed at a different location.

I like the idea of simplifying looking for m4 though.

Cheers,

Richard