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() {
: ${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
PYPREFIX="$XBPS_CROSS_BASE"
if [ "$python_versions" = "2.7" ]; then
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version} -I${XBPS_CROSS_BASE}/usr/include"
else
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version}${pysufx} -I${XBPS_CROSS_BASE}/usr/include"
if [ "$pyver" != "2.7" ]; then
pysufx=m
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"
LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python${python_version} setup.py \
build --build-base=build-$python_version ${make_build_args}
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
build --build-base=build-${pyver} ${make_build_args}
else
python${python_version} setup.py build --build-base=build-$python_version \
${make_build_args}
python${pyver} setup.py build --build-base=build-${pyver} ${make_build_args}
fi
done
}
do_install() {
: ${python_versions:=2.7}
local python_version= pysufx="m"
local pyver= pysufx=
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
PYPREFIX="$XBPS_CROSS_BASE"
if [ "$python_versions" = "2.7" ]; then
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version} -I${XBPS_CROSS_BASE}/usr/include"
else
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version}${pysufx} -I${XBPS_CROSS_BASE}/usr/include"
if [ "$pyver" != "2.7" ]; then
pysufx=m
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"
LDSHARED="${CC} -shared $LDFLAGS"
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" python${python_version} setup.py \
build --build-base=build-$python_version install ${make_install_args}
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
build --build-base=build-${pyver} install ${make_install_args}
else
python${python_version} setup.py build --build-base=build-$python_version install \
${make_install_args}
python${pyver} setup.py build --build-base=build-${pyver} install ${make_install_args}
fi
done
}