# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

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 @nerdling} openmaintainer
long_description    ${description}
homepage            http://arj.sourceforge.net/
master_sites        sourceforge:arj
use_autoconf        yes
autoconf.dir        ${worksrcpath}/gnu
configure.dir       ${autoconf.dir}

checksums           rmd160  80f8a1a8cd203f73def8e957d96563a4dba80153 \
                    sha256  589e4c9bccc8669e7b6d8d6fcd64e01f6a2c21fe10aad56a83304ecc3b96a7db

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

    # strnlen() is already defined
    platform darwin {
        if {${os.major} > 10} {
            reinplace s|strnlen|arjstrnlen|g ${worksrcpath}/fardata.c
        }
    }

}

pre-configure {
    xinstall -m 644 -W ${prefix}/share/libtool/build-aux config.guess config.sub ${autoconf.dir}
}

build.target        prepare all
build.args          CC="${configure.cc} [get_canonical_archflags]"

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

use_parallel_build  no
