summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-04-19 15:08:23 +0100
committerPavel Labath <labath@google.com>2018-04-19 15:11:13 +0100
commit25526c1ce59dddaa0985310dbc29368c6510a17a (patch)
tree7d009d3a5cc726552af4f76368f8b5444f9fda69
parentc4434d41b38b49a1433ec2955cd926f00a1d219a (diff)
downloadlldb-utils-25526c1ce59dddaa0985310dbc29368c6510a17a.tar.gz
Add lldb wrapper script which sets PYTHONHOME correctly
This renames lldb executable to lldb.real and installs a shell script as "lldb". The shell script sets up PYTHONHOME such that we use the python installation we built lldb with and then invokes the real lldb executable. Change-Id: I2cdbcb504c549689dfa40b1b9c51ee474cfdde2f Bug: 76097225
-rwxr-xr-xbuild-posix.sh3
-rwxr-xr-xscripts/lldb.sh22
2 files changed, 25 insertions, 0 deletions
diff --git a/build-posix.sh b/build-posix.sh
index 77848a7..6a81d2f 100755
--- a/build-posix.sh
+++ b/build-posix.sh
@@ -42,6 +42,9 @@ if [ "$OS" == linux ]; then
cp -a "$PREBUILTS/libedit/linux-x86/lib/"libedit.so* "$INSTALL/host/lib/"
cp -a "$TOOLCHAIN/sysroot/usr/lib/"libtinfo.so* "$INSTALL/host/lib/"
cp -a "$PYTHON_DIR/lib/"{libpython2.7.so*,python2.7} "$INSTALL/host/lib/"
+
+ mv "$INSTALL/host/bin/lldb" "$INSTALL/host/bin/lldb.real"
+ cp -a "$LLDB_UTILS/scripts/lldb.sh" "$INSTALL/host/bin/lldb"
else
cp -a "$PREBUILTS/clang/host/$OS-x86/clang-$CLANG_VERSION/lib64/libc++.dylib" "$INSTALL/host/lib"
cp -a "$BUILD/lib/"liblldb.*dylib "$INSTALL/host/lib/"
diff --git a/scripts/lldb.sh b/scripts/lldb.sh
new file mode 100755
index 0000000..feba17b
--- /dev/null
+++ b/scripts/lldb.sh
@@ -0,0 +1,22 @@
+#! /bin/sh
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# lldb wrapper which sets the PYTHONHOME environment variable correctly
+
+dir=$(CDPATH= cd "$(dirname "$0")/.." && pwd)
+export PYTHONHOME=$dir
+exec "$0.real" "$@"