From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v2] scripts: add new script 'native'
Date: Fri, 30 Sep 2016 18:02:36 +0300 [thread overview]
Message-ID: <1475247756-32008-1-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <CABcZAN=WpicbLyg-sc=GDiMS81iwsGe1m+NE-fUfw2tniWpWXA@mail.gmail.com>
Added 'native' convenience shell script to run native tools.
Example of usage:
> bitbake bmap-tools-native
> native bmaptool --version
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/native | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100755 scripts/native
diff --git a/scripts/native b/scripts/native
new file mode 100755
index 0000000..496e34f
--- /dev/null
+++ b/scripts/native
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# Copyright (c) 2016, Intel Corporation.
+# All Rights Reserved
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>
+#
+
+#
+# This script is for running tools from native oe sysroot
+#
+
+if [ $# -lt 1 -o "$1" = '--help' -o "$1" = '-h' ] ; then
+ echo "Usage: $0 <native tool> [parameters]"
+ exit 1
+fi
+
+SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
+if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
+ echo "Error: Unable to find oe-find-native-sysroot script"
+ exit 1
+fi
+. $SYSROOT_SETUP_SCRIPT
+
+OLDPATH=$PATH
+
+# look for a tool only in native sysroot
+PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin
+tool=`/usr/bin/which $1 2>/dev/null`
+
+if [ -n "$tool" ] ; then
+ # add old path to allow usage of host tools
+ PATH=$PATH:$OLD_PATH $@
+else
+ echo "Error: Unable to find '$1' in native sysroot"
+ exit 1
+fi
--
2.1.4
next prev parent reply other threads:[~2016-09-30 15:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 9:55 [PATCH] scripts: add new script Ed Bartosh
2016-09-28 15:00 ` Christopher Larson
2016-09-30 15:02 ` Ed Bartosh [this message]
2016-10-02 14:15 ` [PATCH v2] scripts: add new script 'native' Jérémy Rosen
2016-10-02 14:30 ` Ulf Magnusson
2016-10-02 14:44 ` Ulf Magnusson
2016-10-02 19:37 ` Paul Eggleton
2016-10-04 16:22 ` Randy MacLeod
2016-10-06 3:02 ` Paul Eggleton
2016-10-06 3:20 ` Ulf Magnusson
2016-10-06 3:29 ` Paul Eggleton
2016-10-03 10:31 ` Ed Bartosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1475247756-32008-1-git-send-email-ed.bartosh@linux.intel.com \
--to=ed.bartosh@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox