surpport seeking the recorded video
[vuplus_openembedded] / recipes / python / python_2.6.1.bb
1 require python.inc
2 DEPENDS = "python-native db gdbm openssl readline sqlite3 tcl zlib\
3            ${@base_contains('DISTRO_FEATURES', 'tk', 'tk', '', d)}"
4 DEPENDS_sharprom = "python-native db readline zlib gdbm openssl"
5 PR = "${INC_PR}.0"
6
7 SRC_URI = "\
8   http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \
9   file://00-fix-bindir-libdir-for-cross.patch;patch=1 \
10   file://01-use-proper-tools-for-cross-build.patch;patch=1 \
11   file://02-remove-test-for-cross.patch;patch=1 \
12   file://03-fix-tkinter-detection.patch;patch=1 \
13   file://04-default-is-optimized.patch;patch=1 \
14   file://05-enable-ctypes-cross-build.patch;patch=1 \
15   file://06-libffi-enable-default-mips.patch;patch=1 \
16   file://07-export-grammer.patch;patch=1 \
17   file://99-ignore-optimization-flag.patch;patch=1 \
18   \
19 # not yet pushed forward
20 # sitecustomize, sitebranding
21   \
22 #  file://05-install.patch;patch=1 \
23 #  file://06-fix-urllib-exception.patch;patch=1 \
24 #  file://16-bug1179-imageop.patch;patch=1 \
25 #  file://13-set-wakeup-fix.patch;patch=1 \
26   \
27   file://sitecustomize.py \
28 "
29 S = "${WORKDIR}/Python-${PV}"
30
31 inherit autotools
32
33 # The 3 lines below are copied from the libffi recipe, ctypes ships its own copy of the libffi sources
34 #Somehow gcc doesn't set __SOFTFP__ when passing -mfloatabi=softp :(
35 TARGET_CC_ARCH_append_armv6 = " -D__SOFTFP__"
36 TARGET_CC_ARCH_append_armv7a = " -D__SOFTFP__"
37
38 #
39 # copy config.h and an appropriate Makefile for distutils.sysconfig
40 # which laters uses the information out of these to compile extensions
41 #
42 do_compile_prepend() {
43         install -d ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
44         install -d ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
45         install -m 0644 pyconfig.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
46         install -m 0644 Makefile Makefile.orig
47         install -m 0644 Makefile Makefile.backup
48         sed -e 's,${includedir},${STAGING_INCDIR},' < Makefile.backup > Makefile
49         install -m 0644 Makefile Makefile.backup
50         sed -e 's,${libdir},${STAGING_LIBDIR},' < Makefile.backup > Makefile
51         install -m 0644 Makefile ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
52 }
53
54 do_compile() {
55         oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
56                 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
57                 STAGING_LIBDIR=${STAGING_LIBDIR} \
58                 STAGING_INCDIR=${STAGING_INCDIR} \
59                 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
60                 OPT="${CFLAGS}" libpython${PYTHON_MAJMIN}.so
61
62         oe_libinstall -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR}
63
64         oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
65                 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
66                 STAGING_LIBDIR=${STAGING_LIBDIR} \
67                 STAGING_INCDIR=${STAGING_INCDIR} \
68                 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
69                 OPT="${CFLAGS}"
70 }
71
72 do_stage() {
73         install -m 0644 Include/*.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
74         oe_libinstall -a -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR}
75 }
76
77 do_install() {
78         install -m 0644 Makefile.orig Makefile
79         
80         oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
81                 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
82                 STAGING_LIBDIR=${STAGING_LIBDIR} \
83                 STAGING_INCDIR=${STAGING_INCDIR} \
84                 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
85                 DESTDIR=${D} LIBDIR=${libdir} install
86
87         install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
88
89         # remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144
90         sed -i -e s,ccache,'$(CCACHE)', ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
91 }
92
93 require python-${PYTHON_MAJMIN}-manifest.inc
94
95 # manual dependency additions
96 RPROVIDES_python-core = "python"
97 RRECOMMENDS_python-core = "python-readline"
98 RRECOMMENDS_python-crypt = "openssl"
99
100 # add sitecustomize
101 FILES_python-core += "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py"
102
103 # 2to3
104 FILES_python-core += "${bindir}/2to3"
105
106 # package libpython
107 PACKAGES =+ "libpython2"
108 FILES_libpython2 = "${libdir}/libpython*.so.*"
109
110 # catch debug extensions (isn't that already in python-core-dbg?)
111 FILES_python-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
112
113 # catch all the rest (unsorted)
114 PACKAGES += "python-misc"
115 FILES_python-misc = "${libdir}/python${PYTHON_MAJMIN}"
116
117 # catch manpage
118 PACKAGES += "python-man"
119 FILES_python-man = "${datadir}/man"