Index: trunk/dports/python/py-pil/Portfile
===================================================================
--- trunk/dports/python/py-pil/Portfile	(revision 3994)
+++ trunk/dports/python/py-pil/Portfile	(revision 3994)
@@ -0,0 +1,48 @@
+# $Id: Portfile,v 1.1 2003/11/20 10:06:44 mww Exp $
+
+PortSystem 1.0
+
+name		py-pil
+version		1.1.4
+categories	python graphics
+maintainers	robert@or.homeip.net
+description	Python Imaging Library
+long_description	The Python Imaging Library (PIL) adds image processing \
+		capabilities to your Python interpreter. This library supports \
+		many file formats, and provides powerful image processing and \
+		graphics capabilities. 
+
+homepage	http://www.pythonware.com/
+master_sites	http://effbot.org/downloads/
+distname	Imaging-${version}
+checksums	md5 d2c03c25a9a0128832137dd536da88da
+patchfiles	patch-Makefile.in \
+		patch-setup.py \
+		patch-Image.py
+
+depends_lib	bin:python:python \
+		lib:libjpeg:jpeg
+
+post-patch	{
+	reinplace s,@prefix@,${prefix},g ${worksrcpath}/setup.py
+}
+
+configure.dir	${worksrcpath}/libImaging
+configure.env   CFLAGS="-I${prefix}/include" \
+                LDFLAGS="-L${prefix}/lib"
+
+build.dir	${configure.dir}
+post-build	{
+	system	"cd ${worksrcpath} && python setup.py build"
+}
+
+destroot.dir	${worksrcpath}
+destroot.cmd	python setup.py
+destroot.destdir	--prefix=${destroot}${prefix}
+post-destroot	{
+	file mkdir ${destroot}${prefix}/share/doc
+	file copy ${worksrcpath}/Doc ${destroot}${prefix}/share/doc/${name}
+	file copy ${worksrcpath}/BUILDME ${worksrcpath}/CHANGES-114 \
+		${worksrcpath}/CONTENTS ${worksrcpath}/README \
+		${destroot}${prefix}/share/doc/${name}
+}
Index: trunk/dports/python/py-pil/files/patch-Image.py
===================================================================
--- trunk/dports/python/py-pil/files/patch-Image.py	(revision 3994)
+++ trunk/dports/python/py-pil/files/patch-Image.py	(revision 3994)
@@ -0,0 +1,20 @@
+--- PIL/Image.py.orig	Wed May  7 06:59:10 2003
++++ PIL/Image.py	Wed May  7 07:00:16 2003
+@@ -1715,7 +1715,7 @@
+         format = "BMP"
+         if not command:
+             command = "start"
+-    elif os.environ.get("OSTYPE") == "darwin":
++    elif sys.platform == "darwin":
+         format = "JPEG"
+         if not command:
+             command = "open -a /Applications/Preview.app"
+@@ -1741,7 +1741,7 @@
+     if os.name == "nt":
+         os.system("%s %s" % (command, file))
+         # FIXME: this leaves temporary files around...
+-    elif os.environ.get("OSTYPE") == "darwin":
++    elif sys.platform == "darwin":
+         # on darwin open returns immediately resulting in the temp
+         # file removal while app is opening
+         os.system("(%s %s; sleep 20; rm -f %s)&" % (command, file, file))
Index: trunk/dports/python/py-pil/files/patch-Makefile.in
===================================================================
--- trunk/dports/python/py-pil/files/patch-Makefile.in	(revision 3994)
+++ trunk/dports/python/py-pil/files/patch-Makefile.in	(revision 3994)
@@ -0,0 +1,18 @@
+--- libImaging/Makefile.in.orig	Thu Aug  7 22:57:06 2003
++++ libImaging/Makefile.in	Thu Aug  7 22:58:42 2003
+@@ -24,13 +24,13 @@
+ 
+ DEFS=		@DEFS@
+ 
+-LIBS=		@LIBS@ @LIBM@
++LIBS=		@LDFLAGS@ @LIBS@ @LIBM@
+ 
+ # --------------------------------------------------------------------
+ # Other things that are customizable but not by configure
+ 
+ INCLDIR=	$(srcdir)/.
+-JPEGINCLUDE=	/usr/local/include
++JPEGINCLUDE=	@prefix@/include
+ OPT=		@OPT@
+ #OPT=		-g
+ CFLAGS=		$(OPT) -I$(INCLDIR) -I$(JPEGINCLUDE) $(DEFS)
Index: trunk/dports/python/py-pil/files/patch-setup.py
===================================================================
--- trunk/dports/python/py-pil/files/patch-setup.py	(revision 3994)
+++ trunk/dports/python/py-pil/files/patch-setup.py	(revision 3994)
@@ -0,0 +1,77 @@
+--- setup.py.orig	Fri Dec 13 06:06:28 2002
++++ setup.py	Fri Dec 13 06:09:38 2002
+@@ -30,7 +30,7 @@
+ # on Windows, the following is used to control how and where to search
+ # for Tcl/Tk files.  None enables automatic searching; to override, set
+ # this to a directory name.
+-TCLROOT = None
++TCLROOT = "@prefix@"
+ 
+ from PIL.Image import VERSION
+ 
+@@ -46,10 +46,10 @@
+ LIBRARIES = ["Imaging"]
+ 
+ # Add some standard search spots for MacOSX/darwin
+-if os.path.exists('/sw/include'):
+-    INCLUDE_DIRS.append('/sw/include')
+-if os.path.exists('/sw/lib'):
+-    LIBRARY_DIRS.append('/sw/lib')
++if os.path.exists('@prefix@/include'):
++    INCLUDE_DIRS.append('@prefix@/include')
++if os.path.exists('@prefix@/lib'):
++    LIBRARY_DIRS.append('@prefix@/lib')
+ 
+ HAVE_LIBJPEG = 0
+ HAVE_LIBTIFF = 0
+@@ -63,6 +63,8 @@
+         lib = m.group(1)
+         if lib == "JPEG":
+             HAVE_LIBJPEG = 1
++            INCLUDE_DIRS.append("@prefix@/include")
++            LIBRARY_DIRS.append("@prefix@/lib")
+             if sys.platform == "win32":
+                 LIBRARIES.append("jpeg")
+                 INCLUDE_DIRS.append(JPEGDIR)
+@@ -71,6 +73,8 @@
+                 LIBRARIES.append("jpeg")
+         elif lib == "TIFF":
+             HAVE_LIBTIFF = 1
++            INCLUDE_DIRS.append("@prefix@/include")
++            LIBRARY_DIRS.append("@prefix@/lib")
+             LIBRARIES.append("tiff")
+         elif lib == "Z":
+             HAVE_LIBZ = 1
+@@ -204,10 +208,15 @@
+                 EXTRA_LINK_ARGS = frameworks
+                 HAVE_TCLTK = 1
+ 
++        tk_framework_found = 0
+         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
++            INCLUDE_DIRS.append(os.path.join(TCLROOT, "include"))
++            LIBRARY_DIRS.append(os.path.join(TCLROOT, "lib"))
++            INCLUDE_DIRS.append("/usr/X11R6/include")
++            LIBRARY_DIRS.append("/usr/X11R6/lib")
+ 
+     if HAVE_TCLTK:
+         MODULES.append(
+@@ -266,13 +275,13 @@
+         # FIXME: search for libraries
+         LIBRARIES.append("freetype")
+         INCLUDE_DIRS.append("/usr/include/freetype2")
+-    elif os.path.isdir("/sw/include/freetype2"):
++    elif os.path.isdir("@prefix@/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")
++        INCLUDE_DIRS.append("@prefix@/include/freetype2")
++        LIBRARY_DIRS.append("@prefix@/lib")
+     else:
+         have_freetype = 0
+ 
