dvbapp : TranscodingSetup update
[vuplus_openembedded] / recipes / python / python_2.6.4.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;name=archive \
12   file://00-fix-bindir-libdir-for-cross.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://99-ignore-optimization-flag.patch;patch=1 \
19   \
20 # not yet pushed forward
21 # sitebranding
22   \
23 #  file://05-install.patch;patch=1 \
24 #  file://06-fix-urllib-exception.patch;patch=1 \
25 #  file://16-bug1179-imageop.patch;patch=1 \
26 #  file://13-set-wakeup-fix.patch;patch=1 \
27   \
28   file://sitecustomize.py \
29 "
30 SRC_URI[archive.md5sum] = "fee5408634a54e721a93531aba37f8c1"
31 SRC_URI[archive.sha256sum] = "dad8d5575144a210d5cc4fdbc40b8a26386e9cdb1ef58941bec0be02c7cb9d89"
32
33 SRC_URI_append_opendreambox = " \
34   file://some_configure_fixes.patch;patch=1;pnum=0 \
35   file://strict_aliasing_site.patch;patch=0;pnum=0 \
36   file://fix_pthread_site.patch;patch=0;pnum=0 \
37   file://forced_largefile_support.patch;patch=1;pnum=1"
38 SRC_URI_append_vuplus = " \
39   file://some_configure_fixes.patch;patch=1;pnum=0 \
40   file://strict_aliasing_site.patch;patch=0;pnum=0 \
41   file://fix_pthread_site.patch;patch=0;pnum=0 \
42   file://forced_largefile_support.patch;patch=1;pnum=1"
43
44 S = "${WORKDIR}/Python-${PV}"
45
46 inherit autotools
47
48 # The 3 lines below are copied from the libffi recipe, ctypes ships its own copy of the libffi sources
49 #Somehow gcc doesn't set __SOFTFP__ when passing -mfloatabi=softp :(
50 TARGET_CC_ARCH_append_armv6 = " -D__SOFTFP__"
51 TARGET_CC_ARCH_append_armv7a = " -D__SOFTFP__"
52
53 do_configure_prepend() {
54         rm -R ${S}/Lib/plat-linux3 || /bin/true
55         ln -sf ${S}/Lib/plat-linux2 ${S}/Lib/plat-linux3
56         autoreconf -Wcross --verbose --install --force --exclude=autopoint Modules/_ctypes/libffi || oenote "_ctypes failed to autoreconf"
57 }
58
59 #
60 # Copy config.h and an appropriate Makefile for distutils.sysconfig,
61 # which laters uses the information out of these to compile extensions
62 #
63 do_compile_prepend() {
64         install -d ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
65         install -d ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
66         install -m 0644 pyconfig.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
67         install -m 0644 Makefile Makefile.orig
68         install -m 0644 Makefile Makefile.backup
69         sed -e 's,${includedir},${STAGING_INCDIR},' < Makefile.backup > Makefile
70         install -m 0644 Makefile Makefile.backup
71         sed -e 's,${libdir},${STAGING_LIBDIR},' < Makefile.backup > Makefile
72         install -m 0644 Makefile ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
73 }
74
75 do_compile() {
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                 OPT="${CFLAGS}" libpython${PYTHON_MAJMIN}.so
82
83         oe_libinstall -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR}
84
85         oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
86                 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
87                 STAGING_LIBDIR=${STAGING_LIBDIR} \
88                 STAGING_INCDIR=${STAGING_INCDIR} \
89                 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
90                 RUNSHARED= OPT="${CFLAGS}"
91 }
92
93 do_stage() {
94         install -m 0644 Include/*.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
95         oe_libinstall -a -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR}
96 }
97
98 do_install() {
99         install -m 0644 Makefile.orig Makefile
100         
101         oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
102                 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
103                 STAGING_LIBDIR=${STAGING_LIBDIR} \
104                 STAGING_INCDIR=${STAGING_INCDIR} \
105                 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
106                 DESTDIR=${D} LIBDIR=${libdir} RUNSHARED= install
107
108         install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
109
110         # remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144
111         sed -i -e s,ccache,'$(CCACHE)', ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
112 }
113
114 require python-${PYTHON_MAJMIN}-manifest.inc
115
116 # manual dependency additions
117 RPROVIDES_python-core = "python"
118 RRECOMMENDS_python-core = "python-readline"
119 RRECOMMENDS_python-crypt = "openssl"
120
121 # add sitecustomize
122 FILES_python-core += "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py"
123 # ship 2to3
124 FILES_python-core += "${bindir}/2to3"
125
126 # package libpython2
127 PACKAGES =+ "libpython2"
128 FILES_libpython2 = "${libdir}/libpython*.so*"
129
130 # additional stuff -dev
131
132 FILES_${PN}-dev = "\
133   ${includedir} \
134   ${libdir}/lib*${SOLIBSDEV} \
135   ${libdir}/*.la \
136   ${libdir}/*.a \
137   ${libdir}/*.o \
138   ${libdir}/pkgconfig \
139   ${base_libdir}/*.a \
140   ${base_libdir}/*.o \
141   ${datadir}/aclocal \
142   ${datadir}/pkgconfig \
143 "
144
145 # catch debug extensions (isn't that already in python-core-dbg?)
146 FILES_python-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
147
148 # catch all the rest (unsorted)
149 PACKAGES += "python-misc"
150 FILES_python-misc = "${libdir}/python${PYTHON_MAJMIN}"
151 RDEPENDS_python-misc += "python-shell"
152
153 # catch manpage
154 PACKAGES += "python-man"
155 FILES_python-man = "${datadir}/man"