python3-config.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env bash
  2. # Windows Python3 configuration script
  3. #
  4. # As per comment regarding --with-python in gdb/configure.ac, this script
  5. # follows the interface of gdb/python/python-config.py but return path
  6. # related to Windows Python3.
  7. set -o errexit # Exit if command failed.
  8. set -o pipefail # Exit if pipe failed.
  9. set -o nounset # Exit if variable not set.
  10. if [ ! -d "${SOURCES_FOLDER_PATH}/${PYTHON3_SRC_FOLDER_NAME}" ]
  11. then
  12. exit 1
  13. fi
  14. if [ ! -d "${SOURCES_FOLDER_PATH}/${PYTHON3_WIN_EMBED_FOLDER_NAME}" ]
  15. then
  16. exit 1
  17. fi
  18. while [ $# -ge 1 ]
  19. do
  20. opt="$1"
  21. case ${opt} in
  22. --prefix|--exec-prefix)
  23. prefix="${SOURCES_FOLDER_PATH}/${PYTHON3_WIN_EMBED_FOLDER_NAME}"
  24. echo "${opt} -> [${prefix}]" >&2
  25. echo "${prefix}"
  26. ;;
  27. --includes|--cflags)
  28. cflags="-I${SOURCES_FOLDER_PATH}/${PYTHON3_SRC_FOLDER_NAME}/Include"
  29. if [ "${opt}" == "--cflags" ]
  30. then
  31. cflags+=" ${CFLAGS}"
  32. fi
  33. echo "${opt} -> [${cflags}]" >&2
  34. echo "${cflags}"
  35. ;;
  36. --libs|--ldflags)
  37. # Options to link to static libpython2.7 archive so as to avoid an
  38. # external dependency on python
  39. libs="-L${SOURCES_FOLDER_PATH}/${PYTHON3_WIN_EMBED_FOLDER_NAME} -lpython37"
  40. echo "${opt} -> [${libs}]" >&2
  41. echo "${libs}"
  42. ;;
  43. --*)
  44. echo "Unknown option: ${opt}" >&2
  45. exit 1
  46. ;;
  47. *)
  48. # Ignore non options since we are called with gdb provided
  49. # python-config.py as first parameter
  50. ;;
  51. esac
  52. shift
  53. done
  54. exit 0