# $Id: Portfile,v 1.6 2006/06/07 00:39:58 landonf Exp $

PortSystem 1.0
name			nsis
version			2.17
categories		devel win32
platforms		darwin
maintainers		landonf@opendarwin.org
homepage		http://nsis.sourceforge.net/
description		NSIS is a tool for creating win32 installers.
long_description	NSIS (Nullsoft Scriptable Install System) is a tool \
			that allows programmers to create software installers \
			for Windows. It is released under an open source \
			license and is completely free for any use.

master_sites		sourceforge

distfiles		nsis-${version}-src.tar.bz2 \
			nsis-${version}.zip
checksums		nsis-${version}-src.tar.bz2 md5 a3c068fc1cb613160d7202e1719d63bc \
			nsis-${version}.zip sha1 636f197524e44ba0319f79aac5b00ad7cda07c2c
worksrcdir		nsis-${version}-src
use_bzip2		yes

depends_build		port:scons port:i386-mingw32-gcc

extract.only		nsis-${version}-src.tar.bz2

post-extract {
	system "cd ${workpath} && unzip ${distpath}/nsis-${version}.zip"
}

configure		{}

set scons.args		"PREFIX=\"${prefix}\" PREFIX_DEST=\"${destroot}\" SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all"

build {
	system "cd ${worksrcpath} && scons ${scons.args}"
}

destroot {
	system "cd ${worksrcpath} && scons ${scons.args} install"
	foreach dir {Bin Docs Include Plugins Contrib Examples Menu Stubs} {
		file delete -force ${destpath}/${prefix}/share/nsis/${dir}
		file copy -force ${workpath}/nsis-${version}/${dir} ${destpath}/${prefix}/share/nsis
	}
	system "chmod -R go-w '${destpath}/${prefix}/share/nsis'"
}
