# -*- 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           conflicts_build 1.0
PortGroup           openssl 1.0

name                virtuoso-7
set myname          virtuoso
version             7.2.10
revision            1
categories          devel
maintainers         {snc @nerdling} openmaintainer
license             GPL
description         a high-performance object-relational SQL database
long_description    Virtuoso is an enterprise-grade server that delivers a platform \
                    for Data Access, Integration and Management.
homepage            http://${myname}.openlinksw.com/dataspace/dav/wiki/Main/
master_sites        sourceforge:project/${myname}/${myname}/${version}
distname            ${myname}-opensource-${version}

checksums           rmd160  a7d1d7c7333b3e125543a70c4644b36de8f7da45 \
                    sha256  c02b0a966ff33f854a86f8f74caa8a5a957e22b510cc2f808e54ed34b4b27f0f \
                    size    121992638

# https://trac.macports.org/ticket/61216
patchfiles-append   patch-libsrc-Wi-numeric.c.diff
configure.cflags-append \
                    -Wno-error=implicit-function-declaration \
                    -Wno-error=incompatible-pointer-types \
                    -Wno-error=implicit-int \
                    -Wno-error=int-conversion

supported_archs     x86_64 arm64
conflicts           virtuoso-6 virtuoso-5
conflicts_build     chicken geos

depends_build       port:gawk

depends_lib         port:ImageMagick \
                    path:lib/libldap.dylib:openldap

openssl.branch      1.0
openssl.configure   build_flags

configure.args-append   --disable-all-vads \
                        --disable-silent-rules \
                        --program-transform-name='s/isql/isql-vt/\;s/isqlw/isqlw-vt/'

post-configure {
    reinplace "s|\"gcc\"|\"${configure.cc}\"|" ${worksrcpath}/bin/libtool.macosx
    foreach note $PortInfo(notes) {
        ui_msg $note
    }
}

post-build {
    touch ${worksrcpath}/docsrc/html_virt/test.html
}

pre-activate {
    if {[file exists ${prefix}/bin/inifile]
        && ![catch {set vers [lindex [registry_active $myname ] 0]}]} {
        registry_deactivate_composite ${myname} "" [list ports_nodepcheck 1]
    }
}

notes "
Some antivirus software can cause the virtuoso build to hang indefinitely.\
If you have any antivirus software installed, please disable it while\
building virtuoso; it can be re-enabled after virtuoso has been installed.
"

livecheck.url       http://sourceforge.net/api/file/index/project-id/161622/mtime/desc/rss?path=/virtuoso
livecheck.type      regex
livecheck.regex     ${myname}/(\\d+(\\.\\d+)+)/${myname}-opensource-(\\d+(\\.\\d+)+)