# -*- 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           fuse 1.0
PortGroup           github 1.0
PortGroup           legacysupport 1.1

# _strnlen
legacysupport.newest_darwin_requires_legacy 10

github.setup        libyal libfvde 20240502
revision            0
categories          fuse
license             LGPL-3+
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         Library and tools to access FileVault Drive Encryption (FVDE) encrypted volumes
long_description    {*}${description}.
distname            ${name}-experimental-${version}
checksums           rmd160  bedb7ea66b574647a23baf9ec431b3aa717e278a \
                    sha256  c2d22eca9f646a5a388c6c22d6920292832384800ebeb519c03907bd5003c49b \
                    size    3287900
github.tarball_from releases

worksrcdir          ${name}-${version}

set py_ver          3.14
set py_ver_nodot    [string map {. {}} ${py_ver}]

depends_build-append \
                    port:gettext \
                    path:bin/pkg-config:pkgconfig \
                    port:py${py_ver_nodot}-setuptools

depends_lib-append  port:gettext-runtime \
                    port:libbfio \
                    port:libcaes \
                    port:libcdata \
                    port:libcerror \
                    port:libcfile \
                    port:libclocale \
                    port:libcnotify \
                    port:libcpath \
                    port:libcsplit \
                    port:libcthreads \
                    port:libfcache \
                    port:libfdata \
                    port:libfguid \
                    port:libfplist \
                    port:libfvalue \
                    port:libhmac \
                    port:libiconv \
                    port:libuna \
                    port:python${py_ver_nodot} \
                    port:zlib

configure.python    ${prefix}/bin/python${py_ver}
set python_root     ${frameworks_dir}/Python.framework/Versions/${py_ver}

configure.env-append \
                    PYTHON_CONFIG=${configure.python}-config

# TODO: FreeBSD disable openssl in these ports (and MacPorts did not use it), but why?
# https://github.com/freebsd/freebsd-ports/blob/aa7da7efb75b022fc31f98f46c2135de4cba0b7e/sysutils/libfvde/Makefile#L20
configure.args-append \
                    --enable-python \
                    --with-libiconv-prefix=${prefix} \
                    --with-libintl-prefix=${prefix} \
                    --with-openssl=no \
                    --with-pyprefix=${python_root}
