# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 80332 2011-07-09 06:22:05Z ryandesign@macports.org $

PortSystem 1.0

name                arj
version             3.10.22
revision            1
categories          archivers sysutils
platforms           darwin
description         create and extract files from dos .arj archives
license             GPL-2
maintainers         snc openmaintainer
long_description    ${description}
homepage            http://arj.sourceforge.net/
master_sites        sourceforge:arj
depends_fetch       port:libtool
depends_lib         port:libtool
use_autoconf        yes
autoconf.dir        ${worksrcpath}/gnu
configure.dir       ${autoconf.dir}

checksums           sha1    e8470f480e9eee14906e5485a8898e5c24738c8b \
                    rmd160  80f8a1a8cd203f73def8e957d96563a4dba80153

platform darwin {
    pre-fetch {
        if {${os.major} > 10} {
            ui_error "${name} will only build on Mac OS X 10.6 Snow Leopard or earlier"
            return -code error "incompatible Mac OS X version"
        }
    }
}

post-extract {
    if {[file exists ${prefix}/share/libtool/config/config.guess]} {
        copy -force ${prefix}/share/libtool/config/config.guess ${prefix}/share/libtool/config/config.sub ${autoconf.dir}
    } else {
        copy -force ${prefix}/share/libtool/config.guess ${prefix}/share/libtool/config.sub ${autoconf.dir}
    }
}

patchfiles          patch-configure.in patch-environ.c \
                    patch-makefile.in patch-postproc.c \
                    patch-uxspec.c

post-patch {
    # as: Flag option -o has already been seen!
    reinplace {s|-o$@|-o $@|g} ${worksrcpath}/gnu/makefile.in
}

if {[variant_isset universal]} {
    set archflags ${configure.universal_cflags}
} else {
    set archflags ${configure.cc_archflags}
}

build.target        prepare all
build.args          CC="${configure.cc} ${archflags}"

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

use_parallel_build  no
