Index: Portfile
===================================================================
--- Portfile	(revision 50402)
+++ Portfile	(working copy)
@@ -4,6 +4,7 @@
 
 name            optipng
 version         0.6.2
+revision        1
 categories      graphics
 maintainers     vincent-opdarw@vinc17.org
 description     PNG file optimizer
@@ -26,25 +27,25 @@
 
 # Doesn't depend on libpng or zlib since it uses its own, modified versions
 
-worksrcdir      ${name}-${version}/src
+patch.pre_args  -p1
+patchfiles      optipng-0.6.2.1.diff
 
-use_configure   no
-
 # Make sure gmake 3.81+ is used, as scripts/gcc.mak needs POSIX
 # backslash-newline sequence compatibility.
 depends_build   port:gmake
 
-build.cmd       gmake -f scripts/gcc.mak
-build.target    ""
+configure.pre_args
 
+build.cmd       ${prefix}/bin/gmake
+
 destroot {
         xinstall -m 755 -d ${destroot}${prefix}/bin \
           ${destroot}${prefix}/share/doc/${name} \
           ${destroot}${prefix}/share/man/man1
-        xinstall -m 755 -W ${worksrcpath} optipng ${destroot}${prefix}/bin
-        eval xinstall -m 644 [glob ${worksrcpath}/../doc/*] \
-          ${worksrcpath}/../README.txt ${destroot}${prefix}/share/doc/${name}
-        xinstall -m 644 ${worksrcpath}/../man/optipng.1 \
+        xinstall -m 755 -W ${worksrcpath}/src optipng ${destroot}${prefix}/bin
+        eval xinstall -m 644 [glob ${worksrcpath}/doc/*] \
+          ${worksrcpath}/README.txt ${destroot}${prefix}/share/doc/${name}
+        xinstall -m 644 ${worksrcpath}/man/optipng.1 \
           ${destroot}${prefix}/share/man/man1
 }
 

