perl-native: Add a perl-native wrapper in the normal bindir

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.

(From OE-Core rev: 48c1e10f53894e666283aac086e61444d2c1ed69)

Signed-off-by: Tom Rini <tom_rini@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tom Rini 2011-07-19 08:49:42 -07:00 committed by Richard Purdie
parent 57f771164d
commit 27ba6fbda8
1 changed files with 16 additions and 1 deletions

View 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
}