$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!