python2: make a python-config-u.sh

.. which returns Unixy/MSYS2 paths rather than Windows-y ones.
This is so that GDB detects and defines PYTHON_PATH_RELOCATABLE.
This commit is contained in:
Ray Donnelly
2014-04-28 21:02:40 +01:00
parent fff4d79a0e
commit e8915b7977
2 changed files with 51 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2014-02-18 09:32:21.949400000 +0400
+++ b/configure.ac 2014-02-18 09:32:40.092200000 +0400
diff -urN a/configure.ac b/configure.ac
--- a/configure.ac 2014-04-28 11:20:12.678807400 +0000
+++ b/configure.ac 2014-04-28 17:37:05.595077900 +0000
@@ -912,6 +912,7 @@
# Other platforms follow
@@ -27,39 +27,47 @@ diff -Naur a/configure.ac b/configure.ac
if test "$cross_compiling" = yes; then
RUNSHARED=
@@ -4777,7 +4782,7 @@
@@ -4777,7 +4782,13 @@
AC_MSG_RESULT(done)
# generate output files
-AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
+AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh)
+
+AM_CONDITIONAL([MACHDEP_WIN32], [test "x$MACHDEP" = "xwin32"])
+AM_COND_IF([MACHDEP_WIN32],
+ [AC_CONFIG_FILES(Misc/python-config-u.sh)],
+ [])
+
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
AC_OUTPUT
diff -Naur a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in 2014-02-18 09:32:13.853000000 +0400
+++ b/Makefile.pre.in 2014-02-18 09:32:40.092200000 +0400
@@ -1057,6 +1057,8 @@
diff -urN a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in 2014-04-28 11:20:15.317807400 +0000
+++ b/Makefile.pre.in 2014-04-28 17:57:07.877077900 +0000
@@ -1057,6 +1057,9 @@
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
+ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
+ sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python-config.sh >python-config.sh
+ -sed -e "s,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g" < Misc/python-config-u.sh >python-config-u.sh
# Install the include files
INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
@@ -1115,6 +1117,7 @@
@@ -1115,6 +1118,8 @@
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
+ $(INSTALL_SCRIPT) python-config.sh $(DESTDIR)$(BINDIR)/python-config.sh
+ -test -f python-config-u.sh && $(INSTALL_SCRIPT) python-config-u.sh $(DESTDIR)$(BINDIR)/python-config-u.sh
rm python-config
@if [ -s Modules/python.exp -a \
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
diff -Naur a/Misc/python-config.sh.in b/Misc/python-config.sh.in
--- a/Misc/python-config.sh.in 1970-01-01 03:00:00.000000000 +0300
+++ b/Misc/python-config.sh.in 2014-02-18 09:32:40.092200000 +0400
@@ -0,0 +1,121 @@
diff -urN a/Misc/python-config.sh.in b/Misc/python-config.sh.in
--- a/Misc/python-config.sh.in 1970-01-01 00:00:00.000000000 +0000
+++ b/Misc/python-config.sh.in 2014-04-28 17:26:00.488077900 +0000
@@ -0,0 +1,127 @@
+#!/usr/bin/env sh
+
+exit_with_usage ()
@@ -150,23 +158,27 @@ diff -Naur a/Misc/python-config.sh.in b/Misc/python-config.sh.in
+ esac
+done
+
+RESULT=
+for ARG in $*
+do
+ if [ ! -z "$RESULT" ]; then
+ RESULT=$RESULT" "
+ fi
+ case $ARG in
+ --prefix)
+ echo -ne "$prefix "
+ RESULT=$RESULT"$prefix"
+ ;;
+ --exec-prefix)
+ echo -ne "$exec_prefix "
+ RESULT=$RESULT"$exec_prefix"
+ ;;
+ --includes)
+ echo -ne "$INCDIR "
+ RESULT=$RESULT"$INCDIR"
+ ;;
+ --cflags)
+ echo -ne "$INCDIR $BASECFLAGS $CFLAGS $OPT "
+ RESULT=$RESULT"$INCDIR $BASECFLAGS $CFLAGS $OPT"
+ ;;
+ --libs)
+ echo -ne "$LIBS "
+ RESULT=$RESULT"$LIBS"
+ ;;
+ --ldflags)
+ LINKFORSHAREDUSED=
@@ -174,10 +186,26 @@ diff -Naur a/Misc/python-config.sh.in b/Misc/python-config.sh.in
+ LINKFORSHAREDUSED=$LINKFORSHARED
+ fi
+ LIBPLUSED=
+ if [ "$PY_ENABLE_SHARED" = "0" -o -n "$(DLLLIBRARY)" ] ; then
+ if [ "$PY_ENABLE_SHARED" = "0" -o -n "${DLLLIBRARY}" ] ; then
+ LIBPLUSED="-L$LIBPL"
+ fi
+ echo -ne "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED "
+ RESULT=$RESULT"$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED"
+ ;;
+esac
+done
+echo -ne $RESULT
+
diff -urN a/Misc/python-config-u.sh.in b/Misc/python-config-u.sh.in
--- a/Misc/python-config-u.sh.in 1970-01-01 00:00:00.000000000 +0000
+++ b/Misc/python-config-u.sh.in 2014-04-28 17:42:58.258077900 +0000
@@ -0,0 +1,10 @@
+#!/usr/bin/env sh
+
+THISDIR="$(dirname $0)"
+test "$THISDIR" = "." && THISDIR=${PWD}
+
+RESULT=$("${THISDIR}"/python-config.sh "$@")
+
+exec_prefix_win=$("${THISDIR}"/python-config.sh --exec-prefix)
+exec_prefix_unix=@prefix@
+echo $(echo $RESULT | sed "s#${exec_prefix_win}#${exec_prefix_unix}#g")