diff options
-rw-r--r-- | meta/classes/utils.bbclass | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index 549e4b82f5..fe75f73a77 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -264,10 +264,17 @@ create_cmdline_wrapper () { mv $cmd $cmd.real cmdname=`basename $cmd` + dirname=`dirname $cmd` + cmdoptions=$@ + if [ "${base_prefix}" != "" ]; then + relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"` + cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"` + fi cat <<END >$cmd #!/bin/bash realpath=\`readlink -fn \$0\` -exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $@ "\$@" +realdir=\`dirname \$realpath\` +exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $cmdoptions "\$@" END chmod +x $cmd } @@ -287,10 +294,17 @@ create_wrapper () { mv $cmd $cmd.real cmdname=`basename $cmd` + dirname=`dirname $cmd` + exportstring=$@ + if [ "${base_prefix}" != "" ]; then + relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"` + exportstring=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"` + fi cat <<END >$cmd #!/bin/bash realpath=\`readlink -fn \$0\` -export $@ +realdir=\`dirname \$realpath\` +export $exportstring exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real "\$@" END chmod +x $cmd |