# -*- 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.2.1 v
revision                0
categories              textproc
maintainers             nomaintainer
license                 Apache-2 MIT
description             Unicode routines (UTF8, UTF16, UTF32) and Base64
long_description        {*}${description}
checksums               rmd160  1d4dbc0d4a30099ce71cde29c8abfc2e56c0ee52 \
                        sha256  582f9d0dcf578f6d4766fa29ea12a7f2f02bd3c6ad9e0cf35a8e0ec8478eba4b \
                        size    3498247
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

# Support altivec:
patchfiles-append       simdutf-9.1.2-altivec-combined.diff

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 92
# Altivec build:
# Total Test time (real) = 524.83 sec
# Same v. 9.1.2, without Altivec patch:
# Total Test time (real) = 728.51 sec
# TODO: a few individual tests marginally lose with Altivec build, review that.
test.run                yes
