# -*- 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        MultiMC MultiMC5 0.6.12
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            1
categories          games
license             Apache-2
maintainers         nomaintainer
description         A custom launcher for Minecraft
long_description    MultiMC is {*}${description} that allows you to easily manage \
                    multiple installations of Minecraft at once. It also allows \
                    you to easily install and remove mods by simply dragging and \
                    dropping.
homepage            https://multimc.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
    reinplace -W ${worksrcpath} "s|-target 1.6 -source 1.6|-target 1.8 -source 1.8|g" \
        libraries/javacheck/CMakeLists.txt \
        libraries/launcher/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

cmake.install_prefix \
                    ${applications_dir}

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