Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit distutils3-base |
| 2 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 3 | B = "${WORKDIR}/build" |
| 4 | distutils_do_configure[cleandirs] = "${B}" |
| 5 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | DISTUTILS_BUILD_ARGS ?= "" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 7 | DISTUTILS_INSTALL_ARGS ?= "--root=${D} \ |
| 8 | --prefix=${prefix} \ |
| 9 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ |
| 10 | --install-data=${datadir}" |
| 11 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 12 | DISTUTILS_PYTHON = "python3" |
| 13 | DISTUTILS_PYTHON_class-native = "nativepython3" |
| 14 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 15 | distutils3_do_configure() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 16 | : |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 17 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | |
| 19 | distutils3_do_compile() { |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame] | 20 | cd ${S} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 21 | NO_FETCH_BUILD=1 \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 23 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame] | 24 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 25 | build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 26 | bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 28 | distutils3_do_compile[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | distutils3_do_install() { |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame] | 31 | cd ${S} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 34 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 35 | PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame] | 36 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 37 | build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 38 | bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | |
| 40 | # support filenames with *spaces* |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 41 | find ${D} -name "*.py" -exec grep -q ${D} {} \; \ |
| 42 | -exec sed -i -e s:${D}::g {} \; |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 43 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 44 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
| 45 | if [ -f "$i" ]; then |
| 46 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 48 | fi |
| 49 | done |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | |
| 51 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 52 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | # |
| 54 | # FIXME: Bandaid against wrong datadir computation |
| 55 | # |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 56 | if [ -e ${D}${datadir}/share ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | mv -f ${D}${datadir}/share/* ${D}${datadir}/ |
| 58 | rmdir ${D}${datadir}/share |
| 59 | fi |
| 60 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 61 | distutils3_do_install[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 63 | EXPORT_FUNCTIONS do_configure do_compile do_install |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 64 | |
| 65 | export LDSHARED="${CCLD} -shared" |