Index: trunk/dports/devel/lua-luahpdf/Portfile
===================================================================
--- trunk/dports/devel/lua-luahpdf/Portfile	(revision 118202)
+++ trunk/dports/devel/lua-luahpdf/Portfile	(revision 118205)
@@ -4,6 +4,5 @@
 
 name                lua-luahpdf
-version             1.1
-revision            1
+version             1.5
 license             MIT
 categories          devel
@@ -22,7 +21,7 @@
 homepage            http://code.google.com/p/luahpdf/
 master_sites        http://luahpdf.googlecode.com/files/
-checksums           md5     960a8b3a7f05fc225ae1b5f0feb2efd7 \
-                    sha1    504c170769f1d13882ee9ccb15f55ad8b8e36799 \
-                    rmd160  3c282cc152627fd40963d3a75667b9a1667c3f41
+checksums           md5     7e16e4d6d962318aa39844de070dbead \
+                    sha1    cf148468c54c32fae69e5038581a09d6f7403d48 \
+                    rmd160  4754375932bf6da7772f3b3953066a6a5357de9a
 
 distname            luahpdf-${version}
@@ -31,13 +30,15 @@
 
 patchfiles          patch-Makefile.diff
-post-patch {
-    reinplace   "s|%PREFIX%|${prefix}|"       ${worksrcpath}/Makefile
-    reinplace "s|%COMPILER%|${configure.cc}|" ${worksrcpath}/Makefile
-}
 
 use_configure       no
 
-build.env-append    CFLAGS="-I${prefix}/include ${configure.cflags} [get_canonical_archflags cc]" \
-                    LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]"
+build.args-append   CC=${configure.cc} \
+                    LUAINC="${configure.cppflags}" \
+                    CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
+                    LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]" \
+                    PLATFORM=macosx \
+                    PREFIX=${prefix}
+
+destroot.args-append    PREFIX=${prefix}
 
 post-destroot {
Index: trunk/dports/devel/lua-luahpdf/files/patch-Makefile.diff
===================================================================
--- trunk/dports/devel/lua-luahpdf/files/patch-Makefile.diff	(revision 118202)
+++ trunk/dports/devel/lua-luahpdf/files/patch-Makefile.diff	(revision 118205)
@@ -1,20 +1,22 @@
---- Makefile.orig	2012-02-27 11:50:49.000000000 +0100
-+++ Makefile	2012-02-27 11:53:29.000000000 +0100
-@@ -1,7 +1,7 @@
- # --- Change the settings below to suit your environment. See explanations in
- # --- the build documentation for more details. ---
+--- Makefile.orig	2014-03-25 17:03:29.000000000 +0100
++++ Makefile	2014-03-25 17:04:02.000000000 +0100
+@@ -22,8 +22,8 @@
+ linux_COMPILE=cc -DHPDF_SHARED $(LUAINC) $(HPDFINC) -Wall -O2 -fomit-frame-pointer -shared -fPIC -c -o $@ $<
+ linux_LINK=cc -shared -fPIC -o $@ $^ $(HPDFLIB) -lz -lpng -lm
+ linux_REPORT=ldd ./$(TARGET)
+-macosx_COMPILE=cc -DHPDF_SHARED $(LUAINC) $(HPDFINC) -DLUA_USE_MACOSX -Wall -O2 -fomit-frame-pointer -fPIC -c -o $@ $<
+-macosx_LINK=cc -bundle -undefined dynamic_lookup -DLUA_USE_MACOSX $(HPDFLIB) -lz -lpng -o hpdf.so hpdf.o
++macosx_COMPILE=$(CC) $(CFLAGS) -DHPDF_SHARED $(LUAINC) $(HPDFINC) -DLUA_USE_MACOSX -Wall -fomit-frame-pointer -fPIC -c -o $@ $<
++macosx_LINK=$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup -DLUA_USE_MACOSX $(HPDFLIB) -lz -lpng -o hpdf.so hpdf.o
+ macosx_REPORT=otool -L ./$(TARGET)
  
--PREFIX=/usr/local
-+PREFIX=%PREFIX%
- MODDIR=$(PREFIX)/lib/lua/5.1
- DOCDIR=$(PREFIX)/share/doc/luahpdf
- LUALIB=-llua
-@@ -41,7 +41,7 @@
- 	doc/html/license.html
+ PDF = \
+@@ -58,7 +58,7 @@
+ 	$($(PLATFORM)_COMPILE)
  
- $(TARGET) : hpdf.c
--	cc -ansi -DHPDF_SHARED -pedantic -Wall -O2 $(CFLAGS) $(LDFLAGS) -o $@ $(LUAINC) $(HPDFINC) -shared $(LUALIB) $(HPDFLIB) $<
-+	%COMPILER% -ansi -DHPDF_SHARED -pedantic -Wall $(CFLAGS) $(LDFLAGS) -o $@ $(LUAINC) $(HPDFINC) -shared $(LUALIB) $(HPDFLIB) $<
+ dump :
+-	cc -E -dM -ansi -DHPDF_SHARED -pedantic -Wall -O2 $(CFLAGS) $(LUAINC) $(HPDFINC) -shared hpdf.c > $@
++	$(CC) -E -dM -ansi -DHPDF_SHARED -pedantic -Wall -O2 $(CFLAGS) $(LUAINC) $(HPDFINC) -shared hpdf.c > $@
  
  test : $(TARGET)
- 	@lua -e "package.path=\"\" package.cpath=\"./?.so;./?.dll\" require \"hpdf\" print(hpdf.VERSION_TEXT)"
+ 	$(LUA) -e "package.path=[[]] package.cpath=[[./?.so;./?.dll]] local hpdf = require [[hpdf]] print(hpdf.VERSION_TEXT)"
