# -*- 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
PortGroup           qt5 1.0
PortGroup           java 1.0
PortGroup           cmake 1.1

github.setup        PolyMC PolyMC 1.4.3
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          games
license             GPL-3 Apache-2
maintainers         nomaintainer
description         A custom launcher for Minecraft
long_description    PolyMC is {*}${description} that allows you to easily manage \
                    multiple installations of Minecraft at once.
homepage            https://polymc.org/

fetch.type          git

post-fetch {
    system -W ${worksrcpath} "git submodule update --init"
}

patchfiles          patch-CMakeLists.txt.diff

post-patch {
    reinplace -W ${worksrcpath} "s|-Werror ||g" \
        CMakeLists.txt
}

# Use LTS Java as fallback
java.fallback       openjdk11
java.version        1.8+

compiler.blacklist-append  *gcc* {clang < 700} {macports-clang-3.[0-9]}
compiler.fallback-append macports-clang-5.0 macports-clang-7.0 macports-clang-8.0

qt5.depends_component \
                    qtsvg

depends_lib-append  port:zlib
depends_build-append \
                    path:share/ECM/cmake/ECMConfig.cmake:kde-extra-cmake-modules

cmake.install_prefix \
                    ${applications_dir}

configure.pre_args-replace \
                    -DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib" -DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/PolyMC.app/Contents/MacOS"
