# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 64719 2010-03-15 12:25:32Z rmsfisher@macports.org $

PortSystem      1.0

name            unrar
set my_name     ${name}src
version         3.9.10
categories      archivers
platforms       darwin freebsd
maintainers     nox openmaintainer
description     Extract, view & test RAR archives

long_description \
    The unRAR utility is a minor part of the RAR archiver and \
    contains RAR uncompression algorithm. unRAR requires very \
    small volume of memory to operate.

homepage        http://www.rarlab.com/
master_sites    ${homepage}rar/
distname        ${my_name}-${version}

checksums           md5     3c130ae52ff9fece50af988c343e396d \
                    sha1    8654c4c539a0a05b8cf52ff1aa2fca180601c8e9 \
                    rmd160  7c7d3f5e89ed1657f716c883ef9aaae1f37c1134

worksrcdir      ${name}

use_configure   no

set CXXFLAGS        ${configure.cxxflags}
set LDFLAGS         ${configure.ldflags}
if {[variant_isset universal]} {
    append CXXFLAGS    " ${configure.universal_cxxflags}"
    append LDFLAGS     " ${configure.universal_ldflags}"
} else {
    append CXXFLAGS    " ${configure.cxx_archflags}"
    append LDFLAGS     " ${configure.cc_archflags}"
}

if {[tbool configure.ccache]} {
    configure.cxx "ccache ${configure.cxx}"
}

build.env-append CXX="[join ${configure.cxx} " "]"
build.env-append CXXFLAGS="${CXXFLAGS}"
build.env-append LDFLAGS="${LDFLAGS}"
build.args      -f makefile.unix

destroot {
	set docdir ${prefix}/share/doc/${name}

	xinstall -d ${destroot}${docdir}
	xinstall ${worksrcpath}/${name} ${destroot}${prefix}/bin
	xinstall -m 0644 -W ${worksrcpath} license.txt readme.txt ${destroot}${docdir}
}

variant universal {}

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