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}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 8 | DISTUTILS_INSTALL_ARGS ?= "--root=${D} \ |
| 9 | --prefix=${prefix} \ |
| 10 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ |
| 11 | --install-data=${datadir}" |
| 12 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 13 | DISTUTILS_PYTHON = "python3" |
| 14 | DISTUTILS_PYTHON_class-native = "nativepython3" |
| 15 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | distutils3_do_configure() { |
| 17 | if [ "${CLEANBROKEN}" != "1" ] ; then |
| 18 | NO_FETCH_BUILD=1 \ |
| 19 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py clean ${DISTUTILS_BUILD_ARGS} |
| 20 | fi |
| 21 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | |
| 23 | distutils3_do_compile() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 24 | NO_FETCH_BUILD=1 \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 26 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ |
| 28 | build ${DISTUTILS_BUILD_ARGS} || \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 29 | bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 31 | distutils3_do_compile[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | |
| 33 | distutils3_stage_headers() { |
| 34 | install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 36 | bbfatal_log "'${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS}' execution for stage_headers failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 38 | distutils3_stage_headers[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | |
| 40 | distutils3_stage_all() { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 42 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 43 | install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} |
| 44 | PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 46 | bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS}' execution for stage_all failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 48 | distutils3_stage_all[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 49 | |
| 50 | distutils3_do_install() { |
| 51 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 53 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 54 | PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 55 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS} || \ |
| 56 | bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | |
| 58 | # support filenames with *spaces* |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 59 | find ${D} -name "*.py" -exec grep -q ${D} {} \; \ |
| 60 | -exec sed -i -e s:${D}::g {} \; |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 61 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 62 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
| 63 | if [ -f "$i" ]; then |
| 64 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 65 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 66 | fi |
| 67 | done |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 | |
| 69 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 70 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 71 | # |
| 72 | # FIXME: Bandaid against wrong datadir computation |
| 73 | # |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 74 | if [ -e ${D}${datadir}/share ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 75 | mv -f ${D}${datadir}/share/* ${D}${datadir}/ |
| 76 | rmdir ${D}${datadir}/share |
| 77 | fi |
| 78 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 79 | distutils3_do_install[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 80 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 81 | EXPORT_FUNCTIONS do_configure do_compile do_install |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 82 | |
| 83 | export LDSHARED="${CCLD} -shared" |