# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 77189 2011-03-22 07:30:33Z jmr@macports.org $

PortSystem 1.0

name            launch4j
version         3.0.2
categories      java
maintainers		panayotis.com:panayotis
description     Cross-platform Java executable wrapper
long_description \
				Launch4j is a cross-platform tool for wrapping Java \
				applications distributed as jars in lightweight Windows \
				native executables. The executable can be configured to \
				search for a certain JRE version or use a bundled one, \
				and it's possible to set runtime options, like the \
				initial/max heap size. The wrapper also provides better \
				user experience through an application icon, a native \
				pre-JRE splash screen, a custom process name, and a Java \
				download page in case the appropriate JRE cannot be found. 
homepage        http://launch4j.sourceforge.net/
platforms       darwin

master_sites    sourceforge
distname        launch4j-${version}-macosx
extract.suffix  .tgz
checksums \
           md5 fbe35ef1200196c121682152f94d157e \
           sha1 7e9faaa807547c687c141fe082098f94ca2d2bb1\
           rmd160 e76310b9a447ab58957205533f2027ac4e5e43b1

patchfiles \
	launcher.diff

use_configure   no
build           {}

worksrcdir		launch4j
destroot {
        set sharedir ${destroot}${prefix}/share
		set l4jdir ${sharedir}/launch4j
		set l4jdoc ${sharedir}/doc/launch4j

		xinstall -d -m 755 ${l4jdoc}
		file rename ${worksrcpath}/web ${l4jdoc}
		file rename ${worksrcpath}/demo ${l4jdoc}
		file rename ${worksrcpath}/LICENSE.txt ${l4jdoc}
		file rename ${worksrcpath}/w32api/MinGW.LICENSE.txt ${l4jdoc}
		foreach doc {JGoodies.Forms JGoodies.Looks Nuvola.Icon.Theme XStream commons foxtrot} {
			file rename ${worksrcpath}/lib/${doc}.LICENSE.txt ${l4jdoc}
		}
		file rename ${worksrcpath}/bin/COPYING ${l4jdoc}/bin.COPYING
		file rename ${worksrcpath}/bin/readme.txt ${l4jdoc}/bin.readme.txt
		file rename ${worksrcpath}/head/LICENSE.txt ${l4jdoc}/head.LICENSE.txt

		file delete -force ${worksrcpath}/head_src
		file delete -force ${worksrcpath}/src
		file delete ${worksrcpath}/build.xml
		file delete ${worksrcpath}/launch4j.exe
		file delete ${worksrcpath}/launch4j.jfpr
		file delete ${worksrcpath}/.classpath
		file delete ${worksrcpath}/.project
		file delete -force ${worksrcpath}/.settings

        xinstall -d -m 755 ${sharedir}
        file copy ${worksrcpath} ${sharedir}
		ln -s ../share/launch4j/launch4j ${destroot}${prefix}/bin/launch4j
}
