build_style/python-module: simplify and fix an obvious error.

This commit is contained in:
Juan RP 2014-11-07 16:41:59 +01:00
parent 5b8378dc64
commit 518e78693e

View file

@ -4,54 +4,50 @@
do_build() { do_build() {
: ${python_versions:=2.7} : ${python_versions:=2.7}
local python_version= pysufx="m" local pyver= pysufx=
for python_version in $python_versions; do for pyver in $python_versions; do
if [ -n "$CROSS_BUILD" ]; then if [ -n "$CROSS_BUILD" ]; then
PYPREFIX="$XBPS_CROSS_BASE" PYPREFIX="$XBPS_CROSS_BASE"
if [ "$python_versions" = "2.7" ]; then if [ "$pyver" != "2.7" ]; then
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version} -I${XBPS_CROSS_BASE}/usr/include" pysufx=m
else
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version}${pysufx} -I${XBPS_CROSS_BASE}/usr/include"
fi fi
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${python_version} -L${XBPS_CROSS_BASE}/usr/lib" CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${pyver}${pysufx} -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" CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS" LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \ env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \ PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python${python_version} setup.py \ LDFLAGS="$LDFLAGS" python${pyver} setup.py \
build --build-base=build-$python_version ${make_build_args} build --build-base=build-${pyver} ${make_build_args}
else else
python${python_version} setup.py build --build-base=build-$python_version \ python${pyver} setup.py build --build-base=build-${pyver} ${make_build_args}
${make_build_args}
fi fi
done done
} }
do_install() { do_install() {
: ${python_versions:=2.7} : ${python_versions:=2.7}
local python_version= pysufx="m" local pyver= pysufx=
make_install_args+=" --prefix=/usr --root=$DESTDIR" make_install_args+=" --prefix=/usr --root=$DESTDIR"
for python_version in $python_versions; do for pyver in $python_versions; do
if [ -n "$CROSS_BUILD" ]; then if [ -n "$CROSS_BUILD" ]; then
PYPREFIX="$XBPS_CROSS_BASE" PYPREFIX="$XBPS_CROSS_BASE"
if [ "$python_versions" = "2.7" ]; then if [ "$pyver" != "2.7" ]; then
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version} -I${XBPS_CROSS_BASE}/usr/include" pysufx=m
else
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version}${pysufx} -I${XBPS_CROSS_BASE}/usr/include"
fi fi
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${python_version} -L${XBPS_CROSS_BASE}/usr/lib" CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${pyver}${pysufx} -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" CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS" LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \ env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \ PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python${python_version} setup.py \ LDFLAGS="$LDFLAGS" python${pyver} setup.py \
build --build-base=build-$python_version install ${make_install_args} build --build-base=build-${pyver} install ${make_install_args}
else else
python${python_version} setup.py build --build-base=build-$python_version install \ python${pyver} setup.py build --build-base=build-${pyver} install ${make_install_args}
${make_install_args}
fi fi
done done
} }