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

# Please rev-bump squirrel-ime whenever librime-devel updates
github.setup        rime librime 1.15.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name                librime
revision            1
categories          devel
license             BSD
maintainers         {l2dy @l2dy} openmaintainer
description         Rime Input Method Engine, the core library
long_description    {*}${description}
homepage            https://rime.im/

depends_build-append \
                    port:pkgconfig

depends_lib-append  port:capnproto \
                    port:gflags \
                    port:google-glog \
                    port:leveldb \
                    port:marisa-trie \
                    port:opencc \
                    port:yaml-cpp

compiler.cxx_standard 2014

configure.args      -DBOOST_USE_CXX11=ON \
                    -DBUILD_TEST=OFF

checksums           rmd160  2ff8f163ed4416efec2ea3e1b341738dcd45c470 \
                    sha256  db5288e6f8d5c595685e1edfb1c548fd9d4f3f82386d863251b12b4845093105 \
                    size    2642615

if {${subport} eq ${name}} {
    conflicts   ${name}-devel
}

subport ${name}-devel {
    github.setup        rime librime 75bc43ae9acdd2042d150a8c446e9ac8b6d77c84
    github.tarball_from archive
    version             20251124
    revision            1

    checksums           rmd160  39b1fa3520c847eb4921c477caae645abacfcf40 \
                        sha256  c183cafd454bf1f089cfbab1f84124f5f7150dd8242a20473529ceb11a039236 \
                        size    2642932

    conflicts-prepend   ${name}
}

variant tests description "Build tests" {
    configure.pre_args-replace \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF
    configure.args-replace \
                    -DBUILD_TEST=OFF \
                    -DBUILD_TEST=ON

    test.run        yes
}

