blob: 834e3224743189fcc15a7ba57bcf6869b6038094 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001inherit distutils3-base
2
3DISTUTILS_BUILD_ARGS ?= ""
4DISTUTILS_BUILD_EXT_ARGS ?= ""
5DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}"
6DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \
7 --install-data=${STAGING_DATADIR}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08008DISTUTILS_INSTALL_ARGS ?= "--root=${D} \
9 --prefix=${prefix} \
10 --install-lib=${PYTHON_SITEPACKAGES_DIR} \
11 --install-data=${datadir}"
12
13distutils3_do_configure() {
14 if [ "${CLEANBROKEN}" != "1" ] ; then
15 NO_FETCH_BUILD=1 \
16 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py clean ${DISTUTILS_BUILD_ARGS}
17 fi
18}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019
20distutils3_do_compile() {
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} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
25 build ${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
30distutils3_stage_headers() {
31 install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033 bbfatal_log "'${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS}' execution for stage_headers failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050035distutils3_stage_headers[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036
37distutils3_stage_all() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 STAGING_INCDIR=${STAGING_INCDIR} \
39 STAGING_LIBDIR=${STAGING_LIBDIR} \
40 install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
41 PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080043 bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS}' execution for stage_all failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050045distutils3_stage_all[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046
47distutils3_do_install() {
48 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049 STAGING_INCDIR=${STAGING_INCDIR} \
50 STAGING_LIBDIR=${STAGING_LIBDIR} \
51 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080052 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS} || \
53 bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054
55 # support filenames with *spaces*
56 find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \;
57
58 if test -e ${D}${bindir} ; then
59 for i in ${D}${bindir}/* ; do \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050060 sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${USRBINPATH}/env\ ${PYTHON_PN}:g $i
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
62 done
63 fi
64
65 if test -e ${D}${sbindir}; then
66 for i in ${D}${sbindir}/* ; do \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067 sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${USRBINPATH}/env\ ${PYTHON_PN}:g $i
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
69 done
70 fi
71
72 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
73
74 #
75 # FIXME: Bandaid against wrong datadir computation
76 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077 if [ -e ${D}${datadir}/share ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078 mv -f ${D}${datadir}/share/* ${D}${datadir}/
79 rmdir ${D}${datadir}/share
80 fi
81}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050082distutils3_do_install[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080084EXPORT_FUNCTIONS do_configure do_compile do_install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085
86export LDSHARED="${CCLD} -shared"