You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
7.8 KiB

  1. diff --git a/setup.py b/setup.py
  2. index 15d81e4..ee6dba6 100755
  3. --- a/setup.py
  4. +++ b/setup.py
  5. @@ -136,12 +136,12 @@ except (ImportError, OSError):
  6. NAME = 'Pillow'
  7. PILLOW_VERSION = get_version()
  8. -JPEG_ROOT = None
  9. +JPEG_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib")
  10. JPEG2K_ROOT = None
  11. -ZLIB_ROOT = None
  12. +ZLIB_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib")
  13. IMAGEQUANT_ROOT = None
  14. -TIFF_ROOT = None
  15. -FREETYPE_ROOT = None
  16. +TIFF_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib")
  17. +FREETYPE_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib")
  18. LCMS_ROOT = None
  19. @@ -289,159 +289,6 @@ class pil_build_ext(build_ext):
  20. _add_directory(library_dirs, os.path.join(prefix, "lib"))
  21. _add_directory(include_dirs, os.path.join(prefix, "include"))
  22. - #
  23. - # add platform directories
  24. -
  25. - if self.disable_platform_guessing:
  26. - pass
  27. -
  28. - elif sys.platform == "cygwin":
  29. - # pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory
  30. - _add_directory(library_dirs,
  31. - os.path.join("/usr/lib", "python%s" %
  32. - sys.version[:3], "config"))
  33. -
  34. - elif sys.platform == "darwin":
  35. - # attempt to make sure we pick freetype2 over other versions
  36. - _add_directory(include_dirs, "/sw/include/freetype2")
  37. - _add_directory(include_dirs, "/sw/lib/freetype2/include")
  38. - # fink installation directories
  39. - _add_directory(library_dirs, "/sw/lib")
  40. - _add_directory(include_dirs, "/sw/include")
  41. - # darwin ports installation directories
  42. - _add_directory(library_dirs, "/opt/local/lib")
  43. - _add_directory(include_dirs, "/opt/local/include")
  44. -
  45. - # if Homebrew is installed, use its lib and include directories
  46. - try:
  47. - prefix = subprocess.check_output(['brew', '--prefix']).strip(
  48. - ).decode('latin1')
  49. - except Exception:
  50. - # Homebrew not installed
  51. - prefix = None
  52. -
  53. - ft_prefix = None
  54. -
  55. - if prefix:
  56. - # add Homebrew's include and lib directories
  57. - _add_directory(library_dirs, os.path.join(prefix, 'lib'))
  58. - _add_directory(include_dirs, os.path.join(prefix, 'include'))
  59. - ft_prefix = os.path.join(prefix, 'opt', 'freetype')
  60. -
  61. - if ft_prefix and os.path.isdir(ft_prefix):
  62. - # freetype might not be linked into Homebrew's prefix
  63. - _add_directory(library_dirs, os.path.join(ft_prefix, 'lib'))
  64. - _add_directory(include_dirs,
  65. - os.path.join(ft_prefix, 'include'))
  66. - else:
  67. - # fall back to freetype from XQuartz if
  68. - # Homebrew's freetype is missing
  69. - _add_directory(library_dirs, "/usr/X11/lib")
  70. - _add_directory(include_dirs, "/usr/X11/include")
  71. -
  72. - elif sys.platform.startswith("linux"):
  73. - arch_tp = (plat.processor(), plat.architecture()[0])
  74. - # This should be correct on debian derivatives.
  75. - if os.path.exists('/etc/debian_version'):
  76. - # If this doesn't work, don't just silently patch
  77. - # downstream because it's going to break when people
  78. - # try to build pillow from source instead of
  79. - # installing from the system packages.
  80. - self.add_multiarch_paths()
  81. -
  82. - elif arch_tp == ("x86_64", "32bit"):
  83. - # Special Case: 32-bit build on 64-bit machine.
  84. - _add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
  85. - else:
  86. - libdirs = {
  87. - 'x86_64': ["/lib64", "/usr/lib64",
  88. - "/usr/lib/x86_64-linux-gnu"],
  89. - '64bit': ["/lib64", "/usr/lib64",
  90. - "/usr/lib/x86_64-linux-gnu"],
  91. - 'i386': ["/usr/lib/i386-linux-gnu"],
  92. - 'i686': ["/usr/lib/i386-linux-gnu"],
  93. - '32bit': ["/usr/lib/i386-linux-gnu"],
  94. - 'aarch64': ["/usr/lib64", "/usr/lib/aarch64-linux-gnu"],
  95. - 'arm': ["/usr/lib/arm-linux-gnueabi"],
  96. - 'armv71': ["/usr/lib/arm-linux-gnueabi"],
  97. - 'armv7l': ["/usr/lib"],
  98. - 'ppc64': ["/usr/lib64", "/usr/lib/ppc64-linux-gnu",
  99. - "/usr/lib/powerpc64-linux-gnu"],
  100. - 'ppc64le': ["/usr/lib64"],
  101. - 'ppc': ["/usr/lib/ppc-linux-gnu",
  102. - "/usr/lib/powerpc-linux-gnu"],
  103. - 's390x': ["/usr/lib64", "/usr/lib/s390x-linux-gnu"],
  104. - 's390': ["/usr/lib/s390-linux-gnu"],
  105. - }
  106. -
  107. - for platform_ in arch_tp:
  108. - dirs = libdirs.get(platform_, None)
  109. - if not dirs:
  110. - continue
  111. - for path in dirs:
  112. - _add_directory(library_dirs, path)
  113. - break
  114. -
  115. - else:
  116. - raise ValueError(
  117. - "Unable to identify Linux platform: `%s`" % platform_)
  118. -
  119. - # termux support for android.
  120. - # system libraries (zlib) are installed in /system/lib
  121. - # headers are at $PREFIX/include
  122. - # user libs are at $PREFIX/lib
  123. - if os.environ.get('ANDROID_ROOT', None):
  124. - _add_directory(library_dirs,
  125. - os.path.join(os.environ['ANDROID_ROOT'],
  126. - 'lib'))
  127. -
  128. - elif sys.platform.startswith("gnu"):
  129. - self.add_multiarch_paths()
  130. -
  131. - elif sys.platform.startswith("freebsd"):
  132. - _add_directory(library_dirs, "/usr/local/lib")
  133. - _add_directory(include_dirs, "/usr/local/include")
  134. -
  135. - elif sys.platform.startswith("netbsd"):
  136. - _add_directory(library_dirs, "/usr/pkg/lib")
  137. - _add_directory(include_dirs, "/usr/pkg/include")
  138. -
  139. - elif sys.platform.startswith("sunos5"):
  140. - _add_directory(library_dirs, "/opt/local/lib")
  141. - _add_directory(include_dirs, "/opt/local/include")
  142. -
  143. - # FIXME: check /opt/stuff directories here?
  144. -
  145. - # standard locations
  146. - if not self.disable_platform_guessing:
  147. - _add_directory(library_dirs, "/usr/local/lib")
  148. - _add_directory(include_dirs, "/usr/local/include")
  149. -
  150. - _add_directory(library_dirs, "/usr/lib")
  151. - _add_directory(include_dirs, "/usr/include")
  152. - # alpine, at least
  153. - _add_directory(library_dirs, "/lib")
  154. -
  155. - # on Windows, look for the OpenJPEG libraries in the location that
  156. - # the official installer puts them
  157. - if sys.platform == "win32":
  158. - program_files = os.environ.get('ProgramFiles', '')
  159. - best_version = (0, 0)
  160. - best_path = None
  161. - for name in os.listdir(program_files):
  162. - if name.startswith('OpenJPEG '):
  163. - version = tuple(int(x) for x in
  164. - name[9:].strip().split('.'))
  165. - if version > best_version:
  166. - best_version = version
  167. - best_path = os.path.join(program_files, name)
  168. -
  169. - if best_path:
  170. - _dbg('Adding %s to search list', best_path)
  171. - _add_directory(library_dirs, os.path.join(best_path, 'lib'))
  172. - _add_directory(include_dirs,
  173. - os.path.join(best_path, 'include'))
  174. -
  175. #
  176. # insert new dirs *before* default libs, to avoid conflicts
  177. # between Python PYD stub libs and real libraries