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

# _getline
legacysupport.newest_darwin_requires_legacy 10

name                libgrapheme
version             2.0.2
categories          textproc
maintainers         @wwalexander openmaintainer
license             MIT
description         extremely simple freestanding C99 library providing utilities for properly handling strings according to the latest Unicode standard
long_description    libgrapheme is an extremely simple freestanding C99 library providing utilities for properly handling strings according to the latest Unicode standard 15.0.0. It offers fully Unicode compliant grapheme cluster (i.e. user-perceived character) segmentation, word segmentation, sentence segmentation, detection of permissible line break opportunities, case detection (lower-, upper- and title-case), case conversion (to lower-, upper- and title-case) on UTF-8 strings and codepoint arrays, which both can also be null-terminated. \
                    \
                    The necessary lookup-tables are automatically generated from the Unicode standard data (contained in the tarball) and heavily compressed. Over 10,000 automatically generated conformance tests and over 150 unit tests ensure conformance and correctness. \
                    \
                    There is no complicated build-system involved and it's all done using one POSIX-compliant Makefile. All you need is a C99 compiler, given the lookup-table-generators and compressors that are only run at build-time are also written in C99. The resulting library is freestanding and thus not even dependent on a standard library to be present at runtime, making it a suitable choice for bare metal applications. \
                    \
                    It is also way smaller and much faster than the other established Unicode string libraries (ICU, GNU's libunistring, libutf8proc).
set domain          suckless.org
homepage            https://libs.${domain}/${name}/
master_sites        https://dl.${domain}/libgrapheme/
checksums           rmd160  8cf9cddda9f0647e003669d801984a461976ee1c \
                    sha256  a68bbddde76bd55ba5d64116ce5e42a13df045c81c0852de9ab60896aa143125 \
                    size    846990

patchfiles          config.diff

post-patch {
    reinplace "s|@CPPFLAGS@|${configure.cppflags}|" ${worksrcpath}/config.mk
    reinplace "s|@ARCHFLAGS@|[get_canonical_archflags cc]|" ${worksrcpath}/config.mk
    reinplace "s|@LDFLAGS@|${configure.ldflags} [get_canonical_archflags ld]|" ${worksrcpath}/config.mk
}

test.run            yes
