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