Add Manticore Search to MacPorts

Manicore Search is currently maintained for Homebrew users in Mac; however, it currently isn’t available for MacPorts. There are users using MacPorts who may find this convenient (like in https://github.com/manticoresoftware/manticoresearch/issues/27#issuecomment-342142564).

There’s a MacPort port for Sphinx Search but it’s outdated (2.2.11):

Is there a chance that we offer this in MacPorts?

Hi. Would be nice to have. Do you have experience with preparing a MacPort? Your contribution would be highly appreciated.

@Sergey, unfortunately, I don’t have experience in MacPort other than just being a user of it.

Just for reference for someone who will create the MacPorts Portfile. I manage to build the searchd and indexer in /opt/local/bin based on macports/macports-ports/blob/master/textproc/sphinx/Portfile.

I’ve commented several lines and limited it to MariaDB. Put that to my local MacPorts repository. Hopefully someone may find it helpful and fix/enhance it before publishing it.

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

name                manticore
version             3.4.2
distname            manticore-${version}-200410-6903305-release
revision            1
categories          textproc net
license             GPL-2
platforms           darwin
maintainers         nomaintainer

description         Manticore search is a full-text search engine

long_description    Manticore search is a full-text search engine, meant to provide \
                    fast, size-efficient and relevant fulltext search \
                    functions to other applications. Sphinx was specially \
                    designed to integrate well with SQL databases and \
                    scripting languages. Currently built-in data sources \
                    support fetching data either via direct connection to \
                    MySQL or PostgreSQL, or from an XML pipe.

homepage            https://manticoresearch.com/
master_sites        https://github.com/manticoresoftware/manticoresearch/releases/download/${version}/

checksums           rmd160  511f2d8e0ce6e0d849c12d58ee4879fe1a19e4ee \
                    sha256  a5dcdb561db57fd59fab63531eb23f0585f48432ef8be2b94ec6d979d0f35894

# if {${name} eq ${subport}} {
# depends_lib         port:expat \
#                    port:libiconv

PortGroup           cmake 1.0
cmake.out_of_source yes

#post-extract {
#    # Copy launchd plists to worksrcpath
#    file copy ${filespath}/org.macports.${name}.plist ${worksrcpath}/org.macports.${name}.plist
#}

#patchfiles          endian.patch
#post-patch {
#    reinplace "s|@NAME@|${name}|g" ${worksrcpath}/org.macports.${name}.plist
#    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/org.macports.${name}.plist
#}

configure.args      --datadir=${prefix}/share/doc \
                    --sysconfdir=${prefix}/etc/${name} \
                    --localstatedir=${prefix}/var/${name} \
                    --without-mysql \
                    --without-unixodbc

destroot.keepdirs   ${destroot}${prefix}/var/${name}/data \
                    ${destroot}${prefix}/var/${name}/log
post-destroot {
    file mkdir ${destroot}${prefix}/share/${name}
    copy ${worksrcpath}/api \
        ${destroot}${prefix}/share/${name}/api
    # Manually create this folders with right permissions:
    file mkdir ${destroot}${prefix}/var/db/${name}
    file mkdir ${destroot}${prefix}/var/log/${name}
    #file mkdir ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}
    #file copy ${worksrcpath}/org.macports.${name}.plist \
    #    ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/
}

#post-activate {
# Manually create the conf file
#    if {![file exists ${prefix}/etc/${name}/${name}.conf]} {
#        copy ${prefix}/etc/${name}/${name}.conf.dist \
#            ${prefix}/etc/${name}/${name}.conf
#    }
#}

#startupitem.create      yes
#startupitem.executable  ${prefix}/bin/searchd --nodetach

test.run            yes

variant mariadb conflicts mysql51 mysql55 mysql56 mysql57 percona description {Enable MariaDB support} {
    depends_lib-append      port:mariadb-10.2
    configure.args-delete   --without-mysql
    configure.args-append   --with-mysql=${prefix}/lib/mariadb-10.2
}

default_variants +mariadb

#livecheck.type      regex
#livecheck.url       ${homepage}downloads/release/
#livecheck.regex     ${name}-(\[0-9.\]+)-release${extract.suffix}
#} else {
#    livecheck.type      none
#}

# subport libsphinxclient {
#    license             LGPL-2
#    
#    description         C library to talk to the Sphinx full-text search engine
#    
#    long_description    ${description}
#    
#    worksrcdir          ${worksrcdir}/api/${subport}
#    
#    patchfiles-append   libsphinxclient.patch
#    
#    # build shared library too
#    use_autoreconf      yes
#}