# $Id: Portfile 50980 2009-05-14 19:41:55Z and.damore@macports.org $

PortSystem 1.0
name			nsis
version			2.44
categories		devel win32
platforms		darwin
maintainers		landonf openmaintainer
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     b7f508d5e66ea6730f15702dd793237b \
				sha1    07db4bcbbba7b66b4e1553c2d6ea42ed8eaab66a \
				rmd160  663884df81341fe7ee88262e6423d5eb273bf346 \
			nsis-${version}.zip \
				md5     93af69b2776d92a7e17cb8115d672f22 \
				sha1    6dec54d6a3cacd615b3fad16bd6eb30260d4be63 \
				rmd160  3159f2fecf8846c2fb16761df6cd40dff646f731

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"
}

use_configure		no

set scons.args		"PREFIX=\"${prefix}\" PREFIX_DEST=\"${destroot}\" SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all APPEND_CPPPATH=\"${prefix}/include\" APPEND_LIBPATH=\"${prefix}/lib\""

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'"
}
