# -*- 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        PrismLauncher PrismLauncher 9.4
github.tarball_from releases
revision            0
categories          games
license             GPL-3 Apache-2
maintainers         {@eleanordoesntcode gmail.com:eleanor.publicmail} openmaintainer
description         A custom launcher for Minecraft
long_description    PrismLauncher is {*}${description} that allows you to easily manage \
                    multiple installations of Minecraft at once.
homepage            https://prismlauncher.org/

platforms           {darwin >= 17}

fetch.type          git

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

patchfiles          patch-CMakeLists.txt.diff

cmake.build_type    Release

# Use OpenJDK as fallback
# Cannot use JDK 20+, see https://github.com/PrismLauncher/PrismLauncher/pull/1013.
java.fallback       openjdk8
java.version        1.8

compiler.cxx_standard 2017

qt5.depends_component \
                    qtsvg \
                    qtnetworkauth

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}/PrismLauncher.app/Contents/MacOS"
configure.args-append \
                    -DLauncher_QT_VERSION_MAJOR=5 \
                    -DLauncher_BUILD_PLATFORM=macports
