# -*- 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       conflicts_build 1.0
PortGroup       ffmpeg 1.0
PortGroup       kde4 1.1

name            strigi
version         0.7.8
revision        19
categories      devel
maintainers     nomaintainer
license         LGPL-2+

description     Fastest and smallest desktop searching program
long_description \
    Strigi is a daemon which uses a very fast and efficient crawler that can \
    index data on your harddrive. Indexing operations are performed without \
    hammering your system, this makes Strigi the fastest and smallest desktop \
    searching program. Strigi can index different file formats, including \
    the contents of the archive files.

homepage        https://www.vandenoever.info/software/strigi
master_sites    ${homepage}/

use_bzip2       yes

# If you encounter the following error:
# /bin/sh: line 1: 23060 Bus error /opt/local/libexec/qt4/bin/moc @/opt/local/var/macports/build/strigi-bdfd2156/work/build/strigiclient/lib/searchclient/moc_dlglistindexedfiles.cxx_parameters
# try just resuming the build without changing anything. Seems to work fine then.

ffmpeg.version  4

depends_build-append \
                port:cppunit \
                path:bin/pkg-config:pkgconfig

depends_lib-append \
                port:bzip2 \
                port:clucene \
                port:dbus \
                port:libiconv \
                port:libxml2 \
                port:zlib

checksums       rmd160  34cbbe98e7a371467b115b18586baf299340d1b8 \
                sha256  43e461a625acdefa59bf58cc9d10aebda9eba920dfbe800fc77e6dcbf1eff989 \
                size    810574

patchfiles      patch-ffmpegendanalyzer.diff \
                patch-libstreamanalyzer-cmake.diff \
                patch-libstreamanalyzer-lib-rdfnamespaces.h.diff \
                patch-libstreamanalyzer-plugins-endplugins-ffmpegendanalyzer.cpp.diff \
                patch-strigidaemon-bin-daemon-xesam-xesamsearch.h.diff \
                patch-strigi-use-pair-instead-of-make_pair.diff

compiler.cxx_standard \
                2011
configure.cxxflags-append \
                -std=c++11

# Match kde4 PG to not affect CMake ordering due to deduplication
pre-configure {
    configure.cxxflags-delete   -I${ffmpeg.prefix}/include
    configure.ldflags-delete    -L${ffmpeg.prefix}/lib
}

set kde4.cmake_module_dir ${prefix}/lib/cmake
set shext [expr {${os.platform} eq "darwin" ? "dylib" : "so"}]

configure.args-append \
                -DENABLE_EXIV2=OFF \
                -DENABLE_FFMPEG=ON \
                -DENABLE_LOG4CXX=OFF \
                -DENABLE_XINE=OFF \
                -DICONV_INCLUDE_DIR:PATH=${prefix}/include \
                -DICONV_LIBRARIES:FILEPATH=${prefix}/lib/libiconv.${shext}

platform darwin {
    configure.args-append \
                -DENABLE_FAM=OFF
}

# Best practice for CMake dictates that builds should be out of source.
# However, it appears that strigi uses java to create source files and
# they don't get put in the right place if you're doing an out of source
# build, so for now this is an in-source build. That does, however, simplify
# things because the build and destroot phases can be left at the default
# values.

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} COPYING AUTHORS ChangeLog ${destroot}${prefix}/share/doc/${name}
}

livecheck.type  regex
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
