summaryrefslogtreecommitdiffstats
path: root/meta/classes/distutils3.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/distutils3.bbclass')
-rw-r--r--meta/classes/distutils3.bbclass98
1 files changed, 98 insertions, 0 deletions
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass
new file mode 100644
index 0000000..bbd645c
--- /dev/null
+++ b/meta/classes/distutils3.bbclass
@@ -0,0 +1,98 @@
1inherit 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}"
8DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \
9 --install-data=${D}/${datadir}"
10
11distutils3_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} || \
22 bbfatal "${PYTHON_PN} setup.py build_ext execution failed."
23}
24
25distutils3_stage_headers() {
26 install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
27 if [ ${BUILD_SYS} != ${HOST_SYS} ]; then
28 SYS=${MACHINE}
29 else
30 SYS=${HOST_SYS}
31 fi
32 BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \
33 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
34 bbfatal "${PYTHON_PN} setup.py install_headers execution failed."
35}
36
37distutils3_stage_all() {
38 if [ ${BUILD_SYS} != ${HOST_SYS} ]; then
39 SYS=${MACHINE}
40 else
41 SYS=${HOST_SYS}
42 fi
43 STAGING_INCDIR=${STAGING_INCDIR} \
44 STAGING_LIBDIR=${STAGING_LIBDIR} \
45 install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
46 PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \
47 BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \
48 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
49 bbfatal "${PYTHON_PN} setup.py install (stage) execution failed."
50}
51
52distutils3_do_install() {
53 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
54 if [ ${BUILD_SYS} != ${HOST_SYS} ]; then
55 SYS=${MACHINE}
56 else
57 SYS=${HOST_SYS}
58 fi
59 STAGING_INCDIR=${STAGING_INCDIR} \
60 STAGING_LIBDIR=${STAGING_LIBDIR} \
61 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
62 BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \
63 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \
64 bbfatal "${PYTHON_PN} setup.py install execution failed."
65
66 # support filenames with *spaces*
67 find ${D} -name "*.py" -print0 | while read -d $'\0' i ; do \
68 sed -i -e s:${D}::g "$i"
69 done
70
71 if test -e ${D}${bindir} ; then
72 for i in ${D}${bindir}/* ; do \
73 sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${bindir}/env\ ${PYTHON_PN}:g $i
74 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
75 done
76 fi
77
78 if test -e ${D}${sbindir}; then
79 for i in ${D}${sbindir}/* ; do \
80 sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${bindir}/env\ ${PYTHON_PN}:g $i
81 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
82 done
83 fi
84
85 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
86
87 #
88 # FIXME: Bandaid against wrong datadir computation
89 #
90 if test -e ${D}${datadir}/share; then
91 mv -f ${D}${datadir}/share/* ${D}${datadir}/
92 rmdir ${D}${datadir}/share
93 fi
94}
95
96EXPORT_FUNCTIONS do_compile do_install
97
98export LDSHARED="${CCLD} -shared"