2003-12-03 23:58:26 +01:00
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# python
|
|
|
|
#
|
|
|
|
#############################################################
|
2008-09-02 02:54:49 +02:00
|
|
|
PYTHON_VERSION=2.4.5
|
2009-01-11 21:15:35 +01:00
|
|
|
PYTHON_VERSION_MAJOR=2.4
|
2004-10-08 23:48:43 +02:00
|
|
|
PYTHON_SOURCE:=Python-$(PYTHON_VERSION).tar.bz2
|
2003-12-03 23:58:26 +01:00
|
|
|
PYTHON_SITE:=http://python.org/ftp/python/$(PYTHON_VERSION)
|
|
|
|
PYTHON_DIR:=$(BUILD_DIR)/Python-$(PYTHON_VERSION)
|
2006-11-17 16:43:51 +01:00
|
|
|
PYTHON_CAT:=$(BZCAT)
|
2003-12-03 23:58:26 +01:00
|
|
|
PYTHON_BINARY:=python
|
2009-10-02 10:24:54 +02:00
|
|
|
PYTHON_TARGET_BINARY:=usr/bin/python$(PYTHON_VERSION_MAJOR)
|
2008-01-17 13:42:53 +01:00
|
|
|
PYTHON_DEPS:=
|
2009-01-11 21:15:35 +01:00
|
|
|
PYTHON_SITE_PACKAGE_DIR=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
|
2003-12-03 23:58:26 +01:00
|
|
|
|
2008-01-17 13:42:53 +01:00
|
|
|
BR2_PYTHON_DISABLED_MODULES=dbm zipfile
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON_READLINE),y)
|
2009-01-30 10:50:13 +01:00
|
|
|
PYTHON_DEPS += readline
|
2008-01-17 13:42:53 +01:00
|
|
|
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
|
2007-01-23 18:18:54 +01:00
|
|
|
|
2003-12-03 23:58:26 +01:00
|
|
|
$(DL_DIR)/$(PYTHON_SOURCE):
|
2009-01-16 12:42:52 +01:00
|
|
|
$(call DOWNLOAD,$(PYTHON_SITE),$(PYTHON_SOURCE))
|
2003-12-03 23:58:26 +01:00
|
|
|
|
|
|
|
python-source: $(DL_DIR)/$(PYTHON_SOURCE)
|
|
|
|
|
|
|
|
$(PYTHON_DIR)/.unpacked: $(DL_DIR)/$(PYTHON_SOURCE)
|
2004-10-09 23:19:47 +02:00
|
|
|
$(PYTHON_CAT) $(DL_DIR)/$(PYTHON_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
|
2007-01-23 18:18:54 +01:00
|
|
|
touch $@
|
2003-12-03 23:58:26 +01:00
|
|
|
|
2004-10-08 23:48:43 +02:00
|
|
|
$(PYTHON_DIR)/.patched: $(PYTHON_DIR)/.unpacked
|
2009-01-11 21:15:35 +01:00
|
|
|
toolchain/patch-kernel.sh $(PYTHON_DIR) package/python/ python-$(PYTHON_VERSION_MAJOR)-\*.patch
|
2007-01-23 18:18:54 +01:00
|
|
|
touch $@
|
2004-10-08 23:48:43 +02:00
|
|
|
|
|
|
|
$(PYTHON_DIR)/.hostpython: $(PYTHON_DIR)/.patched
|
|
|
|
(cd $(PYTHON_DIR); rm -rf config.cache; \
|
2007-01-23 18:18:54 +01:00
|
|
|
CC="$(HOSTCC)" OPT="-O2" \
|
2009-10-01 21:24:42 +02:00
|
|
|
./configure $(QUIET) \
|
2004-10-08 23:48:43 +02:00
|
|
|
--with-cxx=no \
|
2007-01-23 18:18:54 +01:00
|
|
|
$(DISABLE_NLS) && \
|
|
|
|
$(MAKE) python Parser/pgen && \
|
|
|
|
mv python hostpython && \
|
|
|
|
mv Parser/pgen Parser/hostpgen && \
|
2008-06-16 13:15:51 +02:00
|
|
|
$(MAKE) distclean \
|
2007-01-23 18:18:54 +01:00
|
|
|
) && \
|
|
|
|
touch $@
|
2004-10-08 23:48:43 +02:00
|
|
|
|
|
|
|
$(PYTHON_DIR)/.configured: $(PYTHON_DIR)/.hostpython
|
2003-12-03 23:58:26 +01:00
|
|
|
(cd $(PYTHON_DIR); rm -rf config.cache; \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2007-06-27 14:01:27 +02:00
|
|
|
$(TARGET_CONFIGURE_ARGS) \
|
2007-01-23 18:18:54 +01:00
|
|
|
OPT="$(TARGET_CFLAGS)" \
|
2009-10-01 21:24:42 +02:00
|
|
|
./configure $(QUIET) \
|
2003-12-03 23:58:26 +01:00
|
|
|
--target=$(GNU_TARGET_NAME) \
|
|
|
|
--host=$(GNU_TARGET_NAME) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
2004-10-08 23:48:43 +02:00
|
|
|
--with-cxx=no \
|
2009-01-15 07:28:05 +01:00
|
|
|
--enable-shared \
|
2007-06-26 19:45:08 +02:00
|
|
|
$(DISABLE_IPV6) \
|
2003-12-03 23:58:26 +01:00
|
|
|
$(DISABLE_NLS) \
|
2007-08-21 21:20:18 +02:00
|
|
|
)
|
2007-01-23 18:18:54 +01:00
|
|
|
touch $@
|
2003-12-03 23:58:26 +01:00
|
|
|
|
|
|
|
$(PYTHON_DIR)/$(PYTHON_BINARY): $(PYTHON_DIR)/.configured
|
2008-01-17 13:42:53 +01:00
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON_SSL),y)
|
2004-10-12 02:06:48 +02:00
|
|
|
export PYTHON_DISABLE_SSL=1
|
2008-01-17 13:42:53 +01:00
|
|
|
endif
|
2004-10-08 23:48:43 +02:00
|
|
|
$(MAKE) CC=$(TARGET_CC) -C $(PYTHON_DIR) DESTDIR=$(TARGET_DIR) \
|
2007-08-12 00:26:56 +02:00
|
|
|
PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
|
2008-10-30 18:21:18 +01:00
|
|
|
PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \
|
2007-01-23 18:18:54 +01:00
|
|
|
PYTHON_DISABLE_MODULES="$(BR2_PYTHON_DISABLED_MODULES)" \
|
2004-10-08 23:48:43 +02:00
|
|
|
HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen
|
2003-12-03 23:58:26 +01:00
|
|
|
|
|
|
|
$(TARGET_DIR)/$(PYTHON_TARGET_BINARY): $(PYTHON_DIR)/$(PYTHON_BINARY)
|
2008-01-17 13:42:53 +01:00
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON_SSL),y)
|
2004-10-12 02:06:48 +02:00
|
|
|
export PYTHON_DISABLE_SSL=1
|
2008-01-17 13:42:53 +01:00
|
|
|
endif
|
2008-09-02 02:54:49 +02:00
|
|
|
rm -rf $(PYTHON_DIR)/Lib/test
|
2004-10-08 23:48:43 +02:00
|
|
|
LD_LIBRARY_PATH=$(STAGING_DIR)/lib
|
|
|
|
$(MAKE) CC=$(TARGET_CC) -C $(PYTHON_DIR) install \
|
|
|
|
DESTDIR=$(TARGET_DIR) CROSS_COMPILE=yes \
|
2007-08-12 00:26:56 +02:00
|
|
|
PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
|
2008-10-30 18:21:18 +01:00
|
|
|
PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \
|
2007-01-23 18:18:54 +01:00
|
|
|
PYTHON_DISABLE_MODULES="$(BR2_PYTHON_DISABLED_MODULES)" \
|
|
|
|
HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen && \
|
2008-09-08 09:26:12 +02:00
|
|
|
rm $(TARGET_DIR)/usr/bin/python && \
|
2009-01-11 21:15:35 +01:00
|
|
|
ln -s python$(PYTHON_VERSION_MAJOR) $(TARGET_DIR)/usr/bin/python && \
|
2007-01-23 18:18:54 +01:00
|
|
|
rm $(TARGET_DIR)/usr/bin/idle && \
|
|
|
|
rm $(TARGET_DIR)/usr/bin/pydoc && \
|
|
|
|
find $(TARGET_DIR)/usr/lib/ -name '*.pyo' -exec rm {} \; && \
|
2003-12-03 23:58:26 +01:00
|
|
|
rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
|
2004-10-09 21:48:32 +02:00
|
|
|
$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc \
|
2009-01-11 21:15:35 +01:00
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/test
|
|
|
|
cp -dpr $(TARGET_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) $(STAGING_DIR)/usr/include/
|
|
|
|
mkdir -p $(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)
|
|
|
|
cp -dpr $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/config $(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/
|
2008-02-06 01:55:05 +01:00
|
|
|
|
2008-01-17 13:42:53 +01:00
|
|
|
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
|
2008-02-06 01:55:05 +01:00
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON_DEV),y)
|
2009-01-11 21:15:35 +01:00
|
|
|
rm -rf $(TARGET_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
|
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/config
|
2008-02-06 01:55:05 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON_BSDDB),y)
|
2009-01-11 21:15:35 +01:00
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/bsddb
|
2008-02-06 01:55:05 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON_CURSES),y)
|
2009-01-11 21:15:35 +01:00
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/curses
|
2008-02-06 01:55:05 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON_TKINTER),y)
|
2009-01-11 21:15:35 +01:00
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/lib-tk
|
2008-02-06 01:55:05 +01:00
|
|
|
endif
|
2009-10-02 10:24:54 +02:00
|
|
|
touch -c $@
|
2003-12-03 23:58:26 +01:00
|
|
|
|
2009-09-02 17:02:02 +02:00
|
|
|
python: $(PYTHON_DEPS) $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
|
2004-10-08 23:48:43 +02:00
|
|
|
|
2003-12-03 23:58:26 +01:00
|
|
|
python-clean:
|
|
|
|
-$(MAKE) -C $(PYTHON_DIR) distclean
|
2008-03-27 16:42:42 +01:00
|
|
|
rm -f $(PYTHON_DIR)/.configured $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
|
|
|
|
-rm -rf $(TARGET_DIR)/usr/lib/python* $(TARGET_DIR)/usr/include/python*
|
2009-01-17 01:19:06 +01:00
|
|
|
-rm -f $(STAGING_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR).so
|
2003-12-03 23:58:26 +01:00
|
|
|
|
|
|
|
python-dirclean:
|
|
|
|
rm -rf $(PYTHON_DIR)
|
2009-01-17 01:19:06 +01:00
|
|
|
|
|
|
|
#### LIBPYTHON
|
|
|
|
|
|
|
|
|
|
|
|
LIBPYTHON_BINARY:=libpython$(PYTHON_VERSION_MAJOR).so
|
|
|
|
|
|
|
|
libpython: python $(TARGET_DIR)/usr/lib/$(LIBPYTHON_BINARY)
|
|
|
|
|
|
|
|
|
2009-10-02 10:24:54 +02:00
|
|
|
$(STAGING_DIR)/usr/lib/$(LIBPYTHON_BINARY): $(TARGET_DIR)/$(PYTHON_TARGET_BINARY)
|
2009-01-17 01:19:06 +01:00
|
|
|
cp -dpr $(PYTHON_DIR)/$(LIBPYTHON_BINARY).* $(STAGING_DIR)/usr/lib
|
|
|
|
(\
|
|
|
|
cd $(STAGING_DIR)/usr/lib ; \
|
|
|
|
rm -f $(LIBPYTHON_BINARY) ; \
|
|
|
|
ln -s `basename \`ls libpython*.so.*\`` $(LIBPYTHON_BINARY) \
|
|
|
|
)
|
|
|
|
|
|
|
|
$(TARGET_DIR)/usr/lib/$(LIBPYTHON_BINARY): $(STAGING_DIR)/usr/lib/$(LIBPYTHON_BINARY)
|
|
|
|
cp -dpr $(STAGING_DIR)/usr/lib/$(LIBPYTHON_BINARY).* $(TARGET_DIR)/usr/lib
|
|
|
|
(\
|
|
|
|
cd $(TARGET_DIR)/usr/lib ; \
|
|
|
|
rm -f $(LIBPYTHON_BINARY) ; \
|
|
|
|
ln -s `basename \`ls libpython*.so.*\`` $(LIBPYTHON_BINARY) \
|
|
|
|
)
|
|
|
|
|
2005-02-10 04:06:39 +01:00
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# Toplevel Makefile options
|
|
|
|
#
|
|
|
|
#############################################################
|
2008-12-08 09:15:27 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON),y)
|
2005-02-10 04:06:39 +01:00
|
|
|
TARGETS+=python
|
|
|
|
endif
|