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