# -*- 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
github.tarball_from archive
revision            0

categories          textproc
license             Apache-2 MIT
maintainers         {reneeotten @reneeotten} openmaintainer

description         Unicode conversion routines, fast
long_description    {*}${description}

checksums           rmd160  cbfbcbf49fa6df96fc6cdbd89aa85e60124a1501 \
                    sha256  fd2ce975f29809a975a8da8843cfb3a7265af3f71be548f199d23cf65e101764 \
                    size    2437537

compiler.cxx_standard 2017

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

# see: https://github.com/simdutf/simdutf/issues/982
# fix for:
# error: cannot initialize a parameter of type 'const char16_t *' with an lvalue of type 'const uint16_t *' (aka 'const unsigned short *')
patchfiles          simdutf-char16_t-fix.patch

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

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

test.run                yes
