Index: files/patch-Makefile.diff
===================================================================
--- files/patch-Makefile.diff	(revision 0)
+++ files/patch-Makefile.diff	(revision 0)
@@ -0,0 +1,22 @@
+--- Makefile.orig	2011-03-27 16:49:40.000000000 +0200
++++ Makefile	2011-03-27 16:52:46.000000000 +0200
+@@ -43,7 +43,7 @@
+ # What to install.
+ TO_BIN= lua luac
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua.a liblua.dylib
+ TO_MAN= lua.1 luac.1
+ 
+ # Lua version and release.
+@@ -64,6 +64,10 @@
+ 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
++	cd $(INSTALL_LIB) && sudo ln -s liblua.a liblua.%VERSION%.a
++	cd $(INSTALL_LIB) && sudo ln -s liblua.a liblua.%COMPAT_VERSION%.a
++	cd $(INSTALL_LIB) && sudo ln -s liblua.dylib liblua.%VERSION%.dylib
++	cd $(INSTALL_LIB) && sudo ln -s liblua.dylib liblua.%COMPAT_VERSION%.dylib
+ 
+ ranlib:
+ 	cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
Index: files/patch-dlopen.diff
===================================================================
--- files/patch-dlopen.diff	(revision 77291)
+++ files/patch-dlopen.diff	(working copy)
@@ -1,53 +0,0 @@
---- Makefile.orig	2008-08-11 19:40:48.000000000 -0500
-+++ Makefile	2011-03-19 23:15:33.000000000 -0500
-@@ -43,7 +43,7 @@
- # What to install.
- TO_BIN= lua luac
- TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
--TO_LIB= liblua.a
-+TO_LIB= liblua.%VERSION%.dylib
- TO_MAN= lua.1 luac.1
- 
- # Lua version and release.
-@@ -64,6 +64,8 @@
- 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
- 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
- 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
-+	cd $(INSTALL_LIB) && sudo ln -s liblua.%VERSION%.dylib liblua.dylib
-+	cd $(INSTALL_LIB) && sudo ln -s liblua.%VERSION%.dylib liblua.%COMPAT_VERSION%.dylib
- 
- ranlib:
- 	cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
---- src/Makefile.orig	2008-01-19 13:37:58.000000000 -0600
-+++ src/Makefile	2011-03-19 23:17:58.000000000 -0500
-@@ -22,7 +22,7 @@
- 
- PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
- 
--LUA_A=	liblua.a
-+LUA_A=	liblua.%VERSION%.dylib
- CORE_O=	lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
- 	lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o  \
- 	lundump.o lvm.o lzio.o
-@@ -50,9 +50,11 @@
- $(LUA_A): $(CORE_O) $(LIB_O)
- 	$(AR) $@ $?
- 	$(RANLIB) $@
-+	$(CC) -o $@ $(MYLDFLAGS) -dynamiclib -install_name %PREFIX%/lib/liblua.%COMPAT_VERSION%.dylib \
-+		-compatibility_version %COMPAT_VERSION% -current_version %VERSION% $^
- 
- $(LUA_T): $(LUA_O) $(LUA_A)
--	$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
-+	$(CC) -o $@ -L. $(MYLDFLAGS) $(MYCFLAGS) $(MYLIBS) -llua.%VERSION% lua.c
- 
- $(LUAC_T): $(LUAC_O) $(LUA_A)
- 	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
-@@ -99,7 +101,7 @@
- 	$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
- 
- macosx:
--	$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
-+	$(MAKE) all MYCFLAGS="-fno-common -DLUA_USE_LINUX" MYLIBS="-lreadline"
- # use this on Mac OS X 10.3-
- #	$(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
- 
Index: files/patch-src_Makefile.diff
===================================================================
--- files/patch-src_Makefile.diff	(revision 0)
+++ files/patch-src_Makefile.diff	(revision 0)
@@ -0,0 +1,53 @@
+--- src/Makefile.orig	2011-03-27 16:49:54.000000000 +0200
++++ src/Makefile	2011-03-27 16:55:30.000000000 +0200
+@@ -23,6 +23,7 @@
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+ 
+ LUA_A=	liblua.a
++LUA_DYLIB=	liblua.dylib
+ CORE_O=	lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
+ 	lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o  \
+ 	lundump.o lvm.o lzio.o
+@@ -36,8 +37,8 @@
+ LUAC_O=	luac.o print.o
+ 
+ ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+-ALL_A= $(LUA_A)
++ALL_T= $(LUA_DYLIB) $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_A= $(LUA_DYLIB) $(LUA_A)
+ 
+ default: $(PLAT)
+ 
+@@ -48,14 +49,20 @@
+ a:	$(ALL_A)
+ 
+ $(LUA_A): $(CORE_O) $(LIB_O)
++	@echo "Building static library"
+ 	$(AR) $@ $?
+ 	$(RANLIB) $@
+ 
++$(LUA_DYLIB): $(CORE_O) $(LIB_O)
++	@echo "Building dylib"
++	$(CC) -o $@ $(MYLDFLAGS) -dynamiclib -install_name %PREFIX%/lib/liblua.dylib \
++		-compatibility_version %COMPAT_VERSION% -current_version %VERSION% $^
++
+ $(LUA_T): $(LUA_O) $(LUA_A)
+-	$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
++	$(CC) -o $@ -L. $(MYLDFLAGS) $(MYCFLAGS) $(MYLIBS) -llua lua.c
+ 
+ $(LUAC_T): $(LUAC_O) $(LUA_A)
+-	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
++	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_DYLIB) $(LIBS)
+ 
+ clean:
+ 	$(RM) $(ALL_T) $(ALL_O)
+@@ -99,7 +106,7 @@
+ 	$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
+ 
+ macosx:
+-	$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
++	$(MAKE) all MYCFLAGS="-fno-common -DLUA_USE_LINUX" MYLIBS="-lreadline"
+ # use this on Mac OS X 10.3-
+ #	$(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
+ 
Index: Portfile
===================================================================
--- Portfile	(revision 77291)
+++ Portfile	(working copy)
@@ -25,7 +25,8 @@
 test.run            yes
 test.env            DYLD_LIBRARY_PATH=./lib
 
-patchfiles          patch-dlopen.diff
+patchfiles          patch-Makefile.diff \
+                    patch-src_Makefile.diff
 
 post-patch {
     reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/luaconf.h
