|
@@ -0,0 +1,199 @@
|
|
1
|
+#
|
|
2
|
+# Copyright (C) 2006-2014 OpenWrt.org
|
|
3
|
+#
|
|
4
|
+# This is free software, licensed under the GNU General Public License v2.
|
|
5
|
+# See /LICENSE for more information.
|
|
6
|
+#
|
|
7
|
+
|
|
8
|
+include $(TOPDIR)/rules.mk
|
|
9
|
+
|
|
10
|
+# The file included below defines PYTHON_VERSION
|
|
11
|
+-include $(if $(DUMP),,./files/python-package.mk)
|
|
12
|
+
|
|
13
|
+PKG_NAME:=python
|
|
14
|
+PKG_RELEASE:=1
|
|
15
|
+PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
|
|
16
|
+
|
|
17
|
+PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
|
|
18
|
+PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)
|
|
19
|
+PKG_MD5SUM:=6cafc183b4106476dd73d5738d7f616a
|
|
20
|
+
|
|
21
|
+PKG_LICENSE:=PSF
|
|
22
|
+PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
|
|
23
|
+
|
|
24
|
+PKG_INSTALL:=1
|
|
25
|
+PKG_BUILD_PARALLEL:=1
|
|
26
|
+HOST_BUILD_PARALLEL:=1
|
|
27
|
+
|
|
28
|
+PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
|
|
29
|
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
|
|
30
|
+
|
|
31
|
+PKG_BUILD_DEPENDS:=python/host
|
|
32
|
+
|
|
33
|
+include $(INCLUDE_DIR)/host-build.mk
|
|
34
|
+include $(INCLUDE_DIR)/package.mk
|
|
35
|
+
|
|
36
|
+define Package/python/Default
|
|
37
|
+ SUBMENU:=Python
|
|
38
|
+ SECTION:=lang
|
|
39
|
+ CATEGORY:=Languages
|
|
40
|
+ TITLE:=Python $(PYTHON_VERSION) programming language
|
|
41
|
+ URL:=http://www.python.org/
|
|
42
|
+ MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
|
|
43
|
+endef
|
|
44
|
+
|
|
45
|
+define Package/python/Default/description
|
|
46
|
+ Python is a dynamic object-oriented programming language that can be used
|
|
47
|
+ for many kinds of software development. It offers strong support for
|
|
48
|
+ integration with other languages and tools, comes with extensive standard
|
|
49
|
+ libraries, and can be learned in a few days. Many Python programmers
|
|
50
|
+ report substantial productivity gains and feel the language encourages
|
|
51
|
+ the development of higher quality, more maintainable code.
|
|
52
|
+endef
|
|
53
|
+
|
|
54
|
+define Package/python
|
|
55
|
+$(call Package/python/Default)
|
|
56
|
+ DEPENDS:=+libpthread +zlib +libffi
|
|
57
|
+endef
|
|
58
|
+
|
|
59
|
+define Package/python/description
|
|
60
|
+$(call Package/python/Default/description)
|
|
61
|
+ .
|
|
62
|
+ This package contains only the interpreter and the bare minimum for the interpreter to start.
|
|
63
|
+endef
|
|
64
|
+
|
|
65
|
+MAKE_FLAGS:=\
|
|
66
|
+ $(TARGET_CONFIGURE_OPTS) \
|
|
67
|
+ DESTDIR="$(PKG_INSTALL_DIR)" \
|
|
68
|
+ CROSS_COMPILE=yes \
|
|
69
|
+ CFLAGS="$(TARGET_CFLAGS) -DNDEBUG -fno-inline" \
|
|
70
|
+ LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
71
|
+ LD="$(TARGET_CC)"
|
|
72
|
+
|
|
73
|
+ENABLE_IPV6:=
|
|
74
|
+ifeq ($(CONFIG_IPV6),y)
|
|
75
|
+ ENABLE_IPV6 += --enable-ipv6
|
|
76
|
+endif
|
|
77
|
+
|
|
78
|
+#=======================================================================
|
|
79
|
+# Notes: adding these so that I don't forget, and can track why stuff
|
|
80
|
+# was did as was did
|
|
81
|
+# - Arguments below were moved to ./files/config.site file, and disabled
|
|
82
|
+# ac_cv_have_chflags=no \
|
|
83
|
+# ac_cv_have_lchflags=no \
|
|
84
|
+# ac_cv_py_format_size_t=no \
|
|
85
|
+# ac_cv_have_long_long_format=yes \
|
|
86
|
+# ac_cv_buggy_getaddrinfo=no \
|
|
87
|
+# - --without-ensurepip added, because the build wants to ensure that
|
|
88
|
+# it works; that's a good idea, but for now, it requires special
|
|
89
|
+# setup, and we can do that later
|
|
90
|
+# - --without-pymalloc added, becase in Python 3, modules are suffixed
|
|
91
|
+# with m; e.g. so some paths are python3.4m instead of python3.4
|
|
92
|
+# all this is detailed here:
|
|
93
|
+# http://legacy.python.org/dev/peps/pep-3149/
|
|
94
|
+#=======================================================================
|
|
95
|
+
|
|
96
|
+define Build/Configure
|
|
97
|
+ -$(MAKE) -C $(PKG_BUILD_DIR) distclean
|
|
98
|
+ (cd $(PKG_BUILD_DIR); autoreconf --force --install || exit 0)
|
|
99
|
+ # The python executable needs to stay in the rootdir since its location will
|
|
100
|
+ # be used to compute the path of the config files.
|
|
101
|
+ $(CP) ./files/config.site $(PKG_BUILD_DIR)
|
|
102
|
+ $(call Build/Configure/Default, \
|
|
103
|
+ --sysconfdir=/etc \
|
|
104
|
+ --disable-shared \
|
|
105
|
+ --without-cxx-main \
|
|
106
|
+ --with-threads \
|
|
107
|
+ --with-system-ffi="$(STAGING_DIR)/usr" \
|
|
108
|
+ --without-ensurepip \
|
|
109
|
+ --without-pymalloc \
|
|
110
|
+ $(ENABLE_IPV6) \
|
|
111
|
+ CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
|
|
112
|
+ OPT="$(TARGET_CFLAGS)" \
|
|
113
|
+ )
|
|
114
|
+endef
|
|
115
|
+
|
|
116
|
+define Build/InstallDev
|
|
117
|
+ $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
|
|
118
|
+ $(INSTALL_DIR) $(STAGING_DIR)/mk/
|
|
119
|
+ $(INSTALL_DATA) ./files/python-package.mk $(STAGING_DIR)/mk/
|
|
120
|
+ $(CP) \
|
|
121
|
+ $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
|
|
122
|
+ $(1)/usr/include/
|
|
123
|
+ $(CP) \
|
|
124
|
+ $(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) \
|
|
125
|
+ $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).a \
|
|
126
|
+ $(1)/usr/lib/
|
|
127
|
+ $(CP) \
|
|
128
|
+ $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION) \
|
|
129
|
+ $(1)/usr/lib/python$(PYTHON_VERSION)/
|
|
130
|
+
|
|
131
|
+ $(CP) \
|
|
132
|
+ $(STAGING_DIR_HOST)/bin/python$(PYTHON_VERSION)-config \
|
|
133
|
+ $(2)/bin/
|
|
134
|
+ $(SED) 's,^#!.*,#!/usr/bin/env python$(PYTHON_VERSION),g' $(2)/bin/python$(PYTHON_VERSION)-config
|
|
135
|
+
|
|
136
|
+ (cd $(2)/bin; \
|
|
137
|
+ ln -sf python$(PYTHON_VERSION)-config python-config;)
|
|
138
|
+endef
|
|
139
|
+
|
|
140
|
+define PyPackage/python/filespec
|
|
141
|
++|/usr/bin/python$(PYTHON_VERSION)
|
|
142
|
++|/usr/lib/python$(PYTHON_VERSION)/encodings
|
|
143
|
++|/usr/lib/python$(PYTHON_VERSION)/_collections_abc.py
|
|
144
|
++|/usr/lib/python$(PYTHON_VERSION)/_sitebuiltins.py
|
|
145
|
++|/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py
|
|
146
|
++|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
|
|
147
|
++|/usr/lib/python$(PYTHON_VERSION)/abc.py
|
|
148
|
++|/usr/lib/python$(PYTHON_VERSION)/codecs.py
|
|
149
|
++|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
|
|
150
|
++|/usr/lib/python$(PYTHON_VERSION)/io.py
|
|
151
|
++|/usr/lib/python$(PYTHON_VERSION)/os.py
|
|
152
|
++|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
|
|
153
|
++|/usr/lib/python$(PYTHON_VERSION)/site.py
|
|
154
|
++|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
|
|
155
|
++|/usr/lib/python$(PYTHON_VERSION)/stat.py
|
|
156
|
+endef
|
|
157
|
+
|
|
158
|
+define PyPackage/python/install
|
|
159
|
+ # Adding the lib-dynload folder (even just empty) suppresses 2 warnings when starting Python
|
|
160
|
+ $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/lib-dynload/
|
|
161
|
+ ln -sf python$(PYTHON_VERSION) $(1)/usr/bin/python
|
|
162
|
+endef
|
|
163
|
+
|
|
164
|
+define Host/Configure
|
|
165
|
+ -$(MAKE) -C $(HOST_BUILD_DIR) distclean
|
|
166
|
+ (cd $(HOST_BUILD_DIR); autoreconf --force --install || exit 0)
|
|
167
|
+ (cd $(HOST_BUILD_DIR); \
|
|
168
|
+ rm -rf config.cache; \
|
|
169
|
+ CONFIG_SITE= \
|
|
170
|
+ OPT="$(HOST_CFLAGS)" \
|
|
171
|
+ ./configure \
|
|
172
|
+ --without-cxx-main \
|
|
173
|
+ --without-ensurepip \
|
|
174
|
+ --without-pymalloc \
|
|
175
|
+ --with-threads \
|
|
176
|
+ --prefix=$(STAGING_DIR_HOST); \
|
|
177
|
+ )
|
|
178
|
+endef
|
|
179
|
+
|
|
180
|
+define Host/Compile
|
|
181
|
+ +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
|
|
182
|
+ python Parser/pgen
|
|
183
|
+ +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
|
|
184
|
+ sharedmods
|
|
185
|
+endef
|
|
186
|
+
|
|
187
|
+define Host/Install
|
|
188
|
+ $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
|
|
189
|
+ $(MAKE) -C $(HOST_BUILD_DIR) \
|
|
190
|
+ install
|
|
191
|
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(STAGING_DIR_HOST)/bin/
|
|
192
|
+endef
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+$(eval $(call HostBuild))
|
|
196
|
+
|
|
197
|
+$(eval $(call PyPackage,python))
|
|
198
|
+
|
|
199
|
+$(eval $(call BuildPackage,python))
|