cc532278bce64eb8f534a43771f9cb5696b653ef
[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 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=python
12 PKG_VERSION:=2.5.1
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=Python-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)/
17 #PKG_MD5SUM:=afb5451049eda91fbde10bd5a4b7fadc
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
20
21 include $(INCLUDE_DIR)/package.mk
22 -include $(if $(DUMP),,./files/python-package.mk)
23
24 define Package/python/Default
25 SUBMENU:=Python
26 SECTION:=lang
27 CATEGORY:=Languages
28 TITLE:=Python 2.5 programming language
29 URL:=http://www.python.org/
30 endef
31
32 define Package/python/Default/description
33 Python is a dynamic object-oriented programming language that can be used
34 for many kinds of software development. It offers strong support for
35 integration with other languages and tools, comes with extensive standard
36 libraries, and can be learned in a few days. Many Python programmers
37 report substantial productivity gains and feel the language encourages
38 the development of higher quality, more maintainable code.
39 endef
40
41 define Package/python
42 $(call Package/python/Default)
43 TITLE+= (full)
44 DEPENDS:=+libpthread +zlib
45 PROVIDES:=python-core
46 endef
47
48 define Package/python/description
49 $(call Package/python/Default/description)
50 .
51 This package contains the full Python install.
52 endef
53
54 define Package/python-mini
55 $(call Package/python/Default)
56 TITLE+= (minimal)
57 DEPENDS:=+libpthread +zlib
58 PROVIDES:=python-core
59 endef
60
61 define Package/python-mini/description
62 $(call Package/python/Default/description)
63 .
64 This package contains only a minimal Python install.
65 endef
66
67 define Package/python-doc
68 $(call Package/python/Default)
69 TITLE:=Python interactive documentation
70 DEPENDS+= python-core
71 endef
72
73 define Package/python-expat
74 $(call Package/python/Default)
75 TITLE:=Python support for expat
76 DEPENDS+= python-core +libexpat
77 endef
78
79 define Package/python-openssl
80 $(call Package/python/Default)
81 TITLE:=Python support for OpenSSL
82 DEPENDS+= python-core +libopenssl
83 endef
84
85
86 PY_DISABLED_MODULES:= \
87 readline _curses _curses_panel _tkinter nis
88
89 MAKE_OPTS:=\
90 $(TARGET_CONFIGURE_OPTS) \
91 PYTHON_DISABLE_MODULES="$(PY_DISABLED_MODULES)" \
92 PYTHON_MODULES_INCLUDE="$(STAGING_DIR)/usr/include" \
93 PYTHON_MODULES_LIB="$(STAGING_DIR)/usr/lib" \
94 CROSS_COMPILE=yes \
95 CFLAGS="$(TARGET_CFLAGS) -fno-inline" \
96 LDFLAGS="$(TARGET_LDFLAGS)" \
97 LD="$(TARGET_CC)" \
98 HOSTPYTHON=$(PKG_INSTALL_DIR)/host/bin/python \
99 HOSTPGEN=./hostpgen \
100
101 define Build/Configure
102 endef
103
104 define Build/Compile
105 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
106 (cd $(PKG_BUILD_DIR); \
107 rm -rf config.cache; \
108 CONFIG_SITE= \
109 OPT="$(HOST_CFLAGS)" \
110 ./configure --without-cxx-main --without-threads --prefix=$(PKG_INSTALL_DIR)/host; \
111 );
112 $(MAKE) -C $(PKG_BUILD_DIR) \
113 python Parser/pgen
114 $(MAKE) -C $(PKG_BUILD_DIR) \
115 HOSTPYTHON=$(PKG_BUILD_DIR)/python \
116 sharedmods install
117 (cd $(PKG_BUILD_DIR);mv Parser/pgen hostpgen)
118 $(MAKE) -C $(PKG_BUILD_DIR) distclean
119
120 $(call Build/Configure/Default, \
121 --sysconfdir=/etc \
122 --disable-shared \
123 --disable-ipv6 \
124 --without-cxx-main \
125 --with-threads \
126 ac_cv_lib_readline_readline=no \
127 OPT="$(TARGET_CFLAGS)" \
128 )
129 $(MAKE) -C $(PKG_BUILD_DIR) \
130 $(MAKE_OPTS) \
131 DESTDIR="$(PKG_INSTALL_DIR)" \
132 all install
133 endef
134
135 define Build/InstallDev
136 $(INSTALL_DIR) $(1)/mk $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
137 $(INSTALL_DATA) ./files/python-package.mk $(1)/mk/
138 $(CP) \
139 $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
140 $(1)/usr/include/
141 $(CP) \
142 $(PKG_INSTALL_DIR)/host/lib/python$(PYTHON_VERSION) \
143 $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).a \
144 $(1)/usr/lib/
145
146 $(CP) \
147 $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
148 $(1)/usr/lib/python$(PYTHON_VERSION)/
149
150 $(CP) \
151 $(PKG_INSTALL_DIR)/host/bin/python \
152 $(1)/usr/bin/hostpython
153 (cd $(2)/bin; \
154 ln -sf ../../usr/bin/hostpython python$(PYTHON_VERSION); \
155 ln -sf python$(PYTHON_VERSION) python)
156
157 $(CP) \
158 $(PKG_INSTALL_DIR)/host/bin/python$(PYTHON_VERSION)-config \
159 $(2)/bin/
160 $(SED) 's,^#!.*,#!/usr/bin/env python2.5,g' $(2)/bin/python$(PYTHON_VERSION)-config
161
162 (cd $(2)/bin; \
163 ln -sf python$(PYTHON_VERSION)-config python-config;)
164 endef
165
166 define PyPackage/python/filespec
167 +|/usr/bin/python$(PYTHON_VERSION)
168 +|/usr/include/python$(PYTHON_VERSION)/pyconfig.h
169 +|/usr/lib/python$(PYTHON_VERSION)
170 -|/usr/lib/python$(PYTHON_VERSION)/bsddb/test
171 -|/usr/lib/python$(PYTHON_VERSION)/config
172 +|/usr/lib/python$(PYTHON_VERSION)/config/Makefile
173 -|/usr/lib/python$(PYTHON_VERSION)/ctypes/test
174 -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst-*.exe
175 -|/usr/lib/python$(PYTHON_VERSION)/distutils/tests
176 -|/usr/lib/python$(PYTHON_VERSION)/email/test
177 -|/usr/lib/python$(PYTHON_VERSION)/idlelib
178 -|/usr/lib/python$(PYTHON_VERSION)/lib-tk
179 -|/usr/lib/python$(PYTHON_VERSION)/sqlite3/test
180 -|/usr/lib/python$(PYTHON_VERSION)/test
181 endef
182
183 define PyPackage/python/install
184 ln -sf python$(PYTHON_VERSION) $(1)/usr/bin/python
185 endef
186
187 define PyPackage/python-mini/filespec
188 +|/usr/bin/python$(PYTHON_VERSION)
189 +|/usr/lib/python$(PYTHON_VERSION)/__future__.py
190 +|/usr/lib/python$(PYTHON_VERSION)/codecs.py
191 +|/usr/lib/python$(PYTHON_VERSION)/compileall.py
192 +|/usr/lib/python$(PYTHON_VERSION)/ConfigParser.py
193 +|/usr/lib/python$(PYTHON_VERSION)/copy.py
194 +|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
195 +|/usr/lib/python$(PYTHON_VERSION)/dis.py
196 +|/usr/lib/python$(PYTHON_VERSION)/encodings
197 +|/usr/lib/python$(PYTHON_VERSION)/fnmatch.py
198 +|/usr/lib/python$(PYTHON_VERSION)/getopt.py
199 +|/usr/lib/python$(PYTHON_VERSION)/glob.py
200 +|/usr/lib/python$(PYTHON_VERSION)/hashlib.py
201 +|/usr/lib/python$(PYTHON_VERSION)/inspect.py
202 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/array.so
203 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/binascii.so
204 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/cStringIO.so
205 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/fcntl.so
206 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so
207 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so
208 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so
209 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so
210 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so
211 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so
212 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so
213 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so
214 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so
215 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/syslog.so
216 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/time.so
217 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so
218 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/zlib.so
219 +|/usr/lib/python$(PYTHON_VERSION)/linecache.py
220 +|/usr/lib/python$(PYTHON_VERSION)/md5.py
221 +|/usr/lib/python$(PYTHON_VERSION)/opcode.py
222 +|/usr/lib/python$(PYTHON_VERSION)/optparse.py
223 +|/usr/lib/python$(PYTHON_VERSION)/os.py
224 +|/usr/lib/python$(PYTHON_VERSION)/pickle.py
225 +|/usr/lib/python$(PYTHON_VERSION)/pickle.py
226 +|/usr/lib/python$(PYTHON_VERSION)/pkgutil.py
227 +|/usr/lib/python$(PYTHON_VERSION)/popen2.py
228 +|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
229 +|/usr/lib/python$(PYTHON_VERSION)/py_compile.py
230 +|/usr/lib/python$(PYTHON_VERSION)/random.py
231 +|/usr/lib/python$(PYTHON_VERSION)/repr.py
232 +|/usr/lib/python$(PYTHON_VERSION)/re.py
233 +|/usr/lib/python$(PYTHON_VERSION)/sha.py
234 +|/usr/lib/python$(PYTHON_VERSION)/site.py
235 +|/usr/lib/python$(PYTHON_VERSION)/socket.py
236 +|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
237 +|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
238 +|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
239 +|/usr/lib/python$(PYTHON_VERSION)/sre.py
240 +|/usr/lib/python$(PYTHON_VERSION)/stat.py
241 +|/usr/lib/python$(PYTHON_VERSION)/StringIO.py
242 +|/usr/lib/python$(PYTHON_VERSION)/stringprep.py
243 +|/usr/lib/python$(PYTHON_VERSION)/string.py
244 +|/usr/lib/python$(PYTHON_VERSION)/struct.py
245 +|/usr/lib/python$(PYTHON_VERSION)/subprocess.py
246 +|/usr/lib/python$(PYTHON_VERSION)/tempfile.py
247 +|/usr/lib/python$(PYTHON_VERSION)/textwrap.py
248 +|/usr/lib/python$(PYTHON_VERSION)/tokenize.py
249 +|/usr/lib/python$(PYTHON_VERSION)/token.py
250 +|/usr/lib/python$(PYTHON_VERSION)/traceback.py
251 +|/usr/lib/python$(PYTHON_VERSION)/types.py
252 +|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
253 +|/usr/lib/python$(PYTHON_VERSION)/warnings.py
254 endef
255
256 define PyPackage/python-mini/install
257 ln -sf python$(PYTHON_VERSION) $(1)/usr/bin/python
258 endef
259
260 define PyPackage/python-doc/filespec
261 +|/usr/lib/python$(PYTHON_VERSION)/pydoc.py
262 endef
263
264 define PyPackage/python-expat/filespec
265 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so
266 endef
267
268 define PyPackage/python-openssl/filespec
269 +|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so
270 endef
271
272 $(eval $(call PyPackage,python))
273 $(eval $(call PyPackage,python-mini))
274 $(eval $(call PyPackage,python-doc))
275 $(eval $(call PyPackage,python-expat))
276 $(eval $(call PyPackage,python-openssl))
277
278 $(eval $(call BuildPackage,python))
279 $(eval $(call BuildPackage,python-mini))
280 $(eval $(call BuildPackage,python-doc))
281 $(eval $(call BuildPackage,python-expat))
282 $(eval $(call BuildPackage,python-openssl))
283