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

github.setup        snowballstem snowball 3.0.1 v
github.tarball_from archive
revision            0

name                libstemmer
categories          textproc
maintainers         nomaintainer
license             BSD

description         Algorithmic Stemmer Library

long_description    Snowball is a language in which stemming algorithms can\
                    be easily represented. The Snowball compiler translates a\
                    Snowball script (a .sbl file) into either a thread-safe\
                    ANSI C program or a Java program. For ANSI C, each\
                    Snowball script produces a program file and corresponding\
                    header file (with .c and .h extensions). This port\
                    delivers the ANSI C library build.

homepage            https://snowballstem.org

checksums           rmd160  0cdebafc64d0a85c76aa162fc3442c21c675fb97 \
                    sha256  80ac10ce40dc4fcfbfed8d085c457b5613da0e86a73611a3d5527d044a142d60 \
                    size    256065

use_configure       no

variant universal   {}

build.env           CC=${configure.cc} \
                    "CFLAGS=${configure.cflags} [get_canonical_archflags cc]" \
                    "LDFLAGS=${configure.ldflags} [get_canonical_archflags ld]"
build.post_args     -f GNUmakefile

post-build {
    system -W ${worksrcpath} \
        "env MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}\
        ${configure.cc} [get_canonical_archflags ld] ${configure.ldflags} -fpic\
        -dynamiclib -Wl,-all_load libstemmer.a -o libstemmer.dylib"
    system -W ${worksrcpath} \
        "env MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}\
        install_name_tool -id ${prefix}/lib/libstemmer.dylib libstemmer.dylib"
}

destroot {
    # install header files
    xinstall -m 0644 -W ${worksrcpath}/include libstemmer.h \
        ${destroot}${prefix}/include
    # install libraries
    xinstall -m 0644 -W ${worksrcpath} \
        libstemmer.dylib ${destroot}${prefix}/lib
    xinstall -m 0644 -W ${worksrcpath} \
        libstemmer.a ${destroot}${prefix}/lib
    # install docs
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -W ${worksrcpath} -m 0644 AUTHORS COPYING NEWS README.rst \
        ${destroot}${prefix}/share/doc/${name}
}
