[meta-java] llvm-config: Work around shebang max length issue

Submitted by Thilo Fromm on Jan. 30, 2012, 9:41 a.m. | Patch ID: 20295


Message ID 1327916482-16069-1-git-send-email-fromm@dresearch-fe.de
State Superseded, archived
Delegated to: Otavio Salvador
Headers show

Commit Message

Thilo Fromm Jan. 30, 2012, 9:41 a.m.
This patch works around a max shebang length issue
    in llvm's llvm-config.

    llvm-config is a perl script. meta-java configures
    the llvm sources to use OE's perl which might reside in
    a path longer than 127 chars. llvm's perl script
    will then have a shebang line longer than 127 characters.
    This will break the script.
    In linux, shebang interpreter paths are cut off after 127 bytes.

    meta-java's llvm recipe already wraps the perl script llvm-config
    with a small shell script. This patch adds an explicit perl
    interpreter call to this wrapping shell script.

Signed-off-by: Thilo Fromm <github@thilo-fromm.de>
 recipes-core/llvm/llvm-common.bb          |   12 ++++++++++++
 recipes-core/llvm/llvm-common/llvm-config |    2 +-
 2 files changed, 13 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/recipes-core/llvm/llvm-common.bb b/recipes-core/llvm/llvm-common.bb
index 38ca1ee..3db4af0 100644
--- a/recipes-core/llvm/llvm-common.bb
+++ b/recipes-core/llvm/llvm-common.bb
@@ -4,8 +4,20 @@  LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \
+# provide native perl binaries via PATH
+inherit perlnative
+DEPENDS += "perl-native"
 SRC_URI = "file://llvm-config"
+do_compile() {
+  cd ..
+  # This adds an explicit call to the interpreter in the wrapper script
+  #  so we don't run into shebang max size issues in the llvm-configX.X perl script
+  #  if the path to perl-native > 127 chars.
+  sed -i -e "s|@PATH_TO_PERL@|`which perl`|" llvm-config
 do_install() {
   install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
   install -m 0755 ${WORKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
diff --git a/recipes-core/llvm/llvm-common/llvm-config b/recipes-core/llvm/llvm-common/llvm-config
index a9a416d..08463e5 100644
--- a/recipes-core/llvm/llvm-common/llvm-config
+++ b/recipes-core/llvm/llvm-common/llvm-config
@@ -2,7 +2,7 @@ 
 # Wrapper script for real llvm-config. Simply calls
 if [ $WANT_LLVM_RELEASE ]; then
-	exec `dirname $0`/${TARGET_PREFIX}llvm-config$WANT_LLVM_RELEASE ${@}
+	exec "@PATH_TO_PERL@" `dirname $0`/${TARGET_PREFIX}llvm-config$WANT_LLVM_RELEASE ${@}
   echo "The variable WANT_LLVM_RELEASE is not defined and exported"
 	echo "by your build recipe. Go figure."


Thilo Fromm Jan. 31, 2012, 8:27 a.m.
Hello oe-devel-list,

>    This patch works around a max shebang length issue
>    in llvm's llvm-config.

Does really no one care about this? Well, we'll be maintaining a
.bbappend for llvm in our HidaV-Layer (https://github.com/DFE/HidaV)
for the time being.