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

github.setup            simdutf simdutf 9.0.0 v
revision                0
categories              textproc
maintainers             nomaintainer
license                 Apache-2 MIT
description             Unicode routines (UTF8, UTF16, UTF32) and Base64
long_description        {*}${description}
checksums               rmd160  cbfbcbf49fa6df96fc6cdbd89aa85e60124a1501 \
                        sha256  fd2ce975f29809a975a8da8843cfb3a7265af3f71be548f199d23cf65e101764 \
                        size    2437537
github.tarball_from     archive

# The code is broken, upstream thinks that fixing bugs is not worth their time.
# https://github.com/simdutf/simdutf/issues/982
patchfiles              simdutf-char16_t-fix.patch

# Make powerpc handling more sensible.
patchfiles-append       fix-broken-powerpc-handling.patch

compiler.cxx_standard   2017

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

depends_build-append    port:python${py_ver_nodot}

depends_lib-append      port:libiconv

configure.args-append   -DBUILD_SHARED_LIBS=ON \
                        -DCPM_LOCAL_PACKAGES_ONLY=ON \
                        -DPython3_EXECUTABLE=${prefix}/bin/python${py_ver} \
                        -DSIMDUTF_ICONV=ON \
                        -DSIMDUTF_TOOLS=ON

# Required for tests to run:
configure.pre_args-replace \
                        -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                        -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

# On powerpc: 100% tests passed, 0 tests failed out of 91
test.run                yes
