2014-01-07 16:29:49 +00:00
|
|
|
#
|
|
|
|
# This helper is for templates installing python modules.
|
|
|
|
#
|
|
|
|
|
|
|
|
do_build() {
|
2014-05-06 08:40:53 +00:00
|
|
|
: ${python_versions:=2.7}
|
2014-11-07 15:41:59 +00:00
|
|
|
local pyver= pysufx=
|
2014-05-01 14:05:28 +00:00
|
|
|
|
2014-11-07 15:41:59 +00:00
|
|
|
for pyver in $python_versions; do
|
2014-05-01 14:05:28 +00:00
|
|
|
if [ -n "$CROSS_BUILD" ]; then
|
|
|
|
PYPREFIX="$XBPS_CROSS_BASE"
|
2014-11-07 15:41:59 +00:00
|
|
|
if [ "$pyver" != "2.7" ]; then
|
|
|
|
pysufx=m
|
2014-11-07 15:33:00 +00:00
|
|
|
fi
|
2014-11-07 15:41:59 +00:00
|
|
|
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"
|
2014-05-01 14:05:28 +00:00
|
|
|
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
|
|
|
|
LDSHARED="${CC} -shared $LDFLAGS"
|
|
|
|
env CC="$CC" LDSHARED="$LDSHARED" \
|
|
|
|
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
|
2014-11-07 15:41:59 +00:00
|
|
|
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
|
|
|
|
build --build-base=build-${pyver} ${make_build_args}
|
2014-05-01 14:05:28 +00:00
|
|
|
else
|
2014-11-07 15:41:59 +00:00
|
|
|
python${pyver} setup.py build --build-base=build-${pyver} ${make_build_args}
|
2014-05-01 14:05:28 +00:00
|
|
|
fi
|
|
|
|
done
|
2014-01-07 16:29:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
2014-05-06 08:40:53 +00:00
|
|
|
: ${python_versions:=2.7}
|
2014-11-07 15:41:59 +00:00
|
|
|
local pyver= pysufx=
|
2014-05-01 14:05:28 +00:00
|
|
|
|
2014-01-07 16:29:49 +00:00
|
|
|
make_install_args+=" --prefix=/usr --root=$DESTDIR"
|
|
|
|
|
2014-11-07 15:41:59 +00:00
|
|
|
for pyver in $python_versions; do
|
2014-05-01 14:05:28 +00:00
|
|
|
if [ -n "$CROSS_BUILD" ]; then
|
|
|
|
PYPREFIX="$XBPS_CROSS_BASE"
|
2014-11-07 15:41:59 +00:00
|
|
|
if [ "$pyver" != "2.7" ]; then
|
|
|
|
pysufx=m
|
2014-11-07 15:33:00 +00:00
|
|
|
fi
|
2014-11-07 15:41:59 +00:00
|
|
|
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"
|
2014-05-01 14:05:28 +00:00
|
|
|
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
|
|
|
|
LDSHARED="${CC} -shared $LDFLAGS"
|
|
|
|
env CC="$CC" LDSHARED="$LDSHARED" \
|
|
|
|
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
|
2014-11-07 15:41:59 +00:00
|
|
|
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
|
|
|
|
build --build-base=build-${pyver} install ${make_install_args}
|
2014-05-01 14:05:28 +00:00
|
|
|
else
|
2014-11-07 15:41:59 +00:00
|
|
|
python${pyver} setup.py build --build-base=build-${pyver} install ${make_install_args}
|
2014-05-01 14:05:28 +00:00
|
|
|
fi
|
|
|
|
done
|
2014-01-07 16:29:49 +00:00
|
|
|
}
|