massive python changes:
[openwrt/svn-archive/archive.git] / lang / python / Makefile
1 #
2 # Copyright (C) 2006 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 PKG_CAT:=bzcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 PY_DISABLED_MODULES=\
26 _curses _curses_panel _tkinter nis
27
28 define Package/python
29 SECTION:=lang
30 CATEGORY:=Languages
31 DEPENDS:=+libexpat +libopenssl +libpthread +libreadline +uclibcxx
32 TITLE:=Python 2.5 programming language
33 URL:=http://www.python.org/
34 endef
35
36 define Package/python/description
37 Python programming language
38 Python is a dynamic object-oriented programming language that
39 can be used for many kinds of software development. It offers
40 strong support for integration with other languages and tools,
41 comes with extensive standard libraries, and can be learned in a
42 few days. Many Python programmers report substantial productivity
43 gains and feel the language encourages the development of higher
44 quality, more maintainable code.
45 endef
46
47 define Build/Configure
48 (cd $(PKG_BUILD_DIR); \
49 rm -rf config.cache; \
50 CONFIG_SITE= \
51 ./configure --with-threads=no --with-cxx=no; \
52 $(MAKE) python Parser/pgen; \
53 mv python hostpython; \
54 mv Parser/pgen Parser/hostpgen; \
55 make distclean; \
56 );
57 $(call Build/Configure/Default, \
58 --disable-shared \
59 --with-cxx=no \
60 --sysconfdir=/etc \
61 --with-threads \
62 --disable-ipv6 \
63 HOSTPYTHON=./hostpython \
64 HOSTPGEN=./Parser/hostpgen \
65 )
66 endef
67
68 MAKE_OPTS:=\
69 $(TARGET_CONFIGURE_OPTS) \
70 PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/include \
71 PYTHON_MODULES_LIB=$(STAGING_DIR)/lib \
72 PYTHON_DISABLE_MODULES="$(PY_DISABLED_MODULES)" \
73 CFLAGS="$(TARGET_CFLAGS) -fno-inline" \
74 LDFLAGS="$(TARGET_LDFLAGS)" \
75 LD="$(TARGET_CC)" \
76 HOSTPYTHON=./hostpython \
77 HOSTPGEN=./Parser/hostpgen
78
79 define Build/Compile
80 $(MAKE) -C $(PKG_BUILD_DIR) \
81 $(MAKE_OPTS) \
82 DESTDIR="$(PKG_INSTALL_DIR)" \
83 EXTRA_CFLAGS="$(TARGET_CFLAGS) -fno-inline" \
84 CROSS_COMPILE=yes \
85 all install
86 endef
87
88 define Build/InstallDev
89 mkdir -p $(STAGING_DIR)/usr/bin
90 $(CP) $(PKG_BUILD_DIR)/hostpython $(STAGING_DIR)/usr/bin/
91 mkdir -p $(STAGING_DIR)/usr/include
92 $(CP) $(PKG_INSTALL_DIR)/usr/include/python2.5 $(STAGING_DIR)/usr/include/
93 mkdir -p $(STAGING_DIR)/usr/lib
94 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.5 $(STAGING_DIR)/usr/lib/
95 $(CP) $(PKG_BUILD_DIR)/libpython2.5.a $(STAGING_DIR)/usr/lib/python2.5/
96 endef
97
98 define Build/UninstallDev
99 rm -rf $(STAGING_DIR)/usr/bin/hostpython \
100 $(STAGING_DIR)/usr/include/python2.5 \
101 $(STAGING_DIR)/usr/lib/python2.5
102 endef
103
104 define Package/python/install
105 $(INSTALL_DIR) $(1)/usr/bin
106 $(CP) $(PKG_INSTALL_DIR)/usr/bin/python2.5 $(1)/usr/bin/
107 $(CP) $(PKG_INSTALL_DIR)/usr/bin/python $(1)/usr/bin/
108 $(INSTALL_DIR) $(1)/usr/include/python2.5
109 $(CP) $(PKG_INSTALL_DIR)/usr/include/python2.5/Python.h $(1)/usr/include/python2.5/
110 $(INSTALL_DIR) $(1)/usr/lib
111 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.5 $(1)/usr/lib/
112 rm -rf $(1)/usr/lib/python2.5/bsddb/test \
113 $(1)/usr/lib/python2.5/distutils/tests \
114 $(1)/usr/lib/python2.5/email/test \
115 $(1)/usr/lib/python2.5/idlelib \
116 $(1)/usr/lib/python2.5/lib-tk \
117 $(1)/usr/lib/python2.5/sqlite3/test \
118 $(1)/usr/lib/python2.5/ctypes/test \
119 $(1)/usr/lib/python2.5/test
120
121 endef
122
123 $(eval $(call BuildPackage,python))