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

name            timescaledb1
github.setup    timescale timescaledb 1.7.5
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision        0
license         Apache-2
description     A time-series database that integrates with PostreSQL.
maintainers     {blair @blair} openmaintainer
categories      databases
conflicts       timescaledb
homepage        https://www.timescaledb.com/

long_description \
                TimescaleDB is an open-source database designed to \
                make SQL scalable for time-series data. It is \
                engineered up from PostgreSQL, providing automatic \
                partitioning across time and space (partitioning key), \
                as well as full SQL support. TimescaleDB is packaged \
                as a PostgreSQL extension.

checksums       rmd160  d42db4f8ff86c85016cf0b2c0ef2133acdc2eb97 \
                sha256  4d696b2a03c66dd0198980a025d840edea12e0f154779d608882bba20390b0d5 \
                size    1993573

depends_build   path:bin/cmake:cmake

variant postgresql96 conflicts postgresql10 postgresql11 postgresql12 description {Support for PostgreSQL 9.6.x} {
    depends_lib-append      port:postgresql96
    configure.env-append    PATH=${prefix}/lib/postgresql96/bin:$::env(PATH)
}

variant postgresql10 conflicts postgresql96 postgresql11 postgresql12 description {Support for PostgreSQL 10.x} {
    depends_lib-append      port:postgresql10
    configure.env-append    PATH=${prefix}/lib/postgresql10/bin:$::env(PATH)
}

variant postgresql11 conflicts postgresql96 postgresql10 postgresql12 description {Support for PostgreSQL 11.x} {
    depends_lib-append      port:postgresql11
    configure.env-append    PATH=${prefix}/lib/postgresql11/bin:$::env(PATH)
}

variant postgresql12 conflicts postgresql96 postgresql10 postgresql11 description {Support for PostgreSQL 12.x} {
    depends_lib-append      port:postgresql12
    configure.env-append    PATH=${prefix}/lib/postgresql12/bin:$::env(PATH)
}

if {![variant_isset postgresql96] && \
    ![variant_isset postgresql10] && \
    ![variant_isset postgresql11] && \
    ![variant_isset postgresql12] } {
    default_variants +postgresql12
}

patch.pre_args-replace  -p0 -p1
patchfiles-append       test-CMakeLists.txt.patch

compiler.c_standard     2011
# Work around MacPorts base C11 compiler selection bug.
# https://github.com/macports/macports-base/pull/196
compiler.blacklist-append {clang < 500}

configure.cmd           ./bootstrap
configure.pre_args

# Do not remove -DAPACHE_ONLY from configure.args otherwise some
# binaries may be built that are licensed under the Timescale License
# (TSL). See https://github.com/timescale/timescaledb#timescaledb and
# https://github.com/timescale/timescaledb/blob/master/tsl/LICENSE-TIMESCALE.
configure.args          -DAPACHE_ONLY=1 \
                        -DPROJECT_INSTALL_METHOD=macports

build.dir               ${worksrcpath}/build

livecheck.type          none
