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

github.setup                H-uru libhsplasma 2025.11.04
version                     0.0-20251104
revision                    0
checksums                   rmd160  6cbbbd762ee958176415c7d464fd1b3d565d5554 \
                            sha256  54c921f34f9b4597f50876e3bf1e80a0bc9c85adac6c350173436d54f885b633 \
                            size    1438119

categories                  devel
maintainers                 {ryandesign @ryandesign}
license                     GPL-3+

description                 library for reading Plasma game engine files

long_description            libHSPlasma is a library for reading files used \
                            by the Plasma game engine (created by Headspin, \
                            acquired by Cyan Worlds), such as those in the \
                            games Myst V: End of Ages and Myst Online: URU Live

github.tarball_from         archive

compiler.cxx_standard       2017

set python_branch           3.14
set python_version          [string map {. ""} ${python_branch}]

depends_lib                 path:include/turbojpeg.h:libjpeg-turbo \
                            port:libpng \
                            port:python${python_version} \
                            port:string_theory \
                            port:zlib

openssl.branch              3

configure.args-append       -DCMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE=PRE_TEST \
                            -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python${python_branch} \
                            -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython${python_branch}.dylib

if {[variant_isset debug]} {
    configure.optflags -O1
    configure.cflags-append -ggdb
    configure.cxxflags-append -ggdb
}

variant commdebug description {Debug network communications (high-level)} {
    configure.cflags-append     -DCOMMDEBUG
    configure.cxxflags-append   -DCOMMDEBUG
}

variant commdebug2 description {Debug network communications (low-level)} {
    configure.cflags-append     -DCOMMDEBUG2
    configure.cxxflags-append   -DCOMMDEBUG2
}

test.run                    yes
test.target                 test

livecheck.version           [regsub {(....)(..)(..)} [lindex [split ${version} -] 1] {\1-\2-\3}]
livecheck.regex             {<updated>([0-9-]+)T}
