Index: Portfile
===================================================================
--- Portfile	(revision 142457)
+++ Portfile	(working copy)
@@ -129,12 +129,15 @@
 }
 
 # https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10881
-#variant lua {
-#	configure.args-delete	--without-lua
-#	configure.args-append	--with-lua=${prefix}
-#	depends_lib-append		port:lua
-#}
+variant lua {
+	configure.args-delete	--without-lua
+	configure.args-append	--with-lua=${prefix}
+	depends_lib-append		port:lua
 
+	patchfiles-append		patch-lua52-pkgconfig.diff
+	use_autoreconf yes
+}
+
 variant libsmi {
 	configure.args-delete	--without-libsmi
 	configure.args-append	--with-libsmi=${prefix}
Index: files/patch-configure.diff
===================================================================
--- files/patch-configure.diff	(revision 142457)
+++ files/patch-configure.diff	(working copy)
@@ -12,3 +12,17 @@
  	  ac_krb5_version="$ac_heimdal_version$ac_mit_version_olddir$ac_mit_version_newdir"
  	  if test "x$ac_krb5_version" = "xHEIMDAL"
  	  then
+--- acinclude.m4	2015-10-14 19:01:09.000000000 +0200
++++ acinclude.m4	2015-11-06 16:35:20.000000000 +0100
+@@ -1282,8 +1167,9 @@
+ 	  CPPFLAGS="$CPPFLAGS -I$krb5_dir/include"
+ 	  ac_heimdal_version=`grep heimdal $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*heimdal.*$/HEIMDAL/'`
+ 	  # MIT Kerberos moved krb5.h to krb5/krb5.h starting with release 1.5
+-	  ac_mit_version_olddir=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
+-	  ac_mit_version_newdir=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
++
++	  ac_mit_version_olddir=`head -20 "$krb5_dir/include/krb5.h" | perl -e 'while (<>) {$line = $_; chomp $line; $allLines .= " $line";} if ($allLines =~ /Massachusetts.*Institute of Technology/s) {print "MIT";}'`
++	  ac_mit_version_newdir=`head -20 "$krb5_dir/include/krb5/krb5.h" | perl -e 'while (<>) {$line = $_; chomp $line; $allLines .= " $line";} if ($allLines =~ /Massachusetts.*Institute of Technology/s) {print "MIT";}'`
+ 	  ac_krb5_version="$ac_heimdal_version$ac_mit_version_olddir$ac_mit_version_newdir"
+ 	  if test "x$ac_krb5_version" = "xHEIMDAL"
+ 	  then
Index: files/patch-lua52-pkgconfig.diff
===================================================================
--- files/patch-lua52-pkgconfig.diff	(nonexistent)
+++ files/patch-lua52-pkgconfig.diff	(working copy)
@@ -0,0 +1,64 @@
+Upstream: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff;h=4fe8ca05767f2a4ec160eae412f5b2fd0ee0903b
+Upstream: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff;h=9e1ddb5b73c28b531186c526ead54bfd544f149d
+
+Inspired by upstream 2.0.0rc2, adapted to 1.12.x and specifically MacPorts.
+Most of it can be thrown out on update to 2.0.0.
+
+--- Makefile.am
++++ Makefile.am
+@@ -625,7 +625,7 @@
+ # Common headers
+ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/wiretap \
+ 	$(LIBGNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS) $(LIBSMI_CFLAGS) $(PY_CFLAGS) \
+-	@LUA_INCLUDES@ -DTOP_SRCDIR=\"$(abs_top_srcdir)\"
++	@LUA_CFLAGS@ -DTOP_SRCDIR=\"$(abs_top_srcdir)\"
+ 
+ #
+ # Build the version string
+--- epan/Makefile.am
++++ epan/Makefile.am
+@@ -47,7 +47,7 @@ libwireshark_la_LDFLAGS = -version-info 0:0:0 @LDFLAGS_SHAREDLIB@
+ include Makefile.common
+ 
+ AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/$(LEMON) -I$(builddir)/wslua \
+-	@LUA_INCLUDES@ $(LIBGNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS) \
++	@LUA_CFLAGS@ $(LIBGNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS) \
+ 	$(LIBSMI_CFLAGS) $(LIBGEOIP_CFLAGS) $(PY_CFLAGS)
+ 
+ AM_NON_GENERATED_CFLAGS =-DWS_BUILD_DLL
+--- epan/wslua/Makefile.am
++++ epan/wslua/Makefile.am
+@@ -23,7 +23,7 @@ if HAVE_WARNINGS_AS_ERRORS
+ AM_CFLAGS = -Werror
+ endif
+ 
+-AM_CPPFLAGS = -I$(top_srcdir) @LUA_INCLUDES@
++AM_CPPFLAGS = -I$(top_srcdir) @LUA_CFLAGS@
+ 
+ noinst_LTLIBRARIES = libwslua.la
+ 
+--- configure.ac
++++ configure.ac
+@@ -2190,12 +2190,20 @@
+ 	AC_MSG_RESULT(no)
+ else
+ 	AC_MSG_RESULT(yes)
+-	AC_WIRESHARK_LIBLUA_CHECK
++	# XXX: MacPorts specific configure to work around incomaptible Lua versions
++	# Try the standard pkg-config way, hardcoding the Lua version
++	PKG_CHECK_MODULES(LUA, lua-5.2, [true], [want_lua=no])
+ 	if test "x$want_lua" = "xno" ; then
+-		AC_MSG_RESULT(liblua not found - disabling support for the lua scripting plugin)
++		AC_MSG_ERROR([Lua support was requested, but is not available])
+ 	fi
+ fi
++if test "x$want_lua" = "xyes"
++then
++	AC_DEFINE(HAVE_LUA, 1, [Define to use Lua])
++fi
+ AM_CONDITIONAL(HAVE_LIBLUA, test x$want_lua = xyes)
++AC_SUBST(LUA_LIBS)
++AC_SUBST(LUA_CFLAGS)
+ 
+ 
+ dnl portaudio check
