blob: 3ef9cc5a787893bf89719d9b0fd3d8c71f0922d6 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001DISTUTILS_BUILD_ARGS ?= ""
2DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}"
3DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \
4 --install-data=${STAGING_DATADIR}"
5DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \
6 --install-data=${D}/${datadir}"
7
8distutils_do_compile() {
9 STAGING_INCDIR=${STAGING_INCDIR} \
10 STAGING_LIBDIR=${STAGING_LIBDIR} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050012 bbfatal_log "${PYTHON_PN} setup.py build_ext execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013}
14
15distutils_stage_headers() {
16 install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050018 bbfatal_log "${PYTHON_PN} setup.py install_headers execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019}
20
21distutils_stage_all() {
22 STAGING_INCDIR=${STAGING_INCDIR} \
23 STAGING_LIBDIR=${STAGING_LIBDIR} \
24 install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
25 PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050027 bbfatal_log "${PYTHON_PN} setup.py install (stage) execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028}
29
30distutils_do_install() {
31 echo "Beginning ${PN} Install ..."
32 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
33 echo "Step 2 of ${PN} Install ..."
34 STAGING_INCDIR=${STAGING_INCDIR} \
35 STAGING_LIBDIR=${STAGING_LIBDIR} \
36 PYTHONPATH=${D}/${PYTHON_SITEPACKAGES_DIR} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050038 bbfatal_log "${PYTHON_PN} setup.py install execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039
40 echo "Step 3 of ${PN} Install ..."
41 # support filenames with *spaces*
42 find ${D} -name "*.py" -print0 | while read -d $'\0' i ; do \
43 sed -i -e s:${D}::g $i
44 done
45
46 echo "Step 4 of ${PN} Install ..."
47 if test -e ${D}${bindir} ; then
48 for i in ${D}${bindir}/* ; do \
49 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
50 done
51 fi
52
53 echo "Step 4 of ${PN} Install ..."
54 if test -e ${D}${sbindir}; then
55 for i in ${D}${sbindir}/* ; do \
56 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
57 done
58 fi
59
60 echo "Step 5 of ${PN} Install ..."
61 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
62
63 #
64 # FIXME: Bandaid against wrong datadir computation
65 #
66 if test -e ${D}${datadir}/share; then
67 mv -f ${D}${datadir}/share/* ${D}${datadir}/
68 fi
69}
70
71#EXPORT_FUNCTIONS do_compile do_install
72
73export LDSHARED="${CCLD} -shared"