wok diff python/stuff/python-2.7.3-xcompile.patch @ rev 22067
updated udevil again (0.4.3 -> 0.4.4)
author | Hans-G?nter Theisgen |
---|---|
date | Fri Oct 25 14:56:03 2019 +0100 (2019-10-25) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/python/stuff/python-2.7.3-xcompile.patch Fri Oct 25 14:56:03 2019 +0100 1.3 @@ -0,0 +1,264 @@ 1.4 +diff -ur Python-2.7.3.orig/configure Python-2.7.3-Source/configure 1.5 +--- Python-2.7.3.orig/configure 2012-04-09 19:07:36.000000000 -0400 1.6 ++++ Python-2.7.3-Source/configure 2012-10-23 14:10:45.305220393 -0400 1.7 +@@ -13697,7 +13697,7 @@ 1.8 + $as_echo_n "(cached) " >&6 1.9 + else 1.10 + if test "$cross_compiling" = yes; then : 1.11 +- ac_cv_have_long_long_format=no 1.12 ++ ac_cv_have_long_long_format="cross -- assuming yes" 1.13 + else 1.14 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext 1.15 + /* end confdefs.h. */ 1.16 +@@ -13749,7 +13749,7 @@ 1.17 + $as_echo "$ac_cv_have_long_long_format" >&6; } 1.18 + fi 1.19 + 1.20 +-if test "$ac_cv_have_long_long_format" = yes 1.21 ++if test "$ac_cv_have_long_long_format" != no 1.22 + then 1.23 + 1.24 + $as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h 1.25 +diff -ur Python-2.7.3.orig/Makefile.pre.in Python-2.7.3-Source/Makefile.pre.in 1.26 +--- Python-2.7.3.orig/Makefile.pre.in 2012-04-09 19:07:33.000000000 -0400 1.27 ++++ Python-2.7.3-Source/Makefile.pre.in 2012-10-23 14:10:45.305220393 -0400 1.28 +@@ -182,6 +182,7 @@ 1.29 + 1.30 + PYTHON= python$(EXE) 1.31 + BUILDPYTHON= python$(BUILDEXE) 1.32 ++HOSTPYTHON= ./$(BUILDPYTHON) 1.33 + 1.34 + # The task to run while instrument when building the profile-opt target 1.35 + PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck 1.36 +@@ -215,6 +216,8 @@ 1.37 + # Parser 1.38 + PGEN= Parser/pgen$(EXE) 1.39 + 1.40 ++HOSTPGEN= $(PGEN) 1.41 ++ 1.42 + POBJS= \ 1.43 + Parser/acceler.o \ 1.44 + Parser/grammar1.o \ 1.45 +@@ -408,8 +411,8 @@ 1.46 + # Build the shared modules 1.47 + sharedmods: $(BUILDPYTHON) 1.48 + @case $$MAKEFLAGS in \ 1.49 +- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ 1.50 +- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ 1.51 ++ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ 1.52 ++ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ 1.53 + esac 1.54 + 1.55 + # Build static library 1.56 +@@ -543,7 +546,7 @@ 1.57 + $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp 1.58 + Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT) 1.59 + -@$(INSTALL) -d Include 1.60 +- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) 1.61 ++ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) 1.62 + -touch Parser/pgen.stamp 1.63 + 1.64 + $(PGEN): $(PGENOBJS) 1.65 +@@ -938,26 +941,26 @@ 1.66 + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ 1.67 + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ 1.68 + fi 1.69 +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1.70 +- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ 1.71 ++ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1.72 ++ ./$(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ 1.73 + -d $(LIBDEST) -f \ 1.74 + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ 1.75 + $(DESTDIR)$(LIBDEST) 1.76 +- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1.77 +- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ 1.78 ++ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1.79 ++ ./$(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ 1.80 + -d $(LIBDEST) -f \ 1.81 + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ 1.82 + $(DESTDIR)$(LIBDEST) 1.83 + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1.84 +- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ 1.85 ++ ./$(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ 1.86 + -d $(LIBDEST)/site-packages -f \ 1.87 + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages 1.88 + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1.89 +- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ 1.90 ++ ./$(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ 1.91 + -d $(LIBDEST)/site-packages -f \ 1.92 + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages 1.93 + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1.94 +- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" 1.95 ++ ./$(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" 1.96 + 1.97 + # Create the PLATDIR source directory, if one wasn't distributed.. 1.98 + $(srcdir)/Lib/$(PLATDIR): 1.99 +@@ -1062,7 +1065,9 @@ 1.100 + # Install the dynamically loadable modules 1.101 + # This goes into $(exec_prefix) 1.102 + sharedinstall: sharedmods 1.103 +- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ 1.104 ++ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ 1.105 ++ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ 1.106 ++ --skip-build \ 1.107 + --prefix=$(prefix) \ 1.108 + --install-scripts=$(BINDIR) \ 1.109 + --install-platlib=$(DESTSHARED) \ 1.110 +diff -ur Python-2.7.3.orig/setup.py Python-2.7.3-Source/setup.py 1.111 +--- Python-2.7.3.orig/setup.py 2012-04-09 19:07:36.000000000 -0400 1.112 ++++ Python-2.7.3-Source/setup.py 2012-10-23 14:10:56.085220237 -0400 1.113 +@@ -145,6 +145,7 @@ 1.114 + def __init__(self, dist): 1.115 + build_ext.__init__(self, dist) 1.116 + self.failed = [] 1.117 ++ self.cross_compile = os.environ.get('CROSS_COMPILE_TARGET') == 'yes' 1.118 + 1.119 + def build_extensions(self): 1.120 + 1.121 +@@ -278,6 +279,14 @@ 1.122 + (ext.name, sys.exc_info()[1])) 1.123 + self.failed.append(ext.name) 1.124 + return 1.125 ++ 1.126 ++ # Import check will not work when cross-compiling. 1.127 ++ if os.environ.has_key('PYTHONXCPREFIX'): 1.128 ++ self.announce( 1.129 ++ 'WARNING: skipping import check for cross-compiled: "%s"' % 1.130 ++ ext.name) 1.131 ++ return 1.132 ++ 1.133 + # Workaround for Mac OS X: The Carbon-based modules cannot be 1.134 + # reliably imported into a command-line Python 1.135 + if 'Carbon' in ext.extra_link_args: 1.136 +@@ -369,9 +378,10 @@ 1.137 + 1.138 + def detect_modules(self): 1.139 + # Ensure that /usr/local is always used 1.140 +- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') 1.141 +- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 1.142 +- self.add_multiarch_paths() 1.143 ++ if not self.cross_compile: 1.144 ++ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') 1.145 ++ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 1.146 ++ self.add_multiarch_paths() 1.147 + 1.148 + # Add paths specified in the environment variables LDFLAGS and 1.149 + # CPPFLAGS for header and library files. 1.150 +@@ -408,7 +418,8 @@ 1.151 + add_dir_to_list(dir_list, directory) 1.152 + 1.153 + if os.path.normpath(sys.prefix) != '/usr' \ 1.154 +- and not sysconfig.get_config_var('PYTHONFRAMEWORK'): 1.155 ++ and not sysconfig.get_config_var('PYTHONFRAMEWORK') \ 1.156 ++ and not self.cross_compile: 1.157 + # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework 1.158 + # (PYTHONFRAMEWORK is set) to avoid # linking problems when 1.159 + # building a framework with different architectures than 1.160 +@@ -426,11 +437,23 @@ 1.161 + # lib_dirs and inc_dirs are used to search for files; 1.162 + # if a file is found in one of those directories, it can 1.163 + # be assumed that no additional -I,-L directives are needed. 1.164 +- lib_dirs = self.compiler.library_dirs + [ 1.165 +- '/lib64', '/usr/lib64', 1.166 +- '/lib', '/usr/lib', 1.167 +- ] 1.168 +- inc_dirs = self.compiler.include_dirs + ['/usr/include'] 1.169 ++ lib_dirs = self.compiler.library_dirs 1.170 ++ inc_dirs = self.compiler.include_dirs 1.171 ++ if not self.cross_compile: 1.172 ++ lib_dirs += [ 1.173 ++ '/lib64', '/usr/lib64', 1.174 ++ '/lib', '/usr/lib', 1.175 ++ ] 1.176 ++ inc_dirs += ['/usr/include'] 1.177 ++ else: 1.178 ++ # The common install prefix of 3rd party libraries used during 1.179 ++ # cross compilation 1.180 ++ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX') 1.181 ++ if mydir: 1.182 ++ inc_dirs += [mydir + '/include' ] 1.183 ++ inc_dirs += [mydir + '/lib/libffi-3.0.10/include'] 1.184 ++ lib_dirs += [mydir + '/lib' ] 1.185 ++ 1.186 + exts = [] 1.187 + missing = [] 1.188 + 1.189 +@@ -1004,13 +1027,24 @@ 1.190 + # We hunt for #define SQLITE_VERSION "n.n.n" 1.191 + # We need to find >= sqlite version 3.0.8 1.192 + sqlite_incdir = sqlite_libdir = None 1.193 +- sqlite_inc_paths = [ '/usr/include', 1.194 +- '/usr/include/sqlite', 1.195 +- '/usr/include/sqlite3', 1.196 +- '/usr/local/include', 1.197 +- '/usr/local/include/sqlite', 1.198 +- '/usr/local/include/sqlite3', 1.199 +- ] 1.200 ++ 1.201 ++ if not self.cross_compile: 1.202 ++ sqlite_inc_paths = [ '/usr/include', 1.203 ++ '/usr/include/sqlite', 1.204 ++ '/usr/include/sqlite3', 1.205 ++ '/usr/local/include', 1.206 ++ '/usr/local/include/sqlite', 1.207 ++ '/usr/local/include/sqlite3', 1.208 ++ ] 1.209 ++ else: 1.210 ++ # The common install prefix of 3rd party headers used during 1.211 ++ # cross compilation 1.212 ++ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX') 1.213 ++ if mydir: 1.214 ++ sqlite_inc_paths = [mydir + '/include' ] 1.215 ++ else: 1.216 ++ sqlite_inc_paths = [] 1.217 ++ 1.218 + MIN_SQLITE_VERSION_NUMBER = (3, 0, 8) 1.219 + MIN_SQLITE_VERSION = ".".join([str(x) 1.220 + for x in MIN_SQLITE_VERSION_NUMBER]) 1.221 +@@ -1050,12 +1084,22 @@ 1.222 + print "sqlite: %s had no SQLITE_VERSION"%(f,) 1.223 + 1.224 + if sqlite_incdir: 1.225 +- sqlite_dirs_to_check = [ 1.226 +- os.path.join(sqlite_incdir, '..', 'lib64'), 1.227 +- os.path.join(sqlite_incdir, '..', 'lib'), 1.228 +- os.path.join(sqlite_incdir, '..', '..', 'lib64'), 1.229 +- os.path.join(sqlite_incdir, '..', '..', 'lib'), 1.230 +- ] 1.231 ++ if not self.cross_compile: 1.232 ++ sqlite_dirs_to_check = [ 1.233 ++ os.path.join(sqlite_incdir, '..', 'lib64'), 1.234 ++ os.path.join(sqlite_incdir, '..', 'lib'), 1.235 ++ os.path.join(sqlite_incdir, '..', '..', 'lib64'), 1.236 ++ os.path.join(sqlite_incdir, '..', '..', 'lib'), 1.237 ++ ] 1.238 ++ else: 1.239 ++ # The common install prefix of 3rd party headers used during 1.240 ++ # cross compilation 1.241 ++ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX') 1.242 ++ if mydir: 1.243 ++ sqlite_dirs_to_check = [mydir + '/lib' ] 1.244 ++ else: 1.245 ++ sqlite_dirs_to_check = [] 1.246 ++ 1.247 + sqlite_libfile = self.compiler.find_library_file( 1.248 + sqlite_dirs_to_check + lib_dirs, 'sqlite3') 1.249 + if sqlite_libfile: 1.250 +@@ -1864,8 +1908,15 @@ 1.251 + 1.252 + # Pass empty CFLAGS because we'll just append the resulting 1.253 + # CFLAGS to Python's; -g or -O2 is to be avoided. 1.254 +- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ 1.255 +- % (ffi_builddir, ffi_srcdir, " ".join(config_args)) 1.256 ++ if self.cross_compile: 1.257 ++ cmd = "cd %s && env CFLAGS='' %s/configure --host=%s --build=%s %s" \ 1.258 ++ % (ffi_builddir, ffi_srcdir, 1.259 ++ os.environ.get('HOSTARCH'), 1.260 ++ os.environ.get('BUILDARCH'), 1.261 ++ " ".join(config_args)) 1.262 ++ else: 1.263 ++ cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ 1.264 ++ % (ffi_builddir, ffi_srcdir, " ".join(config_args)) 1.265 + 1.266 + res = os.system(cmd) 1.267 + if res or not os.path.exists(ffi_configfile):