# -*- 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            testdisk
version         7.2
revision        0
categories      sysutils
maintainers     nomaintainer
license         GPL-2+
description     TestDisk is a powerful free data recovery utility.
long_description    \
        TestDisk was primarily designed to help recover     \
        lost partitions and/or make non-booting disks bootable  \
        again when these symptoms are caused by faulty      \
        software, certain types of viruses or human error   \
        (such as accidentally erasing your Partition Table).    \
        Partition table recovery using TestDisk is really easy.
installs_libs   no

depends_build   port:ncurses

depends_lib     port:libcomerr \
                path:include/turbojpeg.h:libjpeg-turbo \
                port:ntfs-3g \
                port:zlib \
                port:libewf

# e2fsprogs is not universal
universal_variant no

use_bzip2       yes

homepage        https://www.cgsecurity.org/wiki/TestDisk
master_sites    https://www.cgsecurity.org/

checksums           rmd160  8285e51dc999cae954cccc0cdaf833108977d3bf \
                    sha256  f8343be20cb4001c5d91a2e3bcd918398f00ae6d8310894a5a9f2feb813c283f \
                    size    855781

configure.cppflags-append   -I${prefix}/include/ossp

configure.args-append   --with-ncurses-lib=${prefix}/lib \
                        --with-ncurses-includes=${prefix}/include/ncurses \
                        --with-iconv-lib=${prefix}/lib \
                        --with-iconv-includes=${prefix}/include

# configure restores LIBS (dropping -lewf) before the AC_CHECK_FUNCS that probes
# for libewf_handle_{read,write}_buffer_at_offset, so those probes never link and
# always report "no". The code then falls back to libewf_handle_{read,write}_random,
# which libewf 2 removed.
# https://github.com/cgsecurity/testdisk/issues/209
configure.libs-append   -lewf

livecheck.type  regex
livecheck.regex {href="/wiki/TestDisk_Download".*>([0-9.]+)<}
