common/build_style: adding python_versions variable
This variable contains the versions of python for which this packages will be built. Multiple versions can be seperated by whitespace.
This commit is contained in:
parent
dc9acd782c
commit
2415b98064
|
@ -1,36 +1,49 @@
|
|||
#
|
||||
# This helper is for templates installing python modules.
|
||||
#
|
||||
XBPS_PYVER="2.7" # currently 2.7 is the default python
|
||||
|
||||
do_build() {
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${XBPS_PYVER} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${XBPS_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 setup.py build ${make_build_args}
|
||||
else
|
||||
python setup.py build ${make_build_args}
|
||||
fi
|
||||
: ${python_versions:=2}
|
||||
local python_version=
|
||||
|
||||
for python_version in $python_versions; do
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${python_version} -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}
|
||||
else
|
||||
python${python_version} setup.py build --build-base=build-$python_version \
|
||||
${make_build_args}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${python_versions:=2}
|
||||
local python_version=
|
||||
|
||||
make_install_args+=" --prefix=/usr --root=$DESTDIR"
|
||||
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${XBPS_PYVER} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${XBPS_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 setup.py install ${make_install_args}
|
||||
else
|
||||
python setup.py install ${make_install_args}
|
||||
fi
|
||||
for python_version in $python_versions; do
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${python_version} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${python_version} -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}
|
||||
else
|
||||
python${python_version} setup.py build --build-base=build-$python_version install \
|
||||
${make_install_args}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
unset -v pkgname version revision short_desc homepage license maintainer
|
||||
unset -v only_for_archs distfiles checksum build_style
|
||||
unset -v configure_script configure_args wrksrc build_wrksrc create_wrksrc
|
||||
unset -v make_cmd make_build_args make_install_args make_build_target make_install_target
|
||||
unset -v make_cmd make_build_args make_install_args make_build_target make_install_target python_versions
|
||||
unset -v patch_args disable_parallel_build keep_libtool_archives
|
||||
unset -v makedepends hostmakedepends depends
|
||||
unset -v build_options build_options_default bootstrap
|
||||
|
|
Loading…
Reference in New Issue