void-packages/srcpkgs/mod_wsgi/patches/cross-python.patch
Đoàn Trần Công Danh dcb2cfb4af mod_wsgi: cross compile
2020-05-22 13:23:09 +07:00

107 lines
3.9 KiB
Diff

diff --git configure.ac configure.ac
index 63d1bbc..543ecc0 100644
--- configure.ac
+++ configure.ac
@@ -100,26 +100,25 @@ fi
AC_SUBST(PYTHON)
-PYTHON_VERSION=`${PYTHON} -c 'from sys import stdout; \
+if test x"${PYTHON_VERSION}" = x""; then
+ PYTHON_VERSION=`${PYTHON} -c 'from sys import stdout; \
from distutils import sysconfig; \
stdout.write(sysconfig.get_config_var("VERSION"))'`
+fi
-PYTHON_LDVERSION=`${PYTHON} -c 'from sys import stdout; \
+if test x"${PYTHON_LDVERSION}" = x""; then
+ PYTHON_LDVERSION=`${PYTHON} -c 'from sys import stdout; \
from distutils import sysconfig; \
stdout.write(sysconfig.get_config_var("LDVERSION") or "")'`
+fi
if test x"${PYTHON_LDVERSION}" = x""; then
PYTHON_LDVERSION=${PYTHON_VERSION}
fi
-CPPFLAGS1=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write("-I" + sysconfig.get_config_var("INCLUDEPY"))'`
+CPPFLAGS1=$($PYTHON-config --includes)
-CPPFLAGS2=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(" ".join(filter(lambda x: x.startswith("-D"), \
- sysconfig.get_config_var("CFLAGS").split())))'`
+CPPFLAGS2=$($PYTHON-config --cflags | tr ' \t' '\n\n' | grep '^-D' | tr '\n' ' ')
if test "${ENABLE_EMBEDDED}" != "yes"; then
CPPFLAGS3="-DMOD_WSGI_DISABLE_EMBEDDED"
@@ -131,66 +130,7 @@ CPPFLAGS="${CPPFLAGS} ${CPPFLAGS1} ${CPPFLAGS2} ${CPPFLAGS3}"
AC_SUBST(CPPFLAGS)
-PYTHONLIBDIR=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var("LIBDIR"))'`
-PYTHONCFGDIR=`${PYTHON} -c 'from sys import stdout; \
- import distutils.sysconfig; \
- stdout.write(distutils.sysconfig.get_python_lib(plat_specific=1, \
- standard_lib=1) +"/config")'`
-PYTHONFRAMEWORKDIR=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKDIR"))'`
-PYTHONFRAMEWORKPREFIX=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKPREFIX"))'`
-PYTHONFRAMEWORK=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORK"))'`
-
-if test "${PYTHON_LDVERSION}" != "${PYTHON_VERSION}"; then
- PYTHONCFGDIR="${PYTHONCFGDIR}-${PYTHON_LDVERSION}"
-fi
-
-if test "${PYTHONFRAMEWORKDIR}" = "no-framework" -o \
- "${ENABLE_FRAMEWORK}" != "yes"; then
- LDFLAGS1="-L${PYTHONLIBDIR}"
- LDFLAGS2="-L${PYTHONCFGDIR}"
-
- LDLIBS1="-lpython${PYTHON_LDVERSION}"
-
- # MacOS X seems to be broken and doesn't use ABIFLAGS suffix
- # so add a check to try and work out what we need to do.
-
- if test -f "${PYTHONLIBDIR}/libpython${PYTHON_VERSION}.a"; then
- LDLIBS1="-lpython${PYTHON_VERSION}"
- fi
-
- if test -f "${PYTHONCFGDIR}/libpython${PYTHON_VERSION}.a"; then
- LDLIBS1="-lpython${PYTHON_VERSION}"
- fi
-
- LDLIBS2=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var("LIBS"))'`
- LDLIBS3=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var("SYSLIBS"))'`
-else
- LDFLAGS1="-Wl,-F${PYTHONFRAMEWORKPREFIX} -framework ${PYTHONFRAMEWORK}"
-
- VERSION="${PYTHON_VERSION}"
- STRING="${PYTHONFRAMEWORKDIR}/Versions/${VERSION}/${PYTHONFRAMEWORK}"
- LDFLAGS2=`${PYTHON} -c "from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var(
- \"LINKFORSHARED\").replace(\"${STRING}\", ''))" | \
- sed -e 's/-Wl,-stack_size,[[0-9]]*//'`
-
- LDLIBS1=`${PYTHON} -c 'from sys import stdout; \
- from distutils import sysconfig; \
- stdout.write(sysconfig.get_config_var("LIBS"))'`
-fi
+PYTHONLIBDIR=$($PYTHON-config --ldflags)
CFLAGS1=""
for arg in ${CFLAGS}