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