$OpenBSD: patch-setup_py,v 1.5 2010/11/15 20:57:10 sthen Exp $
--- setup.py.orig	Sun Nov 15 21:06:10 2009
+++ setup.py	Sun Nov 14 17:21:14 2010
@@ -160,6 +160,13 @@ class pil_build_ext(build_ext):
 
         if _tkinter:
             TCL_VERSION = _tkinter.TCL_VERSION[:3]
+            TK_VERSION = _tkinter.TK_VERSION[:3]
+            add_directory(include_dirs,
+                          os.path.join(os.getenv("LOCALBASE"),
+                                       "include/tcl%s" % TCL_VERSION))
+            add_directory(include_dirs,
+                          os.path.join(os.getenv("LOCALBASE"),
+                                       "include/tk%s" % TK_VERSION))
 
         if _tkinter and not TCL_ROOT:
             # we have Tkinter but the TCL_ROOT variable was not set;
@@ -214,6 +221,11 @@ class pil_build_ext(build_ext):
         add_directory(library_dirs, "/usr/lib")
         add_directory(include_dirs, "/usr/include")
 
+        add_directory(library_dirs,
+                      os.path.join(os.getenv("X11BASE"), "lib"))
+        add_directory(include_dirs,
+                      os.path.join(os.getenv("X11BASE"), "include"))
+
         #
         # insert new dirs *before* default libs, to avoid conflicts
         # between Python PYD stub libs and real libraries
@@ -314,7 +326,7 @@ class pil_build_ext(build_ext):
             if feature.freetype_version == 20:
                 defs.append(("USE_FREETYPE_2_0", None))
             exts.append(Extension(
-                "_imagingft", ["_imagingft.c"], libraries=["freetype"],
+                "_imagingft", ["_imagingft.c"], libraries=["freetype", "z"],
                 define_macros=defs
                 ))
 
@@ -481,7 +493,6 @@ if __name__ == "__main__":
         package_dir={"": "PIL"},
         packages=[""],
         platforms="Python 1.5.2 and later.",
-        scripts = glob.glob("Scripts/pil*.py"),
         url=HOMEPAGE,
         version=VERSION,
         )
