Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit distutils3-base |
| 2 | |
| 3 | DISTUTILS_BUILD_ARGS ?= "" |
| 4 | DISTUTILS_BUILD_EXT_ARGS ?= "" |
| 5 | DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}" |
| 6 | DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \ |
| 7 | --install-data=${STAGING_DATADIR}" |
| 8 | DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \ |
| 9 | --install-data=${D}/${datadir}" |
| 10 | |
| 11 | distutils3_do_compile() { |
| 12 | if [ ${BUILD_SYS} != ${HOST_SYS} ]; then |
| 13 | SYS=${MACHINE} |
| 14 | else |
| 15 | SYS=${HOST_SYS} |
| 16 | fi |
| 17 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 18 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 19 | BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \ |
| 20 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ |
| 21 | build ${DISTUTILS_BUILD_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 22 | bbfatal_log "${PYTHON_PN} setup.py build_ext execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 24 | distutils3_do_compile[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 | |
| 26 | distutils3_stage_headers() { |
| 27 | install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} |
| 28 | if [ ${BUILD_SYS} != ${HOST_SYS} ]; then |
| 29 | SYS=${MACHINE} |
| 30 | else |
| 31 | SYS=${HOST_SYS} |
| 32 | fi |
| 33 | BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \ |
| 34 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 35 | bbfatal_log "${PYTHON_PN} setup.py install_headers execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 37 | distutils3_stage_headers[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | |
| 39 | distutils3_stage_all() { |
| 40 | if [ ${BUILD_SYS} != ${HOST_SYS} ]; then |
| 41 | SYS=${MACHINE} |
| 42 | else |
| 43 | SYS=${HOST_SYS} |
| 44 | fi |
| 45 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 46 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 47 | install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} |
| 48 | PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \ |
| 49 | BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \ |
| 50 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 51 | bbfatal_log "${PYTHON_PN} setup.py install (stage) execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 53 | distutils3_stage_all[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 54 | |
| 55 | distutils3_do_install() { |
| 56 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} |
| 57 | if [ ${BUILD_SYS} != ${HOST_SYS} ]; then |
| 58 | SYS=${MACHINE} |
| 59 | else |
| 60 | SYS=${HOST_SYS} |
| 61 | fi |
| 62 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 63 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 64 | PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ |
| 65 | BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \ |
| 66 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 67 | bbfatal_log "${PYTHON_PN} setup.py install execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 | |
| 69 | # support filenames with *spaces* |
| 70 | find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \; |
| 71 | |
| 72 | if test -e ${D}${bindir} ; then |
| 73 | for i in ${D}${bindir}/* ; do \ |
| 74 | sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${bindir}/env\ ${PYTHON_PN}:g $i |
| 75 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 76 | done |
| 77 | fi |
| 78 | |
| 79 | if test -e ${D}${sbindir}; then |
| 80 | for i in ${D}${sbindir}/* ; do \ |
| 81 | sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${bindir}/env\ ${PYTHON_PN}:g $i |
| 82 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 83 | done |
| 84 | fi |
| 85 | |
| 86 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth |
| 87 | |
| 88 | # |
| 89 | # FIXME: Bandaid against wrong datadir computation |
| 90 | # |
| 91 | if test -e ${D}${datadir}/share; then |
| 92 | mv -f ${D}${datadir}/share/* ${D}${datadir}/ |
| 93 | rmdir ${D}${datadir}/share |
| 94 | fi |
| 95 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 96 | distutils3_do_install[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 97 | |
| 98 | EXPORT_FUNCTIONS do_compile do_install |
| 99 | |
| 100 | export LDSHARED="${CCLD} -shared" |