mod_wsgi: cross compile

This commit is contained in:
Đoàn Trần Công Danh 2020-05-22 07:04:22 +07:00
parent 3bd05a3834
commit dcb2cfb4af
2 changed files with 134 additions and 3 deletions

View File

@ -0,0 +1,107 @@
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}

View File

@ -3,8 +3,8 @@ pkgname=mod_wsgi
version=4.6.5
revision=2
build_style=gnu-configure
hostmakedepends="python"
makedepends="apache-devel python-devel"
hostmakedepends="python perl automake libtool"
makedepends="apache-devel python-devel apr-devel"
short_desc="Python WSGI adapter module for Apache"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
@ -13,4 +13,28 @@ changelog="https://modwsgi.readthedocs.io/en/latest/release-notes/version-${vers
distfiles="https://github.com/GrahamDumpleton/${pkgname}/archive/${version}.tar.gz"
checksum=5cbe05f8b9b21a9e40d5d7226f4976643b1ee5e23a2d114bceae34d9948be5e0
lib32disabled=yes
nocross=yes
pre_configure() {
if [ "$CROSS_BUILD" ]; then
cp -a ${XBPS_CROSS_BASE}/usr/bin/apxs ${wrksrc}
cp -a ${XBPS_CROSS_BASE}/usr/share/apache/webroot/build/config_vars.mk ${wrksrc}
# Use the modified apxs
configure_args+=" --with-apxs=${wrksrc}/apxs"
configure_args+=" --with-python=$XBPS_WRAPPERDIR/python"
configure_args+=" PYTHON_VERSION=2.7 PYTHON_LDVERSION=2.7"
# Use the ${wrksrc}/config_vars.mk
vsed -i apxs \
-e "/config_vars[.]mk/s;[$]installbuilddir;${wrksrc};g" \
-e "s;[$]installbuilddir/instdso[.]sh;$XBPS_CROSS_BASE/&;g" \
# Use apr-1-config and apu-1-config wrappers
vsed -i config_vars.mk \
-e "/^APR_CONFIG/ s;=.*;= ${XBPS_WRAPPERDIR}/apr-1-config;" \
-e "/^APU_CONFIG/ s;=.*;= ${XBPS_WRAPPERDIR}/apu-1-config;" \
-e "/^includedir/ s;=.*;= $XBPS_CROSS_BASE/usr/include/httpd;" \
-e "s;\([I ]\)/usr/include;\1$XBPS_CROSS_BASE/usr/include;g"
fi
autoreconf -fi
}