summaryrefslogtreecommitdiffstats
path: root/package/python/python.mk
diff options
context:
space:
mode:
Diffstat (limited to 'package/python/python.mk')
-rw-r--r--package/python/python.mk70
1 files changed, 65 insertions, 5 deletions
diff --git a/package/python/python.mk b/package/python/python.mk
index a0eff5c0c..9f7e1b885 100644
--- a/package/python/python.mk
+++ b/package/python/python.mk
@@ -10,10 +10,61 @@ PYTHON_DIR:=$(BUILD_DIR)/Python-$(PYTHON_VERSION)
PYTHON_CAT:=$(BZCAT)
PYTHON_BINARY:=python
PYTHON_TARGET_BINARY:=usr/bin/python
+PYTHON_DEPS:=
-# these could use checks for some BR2_PACKAGE_foo,y
-BR2_PYTHON_DISABLED_MODULES=readline pyexpat dbm gdbm bsddb \
- _curses _curses_panel _tkinter nis zipfile
+BR2_PYTHON_DISABLED_MODULES=dbm zipfile
+
+ifeq ($(BR2_PACKAGE_PYTHON_READLINE),y)
+PYTHON_DEPS += readline-target
+else
+BR2_PYTHON_DISABLED_MODULES += readline
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_CURSES),y)
+PYTHON_DEPS += ncurses
+else
+BR2_PYTHON_DISABLED_MODULES += _curses _curses_panel
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PYEXPAT),y)
+PYTHON_DEPS += expat
+else
+BR2_PYTHON_DISABLED_MODULES += pyexpat
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_GDBM),y)
+PYTHON_DEPS += gdbm
+else
+BR2_PYTHON_DISABLED_MODULES += gdbm
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_BSDDB),y)
+PYTHON_DEPS += berkeleydb
+else
+BR2_PYTHON_DISABLED_MODULES += bsddb
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_TKINTER),y)
+PYTHON_DEPS += tcl
+else
+BR2_PYTHON_DISABLED_MODULES += _tkinter
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_SSL),y)
+PYTHON_DEPS += openssl
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_NIS),y)
+BR2_PYTHON_DISABLED_MODULES += nis
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_CODECSCJK),y)
+BR2_PYTHON_DISABLED_MODULES += _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_UNICODEDATA),y)
+BR2_PYTHON_DISABLED_MODULES += unicodedata
+endif
$(DL_DIR)/$(PYTHON_SOURCE):
$(WGET) -P $(DL_DIR) $(PYTHON_SITE)/$(PYTHON_SOURCE)
@@ -59,7 +110,9 @@ $(PYTHON_DIR)/.configured: $(PYTHON_DIR)/.hostpython
touch $@
$(PYTHON_DIR)/$(PYTHON_BINARY): $(PYTHON_DIR)/.configured
+ifneq ($(BR2_PACKAGE_PYTHON_SSL),y)
export PYTHON_DISABLE_SSL=1
+endif
$(MAKE) CC=$(TARGET_CC) -C $(PYTHON_DIR) DESTDIR=$(TARGET_DIR) \
PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
PYTHON_MODULES_LIB=$(STAGING_DIR)/lib \
@@ -67,7 +120,9 @@ $(PYTHON_DIR)/$(PYTHON_BINARY): $(PYTHON_DIR)/.configured
HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen
$(TARGET_DIR)/$(PYTHON_TARGET_BINARY): $(PYTHON_DIR)/$(PYTHON_BINARY)
+ifneq ($(BR2_PACKAGE_PYTHON_SSL),y)
export PYTHON_DISABLE_SSL=1
+endif
LD_LIBRARY_PATH=$(STAGING_DIR)/lib
$(MAKE) CC=$(TARGET_CC) -C $(PYTHON_DIR) install \
DESTDIR=$(TARGET_DIR) CROSS_COMPILE=yes \
@@ -78,13 +133,18 @@ $(TARGET_DIR)/$(PYTHON_TARGET_BINARY): $(PYTHON_DIR)/$(PYTHON_BINARY)
rm $(TARGET_DIR)/usr/bin/python?.? && \
rm $(TARGET_DIR)/usr/bin/idle && \
rm $(TARGET_DIR)/usr/bin/pydoc && \
- find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -exec rm {} \; && \
find $(TARGET_DIR)/usr/lib/ -name '*.pyo' -exec rm {} \; && \
rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc \
$(TARGET_DIR)/usr/lib/python*/test
+ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
+ find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -exec rm {} \;
+endif
+ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
+ find $(TARGET_DIR)/usr/lib/ -name '*.py' -exec rm {} \;
+endif
-python: uclibc $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
+python: uclibc $(PYTHON_DEPS) $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
python-clean:
-$(MAKE) -C $(PYTHON_DIR) distclean