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