From 4596fb4d859b7d03ad3cf9ea7069e19e118bf9a6 Mon Sep 17 00:00:00 2001 From: Ørjan Malde Date: Dec 08 2018 19:00:14 +0000 Subject: native python2: build using sbpython2 (external build project for Python-2.7). Signed-off-by: Lucio Andrés Illanes Albornoz --- diff --git a/patches/python2-2.7.14.local.patch b/patches/python2-2.7.14.local.patch deleted file mode 100644 index a0700b9..0000000 --- a/patches/python2-2.7.14.local.patch +++ /dev/null @@ -1,171 +0,0 @@ ---- a/Lib/smtpd.py -+++ b/Lib/smtpd.py -@@ -1,4 +1,3 @@ --#! /usr/bin/env python - """An RFC 2821 smtp proxy. - - Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]] ---- a/Lib/smtplib.py -+++ b/Lib/smtplib.py -@@ -1,5 +1,3 @@ --#! /usr/bin/env python -- - '''SMTP/ESMTP client class. - - This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -238,6 +238,7 @@ - ########################################################################## - # Parser - PGEN= Parser/pgen$(EXE) -+PGEN_FOR_BUILD= $(PGEN) - - PSRCS= \ - Parser/acceler.c \ -@@ -498,8 +499,9 @@ - *) quiet="";; \ - esac; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ _PYTHON_HOST_PLATFORM='$(_PYTHON_HOST_PLATFORM)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ -- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build -+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build - - # Build static library - # avoid long command lines, same as LIBRARY_OBJS -@@ -1206,10 +1208,10 @@ - # This goes into $(exec_prefix) - sharedinstall: sharedmods - $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ -- --prefix=$(prefix) \ -- --install-scripts=$(BINDIR) \ -- --install-platlib=$(DESTSHARED) \ -- --root=$(DESTDIR)/ -+ --prefix=$(DESTDIR)///./$(prefix) \ -+ --install-scripts=$(DESTDIR)/./$(BINDIR) \ -+ --install-platlib=$(DESTDIR)/./$(DESTSHARED) \ -+ --root=/ - -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py* - - # Here are a couple of targets for MacOSX again, to install a full ---- a/configure -+++ b/configure -@@ -3212,6 +3212,9 @@ - *-*-cygwin*) - ac_sys_system=Cygwin - ;; -+ *-*-midipix*) -+ ac_sys_system=Midipix -+ ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" -@@ -3258,6 +3261,9 @@ - *-*-cygwin*) - _host_cpu= - ;; -+ *-*-midipix*) -+ _host_cpu= -+ ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" -@@ -14570,7 +14576,7 @@ - $as_echo_n "(cached) " >&6 - else - if test "$cross_compiling" = yes; then : -- ac_cv_have_long_long_format="cross -- assuming no" -+ ac_cv_have_long_long_format="cross -- assuming yes" - if test x$GCC = xyes; then - save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror -Wformat" -@@ -14651,7 +14657,7 @@ - $as_echo "$ac_cv_have_long_long_format" >&6; } - fi - --if test "$ac_cv_have_long_long_format" = yes -+if test "$ac_cv_have_long_long_format" != no - then - - $as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h ---- a/setup.py -+++ b/setup.py -@@ -294,6 +294,13 @@ - (ext.name, sys.exc_info()[1])) - self.failed.append(ext.name) - return -+ -+ if cross_compiling: -+ self.announce( -+ 'INFO: skipping import check for cross-compiled: "%s"' % -+ ext.name) -+ return -+ - # Workaround for Mac OS X: The Carbon-based modules cannot be - # reliably imported into a command-line Python - if 'Carbon' in ext.extra_link_args: -@@ -376,13 +383,6 @@ - finally: - os.unlink(tmpfile) - -- if multiarch_path_component != '': -- add_dir_to_list(self.compiler.library_dirs, -- '/usr/lib/' + multiarch_path_component) -- add_dir_to_list(self.compiler.include_dirs, -- '/usr/include/' + multiarch_path_component) -- return -- - if not find_executable('dpkg-architecture'): - return - opt = '' -@@ -398,10 +398,6 @@ - if ret >> 8 == 0: - with open(tmpfile) as fp: - multiarch_path_component = fp.readline().strip() -- add_dir_to_list(self.compiler.library_dirs, -- '/usr/lib/' + multiarch_path_component) -- add_dir_to_list(self.compiler.include_dirs, -- '/usr/include/' + multiarch_path_component) - finally: - os.unlink(tmpfile) - -@@ -439,11 +435,6 @@ - - def detect_modules(self): - # Ensure that /usr/local is always used -- if not cross_compiling: -- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') -- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') -- if cross_compiling: -- self.add_gcc_paths() - self.add_multiarch_paths() - - # Add paths specified in the environment variables LDFLAGS and -@@ -501,16 +492,6 @@ - # be assumed that no additional -I,-L directives are needed. - inc_dirs = self.compiler.include_dirs[:] - lib_dirs = self.compiler.library_dirs[:] -- if not cross_compiling: -- for d in ( -- '/usr/include', -- ): -- add_dir_to_list(inc_dirs, d) -- for d in ( -- '/lib64', '/usr/lib64', -- '/lib', '/usr/lib', -- ): -- add_dir_to_list(lib_dirs, d) - exts = [] - missing = [] - -@@ -2002,6 +1983,9 @@ - return True - - def configure_ctypes(self, ext): -+ if cross_compiling: -+ self.use_system_libffi = True -+ - if not self.use_system_libffi: - if host_platform == 'darwin': - return self.configure_ctypes_darwin(ext) diff --git a/vars/build.vars b/vars/build.vars index 2d14508..4b96518 100644 --- a/vars/build.vars +++ b/vars/build.vars @@ -1130,9 +1130,12 @@ patch patchutils perl python2 python3 ruby smallbasic tcl"; : ${PKG_PERL_SUBDIR:=perl-${PKG_PERL_VERSION}}; : ${PKG_PYTHON2_SHA256SUM:=304c9b202ea6fbd0a4a8e0ad3733715fbd4749f2204a9173a58ec53c32ea73e8}; : ${PKG_PYTHON2_VERSION:=2.7.14}; -: ${PKG_PYTHON2_URL:=https://www.python.org/ftp/python/${PKG_PYTHON2_VERSION}/Python-${PKG_PYTHON2_VERSION}.tgz}; -: ${PKG_PYTHON2_CONFIGURE_ARGS:="--build=x86_64 -C --enable-ipv6 --enable-shared --enable-unicode=ucs4 --host=${DEFAULT_TARGET} --prefix=${PREFIX_NATIVE}"}; -: ${PKG_PYTHON2_ENV_VARS_EXTRA:="PYTHON_FOR_BUILD=${PREFIX}/bin/python2.7.wrapper"}; +: ${PKG_PYTHON2_URL:="https://www.python.org/ftp/python/${PKG_PYTHON2_VERSION}/Python-${PKG_PYTHON2_VERSION}.tgz"}; +: ${PKG_PYTHON2_URLS_GIT:="sbpython2=${DEFAULT_GITROOT}/python/sbpython2@main"}; +: ${PKG_PYTHON2_BASE_DIR:=${BUILD_WORKDIR}/python2-native-${DEFAULT_TARGET}}; +: ${PKG_PYTHON2_BUILD_DIR:=build/python2}; +: ${PKG_PYTHON2_CONFIGURE:=build/sbpython2/configure}; +: ${PKG_PYTHON2_CONFIGURE_ARGS:="--source-dir=../../Python-${PKG_PYTHON2_VERSION} --sysroot=${PREFIX_NATIVE} --prefix= --target=${DEFAULT_TARGET}"}; : ${PKG_PYTHON3_SHA256SUM:=687e067d9f391da645423c7eda8205bae9d35edc0c76ef5218dcbe4cc770d0d7}; : ${PKG_PYTHON3_VERSION:=3.5.1}; : ${PKG_PYTHON3_URL:=https://www.python.org/ftp/python/${PKG_PYTHON3_VERSION}/Python-${PKG_PYTHON3_VERSION}.tgz}; diff --git a/vars/python2.vars b/vars/python2.vars new file mode 100644 index 0000000..aee9d6c --- /dev/null +++ b/vars/python2.vars @@ -0,0 +1,11 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_python2_fetch_git() { + ex_rtl_fileop rm "${PKG_BASE_DIR}/sbpython2"; + ex_rtl_fetch_urls_git "${PKG_BASE_DIR}/build" "sbpython2=${DEFAULT_GITROOT}/python/sbpython2@main"; + ex_pkg_state_set "${PKG_NAME}" fetch -extract; +}; + +# vim:filetype=sh