# -*- 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           app 1.0
PortGroup           qt5 1.0

compiler.cxx_standard  2011
qt5.depends_component qtwebkit

name                recoll
version             1.26.7
categories          textproc
platforms           darwin
license             GPL-2+
maintainers         {dockes.org:jf @medoc92} openmaintainer

description         Desktop full text search

long_description    Recoll is a desktop search tool based on Xapian

homepage            https://www.lesbonscomptes.com/recoll/
master_sites        ${homepage}

checksums           rmd160  50f25961709ff3ee0ab39c72812f4c46a86dfdbc \
                    sha256  0c7f6e420e345f0c7ea36c6898518f183cf97ab648d25ebe3ff16417b588e1a2 \
                    size 3075386

depends_lib         port:xapian-core \
                    port:aspell \
                    port:libiconv \
                    port:zlib

depends_run         port:antiword \
                    port:python39 \
                    port:py39-lxml \
                    port:poppler \
                    port:unrtf \
                    port:unzip

patchfiles          patch-sampleconf-mimeview.diff \
    patch-mkin-no-no-undefined.diff \
    patch-recoll-pro-stdlib.diff \
    patch-internfile-mh_xslt.diff

post-patch {
    set clang_stdlib ""
    
    if {[string match *clang* ${configure.compiler}]} {
        set clang_stdlib -stdlib=${configure.cxx_stdlib}
    }
    reinplace "s|@@STDLIB@@|${clang_stdlib}|g" qtgui/recoll.pro.in
}


# Note: this is probably not the right way to configure QMAKE
configure.args      QMAKE=${prefix}/libexec/qt5/bin/qmake \
                    --without-x \
                    --disable-x11mon \
                    --disable-python-module \
                    --disable-python-chm

build.args          CC=${configure.cc} CXX=${configure.cxx} CPPFLAGS=-DMACPORTS=1

pre-destroot {
    xinstall -m 755 ${worksrcpath}/qtgui/recoll.app/Contents/MacOS/recoll ${destroot}${prefix}/bin/${name}
}

# g++-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
universal_variant   no
