python-netifaces-fix-cross-build.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. fix cross-compilation issues:
  2. - don't execute cross-compiled binaries
  3. - pass LDFLAGS to linker
  4. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
  5. ---
  6. setup.py | 19 +++++++------------
  7. 1 file changed, 7 insertions(+), 12 deletions(-)
  8. Index: b/setup.py
  9. ===================================================================
  10. --- a/setup.py
  11. +++ b/setup.py
  12. @@ -67,17 +67,8 @@
  13. libraries=libraries,
  14. debug=self.debug)
  15. if execute:
  16. - abspath = os.path.abspath(os.path.join(self.build_temp,
  17. - 'conftest'))
  18. - pipe = os.popen(abspath, 'r')
  19. - result = pipe.read().strip()
  20. - status = pipe.close()
  21. - if status is None:
  22. - status = 0
  23. - if result == '':
  24. - result = True
  25. - if status != 0:
  26. - result = False
  27. + # cross-compiled code can't be executed
  28. + result = True
  29. finally:
  30. os.dup2(mystdout, 1)
  31. @@ -89,6 +80,10 @@
  32. return result
  33. def check_requirements(self):
  34. + # get library dirs
  35. + if os.environ.has_key('LDFLAGS'):
  36. + lib_dirs = os.environ['LDFLAGS']
  37. +
  38. # Load the cached config data from a previous run if possible; compiling
  39. # things to test for features is slow
  40. cache_file = os.path.join(self.build_temp, 'config.cache')
  41. @@ -356,7 +351,7 @@
  42. in optional_headers]),
  43. 'sockaddr': sockaddr }
  44. - if self.test_build(testrig, execute=False):
  45. + if self.test_build(testrig, execute=False, library_dirs = [lib_dirs]):
  46. result.append(sockaddr)
  47. if result: