blob: 7356b5245aa6e817ecd375d4aff44382282924d7 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001inherit distutils3-base
2
Andrew Geissler82c905d2020-04-13 13:39:40 -05003B = "${WORKDIR}/build"
4distutils_do_configure[cleandirs] = "${B}"
5
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006DISTUTILS_BUILD_ARGS ?= ""
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08007DISTUTILS_INSTALL_ARGS ?= "--root=${D} \
8 --prefix=${prefix} \
9 --install-lib=${PYTHON_SITEPACKAGES_DIR} \
10 --install-data=${datadir}"
11
Brad Bishopc342db32019-05-15 21:57:59 -040012DISTUTILS_PYTHON = "python3"
13DISTUTILS_PYTHON_class-native = "nativepython3"
14
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080015distutils3_do_configure() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050016 :
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080017}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018
19distutils3_do_compile() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050020 cd ${S}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080021 NO_FETCH_BUILD=1 \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 STAGING_INCDIR=${STAGING_INCDIR} \
23 STAGING_LIBDIR=${STAGING_LIBDIR} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050024 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \
25 build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080026 bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050028distutils3_do_compile[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030distutils3_do_install() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050031 cd ${S}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033 STAGING_INCDIR=${STAGING_INCDIR} \
34 STAGING_LIBDIR=${STAGING_LIBDIR} \
35 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050036 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \
37 build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038 bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039
40 # support filenames with *spaces*
Brad Bishopc342db32019-05-15 21:57:59 -040041 find ${D} -name "*.py" -exec grep -q ${D} {} \; \
42 -exec sed -i -e s:${D}::g {} \;
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043
Brad Bishopc342db32019-05-15 21:57:59 -040044 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 Williamsc124f4f2015-09-15 14:41:29 -050047 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
Brad Bishopc342db32019-05-15 21:57:59 -040048 fi
49 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050
51 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
Brad Bishopc342db32019-05-15 21:57:59 -040052
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053 #
54 # FIXME: Bandaid against wrong datadir computation
55 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -050056 if [ -e ${D}${datadir}/share ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057 mv -f ${D}${datadir}/share/* ${D}${datadir}/
58 rmdir ${D}${datadir}/share
59 fi
60}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050061distutils3_do_install[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080063EXPORT_FUNCTIONS do_configure do_compile do_install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064
65export LDSHARED="${CCLD} -shared"