# -*- 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           cmake 1.1
PortGroup           github 1.0
PortGroup           openssl 1.0

boost.version       1.81

github.setup        emweb wt 4.11.1
revision            3
categories          devel www
license             GPL-2
maintainers         nomaintainer
description         C++ Web Toolkit
long_description    Wt is a C++ library for developing web applications.
homepage            https://www.webtoolkit.eu/wt
checksums           rmd160  63e03068cc57a5bb4cd03788c8b41433b6b1a5a6 \
                    sha256  c255b7d6b0569a9c67282ef7a89af9624e3ab79477924e5a110814a570d1d017 \
                    size    10573506
github.tarball_from archive

depends_build-append \
                    port:asciidoctor \
                    path:bin/doxygen:doxygen \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:glew \
                    port:GraphicsMagick \
                    port:libharu \
                    port:log4shib \
                    port:mesa \
                    path:lib/pkgconfig/pango.pc:pango \
                    port:postgresql16 \
                    port:sqlite3 \
                    port:xercesc3 \
                    port:xml-security-c \
                    port:xmltooling \
                    port:xorg-libX11 \
                    port:zlib

patchfiles-append   0001-src-CMakeLists-fix-OpenGL-linking.patch \
                    0002-WServerGLWidget.C-do-not-hardcode-OpenGL-implementat.patch

compiler.cxx_standard   2014

# Qt is only used in examples, no need to enable it by default.
# Also do not force Qt5+ on 10.6 and below in any case.
configure.args-append \
                    -DBUILD_EXAMPLES=OFF \
                    -DDEBUG_JS=OFF \
                    -DENABLE_QT4=OFF \
                    -DENABLE_QT5=OFF \
                    -DENABLE_QT6=OFF \
                    -DENABLE_FIREBIRD=OFF \
                    -DENABLE_HARU=ON \
                    -DENABLE_LIBWTDBO=ON \
                    -DENABLE_LIBWTTEST=OFF \
                    -DENABLE_MSSQLSERVER=OFF \
                    -DENABLE_MYSQL=OFF \
                    -DENABLE_OPENGL=ON \
                    -DENABLE_PANGO=ON \
                    -DENABLE_POSTGRES=ON \
                    -DENABLE_SAML=OFF \
                    -DENABLE_SQLITE=ON \
                    -DENABLE_SSL=ON \
                    -DENABLE_UNWIND=OFF \
                    -DGM_PREFIX=${prefix} \
                    -DMULTI_THREADED_BUILD=ON \
                    -DSHARED_LIBS=ON \
                    -DWT_WRASTERIMAGE_IMPLEMENTATION="GraphicsMagick"

variant unixODBC description "Enable ODBC support" {
    depends_lib-append \
                    port:unixODBC

    configure.args-replace \
                    -DENABLE_MSSQLSERVER=OFF -DENABLE_MSSQLSERVER=ON
}
