13880269a13293036a0442258ade4a658763d77e
[openwrt/svn-archive/archive.git] / lang / python / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=python
11 PKG_VERSION:=2.6.4
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=Python-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)/
16 PKG_MD5SUM:=fee5408634a54e721a93531aba37f8c1
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21 -include $(if $(DUMP),,./files/python-package.mk)
22
23 define Package/python/Default
24 SUBMENU:=Python
25 SECTION:=lang
26 CATEGORY:=Languages
27 TITLE:=Python $(PYTHON_VERSION) programming language
28 URL:=http://www.python.org/
29 endef
30
31 define Package/python/Default/description
32 Python is a dynamic object-oriented programming language that can be used
33 for many kinds of software development. It offers strong support for
34 integration with other languages and tools, comes with extensive standard
35 libraries, and can be learned in a few days. Many Python programmers
36 report substantial productivity gains and feel the language encourages
37 the development of higher quality, more maintainable code.
38 endef
39
40 define Package/python
41 $(call Package/python/Default)
42 TITLE+= (full)
43 DEPENDS:=+libpthread +zlib +PACKAGE_python:libffi +python-mini
44 endef
45
46 define Package/python/description
47 $(call Package/python/Default/description)
48 .
49 This package contains the full Python install.
50 endef
51
52 define Package/python-mini
53 $(call Package/python/Default)
54 TITLE+= (minimal)
55 DEPENDS:=+libpthread +zlib
56 endef
57
58 define Package/python-mini/description
59 $(call Package/python/Default/description)
60 .
61 This package contains only a minimal Python install.
62 endef
63
64 define Package/python-doc
65 $(call Package/python/Default)
66 TITLE:=Python interactive documentation
67 DEPENDS+=+python-mini
68 endef
69
70 define Package/python-expat
71 $(call Package/python/Default)
72 TITLE:=Python support for expat
73 DEPENDS+=+python-mini +libexpat
74 endef
75
76 define Package/python-openssl
77 $(call Package/python/Default)
78 TITLE:=Python support for OpenSSL
79 DEPENDS+=+python-mini +libopenssl
80 endef
81
82 define Package/python-sqlite3
83 $(call Package/python/Default)
84 TITLE:=Python support for sqlite3
85 DEPENDS+=+python-mini +libsqlite3
86 endef
87
88 define Package/python-gdbm
89 $(call Package/python/Default)
90 TITLE:=Python support for gdbm
91 DEPENDS+=+python-mini +libgdbm
92 endef
93
94 PY_DISABLED_MODULES:= \
95 readline _curses _curses_panel _tkinter nis
96
97 MAKE_OPTS:=\
98 $(TARGET_CONFIGURE_OPTS) \
99 PYTHON_DISABLE_MODULES="$(PY_DISABLED_MODULES)" \
100 PYTHON_MODULES_INCLUDE="$(STAGING_DIR)/usr/include" \
101 PYTHON_MODULES_LIB="$(STAGING_DIR)/usr/lib" \
102 CROSS_COMPILE=yes \
103 CFLAGS="$(TARGET_CFLAGS) -fno-inline" \
104 LDFLAGS="$(TARGET_LDFLAGS)" \
105 LD="$(TARGET_CC)" \
106 HOSTPYTHON=./hostpython \
107 HOSTPGEN=./hostpgen \
108
109 define Build/Configure
110 endef
111
112 define Build/Compile
113 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
114 (cd $(PKG_BUILD_DIR); autoreconf --force --install || exit 0);
115 (cd $(PKG_BUILD_DIR); \
116 rm -rf config.cache; \
117 CONFIG_SITE= \
118 OPT="$(HOST_CFLAGS)" \
119 ./configure --without-cxx-main --without-threads --prefix=$(PKG_INSTALL_DIR)/host; \
120 );
121 $(MAKE) -C $(PKG_BUILD_DIR) \
122 python Parser/pgen
123 $(MAKE) -C $(PKG_BUILD_DIR) \
124 HOSTPYTHON=$(PKG_BUILD_DIR)/python \
125 sharedmods install
126 (cd $(PKG_BUILD_DIR);mv Parser/pgen hostpgen)
127 # The python executable needs to stay in the rootdir since its location will
128 # be used to compute the path of the config files.
129 $(CP) $(PKG_BUILD_DIR)/python $(PKG_BUILD_DIR)/hostpython
130 $(MAKE) -C $(PKG_BUILD_DIR) distclean
131 $(call Build/Configure/Default, \
132 --sysconfdir=/etc \
133 --disable-shared \
134 --without-cxx-main \
135 --with-threads \
136 --with-system-ffi \
137 ac_cv_lib_readline_readline=no \
138 ac_cv_have_chflags=no \
139 ac_cv_have_lchflags=no \
140 ac_cv_py_format_size_t=no \
141 OPT="$(TARGET_CFLAGS)" \
142 )
143 $(MAKE) -C $(PKG_BUILD_DIR) \
144 $(MAKE_OPTS) \
145 DESTDIR="$(PKG_INSTALL_DIR)" \
146 all install
147 endef
148
149 define Build/InstallDev
150 $(INSTALL_DIR) $(1)/mk $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
151 $(INSTALL_DATA) ./files/python-package.mk $(1)/mk/
152 $(CP) \
153 $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
154 $(1)/usr/include/
155 $(CP) \
156 $(PKG_INSTALL_DIR)/host/lib/python$(PYTHON_VERSION) \
157 $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).a \
158 $(1)/usr/lib/
159
160 $(CP) \
161 $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
162 $(1)/usr/lib/python$(PYTHON_VERSION)/
163
164 $(CP) \
165 $(PKG_INSTALL_DIR)/host/bin/python \
166 $(1)/usr/bin/hostpython
167 (cd $(2)/bin; \
168 ln -sf ../../usr/bin/hostpython python$(PYTHON_VERSION); \
169 ln -sf python$(PYTHON_VERSION) python)
170
171 $(CP) \
172 $(PKG_INSTALL_DIR)/host/bin/python$(PYTHON_VERSION)-config \
173 $(2)/bin/
174 $(SED) 's,^#!.*,#!/usr/bin/env python$(PYTHON_VERSION),g' $(2)/bin/python$(PYTHON_VERSION)-config
175
176 (cd $(2)/bin; \
177 ln -sf python$(PYTHON_VERSION)-config python-config;)
178 endef
179
180 define PyPackage/python/filespec
181 +|/usr/lib/python$(PYTHON_VERSION)
182 -|/usr/lib/python$(PYTHON_VERSION)/bsddb/test
183 -|/usr/lib/python$(PYTHON_VERSION)/config
184 +|/usr/lib/python$(PYTHON_VERSION)/config/Makefile
185 -|/usr/lib/python$(PYTHON_VERSION)/ctypes/test
186 -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst-*.exe
187 -|/usr/lib/python$(PYTHON_VERSION)/distutils/tests
188 -|/usr/lib/python$(PYTHON_VERSION)/email/test
189 -|/usr/lib/python$(PYTHON_VERSION)/idlelib
190 -|/usr/lib/python$(PYTHON_VERSION)/json/tests
191 -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
192 -|/usr/lib/python$(PYTHON_VERSION)/sqlite3
193 -|/usr/lib/python$(PYTHON_VERSION)/test
194 -|/usr/lib/python$(PYTHON_VERSION)/lib2to3
195 -|/usr/lib/python$(PYTHON_VERSION)/lib-old
196 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/gdbm.so
197 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so
198 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so
199 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so
200 -|/usr/lib/python$(PYTHON_VERSION)/pydoc_topics.py
201 -|/usr/lib/python$(PYTHON_VERSION)/pydoc.py
202 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ctypes_test.so
203 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
204 -|/usr/lib/python$(PYTHON_VERSION)/__future__.py
205 -|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
206 -|/usr/lib/python$(PYTHON_VERSION)/abc.py
207 -|/usr/lib/python$(PYTHON_VERSION)/codecs.py
208 -|/usr/lib/python$(PYTHON_VERSION)/compileall.py
209 -|/usr/lib/python$(PYTHON_VERSION)/ConfigParser.py
210 -|/usr/lib/python$(PYTHON_VERSION)/copy.py
211 -|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
212 -|/usr/lib/python$(PYTHON_VERSION)/dis.py
213 -|/usr/lib/python$(PYTHON_VERSION)/encodings
214 -|/usr/lib/python$(PYTHON_VERSION)/fnmatch.py
215 -|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
216 -|/usr/lib/python$(PYTHON_VERSION)/getopt.py
217 -|/usr/lib/python$(PYTHON_VERSION)/glob.py
218 -|/usr/lib/python$(PYTHON_VERSION)/hashlib.py
219 -|/usr/lib/python$(PYTHON_VERSION)/inspect.py
220 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/array.so
221 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/binascii.so
222 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/cStringIO.so
223 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/fcntl.so
224 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so
225 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so
226 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so
227 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so
228 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so
229 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so
230 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so
231 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so
232 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so
233 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/syslog.so
234 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/time.so
235 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so
236 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/zlib.so
237 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_weakref.so
238 -|/usr/lib/python$(PYTHON_VERSION)/linecache.py
239 -|/usr/lib/python$(PYTHON_VERSION)/md5.py
240 -|/usr/lib/python$(PYTHON_VERSION)/new.py
241 -|/usr/lib/python$(PYTHON_VERSION)/opcode.py
242 -|/usr/lib/python$(PYTHON_VERSION)/optparse.py
243 -|/usr/lib/python$(PYTHON_VERSION)/os.py
244 -|/usr/lib/python$(PYTHON_VERSION)/pickle.py
245 -|/usr/lib/python$(PYTHON_VERSION)/pickle.py
246 -|/usr/lib/python$(PYTHON_VERSION)/pkgutil.py
247 -|/usr/lib/python$(PYTHON_VERSION)/popen2.py
248 -|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
249 -|/usr/lib/python$(PYTHON_VERSION)/py_compile.py
250 -|/usr/lib/python$(PYTHON_VERSION)/random.py
251 -|/usr/lib/python$(PYTHON_VERSION)/repr.py
252 -|/usr/lib/python$(PYTHON_VERSION)/re.py
253 -|/usr/lib/python$(PYTHON_VERSION)/sha.py
254 -|/usr/lib/python$(PYTHON_VERSION)/site.py
255 -|/usr/lib/python$(PYTHON_VERSION)/socket.py
256 -|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
257 -|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
258 -|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
259 -|/usr/lib/python$(PYTHON_VERSION)/sre.py
260 -|/usr/lib/python$(PYTHON_VERSION)/stat.py
261 -|/usr/lib/python$(PYTHON_VERSION)/StringIO.py
262 -|/usr/lib/python$(PYTHON_VERSION)/stringprep.py
263 -|/usr/lib/python$(PYTHON_VERSION)/string.py
264 -|/usr/lib/python$(PYTHON_VERSION)/struct.py
265 -|/usr/lib/python$(PYTHON_VERSION)/subprocess.py
266 -|/usr/lib/python$(PYTHON_VERSION)/tempfile.py
267 -|/usr/lib/python$(PYTHON_VERSION)/textwrap.py
268 -|/usr/lib/python$(PYTHON_VERSION)/tokenize.py
269 -|/usr/lib/python$(PYTHON_VERSION)/token.py
270 -|/usr/lib/python$(PYTHON_VERSION)/traceback.py
271 -|/usr/lib/python$(PYTHON_VERSION)/types.py
272 -|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
273 -|/usr/lib/python$(PYTHON_VERSION)/warnings.py
274 -|/usr/lib/python$(PYTHON_VERSION)/weakref.py
275 endef
276
277 define PyPackage/python-mini/filespec
278 +|/usr/bin/python$(PYTHON_VERSION)
279 +|/usr/lib/python$(PYTHON_VERSION)/__future__.py
280 +|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
281 +|/usr/lib/python$(PYTHON_VERSION)/abc.py
282 +|/usr/lib/python$(PYTHON_VERSION)/codecs.py
283 +|/usr/lib/python$(PYTHON_VERSION)/compileall.py
284 +|/usr/lib/python$(PYTHON_VERSION)/ConfigParser.py
285 +|/usr/lib/python$(PYTHON_VERSION)/copy.py
286 +|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
287 +|/usr/lib/python$(PYTHON_VERSION)/dis.py
288 +|/usr/lib/python$(PYTHON_VERSION)/encodings
289 +|/usr/lib/python$(PYTHON_VERSION)/fnmatch.py
290 +|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
291 +|/usr/lib/python$(PYTHON_VERSION)/getopt.py
292 +|/usr/lib/python$(PYTHON_VERSION)/glob.py
293 +|/usr/lib/python$(PYTHON_VERSION)/hashlib.py
294 +|/usr/lib/python$(PYTHON_VERSION)/inspect.py
295 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/array.so
296 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/binascii.so
297 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/cStringIO.so
298 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/fcntl.so
299 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so
300 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so
301 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so
302 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so
303 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so
304 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so
305 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so
306 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so
307 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so
308 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/syslog.so
309 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/time.so
310 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so
311 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/zlib.so
312 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_weakref.so
313 +|/usr/lib/python$(PYTHON_VERSION)/linecache.py
314 +|/usr/lib/python$(PYTHON_VERSION)/md5.py
315 +|/usr/lib/python$(PYTHON_VERSION)/new.py
316 +|/usr/lib/python$(PYTHON_VERSION)/opcode.py
317 +|/usr/lib/python$(PYTHON_VERSION)/optparse.py
318 +|/usr/lib/python$(PYTHON_VERSION)/os.py
319 +|/usr/lib/python$(PYTHON_VERSION)/pickle.py
320 +|/usr/lib/python$(PYTHON_VERSION)/pickle.py
321 +|/usr/lib/python$(PYTHON_VERSION)/pkgutil.py
322 +|/usr/lib/python$(PYTHON_VERSION)/popen2.py
323 +|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
324 +|/usr/lib/python$(PYTHON_VERSION)/py_compile.py
325 +|/usr/lib/python$(PYTHON_VERSION)/random.py
326 +|/usr/lib/python$(PYTHON_VERSION)/repr.py
327 +|/usr/lib/python$(PYTHON_VERSION)/re.py
328 +|/usr/lib/python$(PYTHON_VERSION)/sha.py
329 +|/usr/lib/python$(PYTHON_VERSION)/site.py
330 +|/usr/lib/python$(PYTHON_VERSION)/socket.py
331 +|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
332 +|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
333 +|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
334 +|/usr/lib/python$(PYTHON_VERSION)/sre.py
335 +|/usr/lib/python$(PYTHON_VERSION)/stat.py
336 +|/usr/lib/python$(PYTHON_VERSION)/StringIO.py
337 +|/usr/lib/python$(PYTHON_VERSION)/stringprep.py
338 +|/usr/lib/python$(PYTHON_VERSION)/string.py
339 +|/usr/lib/python$(PYTHON_VERSION)/struct.py
340 +|/usr/lib/python$(PYTHON_VERSION)/subprocess.py
341 +|/usr/lib/python$(PYTHON_VERSION)/tempfile.py
342 +|/usr/lib/python$(PYTHON_VERSION)/textwrap.py
343 +|/usr/lib/python$(PYTHON_VERSION)/tokenize.py
344 +|/usr/lib/python$(PYTHON_VERSION)/token.py
345 +|/usr/lib/python$(PYTHON_VERSION)/traceback.py
346 +|/usr/lib/python$(PYTHON_VERSION)/types.py
347 +|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
348 +|/usr/lib/python$(PYTHON_VERSION)/warnings.py
349 +|/usr/lib/python$(PYTHON_VERSION)/weakref.py
350 endef
351
352 define PyPackage/python-mini/install
353 ln -sf python$(PYTHON_VERSION) $(1)/usr/bin/python
354 endef
355
356 define PyPackage/python-doc/filespec
357 +|/usr/lib/python$(PYTHON_VERSION)/pydoc_topics.py
358 +|/usr/lib/python$(PYTHON_VERSION)/pydoc.py
359 endef
360
361 define PyPackage/python-expat/filespec
362 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so
363 endef
364
365 define PyPackage/python-openssl/filespec
366 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so
367 endef
368
369 define PyPackage/python-sqlite3/filespec
370 +|/usr/lib/python$(PYTHON_VERSION)/sqlite3
371 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so
372 endef
373
374 define PyPackage/python-gdbm/filespec
375 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/gdbm.so
376 endef
377
378 $(eval $(call PyPackage,python))
379 $(eval $(call PyPackage,python-mini))
380 $(eval $(call PyPackage,python-doc))
381 $(eval $(call PyPackage,python-expat))
382 $(eval $(call PyPackage,python-openssl))
383 $(eval $(call PyPackage,python-sqlite3))
384 $(eval $(call PyPackage,python-gdbm))
385
386 $(eval $(call BuildPackage,python))
387 $(eval $(call BuildPackage,python-mini))
388 $(eval $(call BuildPackage,python-doc))
389 $(eval $(call BuildPackage,python-expat))
390 $(eval $(call BuildPackage,python-openssl))
391 $(eval $(call BuildPackage,python-sqlite3))
392 $(eval $(call BuildPackage,python-gdbm))