Merge branch 'opendreambox' of ssh://192.168.102.66/~ikseong/work/repo/openembedded...
[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}.1"
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         autoreconf -Wcross --verbose --install --force --exclude=autopoint Modules/_ctypes/libffi || oenote "_ctypes failed to autoreconf"
55 }
56
57 #
58 # Copy config.h and an appropriate Makefile for distutils.sysconfig,
59 # which laters uses the information out of these to compile extensions
60 #
61 do_compile_prepend() {
62         install -d ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
63         install -d ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
64         install -m 0644 pyconfig.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
65         install -m 0644 Makefile Makefile.orig
66         install -m 0644 Makefile Makefile.backup
67         sed -e 's,${includedir},${STAGING_INCDIR},' < Makefile.backup > Makefile
68         install -m 0644 Makefile Makefile.backup
69         sed -e 's,${libdir},${STAGING_LIBDIR},' < Makefile.backup > Makefile
70         install -m 0644 Makefile ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
71 }
72
73 do_compile() {
74         oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
75                 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
76                 STAGING_LIBDIR=${STAGING_LIBDIR} \
77                 STAGING_INCDIR=${STAGING_INCDIR} \
78                 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
79                 OPT="${CFLAGS}" libpython${PYTHON_MAJMIN}.so
80
81         oe_libinstall -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR}
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                 RUNSHARED= OPT="${CFLAGS}"
89 }
90
91 do_stage() {
92         install -m 0644 Include/*.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
93         oe_libinstall -a -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR}
94 }
95
96 do_install() {
97         install -m 0644 Makefile.orig Makefile
98         
99         oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
100                 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
101                 STAGING_LIBDIR=${STAGING_LIBDIR} \
102                 STAGING_INCDIR=${STAGING_INCDIR} \
103                 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
104                 DESTDIR=${D} LIBDIR=${libdir} RUNSHARED= install
105
106         install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
107
108         # remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144
109         sed -i -e s,ccache,'$(CCACHE)', ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
110 }
111
112 require python-${PYTHON_MAJMIN}-manifest.inc
113
114 # manual dependency additions
115 RPROVIDES_python-core = "python"
116 RRECOMMENDS_python-core = "python-readline"
117 RRECOMMENDS_python-crypt = "openssl"
118
119 # add sitecustomize
120 FILES_python-core += "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py"
121 # ship 2to3
122 FILES_python-core += "${bindir}/2to3"
123
124 # package libpython2
125 PACKAGES =+ "libpython2"
126 FILES_libpython2 = "${libdir}/libpython*.so*"
127
128 # additional stuff -dev
129
130 FILES_${PN}-dev = "\
131   ${includedir} \
132   ${libdir}/lib*${SOLIBSDEV} \
133   ${libdir}/*.la \
134   ${libdir}/*.a \
135   ${libdir}/*.o \
136   ${libdir}/pkgconfig \
137   ${base_libdir}/*.a \
138   ${base_libdir}/*.o \
139   ${datadir}/aclocal \
140   ${datadir}/pkgconfig \
141 "
142
143 # catch debug extensions (isn't that already in python-core-dbg?)
144 FILES_python-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
145
146 # catch all the rest (unsorted)
147 PACKAGES += "python-misc"
148 FILES_python-misc = "${libdir}/python${PYTHON_MAJMIN}"
149 RDEPENDS_python-misc += "python-shell"
150
151 # catch manpage
152 PACKAGES += "python-man"
153 FILES_python-man = "${datadir}/man"