84d584ea0d
This commit adds a new option BR2_PACKAGE_GDB_PYTHON to enable Python support in the target gdb. Since we can assume that the user will be aware that Python is needed to get Python support in gdb, we chose to use a "depends on" dependency instead of a "select" dependency. The other weird thing is the need for a wrapper shell script to replace gdb's provided python-config.py script. See the shell script comment itself for all the details. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
37 lines
925 B
Bash
Executable File
37 lines
925 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# This shell script is used to fake Python. Gdb wants to be passed a
|
|
# Python interpreter, to run its own python-config.py program, which
|
|
# uses sysconfig. However, when cross-compiling, this doesn't work
|
|
# well since we would have to use the host Python, whose sysconfig
|
|
# module would return host values.
|
|
#
|
|
# As recommended at
|
|
# https://sourceware.org/gdb/wiki/CrossCompilingWithPythonSupport,
|
|
# this wrapper shell script can be used as a replacement. It ignores
|
|
# the python-config.py script passed as first arguments, and
|
|
# "emulates" its behavior.
|
|
|
|
if [ $# -ne 2 ] ; then
|
|
echo "Bad # args." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# The first argument is the path to python-config.py, ignore it.
|
|
|
|
case "$2" in
|
|
--includes)
|
|
echo "-I${STAGING_DIR}/usr/include/python2.7"
|
|
;;
|
|
--ldflags)
|
|
echo "-lpthread -ldl -lutil -lm -lpython2.7"
|
|
;;
|
|
--exec-prefix)
|
|
echo "/usr"
|
|
;;
|
|
*)
|
|
echo "Bad arg $2." >&2
|
|
exit 1
|
|
;;
|
|
esac
|