2014-01-07 17:29:49 +01:00
|
|
|
#
|
|
|
|
# This helper is for templates installing python modules.
|
|
|
|
#
|
|
|
|
|
|
|
|
do_build() {
|
2016-10-16 16:46:46 +02:00
|
|
|
: ${python_versions:="2.7 $py3_ver"}
|
2014-11-07 16:41:59 +01:00
|
|
|
local pyver= pysufx=
|
2014-05-01 16:05:28 +02:00
|
|
|
|
2014-11-07 16:41:59 +01:00
|
|
|
for pyver in $python_versions; do
|
2014-05-01 16:05:28 +02:00
|
|
|
if [ -n "$CROSS_BUILD" ]; then
|
|
|
|
PYPREFIX="$XBPS_CROSS_BASE"
|
2014-11-07 16:41:59 +01:00
|
|
|
if [ "$pyver" != "2.7" ]; then
|
|
|
|
pysufx=m
|
2014-11-07 16:33:00 +01:00
|
|
|
fi
|
2014-11-07 16:41:59 +01: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 16:05:28 +02: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 16:41:59 +01:00
|
|
|
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
|
2017-01-12 12:27:12 +01:00
|
|
|
build --build-base=build-${pyver} ${make_build_args}
|
2014-05-01 16:05:28 +02:00
|
|
|
else
|
2017-01-12 12:27:12 +01:00
|
|
|
python${pyver} setup.py build --build-base=build-${pyver} ${make_build_args}
|
2014-05-01 16:05:28 +02:00
|
|
|
fi
|
|
|
|
done
|
2014-01-07 17:29:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
2016-10-16 16:46:46 +02:00
|
|
|
: ${python_versions:="2.7 $py3_ver"}
|
2014-11-07 16:41:59 +01:00
|
|
|
local pyver= pysufx=
|
2014-05-01 16:05:28 +02:00
|
|
|
|
2014-11-07 16:41:59 +01:00
|
|
|
for pyver in $python_versions; do
|
2014-05-01 16:05:28 +02:00
|
|
|
if [ -n "$CROSS_BUILD" ]; then
|
|
|
|
PYPREFIX="$XBPS_CROSS_BASE"
|
2014-11-07 16:41:59 +01:00
|
|
|
if [ "$pyver" != "2.7" ]; then
|
|
|
|
pysufx=m
|
2014-11-07 16:33:00 +01:00
|
|
|
fi
|
2014-11-07 16:41:59 +01: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 16:05:28 +02: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 16:41:59 +01:00
|
|
|
LDFLAGS="$LDFLAGS" python${pyver} setup.py \
|
2017-01-12 12:27:12 +01:00
|
|
|
build --build-base=build-${pyver} \
|
2015-02-21 19:21:21 +01:00
|
|
|
install --prefix=/usr --root=${DESTDIR} ${make_install_args}
|
2014-05-01 16:05:28 +02:00
|
|
|
else
|
2017-01-12 12:27:12 +01:00
|
|
|
python${pyver} setup.py build --build-base=build-${pyver} \
|
2015-02-21 19:21:21 +01:00
|
|
|
install --prefix=/usr --root=${DESTDIR} ${make_install_args}
|
2014-05-01 16:05:28 +02:00
|
|
|
fi
|
2016-04-25 01:25:25 +02:00
|
|
|
|
|
|
|
# Rename unversioned scripts to avoid name conflicts.
|
2016-10-16 16:46:46 +02:00
|
|
|
if [ -d ${DESTDIR}/usr/bin ]; then
|
|
|
|
find ${DESTDIR}/usr/bin -type f ! -name "*[[:digit:]]" | while IFS= read -r f _; do
|
|
|
|
mv "${f}" "${f}${pyver%.*}"
|
|
|
|
echo "[python-module] Unversioned script renamed to '${f#$DESTDIR}${pyver%.*}'"
|
|
|
|
done
|
2016-04-25 01:25:25 +02:00
|
|
|
fi
|
2014-05-01 16:05:28 +02:00
|
|
|
done
|
2014-01-07 17:29:49 +01:00
|
|
|
}
|