gdb-python-config 925 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. # This shell script is used to fake Python. Gdb wants to be passed a
  3. # Python interpreter, to run its own python-config.py program, which
  4. # uses sysconfig. However, when cross-compiling, this doesn't work
  5. # well since we would have to use the host Python, whose sysconfig
  6. # module would return host values.
  7. #
  8. # As recommended at
  9. # https://sourceware.org/gdb/wiki/CrossCompilingWithPythonSupport,
  10. # this wrapper shell script can be used as a replacement. It ignores
  11. # the python-config.py script passed as first arguments, and
  12. # "emulates" its behavior.
  13. if [ $# -ne 2 ] ; then
  14. echo "Bad # args." >&2
  15. exit 1
  16. fi
  17. # The first argument is the path to python-config.py, ignore it.
  18. case "$2" in
  19. --includes)
  20. echo "-I${STAGING_DIR}/usr/include/python2.7"
  21. ;;
  22. --ldflags)
  23. echo "-lpthread -ldl -lutil -lm -lpython2.7"
  24. ;;
  25. --exec-prefix)
  26. echo "/usr"
  27. ;;
  28. *)
  29. echo "Bad arg $2." >&2
  30. exit 1
  31. ;;
  32. esac