2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2012-11-07 06:01:21 +01:00
|
|
|
#
|
|
|
|
# python3
|
|
|
|
#
|
2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2013-06-06 01:53:25 +02:00
|
|
|
|
2014-02-18 21:40:01 +01:00
|
|
|
PYTHON3_VERSION_MAJOR = 3.4
|
2015-04-26 14:26:36 +02:00
|
|
|
PYTHON3_VERSION = $(PYTHON3_VERSION_MAJOR).3
|
2014-03-26 23:22:06 +01:00
|
|
|
PYTHON3_SOURCE = Python-$(PYTHON3_VERSION).tar.xz
|
|
|
|
PYTHON3_SITE = http://python.org/ftp/python/$(PYTHON3_VERSION)
|
2014-07-23 20:33:20 +02:00
|
|
|
PYTHON3_LICENSE = Python software foundation license v2, others
|
|
|
|
PYTHON3_LICENSE_FILES = LICENSE
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2014-12-28 21:54:52 +01:00
|
|
|
# Python itself doesn't use libtool, but it includes the source code
|
|
|
|
# of libffi, which uses libtool. Unfortunately, it uses a beta version
|
|
|
|
# of libtool for which we don't have a matching patch. However, this
|
|
|
|
# is not a problem, because we don't use the libffi copy included in
|
|
|
|
# the Python sources, but instead use an external libffi library.
|
|
|
|
PYTHON3_LIBTOOL_PATCH = NO
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
# Python needs itself and a "pgen" program to build itself, both being
|
|
|
|
# provided in the Python sources. So in order to cross-compile Python,
|
|
|
|
# we need to build a host Python first. This host Python is also
|
|
|
|
# installed in $(HOST_DIR), as it is needed when cross-compiling
|
|
|
|
# third-party Python modules.
|
|
|
|
|
2014-09-27 21:32:44 +02:00
|
|
|
HOST_PYTHON3_CONF_OPTS += \
|
2014-02-18 21:40:01 +01:00
|
|
|
--without-ensurepip \
|
2012-11-07 06:01:21 +01:00
|
|
|
--without-cxx-main \
|
|
|
|
--disable-sqlite3 \
|
|
|
|
--disable-tk \
|
|
|
|
--with-expat=system \
|
|
|
|
--disable-curses \
|
|
|
|
--disable-codecs-cjk \
|
|
|
|
--disable-nis \
|
2014-02-18 21:40:05 +01:00
|
|
|
--enable-unicodedata \
|
2012-11-07 06:01:21 +01:00
|
|
|
--disable-test-modules \
|
2014-02-18 21:40:01 +01:00
|
|
|
--disable-idle3 \
|
2015-01-10 16:32:48 +01:00
|
|
|
--disable-ossaudiodev \
|
2014-02-18 21:40:01 +01:00
|
|
|
--disable-pyo-build
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2014-03-05 00:29:49 +01:00
|
|
|
# Make sure that LD_LIBRARY_PATH overrides -rpath.
|
|
|
|
# This is needed because libpython may be installed at the same time that
|
|
|
|
# python is called.
|
|
|
|
HOST_PYTHON3_CONF_ENV += \
|
|
|
|
LDFLAGS="$(HOST_LDFLAGS) -Wl,--enable-new-dtags"
|
|
|
|
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
PYTHON3_DEPENDENCIES = host-python3 libffi
|
2012-11-07 06:01:21 +01:00
|
|
|
|
|
|
|
HOST_PYTHON3_DEPENDENCIES = host-expat host-zlib
|
|
|
|
|
|
|
|
PYTHON3_INSTALL_STAGING = YES
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_READLINE),y)
|
|
|
|
PYTHON3_DEPENDENCIES += readline
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y)
|
|
|
|
PYTHON3_DEPENDENCIES += ncurses
|
2013-05-29 10:36:57 +02:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-curses
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
2014-07-23 20:33:19 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_DECIMAL),y)
|
|
|
|
PYTHON3_DEPENDENCIES += mpdecimal
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-libmpdec=system
|
2014-07-23 20:33:19 +02:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-libmpdec=none
|
2014-07-23 20:33:19 +02:00
|
|
|
endif
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y)
|
|
|
|
PYTHON3_DEPENDENCIES += expat
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-expat=system
|
2012-11-07 06:01:21 +01:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-expat=none
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
2013-01-27 16:38:56 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --enable-old-stdlib-cache
|
2013-01-27 16:38:56 +01:00
|
|
|
endif
|
|
|
|
|
2014-02-18 21:40:01 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-pyc-build
|
2014-02-18 21:40:01 +01:00
|
|
|
endif
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
|
|
|
|
PYTHON3_DEPENDENCIES += sqlite
|
2013-05-29 10:36:57 +02:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-sqlite3
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_SSL),y)
|
2013-05-29 10:36:57 +02:00
|
|
|
PYTHON3_DEPENDENCIES += openssl
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK),y)
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-codecs-cjk
|
2013-05-29 10:36:57 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA),y)
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-unicodedata
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2),y)
|
2013-05-29 10:36:57 +02:00
|
|
|
PYTHON3_DEPENDENCIES += bzip2
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB),y)
|
|
|
|
PYTHON3_DEPENDENCIES += zlib
|
|
|
|
endif
|
|
|
|
|
2015-01-10 16:32:48 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_OSSAUDIODEV),y)
|
|
|
|
PYTHON3_CONF_OPTS += --enable-ossaudiodev
|
|
|
|
else
|
|
|
|
PYTHON3_CONF_OPTS += --disable-ossaudiodev
|
|
|
|
endif
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
PYTHON3_CONF_ENV += \
|
|
|
|
ac_cv_have_long_long_format=yes \
|
|
|
|
ac_cv_file__dev_ptmx=yes \
|
|
|
|
ac_cv_file__dev_ptc=yes \
|
2014-07-09 12:38:59 +02:00
|
|
|
ac_cv_working_tzset=yes
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2014-11-13 22:23:23 +01:00
|
|
|
# uClibc is known to have a broken wcsftime() implementation, so tell
|
|
|
|
# Python 3 to fall back to strftime() instead.
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
|
|
|
|
PYTHON3_CONF_ENV += ac_cv_func_wcsftime=no
|
|
|
|
endif
|
|
|
|
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += \
|
2014-02-18 21:40:01 +01:00
|
|
|
--without-ensurepip \
|
2012-11-07 06:01:21 +01:00
|
|
|
--without-cxx-main \
|
|
|
|
--with-system-ffi \
|
|
|
|
--disable-pydoc \
|
|
|
|
--disable-test-modules \
|
|
|
|
--disable-lib2to3 \
|
|
|
|
--disable-tk \
|
|
|
|
--disable-nis \
|
2014-02-18 21:40:01 +01:00
|
|
|
--disable-idle3 \
|
|
|
|
--disable-pyo-build
|
|
|
|
|
|
|
|
# This is needed to make sure the Python build process doesn't try to
|
|
|
|
# regenerate those files with the pgen program. Otherwise, it builds
|
|
|
|
# pgen for the target, and tries to run it on the host.
|
|
|
|
|
|
|
|
define PYTHON3_TOUCH_GRAMMAR_FILES
|
|
|
|
touch $(@D)/Include/graminit.h $(@D)/Python/graminit.c
|
2012-11-07 06:01:21 +01:00
|
|
|
endef
|
|
|
|
|
2015-11-14 16:54:30 +01:00
|
|
|
# This prevents the Python Makefile from regenerating the
|
|
|
|
# Python/importlib.h header if Lib/importlib/_bootstrap.py has changed
|
|
|
|
# because its generation is broken in a cross-compilation environment
|
|
|
|
# and importlib.h is not used.
|
|
|
|
|
|
|
|
define PYTHON3_TOUCH_IMPORTLIB_H
|
|
|
|
touch $(@D)/Python/importlib.h
|
|
|
|
endef
|
|
|
|
|
2014-02-18 21:40:01 +01:00
|
|
|
PYTHON3_POST_PATCH_HOOKS += PYTHON3_TOUCH_GRAMMAR_FILES
|
2015-11-14 16:54:30 +01:00
|
|
|
PYTHON3_POST_PATCH_HOOKS += PYTHON3_TOUCH_IMPORTLIB_H
|
2012-11-07 06:01:21 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Remove useless files. In the config/ directory, only the Makefile
|
|
|
|
# and the pyconfig.h files are needed at runtime.
|
|
|
|
#
|
|
|
|
define PYTHON3_REMOVE_USELESS_FILES
|
2013-06-30 21:29:08 +02:00
|
|
|
rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)-config
|
|
|
|
rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)m-config
|
|
|
|
rm -f $(TARGET_DIR)/usr/bin/python3-config
|
2013-07-10 20:39:18 +02:00
|
|
|
rm -f $(TARGET_DIR)/usr/bin/smtpd.py.3
|
2014-02-18 21:40:00 +01:00
|
|
|
for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-$(PYTHON3_VERSION_MAJOR)m/ \
|
2012-11-07 06:01:21 +01:00
|
|
|
-type f -not -name pyconfig.h -a -not -name Makefile` ; do \
|
|
|
|
rm -f $$i ; \
|
|
|
|
done
|
2014-09-30 23:38:57 +02:00
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/__pycache__/
|
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/lib-dynload/sysconfigdata/__pycache__
|
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/collections/__pycache__
|
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/importlib/__pycache__
|
2012-11-07 06:01:21 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
|
|
|
|
|
2014-02-18 21:40:07 +01:00
|
|
|
#
|
|
|
|
# Make sure libpython gets stripped out on target
|
|
|
|
#
|
|
|
|
define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
|
|
|
|
chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)*.so
|
|
|
|
endef
|
|
|
|
|
|
|
|
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_ENSURE_LIBPYTHON_STRIPPED
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
PYTHON3_AUTORECONF = YES
|
|
|
|
|
2013-01-18 05:06:12 +01:00
|
|
|
define PYTHON3_INSTALL_SYMLINK
|
|
|
|
ln -fs python3 $(TARGET_DIR)/usr/bin/python
|
|
|
|
endef
|
|
|
|
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON),y)
|
|
|
|
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
|
|
|
|
endif
|
2013-01-18 05:06:14 +01:00
|
|
|
|
2014-03-05 23:04:41 +01:00
|
|
|
# Some packages may have build scripts requiring python3, whatever is the
|
|
|
|
# python version chosen for the target.
|
|
|
|
# Only install the python symlink in the host tree if python3 is enabled
|
|
|
|
# for the target.
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
2014-02-18 21:39:58 +01:00
|
|
|
define HOST_PYTHON3_INSTALL_SYMLINK
|
|
|
|
ln -fs python3 $(HOST_DIR)/usr/bin/python
|
2014-03-05 23:04:41 +01:00
|
|
|
ln -fs python3-config $(HOST_DIR)/usr/bin/python-config
|
2013-01-18 05:06:14 +01:00
|
|
|
endef
|
|
|
|
|
2014-02-18 21:39:58 +01:00
|
|
|
HOST_PYTHON3_POST_INSTALL_HOOKS += HOST_PYTHON3_INSTALL_SYMLINK
|
2014-03-05 23:04:41 +01:00
|
|
|
endif
|
2013-01-18 05:06:14 +01:00
|
|
|
|
2014-02-18 21:40:02 +01:00
|
|
|
# Provided to other packages
|
2014-04-12 23:03:10 +02:00
|
|
|
PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/sysconfigdata/:$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/
|
2013-01-18 05:06:14 +01:00
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
$(eval $(autotools-package))
|
|
|
|
$(eval $(host-autotools-package))
|
2014-09-30 23:39:01 +02:00
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
|
|
|
|
define PYTHON3_FINALIZE_TARGET
|
|
|
|
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | xargs -0 rm -f
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
|
|
|
|
define PYTHON3_FINALIZE_TARGET
|
|
|
|
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | xargs -0 rm -f
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
|
|
|
TARGET_FINALIZE_HOOKS += PYTHON3_FINALIZE_TARGET
|