Patchwork [3/3] automake-nativesdk: fix builds on fedora 17

login
register
mail settings
Submitter Robert Yang
Date April 16, 2012, 1:38 p.m.
Message ID <3f7359690123356107fdc1a60f664a11bb54debb.1334583221.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/25937/
State Accepted
Commit ee7a86c06c2289f01aa5f1da958ce51523495572
Headers show

Comments

Robert Yang - April 16, 2012, 1:38 p.m.
Generally distros keep perl at /sur/bin/perl
Fedora 17 also has /bin/perl

this causes automake-nativesdk build on such distros to put perl
interpreter path in the perl scripts as /bin/perl

But we set perl location for target as /usr/bin/perl

This mismatch of perl path causes failure of rootfs image creation
like this:

| error: Failed dependencies:
|       /bin/perl is needed by automake-nativesdk-1.11.2-r2.x86_64
NOTE: package meta-toolchain-gmae-1.0-r7: task do_populate_sdk: Failed

The second sed command is for such a case:

eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; esac'

This line has two "/bin/perl" and we can't use a line number to tell
sed which line it is since the line numbers in different files are
defferent.

[YOCTO #2304]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/recipes-devtools/automake/automake_1.11.2.bb |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/recipes-devtools/automake/automake_1.11.2.bb b/meta/recipes-devtools/automake/automake_1.11.2.bb
index 4271336..66589fe 100644
--- a/meta/recipes-devtools/automake/automake_1.11.2.bb
+++ b/meta/recipes-devtools/automake/automake_1.11.2.bb
@@ -34,19 +34,33 @@  PATHFIXPATCH = "file://path_prog_fixes.patch"
 PATHFIXPATCH_virtclass-native = ""
 PATHFIXPATCH_virtclass-nativesdk = ""
 
+PERLPATH = "${bindir}/perl"
+PERLPATH_virtclass-native = "/usr/bin/perl"
+PERLPATH_virtclass-nativesdk = "/usr/bin/perl"
+
 SRC_URI += "${PATHFIXPATCH} \
 	    file://prefer-cpio-over-pax-for-ustar-archives.patch \
 	    file://python-libdir.patch \
             file://automake_1.11.2_fix_for_pkglibexec_SCRIPTS.patch \
             file://py-compile-compile-only-optimized-byte-code.patch"
 
-PR = "r2"
+PR = "r3"
 SRC_URI[md5sum] = "18194e804d415767bae8f703c963d456"
 SRC_URI[sha256sum] = "4f46d1f9380c8a3506280750f630e9fc915cb1a435b724be56b499d016368718"
 
 do_install () {
-	oe_runmake 'DESTDIR=${D}' install
-	install -d ${D}${datadir}
+    oe_runmake 'DESTDIR=${D}' install
+    install -d ${D}${datadir}
+
+    # Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
+    # for target as /usr/bin/perl, so fix it to /usr/bin/perl.
+    for i in aclocal aclocal-1.11 automake automake-1.11; do
+        if [ -f ${D}${bindir}/$i ]; then
+            sed -i -e '1s,#!.*perl,#! ${PERLPATH},' \
+            -e 's,exec .*/bin/perl \(.*\) exec .*/bin/perl \(.*\),exec ${PERLPATH} \1 exec ${PERLPATH} \2,' \
+            ${D}${bindir}/$i
+        fi
+    done
 }
 
 BBCLASSEXTEND = "native nativesdk"