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

boost.version       1.78

github.setup        luceneplusplus LucenePlusPlus 3.0.9 rel_
revision            0
categories          devel
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             GPL-3+

description         High-performance, full-featured text search engine for C++

long_description    Lucene++ is an up to date C++ port of the popular Java Lucene library, \
                    a high-performance, full-featured text search engine.

checksums           rmd160  98a1508feaba53920a3b2a6684905212df9d7f7b \
                    sha256  4e69e29d5d79a976498ef71eab70c9c88c7014708be4450a9fda7780fe93584e \
                    size    2458287
github.tarball_from archive

depends_lib-append  port:zlib

# CMakeLists in the source installs liblucene++.pc into a wrong place.
# https://github.com/luceneplusplus/LucenePlusPlus/pull/202
patchfiles-append   patch-fix-pc-path.diff

conflicts_build     gtest

compiler.cxx_standard   2011
compiler.c_standard     2011

# error: unknown argument: '-fno-pch-timestamp'
# https://github.com/luceneplusplus/LucenePlusPlus/issues/205
# error: use of undeclared identifier 'max_align_t'
# std::size_t size, std::size_t align = BOOST_ASIO_DEFAULT_ALIGN)
# error: default initialization of an object of const type 'void *const'
# void* const pointer = aligned_new(align, chunks * chunk_size + 1);
# https://github.com/luceneplusplus/LucenePlusPlus/issues/206
compiler.blacklist-append \
                    {clang < 900}

configure.pre_args-replace \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

configure.args-append \
                    -DENABLE_DEMO=OFF \
                    -DENABLE_TEST=OFF \
                    -DINSTALL_GTEST=OFF

# While on PowerPC all tests pass, on new systems build fails at the moment:
# https://github.com/luceneplusplus/LucenePlusPlus/issues/199
variant tests description "Support testing" {
    configure.args-replace \
                    -DENABLE_TEST=OFF \
                    -DENABLE_TEST=ON

    test.run        yes
    test.dir        ${cmake.build_dir}/src/test
    test.cmd        ./lucene++-tester
    test.post_args  --test_dir="${worksrcpath}/src/test/testfiles"
    test.target
}