# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# $Id$
# vim: set fileencoding=utf-8 tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab filetype=tcl :

PortSystem	    1.0

name		    libunrar
version		    3.9.10
revision	    1
categories	    archivers
platforms	    darwin freebsd
maintainers	    krischik 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	    unrarsrc-${version}
dist_subdir	    unrar
patchfiles	    patch-makefile.unix.diff \
		    patch-dll.hpp.diff
worksrcdir	    unrar
use_configure	    no
use_parallel_build  yes

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

set CXXFLAGS	    "${configure.cxxflags} -DSILENT -DGUI -fPIC"
set LDFLAGS	    "${configure.ldflags}"
if {[variant_isset universal]} {
    set CXXFLAGS    "${CXXFLAGS} ${configure.universal_cxxflags}"
    set LDFLAGS     "${LDFLAGS} ${configure.universal_ldflags}"
}

build.env-append    CXX=${configure.cxx}
build.env-append    CXXFLAGS="${CXXFLAGS}"
build.env-append    LDFLAGS="${LDFLAGS}"
build.args	    -f makefile.unix
build.target	    lib

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

    xinstall -d ${destroot}${docdir}
    xinstall ${worksrcpath}/${name}.dylib ${destroot}${prefix}/lib
    xinstall -d ${destroot}${prefix}/include/unrar
    xinstall -m 0444 ${worksrcpath}/dll.hpp ${destroot}${prefix}/include/unrar/dll.hpp
    xinstall -m 0644 -W ${worksrcpath} license.txt readme.txt ${destroot}${docdir}
}

variant universal {}

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