]> code.ossystems Code Review - openembedded-core.git/commitdiff
perl-native: Add a perl-native wrapper in the normal bindir
authorTom Rini <tom_rini@mentor.com>
Tue, 19 Jul 2011 15:49:42 +0000 (08:49 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 21 Jul 2011 09:45:00 +0000 (10:45 +0100)
We need this to allow for scripts to do #!/usr/bin/env perl-native
and not require an 'inherit perlnative' per user of a package.

Signed-off-by: Tom Rini <tom_rini@mentor.com>
meta/recipes-devtools/perl/perl-native_5.12.3.bb

index 63f7e13e01e6b45f1ef44a747377b7884e0e82da..945ebd4ba1259f6121f0f15e8af3d07796348fa2 100644 (file)
@@ -4,7 +4,7 @@ SECTION = "libs"
 LICENSE = "Artistic|GPL"
 LIC_FILES_CHKSUM = "file://Copying;md5=2b4c6ffbcfcbdee469f02565f253d81a \
                    file://Artistic;md5=f921793d03cc6d63ec4b15e9be8fd3f8"
-PR = "r3"
+PR = "r4"
 
 LIC_FILES_CHKSUM = "file://Copying;md5=2b4c6ffbcfcbdee469f02565f253d81a \
                     file://Artistic;md5=f921793d03cc6d63ec4b15e9be8fd3f8"
@@ -102,3 +102,18 @@ do_install () {
        create_wrapper ${D}${bindir}/perl PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl/${PV}:${STAGING_LIBDIR}/perl/'
        create_wrapper ${D}${bindir}/perl${PV} PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl/${PV}:${STAGING_LIBDIR}/perl/'
 }
+
+SYSROOT_PREPROCESS_FUNCS += "perl_sysroot_create_wrapper"
+
+perl_sysroot_create_wrapper () {
+       mkdir -p ${SYSROOT_DESTDIR}${bindir}
+       # Create a wrapper that /usr/bin/env perl will use to get perl-native.
+       # This MUST live in the normal bindir.
+       cat > ${SYSROOT_DESTDIR}${bindir}/../nativeperl << EOF
+#!/bin/sh
+realpath=\`readlink -fn \$0\`
+exec \`dirname \$realpath\`/perl-native/perl "\$@"
+EOF
+       chmod 0755 ${SYSROOT_DESTDIR}${bindir}/../nativeperl
+       cat ${SYSROOT_DESTDIR}${bindir}/../nativeperl
+}