replace lots of manual install commands with INSTALL_* variables
[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.4.3
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=Python-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.python.org/ftp/python/2.4.3/
17 PKG_MD5SUM:=141c683447d5e76be1d2bd4829574f02
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 define Package/python
26   SECTION:=lang
27   CATEGORY:=Languages
28   DEPENDS:=+uclibcxx
29   TITLE:=Python programming language
30   URL:=http://www.python.org/
31 endef
32
33 define Package/python/description
34 Python programming language
35         Python is a dynamic object-oriented programming language that 
36         can be used for many kinds of software development. It offers 
37         strong support for integration with other languages and tools, 
38         comes with extensive standard libraries, and can be learned in a 
39         few days. Many Python programmers report substantial productivity 
40         gains and feel the language encourages the development of higher 
41         quality, more maintainable code.
42 endef
43
44 define Build/Configure
45         (cd $(PKG_BUILD_DIR); \
46                 CONFIG_SITE= \
47                 ./configure --with-threads=no; \
48                 $(MAKE) python Parser/pgen; \
49                 mv python hostpython; \
50                 mv Parser/pgen Parser/hostpgen; \
51                 make distclean; \
52                 echo "import sys" > $(PKG_BUILD_DIR)/setup.py.new; \
53                 echo "sys.path.append('$(PKG_BUILD_DIR)/Lib')" >> $(PKG_BUILD_DIR)/setup.py.new; \
54                 cat $(PKG_BUILD_DIR)/setup.py >> $(PKG_BUILD_DIR)/setup.py.new; \
55                 mv $(PKG_BUILD_DIR)/setup.py.new $(PKG_BUILD_DIR)/setup.py; \
56         );
57         $(call Build/Configure/Default, \
58                 --disable-shared \
59                 --sysconfdir=/etc \
60                 --with-threads=no, \
61                 HOSTPYTHON=./hostpython \
62                 HOSTPGEN=./Parser/hostpgen \
63         )
64 endef
65
66 MAKE_OPTS:=\
67                 $(TARGET_CONFIGURE_OPTS) \
68                 CFLAGS="$(TARGET_CFLAGS)" \
69                 LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" \
70                 LD="$(TARGET_CC)" \
71                 HOSTPYTHON=./hostpython \
72                 HOSTPGEN=./Parser/hostpgen
73
74 define Build/Compile
75         $(MAKE) -C $(PKG_BUILD_DIR) \
76                 $(MAKE_OPTS) \
77                 DESTDIR="$(PKG_INSTALL_DIR)" \
78                 all install
79 endef
80
81 define Build/InstallDev
82         mkdir -p $(STAGING_DIR)/usr/bin
83         $(CP) $(PKG_BUILD_DIR)/hostpython $(STAGING_DIR)/usr/bin/
84         mkdir -p $(STAGING_DIR)/usr/include
85         $(CP) $(PKG_INSTALL_DIR)/usr/include/python2.4 $(STAGING_DIR)/usr/include/
86         mkdir -p $(STAGING_DIR)/usr/lib
87         $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.4 $(STAGING_DIR)/usr/lib/
88 endef
89
90 define Build/UninstallDev
91         rm -rf \
92                 $(STAGING_DIR)/usr/{include,lib}/python2.4
93 endef
94
95 define Package/python/install
96         $(INSTALL_DIR) $(1)/usr/bin
97         $(CP) $(PKG_INSTALL_DIR)/usr/bin/python2.4 $(1)/usr/bin/
98         ln -sf python2.4 $(1)/usr/bin/python
99         $(INSTALL_DIR) $(1)/usr/lib
100         $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.4 $(1)/usr/lib/
101         rm -rf \
102                 $(1)/usr/lib/python2.4/bsddb/test \
103                 $(1)/usr/lib/python2.4/distutils/tests \
104                 $(1)/usr/lib/python2.4/email/test \
105                 $(1)/usr/lib/python2.4/idlelib \
106                 $(1)/usr/lib/python2.4/lib-tk \
107                 $(1)/usr/lib/python2.4/test \
108
109 endef
110
111 $(eval $(call BuildPackage,python))