# $Id: Portfile 83841 2011-09-11 17:51:50Z jmr@macports.org $

PortSystem      1.0

name			unalz
version         0.65
categories		archivers
platforms		darwin
maintainers		bawi.org:minskim
description		unarchiver for the AlZip format

long_description	Unalz is a BSD-licensed unarchiver for AlZip format which \
				requires proprietary and win32-only software but widely used \
				in Korea.

homepage		http://www.kipple.pe.kr/win/unalz/
master_sites	${homepage}
extract.suffix	.tgz

depends_lib     port:libiconv

checksums       md5 e4db2c4e3c8f6f5ee414b68bc55288e5 \
                sha1 98a64f799892f7adfffd4635bd19826fe8f18b26 \
                rmd160 bb55aee26e12c8bf0e4422b11feffa5c88844771

worksrcdir		unalz

post-patch {
    reinplace "s|/usr/local|\$(DESTDIR)${prefix}|" ${worksrcpath}/Makefile
}

# Note: CPP in the Makefile is the C++ compiler, not preprocessor
configure {
    reinplace -E "/^CFLAGS/s|\$|${configure.cflags} [get_canonical_archflags cc]\\\nCPPFLAGS=${configure.cxxflags} [get_canonical_archflags cxx]|" ${worksrcpath}/Makefile
    reinplace -E "/^LDFLAGS/s|\$|${configure.ldflags} [get_canonical_archflags ld]|" ${worksrcpath}/Makefile
}

build.args       CPP="${configure.cxx}" \
	             CXX="${configure.cxx}" \
	             CC="${configure.cc}"
build.target	posix-utf8

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 ${worksrcpath}/readme.txt ${destroot}${docdir}
}

livecheck.type  regex
livecheck.url   ${homepage}
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)
