# -*- 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
PortGroup           makefile 1.0

name                unalz
version             0.65
revision            1
categories          archivers
license             zlib
maintainers         {hotmail.com:amtor @RobK88} \
                    bawi.org:minskim \
                    openmaintainer

description         unarchiver for the AlZip format

long_description    Unalz is an unarchiver for the AlZip format which \
                    is widely used in Korea.  The ALZ file format is a proprietary \
                    file compression and archiving format designed to overcome \
                    the file size limitations of the ZIP file format. \
                    If you want to create .alz archives, \
                    you will need to use the proprietary ALZip software which only \
                    runs in Windows.

homepage            http://kippler.com/win/unalz/
master_sites        ${homepage}

extract.suffix      .tgz
worksrcdir          ${name}

depends_lib         port:libiconv \
                    port:zlib \
                    port:bzip2

checksums           rmd160 bb55aee26e12c8bf0e4422b11feffa5c88844771 \
                    sha256 4c26699eb7545072de2ef7de79b4fff1f01c4db09cebff2d8d50ec03d5d74db0 \
                    size 137985

patchfiles          1000-Makefile.diff \
                    1001-libz-linkage.diff \
                    1002-libbz2-linkage.diff \
                    1003-zlib-1.2.7-build.diff \
                    1004-pipe-mode-fixes.diff \
                    1005-filename-length-check.diff \
                    1006-fix-offset-overflow.diff \
                    1007-Remove-CXXFLAGS-from-linking.diff

#
# Remove this post-patch if you want to take advantage of the potential speed increase
# offered by using the "register" keyword in the C++ program.
# Unfortunately, the "register" keyword is only available in older compilers.
# The "register" keyword was deprecated in the C++17 language standard.
#
post-patch {
    reinplace -locale C "s|register ||" ${worksrcpath}/UnAlz.cpp
}

#
# The following is needed so unalz will build on older Macs running Lion etc
#
if {${configure.cxx_stdlib} ne ""} {
    configure.ldflags-append    "-stdlib=${configure.cxx_stdlib}"
}

build.target        posix-utf8

destroot {
    xinstall -m 755 ${worksrcpath}/unalz ${destroot}${prefix}/bin
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/readme.txt ${destroot}${prefix}/share/doc/${name}
}

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