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

boost.version       1.81

# Need strnlen() on 10.6, fdopendir() on 10.9 and earlier
legacysupport.newest_darwin_requires_legacy 13

name                mesos
version             1.11.0

categories          devel
maintainers         nomaintainer
license             Apache-2
homepage            https://mesos.apache.org
master_sites        apache:mesos/${version}

description         Apache Mesos abstracts CPU, memory, storage and other compute resources \
                    away from machines (physical or virtual), enabling fault-tolerant \
                    and elastic distributed systems to easily be built and run effectively.
long_description    {*}${description}

checksums           rmd160  c4b7088162699971d6bdb2b5503fcae39845e276 \
                    sha256  ce08cb648a21502a4a0c45d240a596d9ac860fcaf717f9a3dc986da9d406fe34 \
                    size    72210031

# https://issues.apache.org/jira/browse/MESOS-10240
patchfiles          patch-configureac.patch

patchfiles-append   patch-error_message.diff

use_autoreconf      yes

depends_build-append \
                    port:http-parser \
                    path:bin/pkg-config:pkgconfig \
                    path:lib/pkgconfig/RapidJSON.pc:rapidjson

depends_lib-append  port:apr-util \
                    port:curl \
                    port:cyrus-sasl2 \
                    port:google-glog \
                    port:grpc \
                    path:lib/pkgconfig/jemalloc.pc:jemalloc \
                    port:leveldb \
                    port:libarchive \
                    port:libev \
                    port:protobuf3-cpp \
                    port:re2 \
                    port:subversion \
                    port:zlib

compiler.cxx_standard 2017
compiler.thread_local_storage yes

if {${os.platform} eq "darwin" && ${os.major} == 15 \
        && ${configure.cxx_stdlib} eq "libc++"} {
    # "Mesos cannot be built with optimizations against this version of libcxx (MESOS-5745).
    # Consider building without optimizations, or changing the used C++ standard library."
    configure.optflags      -O0
    configure.args-append   --disable-optimize
}

configure.args-append --with-apr=${prefix} \
                      --with-boost=[boost::install_area] \
                      --with-curl=${prefix} \
                      --with-glog=${prefix} \
                      --with-grpc=${prefix} \
                      --with-jemalloc=${prefix} \
                      --with-leveldb=${prefix} \
                      --with-libarchive=${prefix} \
                      --with-libev=${prefix} \
                      --with-protobuf=${prefix} \
                      --with-rapidjson=${prefix} \
                      --with-re2=${prefix} \
                      --with-sasl=${prefix} \
                      --with-svn=${prefix} \
                      --with-zlib=${prefix} \
                      --disable-java \
                      --disable-maintainer-mode \
                      --disable-python \
                      --disable-silent-rules \
                      --disable-werror

build.env           MAVEN_OPTS=-Duser.home=${workpath}/.home

livecheck.type      regex
livecheck.url       https://archive.apache.org/dist/mesos/
livecheck.regex     {(\d+\.\d+\.\d+)/}
