wok-6.x annotate python/stuff/python-2.7.3-xcompile.patch @ rev 23047

slitaz-i18n-extra: add audacity
author Richard Dunbar <mojo@slitaz.org>
date Thu Mar 05 22:11:28 2020 -0500 (2020-03-05)
parents
children
rev   line source
pankso@16307 1 diff -ur Python-2.7.3.orig/configure Python-2.7.3-Source/configure
pankso@16307 2 --- Python-2.7.3.orig/configure 2012-04-09 19:07:36.000000000 -0400
pankso@16307 3 +++ Python-2.7.3-Source/configure 2012-10-23 14:10:45.305220393 -0400
pankso@16307 4 @@ -13697,7 +13697,7 @@
pankso@16307 5 $as_echo_n "(cached) " >&6
pankso@16307 6 else
pankso@16307 7 if test "$cross_compiling" = yes; then :
pankso@16307 8 - ac_cv_have_long_long_format=no
pankso@16307 9 + ac_cv_have_long_long_format="cross -- assuming yes"
pankso@16307 10 else
pankso@16307 11 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
pankso@16307 12 /* end confdefs.h. */
pankso@16307 13 @@ -13749,7 +13749,7 @@
pankso@16307 14 $as_echo "$ac_cv_have_long_long_format" >&6; }
pankso@16307 15 fi
pankso@16307 16
pankso@16307 17 -if test "$ac_cv_have_long_long_format" = yes
pankso@16307 18 +if test "$ac_cv_have_long_long_format" != no
pankso@16307 19 then
pankso@16307 20
pankso@16307 21 $as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h
pankso@16307 22 diff -ur Python-2.7.3.orig/Makefile.pre.in Python-2.7.3-Source/Makefile.pre.in
pankso@16307 23 --- Python-2.7.3.orig/Makefile.pre.in 2012-04-09 19:07:33.000000000 -0400
pankso@16307 24 +++ Python-2.7.3-Source/Makefile.pre.in 2012-10-23 14:10:45.305220393 -0400
pankso@16307 25 @@ -182,6 +182,7 @@
pankso@16307 26
pankso@16307 27 PYTHON= python$(EXE)
pankso@16307 28 BUILDPYTHON= python$(BUILDEXE)
pankso@16307 29 +HOSTPYTHON= ./$(BUILDPYTHON)
pankso@16307 30
pankso@16307 31 # The task to run while instrument when building the profile-opt target
pankso@16307 32 PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
pankso@16307 33 @@ -215,6 +216,8 @@
pankso@16307 34 # Parser
pankso@16307 35 PGEN= Parser/pgen$(EXE)
pankso@16307 36
pankso@16307 37 +HOSTPGEN= $(PGEN)
pankso@16307 38 +
pankso@16307 39 POBJS= \
pankso@16307 40 Parser/acceler.o \
pankso@16307 41 Parser/grammar1.o \
pankso@16307 42 @@ -408,8 +411,8 @@
pankso@16307 43 # Build the shared modules
pankso@16307 44 sharedmods: $(BUILDPYTHON)
pankso@16307 45 @case $$MAKEFLAGS in \
pankso@16307 46 - *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
pankso@16307 47 - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
pankso@16307 48 + *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
pankso@16307 49 + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
pankso@16307 50 esac
pankso@16307 51
pankso@16307 52 # Build static library
pankso@16307 53 @@ -543,7 +546,7 @@
pankso@16307 54 $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
pankso@16307 55 Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
pankso@16307 56 -@$(INSTALL) -d Include
pankso@16307 57 - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
pankso@16307 58 + -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
pankso@16307 59 -touch Parser/pgen.stamp
pankso@16307 60
pankso@16307 61 $(PGEN): $(PGENOBJS)
pankso@16307 62 @@ -938,26 +941,26 @@
pankso@16307 63 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
pankso@16307 64 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
pankso@16307 65 fi
pankso@16307 66 - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
pankso@16307 67 - ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 68 + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
pankso@16307 69 + ./$(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 70 -d $(LIBDEST) -f \
pankso@16307 71 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
pankso@16307 72 $(DESTDIR)$(LIBDEST)
pankso@16307 73 - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
pankso@16307 74 - ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 75 + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
pankso@16307 76 + ./$(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 77 -d $(LIBDEST) -f \
pankso@16307 78 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
pankso@16307 79 $(DESTDIR)$(LIBDEST)
pankso@16307 80 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
pankso@16307 81 - ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 82 + ./$(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 83 -d $(LIBDEST)/site-packages -f \
pankso@16307 84 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
pankso@16307 85 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
pankso@16307 86 - ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 87 + ./$(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
pankso@16307 88 -d $(LIBDEST)/site-packages -f \
pankso@16307 89 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
pankso@16307 90 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
pankso@16307 91 - ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
pankso@16307 92 + ./$(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
pankso@16307 93
pankso@16307 94 # Create the PLATDIR source directory, if one wasn't distributed..
pankso@16307 95 $(srcdir)/Lib/$(PLATDIR):
pankso@16307 96 @@ -1062,7 +1065,9 @@
pankso@16307 97 # Install the dynamically loadable modules
pankso@16307 98 # This goes into $(exec_prefix)
pankso@16307 99 sharedinstall: sharedmods
pankso@16307 100 - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
pankso@16307 101 + CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
pankso@16307 102 + $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
pankso@16307 103 + --skip-build \
pankso@16307 104 --prefix=$(prefix) \
pankso@16307 105 --install-scripts=$(BINDIR) \
pankso@16307 106 --install-platlib=$(DESTSHARED) \
pankso@16307 107 diff -ur Python-2.7.3.orig/setup.py Python-2.7.3-Source/setup.py
pankso@16307 108 --- Python-2.7.3.orig/setup.py 2012-04-09 19:07:36.000000000 -0400
pankso@16307 109 +++ Python-2.7.3-Source/setup.py 2012-10-23 14:10:56.085220237 -0400
pankso@16307 110 @@ -145,6 +145,7 @@
pankso@16307 111 def __init__(self, dist):
pankso@16307 112 build_ext.__init__(self, dist)
pankso@16307 113 self.failed = []
pankso@16307 114 + self.cross_compile = os.environ.get('CROSS_COMPILE_TARGET') == 'yes'
pankso@16307 115
pankso@16307 116 def build_extensions(self):
pankso@16307 117
pankso@16307 118 @@ -278,6 +279,14 @@
pankso@16307 119 (ext.name, sys.exc_info()[1]))
pankso@16307 120 self.failed.append(ext.name)
pankso@16307 121 return
pankso@16307 122 +
pankso@16307 123 + # Import check will not work when cross-compiling.
pankso@16307 124 + if os.environ.has_key('PYTHONXCPREFIX'):
pankso@16307 125 + self.announce(
pankso@16307 126 + 'WARNING: skipping import check for cross-compiled: "%s"' %
pankso@16307 127 + ext.name)
pankso@16307 128 + return
pankso@16307 129 +
pankso@16307 130 # Workaround for Mac OS X: The Carbon-based modules cannot be
pankso@16307 131 # reliably imported into a command-line Python
pankso@16307 132 if 'Carbon' in ext.extra_link_args:
pankso@16307 133 @@ -369,9 +378,10 @@
pankso@16307 134
pankso@16307 135 def detect_modules(self):
pankso@16307 136 # Ensure that /usr/local is always used
pankso@16307 137 - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
pankso@16307 138 - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
pankso@16307 139 - self.add_multiarch_paths()
pankso@16307 140 + if not self.cross_compile:
pankso@16307 141 + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
pankso@16307 142 + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
pankso@16307 143 + self.add_multiarch_paths()
pankso@16307 144
pankso@16307 145 # Add paths specified in the environment variables LDFLAGS and
pankso@16307 146 # CPPFLAGS for header and library files.
pankso@16307 147 @@ -408,7 +418,8 @@
pankso@16307 148 add_dir_to_list(dir_list, directory)
pankso@16307 149
pankso@16307 150 if os.path.normpath(sys.prefix) != '/usr' \
pankso@16307 151 - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
pankso@16307 152 + and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
pankso@16307 153 + and not self.cross_compile:
pankso@16307 154 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
pankso@16307 155 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
pankso@16307 156 # building a framework with different architectures than
pankso@16307 157 @@ -426,11 +437,23 @@
pankso@16307 158 # lib_dirs and inc_dirs are used to search for files;
pankso@16307 159 # if a file is found in one of those directories, it can
pankso@16307 160 # be assumed that no additional -I,-L directives are needed.
pankso@16307 161 - lib_dirs = self.compiler.library_dirs + [
pankso@16307 162 - '/lib64', '/usr/lib64',
pankso@16307 163 - '/lib', '/usr/lib',
pankso@16307 164 - ]
pankso@16307 165 - inc_dirs = self.compiler.include_dirs + ['/usr/include']
pankso@16307 166 + lib_dirs = self.compiler.library_dirs
pankso@16307 167 + inc_dirs = self.compiler.include_dirs
pankso@16307 168 + if not self.cross_compile:
pankso@16307 169 + lib_dirs += [
pankso@16307 170 + '/lib64', '/usr/lib64',
pankso@16307 171 + '/lib', '/usr/lib',
pankso@16307 172 + ]
pankso@16307 173 + inc_dirs += ['/usr/include']
pankso@16307 174 + else:
pankso@16307 175 + # The common install prefix of 3rd party libraries used during
pankso@16307 176 + # cross compilation
pankso@16307 177 + mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
pankso@16307 178 + if mydir:
pankso@16307 179 + inc_dirs += [mydir + '/include' ]
pankso@16307 180 + inc_dirs += [mydir + '/lib/libffi-3.0.10/include']
pankso@16307 181 + lib_dirs += [mydir + '/lib' ]
pankso@16307 182 +
pankso@16307 183 exts = []
pankso@16307 184 missing = []
pankso@16307 185
pankso@16307 186 @@ -1004,13 +1027,24 @@
pankso@16307 187 # We hunt for #define SQLITE_VERSION "n.n.n"
pankso@16307 188 # We need to find >= sqlite version 3.0.8
pankso@16307 189 sqlite_incdir = sqlite_libdir = None
pankso@16307 190 - sqlite_inc_paths = [ '/usr/include',
pankso@16307 191 - '/usr/include/sqlite',
pankso@16307 192 - '/usr/include/sqlite3',
pankso@16307 193 - '/usr/local/include',
pankso@16307 194 - '/usr/local/include/sqlite',
pankso@16307 195 - '/usr/local/include/sqlite3',
pankso@16307 196 - ]
pankso@16307 197 +
pankso@16307 198 + if not self.cross_compile:
pankso@16307 199 + sqlite_inc_paths = [ '/usr/include',
pankso@16307 200 + '/usr/include/sqlite',
pankso@16307 201 + '/usr/include/sqlite3',
pankso@16307 202 + '/usr/local/include',
pankso@16307 203 + '/usr/local/include/sqlite',
pankso@16307 204 + '/usr/local/include/sqlite3',
pankso@16307 205 + ]
pankso@16307 206 + else:
pankso@16307 207 + # The common install prefix of 3rd party headers used during
pankso@16307 208 + # cross compilation
pankso@16307 209 + mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
pankso@16307 210 + if mydir:
pankso@16307 211 + sqlite_inc_paths = [mydir + '/include' ]
pankso@16307 212 + else:
pankso@16307 213 + sqlite_inc_paths = []
pankso@16307 214 +
pankso@16307 215 MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
pankso@16307 216 MIN_SQLITE_VERSION = ".".join([str(x)
pankso@16307 217 for x in MIN_SQLITE_VERSION_NUMBER])
pankso@16307 218 @@ -1050,12 +1084,22 @@
pankso@16307 219 print "sqlite: %s had no SQLITE_VERSION"%(f,)
pankso@16307 220
pankso@16307 221 if sqlite_incdir:
pankso@16307 222 - sqlite_dirs_to_check = [
pankso@16307 223 - os.path.join(sqlite_incdir, '..', 'lib64'),
pankso@16307 224 - os.path.join(sqlite_incdir, '..', 'lib'),
pankso@16307 225 - os.path.join(sqlite_incdir, '..', '..', 'lib64'),
pankso@16307 226 - os.path.join(sqlite_incdir, '..', '..', 'lib'),
pankso@16307 227 - ]
pankso@16307 228 + if not self.cross_compile:
pankso@16307 229 + sqlite_dirs_to_check = [
pankso@16307 230 + os.path.join(sqlite_incdir, '..', 'lib64'),
pankso@16307 231 + os.path.join(sqlite_incdir, '..', 'lib'),
pankso@16307 232 + os.path.join(sqlite_incdir, '..', '..', 'lib64'),
pankso@16307 233 + os.path.join(sqlite_incdir, '..', '..', 'lib'),
pankso@16307 234 + ]
pankso@16307 235 + else:
pankso@16307 236 + # The common install prefix of 3rd party headers used during
pankso@16307 237 + # cross compilation
pankso@16307 238 + mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
pankso@16307 239 + if mydir:
pankso@16307 240 + sqlite_dirs_to_check = [mydir + '/lib' ]
pankso@16307 241 + else:
pankso@16307 242 + sqlite_dirs_to_check = []
pankso@16307 243 +
pankso@16307 244 sqlite_libfile = self.compiler.find_library_file(
pankso@16307 245 sqlite_dirs_to_check + lib_dirs, 'sqlite3')
pankso@16307 246 if sqlite_libfile:
pankso@16307 247 @@ -1864,8 +1908,15 @@
pankso@16307 248
pankso@16307 249 # Pass empty CFLAGS because we'll just append the resulting
pankso@16307 250 # CFLAGS to Python's; -g or -O2 is to be avoided.
pankso@16307 251 - cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
pankso@16307 252 - % (ffi_builddir, ffi_srcdir, " ".join(config_args))
pankso@16307 253 + if self.cross_compile:
pankso@16307 254 + cmd = "cd %s && env CFLAGS='' %s/configure --host=%s --build=%s %s" \
pankso@16307 255 + % (ffi_builddir, ffi_srcdir,
pankso@16307 256 + os.environ.get('HOSTARCH'),
pankso@16307 257 + os.environ.get('BUILDARCH'),
pankso@16307 258 + " ".join(config_args))
pankso@16307 259 + else:
pankso@16307 260 + cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
pankso@16307 261 + % (ffi_builddir, ffi_srcdir, " ".join(config_args))
pankso@16307 262
pankso@16307 263 res = os.system(cmd)
pankso@16307 264 if res or not os.path.exists(ffi_configfile):