update to python 2.5.1, security and bug fixes... clean up the makefile slightly...
[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=pyexpat dbm gdbm bsddb \
26 _curses _curses_panel _tkinter nis zipfile
27
28 define Package/python
29 SECTION:=lang
30 CATEGORY:=Languages
31 DEPENDS:=+uclibcxx +libpthread +libreadline +libncurses
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) -lncurses" \
75 LD="$(TARGET_CC)" \
76 HOSTPYTHON=./hostpython \
77 HOSTPGEN=./Parser/hostpgen
78
79 define Build/Compile
80 export PYTHON_DISABLE_SSL=1
81 $(MAKE) -C $(PKG_BUILD_DIR) \
82 $(MAKE_OPTS) \
83 DESTDIR="$(PKG_INSTALL_DIR)" \
84 EXTRA_CFLAGS="$(TARGET_CFLAGS) -fno-inline" \
85 CROSS_COMPILE=yes \
86 all install
87 endef
88
89 define Build/InstallDev
90 mkdir -p $(STAGING_DIR)/usr/bin
91 $(CP) $(PKG_BUILD_DIR)/hostpython $(STAGING_DIR)/usr/bin/
92 mkdir -p $(STAGING_DIR)/usr/include
93 $(CP) $(PKG_INSTALL_DIR)/usr/include/python2.5 $(STAGING_DIR)/usr/include/
94 mkdir -p $(STAGING_DIR)/usr/lib
95 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.5 $(STAGING_DIR)/usr/lib/
96 endef
97
98 define Build/UninstallDev
99 rm -rf \
100 $(STAGING_DIR)/usr/{include,lib}/python2.5
101 endef
102
103 define Package/python/install
104 $(INSTALL_DIR) $(1)/usr/bin
105 $(CP) $(PKG_INSTALL_DIR)/usr/bin/python2.5 $(1)/usr/bin/
106 $(CP) $(PKG_INSTALL_DIR)/usr/bin/python $(1)/usr/bin/
107 $(INSTALL_DIR) $(1)/usr/lib
108 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.5 $(1)/usr/lib/
109 rm -rf \
110 $(1)/usr/lib/python2.5/bsddb/test \
111 $(1)/usr/lib/python2.5/distutils/tests \
112 $(1)/usr/lib/python2.5/email/test \
113 $(1)/usr/lib/python2.5/idlelib \
114 $(1)/usr/lib/python2.5/lib-tk \
115 $(1)/usr/lib/python2.5/test \
116
117 endef
118
119 $(eval $(call BuildPackage,python))