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