build-style/python[3]-module: override _PYTHON_SYSCONFIGDATA_NAME

Use the sysconfigdata for the appropriate cross arch.
Upstream change: https://bugs.python.org/issue36235
This commit is contained in:
Leah Neukirchen 2019-12-23 17:14:02 +01:00
parent 69e7262005
commit d3968bef3c
2 changed files with 34 additions and 2 deletions

View File

@ -10,13 +10,23 @@ do_build() {
if [ -n "$CROSS_BUILD" ]; then
CFLAGS="$tmp_cflags"
LDFLAGS="$tmp_ldflags"
ADDENV=
PYPREFIX="$XBPS_CROSS_BASE"
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${pyver} -I${XBPS_CROSS_BASE}/usr/include"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${pyver} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \
case $pyver in
3.*)
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
f=${f##*/}
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
done
ADDENV+=" PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib}"
ADDENV+=" _PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME""
esac
env CC="$CC" LDSHARED="$LDSHARED" $ADDENV \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
build --build-base=build-${pyver} ${make_build_args}
@ -50,12 +60,22 @@ do_install() {
for pyver in $python_versions; do
if [ -n "$CROSS_BUILD" ]; then
ADDENV=
PYPREFIX="$XBPS_CROSS_BASE"
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${pyver} -I${XBPS_CROSS_BASE}/usr/include"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${pyver} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \
case $pyver in
3.*)
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
f=${f##*/}
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
done
ADDENV+=" PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib}"
ADDENV+=" _PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME""
esac
env CC="$CC" LDSHARED="$LDSHARED" $ADDENV \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
build --build-base=build-${pyver} \

View File

@ -9,8 +9,14 @@ do_build() {
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
f=${f##*/}
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
done
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib} \
_PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME" \
LDFLAGS="$LDFLAGS" python3 setup.py build ${make_build_args}
else
python3 setup.py build ${make_build_args}
@ -36,8 +42,14 @@ do_install() {
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
f=${f##*/}
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
done
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib} \
_PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME" \
LDFLAGS="$LDFLAGS" python3 setup.py \
install --prefix=/usr --root=${DESTDIR} ${make_install_args}
else