# $Id: Portfile 66285 2010-04-08 08:09:09Z jmr@macports.org $

PortSystem 1.0

name			wxLua
version			2.8.7.0
revision			1
categories		graphics devel
platforms		darwin freebsd
maintainers		afb
description		Lua bindings for wxWidgets
long_description	wxLua is a lua scripting language wrapper around the \
			wxWidgets cross-platform GUI library. It consists of an \
			executable for running standalone wxLua scripts and a \
			library for extending C++ programs with a fast, small, \
			fully embeddable scripting language.

homepage		http://wxlua.sourceforge.net/
master_sites		sourceforge:wxlua
distname		${name}-${version}-src

checksums		md5 d342db617eb63e69232ef13ba96c678a \
			sha1 94b9b80d6a08cd358093d7ae117a151e7167dc6b \
			rmd160 0f699cf4e462d8ed934b29795a684dc593a57691

depends_lib		port:wxstedit port:lua

worksrcdir		wxLua

configure.args		--mandir=${prefix}/share/man \
			--with-wx-prefix=${prefix} \
			--enable-wxbindstc --enable-luamodule \
			--with-lua-prefix=${prefix} \
			--enable-wxluafreeze-app

configure.ccache	no

post-destroot {
	# these includes conflict with the "lua" port:
	delete "${destroot}${prefix}/include/lauxlib.h"
	delete "${destroot}${prefix}/include/lua.h"
	delete "${destroot}${prefix}/include/luaconf.h"
	delete "${destroot}${prefix}/include/lualib.h"
}

platform macosx {}
if { ([variant_isset macosx] || ([info exists os.subplatform] && ${os.subplatform} == "macosx"))
     && ![variant_isset x11] } {
    default_variants +aqua
} else {
    default_variants +x11
}

if { ([variant_isset macosx] || ([info exists os.subplatform] && ${os.subplatform} == "macosx")) } {
variant aqua conflicts x11 description "Use the wxMac port of wxWidgets" {

depends_lib-append	port:wxWidgets

post-destroot {
	set appPath /Applications/MacPorts/wxLua
	xinstall -d -m 0755 ${destroot}${appPath}

	# for wxMac, we delete the programs and use bundles
	delete "${destroot}${prefix}/bin/wxlua"
	delete "${destroot}${prefix}/bin/wxluacan"
	delete "${destroot}${prefix}/bin/wxluaedit"
	delete "${destroot}${prefix}/bin/wxluafreeze"
	copy "${worksrcpath}/apps/wxLua.app" "${destroot}${appPath}"
	copy "${worksrcpath}/apps/wxLuaCan.app" "${destroot}${appPath}"
	copy "${worksrcpath}/apps/wxLuaEdit.app" "${destroot}${appPath}"
	copy "${worksrcpath}/apps/wxLuaFreeze.app" "${destroot}${appPath}"

	# provide a symbolic link to the wxLua sample programs
	ln -sf "${prefix}/share/wxlua/samples" "${destroot}${appPath}/Samples"

	# set up a wrapper so that you can call "wxlua *.wx.lua"
	xinstall -m 0755 "${filespath}/wxlua.sh" "${destroot}${prefix}/bin/wxlua"
	# set up a wrapper so that you can call "wxluaedit" too
	xinstall -m 0755 "${filespath}/wxluaedit.sh" "${destroot}${prefix}/bin/wxluaedit"

	# remove some stuff that is unused with wxMac port
	delete "${destroot}/${prefix}/share/applications/wxlua.desktop"
	delete "${destroot}/${prefix}/share/mime/packages/wxlua.xml"
	delete "${destroot}/${prefix}/share/pixmaps/wxlualogo.xpm"
}

}
}

variant x11 description "Use the wxGTK port of wxWidgets" {

depends_lib-append	port:wxgtk

}

#livecheck.url	http://wxlua.sourceforge.net/download.php
#livecheck.regex	\&raquo\;\&nbsp\;(\[0-9\.\]+)\&nbsp\;\&laquo\;
