$OpenBSD: patch-setup_py,v 1.2 2014/04/06 21:10:19 sthen Exp $
--- setup.py.orig	Tue Apr  1 18:21:44 2014
+++ setup.py	Sun Apr  6 16:47:32 2014
@@ -290,6 +290,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;
@@ -330,6 +337,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("LOCALBASE"), "lib"))
+        _add_directory(include_dirs, os.path.join(os.getenv("LOCALBASE"), "include"))
+        _add_directory(library_dirs, os.path.join(os.getenv("X11BASE"), "lib"))
+        _add_directory(include_dirs, os.path.join(os.getenv("X11BASE"), "include"))
+
         # on Windows, look for the OpenJPEG libraries in the location that
         # the official installed puts them
         if sys.platform == "win32":
@@ -481,7 +493,7 @@ class pil_build_ext(build_ext):
             if feature.freetype_version == 20:
                 defs.append(("USE_FREETYPE_2_0", None))
             exts.append(Extension(
-                "PIL._imagingft", ["_imagingft.c"], libraries=["freetype"],
+                "PIL._imagingft", ["_imagingft.c"], libraries=["freetype", "z"],
                 define_macros=defs))
 
         if os.path.isfile("_imagingtiff.c") and feature.tiff:
@@ -673,7 +685,6 @@ setup(
     ext_modules=[Extension("PIL._imaging", ["_imaging.c"])],
     include_package_data=True,
     packages=find_packages(),
-    scripts=glob.glob("Scripts/pil*.py"),
     test_suite='PIL.tests',
     keywords=["Imaging",],
     license='Standard PIL License',
