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