7a918cf09ee6065f779447a4fca443887fcdc9fb
[openwrt/svn-archive/archive.git] / lang / python / Makefile
1 #
2 # Copyright (C) 2006-2008 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.1
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=Python-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)/
16 PKG_MD5SUM:=e81c2f0953aa60f8062c05a4673f2be0
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
89 PY_DISABLED_MODULES:= \
90 readline _curses _curses_panel _tkinter nis
91
92 MAKE_OPTS:=\
93 $(TARGET_CONFIGURE_OPTS) \
94 PYTHON_DISABLE_MODULES="$(PY_DISABLED_MODULES)" \
95 PYTHON_MODULES_INCLUDE="$(STAGING_DIR)/usr/include" \
96 PYTHON_MODULES_LIB="$(STAGING_DIR)/usr/lib" \
97 CROSS_COMPILE=yes \
98 CFLAGS="$(TARGET_CFLAGS) -fno-inline" \
99 LDFLAGS="$(TARGET_LDFLAGS)" \
100 LD="$(TARGET_CC)" \
101 HOSTPYTHON=./hostpython \
102 HOSTPGEN=./hostpgen \
103
104 define Build/Configure
105 endef
106
107 define Build/Compile
108 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
109 (cd $(PKG_BUILD_DIR); autoreconf --force --install || exit 0);
110 (cd $(PKG_BUILD_DIR); \
111 rm -rf config.cache; \
112 CONFIG_SITE= \
113 OPT="$(HOST_CFLAGS)" \
114 ./configure --without-cxx-main --without-threads --prefix=$(PKG_INSTALL_DIR)/host; \
115 );
116 $(MAKE) -C $(PKG_BUILD_DIR) \
117 python Parser/pgen
118 $(MAKE) -C $(PKG_BUILD_DIR) \
119 HOSTPYTHON=$(PKG_BUILD_DIR)/python \
120 sharedmods install
121 (cd $(PKG_BUILD_DIR);mv Parser/pgen hostpgen)
122 # The python executable needs to stay in the rootdir since its location will
123 # be used to compute the path of the config files.
124 $(CP) $(PKG_BUILD_DIR)/python $(PKG_BUILD_DIR)/hostpython
125 $(MAKE) -C $(PKG_BUILD_DIR) distclean
126 $(call Build/Configure/Default, \
127 --sysconfdir=/etc \
128 --disable-shared \
129 --disable-ipv6 \
130 --without-cxx-main \
131 --with-threads \
132 --with-system-ffi \
133 ac_cv_lib_readline_readline=no \
134 ac_cv_have_chflags=no \
135 ac_cv_have_lchflags=no \
136 ac_cv_py_format_size_t=no \
137 OPT="$(TARGET_CFLAGS)" \
138 )
139 $(MAKE) -C $(PKG_BUILD_DIR) \
140 $(MAKE_OPTS) \
141 DESTDIR="$(PKG_INSTALL_DIR)" \
142 all install
143 endef
144
145 define Build/InstallDev
146 $(INSTALL_DIR) $(1)/mk $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
147 $(INSTALL_DATA) ./files/python-package.mk $(1)/mk/
148 $(CP) \
149 $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
150 $(1)/usr/include/
151 $(CP) \
152 $(PKG_INSTALL_DIR)/host/lib/python$(PYTHON_VERSION) \
153 $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).a \
154 $(1)/usr/lib/
155
156 $(CP) \
157 $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
158 $(1)/usr/lib/python$(PYTHON_VERSION)/
159
160 $(CP) \
161 $(PKG_INSTALL_DIR)/host/bin/python \
162 $(1)/usr/bin/hostpython
163 (cd $(2)/bin; \
164 ln -sf ../../usr/bin/hostpython python$(PYTHON_VERSION); \
165 ln -sf python$(PYTHON_VERSION) python)
166
167 $(CP) \
168 $(PKG_INSTALL_DIR)/host/bin/python$(PYTHON_VERSION)-config \
169 $(2)/bin/
170 $(SED) 's,^#!.*,#!/usr/bin/env python$(PYTHON_VERSION),g' $(2)/bin/python$(PYTHON_VERSION)-config
171
172 (cd $(2)/bin; \
173 ln -sf python$(PYTHON_VERSION)-config python-config;)
174 endef
175
176 define PyPackage/python/filespec
177 +|/usr/bin/python$(PYTHON_VERSION)
178 +|/usr/lib/python$(PYTHON_VERSION)
179 -|/usr/lib/python$(PYTHON_VERSION)/bsddb/test
180 -|/usr/lib/python$(PYTHON_VERSION)/config
181 +|/usr/lib/python$(PYTHON_VERSION)/config/Makefile
182 -|/usr/lib/python$(PYTHON_VERSION)/ctypes/test
183 -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst-*.exe
184 -|/usr/lib/python$(PYTHON_VERSION)/distutils/tests
185 -|/usr/lib/python$(PYTHON_VERSION)/email/test
186 -|/usr/lib/python$(PYTHON_VERSION)/idlelib
187 -|/usr/lib/python$(PYTHON_VERSION)/json/tests
188 -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
189 -|/usr/lib/python$(PYTHON_VERSION)/sqlite3
190 -|/usr/lib/python$(PYTHON_VERSION)/test
191 -|/usr/lib/python$(PYTHON_VERSION)/lib2to3
192 -|/usr/lib/python$(PYTHON_VERSION)/lib-old
193 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so
194 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so
195 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so
196 -|/usr/lib/python$(PYTHON_VERSION)/pydoc_topics.py
197 -|/usr/lib/python$(PYTHON_VERSION)/pydoc.py
198 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ctypes_test.so
199 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
200 -|/usr/lib/python$(PYTHON_VERSION)/__future__.py
201 -|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
202 -|/usr/lib/python$(PYTHON_VERSION)/abc.py
203 -|/usr/lib/python$(PYTHON_VERSION)/codecs.py
204 -|/usr/lib/python$(PYTHON_VERSION)/compileall.py
205 -|/usr/lib/python$(PYTHON_VERSION)/ConfigParser.py
206 -|/usr/lib/python$(PYTHON_VERSION)/copy.py
207 -|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
208 -|/usr/lib/python$(PYTHON_VERSION)/dis.py
209 -|/usr/lib/python$(PYTHON_VERSION)/encodings
210 -|/usr/lib/python$(PYTHON_VERSION)/fnmatch.py
211 -|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
212 -|/usr/lib/python$(PYTHON_VERSION)/getopt.py
213 -|/usr/lib/python$(PYTHON_VERSION)/glob.py
214 -|/usr/lib/python$(PYTHON_VERSION)/hashlib.py
215 -|/usr/lib/python$(PYTHON_VERSION)/inspect.py
216 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/array.so
217 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/binascii.so
218 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/cStringIO.so
219 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/fcntl.so
220 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so
221 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so
222 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so
223 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so
224 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so
225 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so
226 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so
227 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so
228 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so
229 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/syslog.so
230 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/time.so
231 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so
232 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/zlib.so
233 -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_weakref.so
234 -|/usr/lib/python$(PYTHON_VERSION)/linecache.py
235 -|/usr/lib/python$(PYTHON_VERSION)/md5.py
236 -|/usr/lib/python$(PYTHON_VERSION)/new.py
237 -|/usr/lib/python$(PYTHON_VERSION)/opcode.py
238 -|/usr/lib/python$(PYTHON_VERSION)/optparse.py
239 -|/usr/lib/python$(PYTHON_VERSION)/os.py
240 -|/usr/lib/python$(PYTHON_VERSION)/pickle.py
241 -|/usr/lib/python$(PYTHON_VERSION)/pickle.py
242 -|/usr/lib/python$(PYTHON_VERSION)/pkgutil.py
243 -|/usr/lib/python$(PYTHON_VERSION)/popen2.py
244 -|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
245 -|/usr/lib/python$(PYTHON_VERSION)/py_compile.py
246 -|/usr/lib/python$(PYTHON_VERSION)/random.py
247 -|/usr/lib/python$(PYTHON_VERSION)/repr.py
248 -|/usr/lib/python$(PYTHON_VERSION)/re.py
249 -|/usr/lib/python$(PYTHON_VERSION)/sha.py
250 -|/usr/lib/python$(PYTHON_VERSION)/site.py
251 -|/usr/lib/python$(PYTHON_VERSION)/socket.py
252 -|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
253 -|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
254 -|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
255 -|/usr/lib/python$(PYTHON_VERSION)/sre.py
256 -|/usr/lib/python$(PYTHON_VERSION)/stat.py
257 -|/usr/lib/python$(PYTHON_VERSION)/StringIO.py
258 -|/usr/lib/python$(PYTHON_VERSION)/stringprep.py
259 -|/usr/lib/python$(PYTHON_VERSION)/string.py
260 -|/usr/lib/python$(PYTHON_VERSION)/struct.py
261 -|/usr/lib/python$(PYTHON_VERSION)/subprocess.py
262 -|/usr/lib/python$(PYTHON_VERSION)/tempfile.py
263 -|/usr/lib/python$(PYTHON_VERSION)/textwrap.py
264 -|/usr/lib/python$(PYTHON_VERSION)/tokenize.py
265 -|/usr/lib/python$(PYTHON_VERSION)/token.py
266 -|/usr/lib/python$(PYTHON_VERSION)/traceback.py
267 -|/usr/lib/python$(PYTHON_VERSION)/types.py
268 -|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
269 -|/usr/lib/python$(PYTHON_VERSION)/warnings.py
270 -|/usr/lib/python$(PYTHON_VERSION)/weakref.py
271 endef
272
273 define PyPackage/python/install
274 ln -sf python$(PYTHON_VERSION) $(1)/usr/bin/python
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 $(eval $(call PyPackage,python))
370 $(eval $(call PyPackage,python-mini))
371 $(eval $(call PyPackage,python-doc))
372 $(eval $(call PyPackage,python-expat))
373 $(eval $(call PyPackage,python-openssl))
374 $(eval $(call PyPackage,python-sqlite3))
375
376 $(eval $(call BuildPackage,python))
377 $(eval $(call BuildPackage,python-mini))
378 $(eval $(call BuildPackage,python-doc))
379 $(eval $(call BuildPackage,python-expat))
380 $(eval $(call BuildPackage,python-openssl))
381 $(eval $(call BuildPackage,python-sqlite3))