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

Submitted by Thilo Fromm on Jan. 30, 2012, 9:10 a.m.

Details

Message ID CADZ6=asn5Tq6adpuysW229BYXDu3ExUVNDWEZtzpjyAUv9PHgQ@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Thilo Fromm Jan. 30, 2012, 9:10 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(-)

 	echo "by your build recipe. Go figure."

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 ${@}
 else
   echo "The variable WANT_LLVM_RELEASE is not defined and exported"

Comments

Thilo Fromm Jan. 30, 2012, 1:09 p.m.
Hello *.*,

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

Sorry guys, I garbled the patch in the first submission. I already
changed the first submission's patch state to "not applicable" in
patchwork and resent it. Just want to make sure no one tries to apply
my first submission to this issue. Patchwork already has the sane
diff.

Some feedback on the patch would be great.

Regards,
Thilo
Henning Heinold Jan. 31, 2012, 5:02 p.m.
On Mon, Jan 30, 2012 at 02:09:40PM +0100, Thilo Fromm wrote:
> Hello *.*,
> 
> > This patch works around a max shebang length issue
> > in llvm's llvm-config.
> >
> 
> Sorry guys, I garbled the patch in the first submission. I already
> changed the first submission's patch state to "not applicable" in
> patchwork and resent it. Just want to make sure no one tries to apply
> my first submission to this issue. Patchwork already has the sane
> diff.
> 
> Some feedback on the patch would be great.
> 
> Regards,
> Thilo

Hi Thilo,

I am a bit short of time at the moment. So I can not test or apply your patch.
For the longer term llvm should go to core.

Bye Henning
Thilo Fromm Feb. 1, 2012, 8:26 a.m.
Hello Henning,

>> > This patch works around a max shebang length issue
>> > in llvm's llvm-config.
>>
>> Some feedback on the patch would be great.
>>
>
> I am a bit short of time at the moment. So I can not test or apply your patch.
> For the longer term llvm should go to core.
>

Okay. We'll maintain this patch in our HidaV layer (which is
https://github.com/DFE/HidaV) for the time being.

Regards,
Thilo
Henning Heinold Feb. 1, 2012, 12:57 p.m.
On Wed, Feb 01, 2012 at 09:26:23AM +0100, Thilo Fromm wrote:
> Hello Henning,
> 
> >> > This patch works around a max shebang length issue
> >> > in llvm's llvm-config.
> >>
> >> Some feedback on the patch would be great.
> >>
> >
> > I am a bit short of time at the moment. So I can not test or apply your patch.
> > For the longer term llvm should go to core.
> >
> 
> Okay. We'll maintain this patch in our HidaV layer (which is
> https://github.com/DFE/HidaV) for the time being.
> 
> Regards,
> Thilo

btw. you can make a pull request.

Bye Henning
Thilo Fromm Feb. 2, 2012, 9:07 a.m.
Hallo Henning,

>> >> > This patch works around a max shebang length issue
>> >> > in llvm's llvm-config.
>> >>
>> >> Some feedback on the patch would be great.
>> >
>> > I am a bit short of time at the moment. So I can not test or apply your patch.
>> > For the longer term llvm should go to core.
>>
>> Okay. We'll maintain this patch in our HidaV layer (which is
>> https://github.com/DFE/HidaV) for the time being.
>
> btw. you can make a pull request.
>

Wouldn't work - we use a .bbappend to meta-java's original llvm-config
recipe. It's not hard to re-integrate into the original recipe, but a
pull alone would not do.

Regards,
Thilo