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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
$NetBSD: patch-ab,v 1.3 2003/06/27 10:12:00 drochner Exp $
--- setup.py.orig 2003-05-09 14:00:56.000000000 +0200
+++ setup.py 2003-06-24 14:34:28.000000000 +0200
@@ -23,7 +23,7 @@
# on windows, the build script expects to find both library files and
# include files in the directories below. tweak as necessary.
-JPEGDIR = "../../kits/jpeg-6b"
+JPEGDIR = "/usr/pkg"
ZLIBDIR = "../../kits/zlib-1.1.4"
FREETYPEDIR = "../../kits/freetype-2.0"
@@ -69,6 +69,8 @@
LIBRARY_DIRS.append(JPEGDIR)
else:
LIBRARIES.append("jpeg")
+ INCLUDE_DIRS.append(JPEGDIR + "/include")
+ LIBRARY_DIRS.append(JPEGDIR + "/lib")
elif lib == "TIFF":
HAVE_LIBTIFF = 1
LIBRARIES.append("tiff")
@@ -117,177 +119,6 @@
break
# --------------------------------------------------------------------
-# configure imagingtk module
-
-try:
- import _tkinter
- TCL_VERSION = _tkinter.TCL_VERSION[:3]
-except (ImportError, AttributeError):
- pass
-else:
- INCLUDE_DIRS = ["libImaging"]
- LIBRARY_DIRS = ["libImaging"]
- LIBRARIES = ["Imaging"]
- EXTRA_COMPILE_ARGS = None
- EXTRA_LINK_ARGS = None
- if sys.platform == "win32":
- # locate tcl/tk on windows
- if TCLROOT:
- path = [TCLROOT]
- else:
- path = [
- os.path.join("/py" + PY_VERSION, "Tcl"),
- os.path.join(os.environ.get("ProgramFiles", ""), "Tcl"),
- # FIXME: add more directories here?
- ]
- for root in path:
- TCLROOT = os.path.abspath(root)
- if os.path.isfile(os.path.join(TCLROOT, "include", "tk.h")):
- break
- else:
- TCLROOT = None
- print "*** Cannot find Tcl/Tk headers and library files."
- print "*** To build the Tkinter interface, set the TCLROOT"
- print "*** variable in the setup.py file."
-
- # print "using Tcl/Tk libraries at", TCLROOT
- # print "using Tcl/Tk version", TCL_VERSION
-
- if TCLROOT:
- version = TCL_VERSION[0] + TCL_VERSION[2]
- INCLUDE_DIRS.append(os.path.join(TCLROOT, "include"))
- LIBRARY_DIRS.append(os.path.join(TCLROOT, "lib"))
- LIBRARIES.extend(["tk" + version, "tcl" + version])
- HAVE_TCLTK = 1
- else:
- tk_framework_found = 0
- if sys.platform == 'darwin':
- # First test for a MacOSX/darwin framework install
- from os.path import join, exists
- framework_dirs = [
- '/System/Library/Frameworks/',
- '/Library/Frameworks',
- join(os.getenv('HOME'), '/Library/Frameworks')
- ]
-
- # Find the directory that contains the Tcl.framwork and Tk.framework
- # bundles.
- # XXX distutils should support -F!
- for F in framework_dirs:
- # both Tcl.framework and Tk.framework should be present
- for fw in 'Tcl', 'Tk':
- if not exists(join(F, fw + '.framework')):
- break
- else:
- # ok, F is now directory with both frameworks. Continure
- # building
- tk_framework_found = 1
- break
- if tk_framework_found:
- # For 8.4a2, we must add -I options that point inside the Tcl and Tk
- # frameworks. In later release we should hopefully be able to pass
- # the -F option to gcc, which specifies a framework lookup path.
- #
- tk_include_dirs = [
- join(F, fw + '.framework', H)
- for fw in 'Tcl', 'Tk'
- for H in 'Headers', 'Versions/Current/PrivateHeaders'
- ]
-
- # For 8.4a2, the X11 headers are not included. Rather than include a
- # complicated search, this is a hard-coded path. It could bail out
- # if X11 libs are not found...
- # tk_include_dirs.append('/usr/X11R6/include')
- INCLUDE_DIRS = INCLUDE_DIRS + tk_include_dirs
- frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
- EXTRA_COMPILE_ARGS = frameworks
- EXTRA_LINK_ARGS = frameworks
- HAVE_TCLTK = 1
-
- if not tk_framework_found:
- # assume the libraries are installed in the default location
- LIBRARIES.extend(["tk" + TCL_VERSION, "tcl" + TCL_VERSION])
- HAVE_TCLTK = 1
-
- if HAVE_TCLTK:
- MODULES.append(
- Extension(
- "_imagingtk",
- ["_imagingtk.c", "Tk/tkImaging.c"],
- include_dirs=INCLUDE_DIRS,
- library_dirs=LIBRARY_DIRS,
- libraries=LIBRARIES
- )
- )
-
-# --------------------------------------------------------------------
-# configure imagingft module
-
-if os.path.isdir(FREETYPEDIR) or os.name == "posix":
-
- FILES = []
- INCLUDE_DIRS = ["libImaging"]
- LIBRARY_DIRS = []
- LIBRARIES = []
- have_freetype = 1 # Assume we have it, unless proven otherwise
-
- # use source distribution, if available
- for file in [
- "src/autohint/autohint.c",
- "src/base/ftbase.c",
- #"src/cache/ftcache.c",
- "src/cff/cff.c",
- "src/cid/type1cid.c",
- "src/psaux/psaux.c",
- "src/psnames/psnames.c",
- "src/raster/raster.c",
- "src/sfnt/sfnt.c",
- "src/smooth/smooth.c",
- "src/truetype/truetype.c",
- "src/type1/type1.c",
- "src/winfonts/winfnt.c",
- "src/base/ftsystem.c",
- "src/base/ftinit.c",
- "src/base/ftglyph.c"
- ]:
- file = os.path.join(FREETYPEDIR, file)
- if os.path.isfile(file):
- FILES.append(file)
- else:
- FILES = []
- break
-
- if FILES:
- INCLUDE_DIRS.append(os.path.join(FREETYPEDIR, "include"))
- INCLUDE_DIRS.append(os.path.join(FREETYPEDIR, "src"))
- elif os.path.isdir("/usr/include/freetype2"):
- # assume that the freetype library is installed in a
- # standard location
- # FIXME: search for libraries
- LIBRARIES.append("freetype")
- INCLUDE_DIRS.append("/usr/include/freetype2")
- elif os.path.isdir("/sw/include/freetype2"):
- # assume that the freetype library is installed in a
- # standard location
- # FIXME: search for libraries
- LIBRARIES.append("freetype")
- INCLUDE_DIRS.append("/sw/include/freetype2")
- LIBRARY_DIRS.append("/sw/lib")
- else:
- have_freetype = 0
-
- if have_freetype:
- MODULES.append(
- Extension(
- "_imagingft",
- ["_imagingft.c"] + FILES,
- include_dirs=INCLUDE_DIRS,
- library_dirs=LIBRARY_DIRS,
- libraries=LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS
- )
- )
# build!
|