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

github.setup        hyprwm hyprlang 0.6.0 v
revision            0
categories          devel
license             LGPL-2
maintainers         nomaintainer
description         The hypr configuration language is an extremely efficient, \
                    yet easy to work with, configuration language \
                    for applications.
long_description    {*}${description}
homepage            https://hyprland.org/hyprlang
checksums           rmd160  686615ccec11d88576175087147f2094c50c1e8c \
                    sha256  b1a163606402041d92507936fb6dcbc40dd0035b8e8abbf44b0ab59be627b52c \
                    size    57475
github.tarball_from archive

depends_lib-append  port:hyprutils

# The port requires C++23, and builds either on macOS 13+ with clangs,
# or on old systems which can use libstdc++ with modern gcc.
# libc++ of macOS 12 cannot handle it, and unfortunately
# Macports does not support building against libstdc++ anymore
# on modern systems. In particular, on macOS 12
# clang-17 fails at linking with this kind of error:
# https://stackoverflow.com/questions/58923623/stdto-chars-compile-but-not-linking-on-macos-clang
# gcc13 is broken with libc++ at the moment:
# https://trac.macports.org/ticket/68592
# gcc12 fails due to missing <expected>. gcc10-bootstrap also cannot build it,
# complaining about missing <format>.
# Looks like we need to wait until Macports can supply a modern C++ runtime
# for systems lacking it. Currently macports-libcxx uses clang-11 headers,
# which is too old. A manual solution would be to switch to libstdc++
# and build everything against it, with gcc13+.
platforms           {darwin < 11} {darwin > 21}

# Requires C++23, but at the moment we need this trickery:
compiler.cxx_standard       2020
compiler.blacklist-append   {clang} {macports-clang-1[1-6]}
if {${configure.cxx_stdlib} eq "libc++"} {
    compiler.blacklist-append \
                            macports-gcc-13
}

configure.pre_args-replace \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

test.run            yes
