# -*- 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           perl5 1.0

name                dc3dd
version             7.3.1
revision            0
categories          sysutils
license             GPL-3+
maintainers         nomaintainer

description         Enhanced GNU dd
long_description    A patch to the GNU dd program, this version has several \
                    features intended for forensic acquisition of data. \
                    Highlights include hashing on-the-fly, split output \
                    files, pattern writing, a progress meter, and file \
                    verification.
homepage            https://sourceforge.net/projects/dc3dd/

set branch          [join [lrange [split ${version} .] 0 1] .]
master_sites        sourceforge:project/dc3dd/dc3dd/${version}
use_zip             yes

checksums           rmd160  93b3a8d2bb9b5aa4165b80a727a0388c36437c2f \
                    sha256  bd1b66d20a4020ab94b512e56d76cb5f86470d0216081586d596366927cb8d8b \
                    size    5058325

post-extract {
    # find . -type f -print0|LC_ALL=C xargs -0 awk 'FNR==1&&/^#!/{sub(/^\.\//,"",FILENAME);print FILENAME}'|pbcopy
    foreach f {
        blockbench.pl
        bootstrap
        build-aux/announce-gen
        build-aux/compile
        build-aux/config.guess
        build-aux/config.rpath
        build-aux/config.sub
        build-aux/cvsu
        build-aux/depcomp
        build-aux/git-version-gen
        build-aux/gitlog-to-changelog
        build-aux/gnupload
        build-aux/install-sh
        build-aux/mdate-sh
        build-aux/missing
        build-aux/useless-if-before-free
        build-aux/vc-list-files
        build-aux/ylwrap
        configure
        lib/config.charset
        man/help2man
        tests/test-compile.sh
        tests/test-damaged-device-imaging.sh
        tests/test-device-imaging.sh
        tests/test-file-imaging.sh
        tests/test-hashing.sh
        tests/tests-linux.sh
        tests/tests-mac.sh
    } {
        file attributes ${worksrcpath}/${f} -permissions a+x
    }
}

patchfiles-append   patch-lib-vasnprintf.c.diff

if {${os.major} >= 11 && ${os.platform} eq "darwin"} {
    # check for stpncpy is broken
    configure.args-append \
                    gl_cv_func_stpncpy=yes
}

# Perl is only needed to generate *.mo files with gettext
# (no other dependency on Perl)
perl5.branches      5.34
configure.perl      ${perl5.bin}
depends_build-append \
                    port:gettext \
                    port:perl${perl5.major} \
                    port:p${perl5.major}-locale-gettext

depends_lib-append \
                    port:gettext-runtime \
                    port:libiconv

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