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

name                monotone

subport monotone-devel {}

categories          devel
license             GPL-2+
maintainers         nomaintainer
description         A distributed version control system
long_description    monotone is a free distributed version control system. It provides \
                    a simple, single-file transactional version store, with fully \
                    disconnected operation and an efficient peer-to-peer synchronization \
                    protocol. It understands history-sensitive merging, lightweight \
                    branches, integrated code review and 3rd party testing.
homepage            http://www.monotone.ca/
platforms           darwin

depends_build       port:pkgconfig
depends_lib         port:zlib \
                    port:libiconv \
                    port:libidn \
                    port:gettext \
                    port:lua \
                    port:pcre \
                    port:sqlite3 \
                    port:botan

if {${name} eq ${subport}} {
    # stable
    version             1.1
    revision            7

    master_sites        ${homepage}downloads/${version}/
    use_bzip2           yes
    checksums           rmd160  c5e0f45028b806eb166b4aaecababa8e8e81b686 \
                        sha256  f95cf60a22d4e461bec9d0e72f5d3609c9a4576fb1cc45f553d0202ce2e38c88
    known_fail          yes
    pre-fetch {
        return -code error "monotone port is incompatible with the current botan. Use monotone-devel instead."
    }
} else {
    # devel
    version             20180227
    set commit 880df7b506faa1ac84871b84629616a66bc02b84
    revision            2

    master_sites        https://code.monotone.ca/p/monotone/source/download/${commit}/?dummy=
    distname            monotone-${commit}
    use_zip             yes
    extract.mkdir       yes

    checksums           rmd160  262e74f4998f7234db7757eb1b20e5ce0e83acda \
                        sha256  593b186d0b3168eb12b1a14f471929a5d3bebad367bfff5f59d870e29e35f5d2 \
                        size    6167787

    patchfiles-append   patch-botan2.5.diff \
                        patch-botan2.9.diff \
                        patch-float128.diff \
                        patch-cstdlib.diff \
                        patch-pid_t.diff

    use_autoreconf      yes

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

patchfiles-append   monotone-1.1-Adapt-to-changes-in-pcre-8.42.patch

# botan is not universal
universal_variant   no

test.run            yes
test.target         check
