017-python-config-include-libdir.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From 50f34d2cac63b6bf0935294a7d63d9451714f4c4 Mon Sep 17 00:00:00 2001
  2. From: Peter Korsgaard <peter@korsgaard.com>
  3. Date: Thu, 20 Nov 2014 13:24:59 +0100
  4. Subject: [PATCH] Misc/python-config.sh.in: ensure sed invocations only match
  5. beginning of strings
  6. The build/real prefix handling using sed breaks if build != real and the
  7. standard include / lib directories are used ($prefix/include and $prefix/lib).
  8. E.G.
  9. prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include".
  10. If this gets installed with make DESTDIR="/foo" install, then we end up with
  11. prefix_real = prefix = "/foo/usr" as expected, but
  12. includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of
  13. the double sed invocation (prefix is already expanded). Work around it by
  14. ensuring we only match the beginning of the string.
  15. Submitted upstream: http://bugs.python.org/issue22907
  16. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  17. ---
  18. Misc/python-config.sh.in | 12 ++++++------
  19. 1 file changed, 6 insertions(+), 6 deletions(-)
  20. Index: b/Misc/python-config.sh.in
  21. ===================================================================
  22. --- a/Misc/python-config.sh.in
  23. +++ b/Misc/python-config.sh.in
  24. @@ -29,12 +29,12 @@
  25. # Use sed to fix paths from their built-to locations to their installed-to
  26. # locations.
  27. -prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
  28. +prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#")
  29. exec_prefix_build="@exec_prefix@"
  30. -exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#")
  31. -includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#")
  32. -libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#")
  33. -CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
  34. +exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#")
  35. +includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
  36. +libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#")
  37. +CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#")
  38. VERSION="@VERSION@"
  39. LIBM="@LIBM@"
  40. LIBC="@LIBC@"
  41. @@ -48,7 +48,7 @@
  42. PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
  43. LDVERSION="@LDVERSION@"
  44. LIBDEST=${prefix}/lib/python${VERSION}
  45. -LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#")
  46. +LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#")
  47. SO="@SO@"
  48. PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
  49. INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"