package/gdb: do not hard-code python version in gdb-python-config

The gdb-python-config simulates a python-2.7, with a hard-coded 2.7
version.

gdb also supports running with python3 nowadays, so prepare the wrapper
to return appropriate values.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Yann E. MORIN 2020-12-31 10:53:11 +01:00 committed by Thomas Petazzoni
parent 7fe40110e8
commit 8f6e333f96
2 changed files with 10 additions and 2 deletions

View File

@ -17,14 +17,19 @@ if [ $# -ne 2 ] ; then
exit 1
fi
if [ -z "${BR_PYTHON_VERSION}" ]; then
echo "Environment variable BR_PYTHON_VERSION not set." >&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"
echo "-I${STAGING_DIR}/usr/include/python${BR_PYTHON_VERSION}"
;;
--ldflags)
echo "-lpthread -ldl -lutil -lm -lpython2.7"
echo "-lpthread -ldl -lutil -lm -lpython${BR_PYTHON_VERSION}"
;;
--exec-prefix)
echo "/usr"

View File

@ -194,6 +194,9 @@ GDB_CONF_OPTS += --disable-tui
endif
ifeq ($(BR2_PACKAGE_GDB_PYTHON),y)
# CONF_ENV: for top-level configure; MAKE_ENV: for sub-projects' configure.
GDB_CONF_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR)
GDB_MAKE_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR)
GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config
GDB_DEPENDENCIES += python
else