# -*- 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        bvschaik julius 1.8.0 v
github.tarball_from archive
name                julius-caesar-3
revision            0

description         An open source re-implementation of Caesar III

long_description    \
    Julius is a fully working open-source version of Caesar 3, with the same \
    logic as the original, but with some UI enhancements, that can be played \
    on multiple platforms. Julius will not run without the original Caesar 3 \
    files. You can buy a digital copy from GOG or Steam, or you can use an \
    original CD-ROM version. The goal of the project is to have exactly the \
    same game logic as Caesar 3, with the same look and feel. This means that \
    the saved games are 100% compatible with Caesar 3, and any gameplay bugs \
    present in the original Caesar 3 game will also be present in Julius.

categories          games
installs_libs       no
license             AGPL-3
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

depends_lib-append  port:libpng         \
                    port:libsdl2        \
                    port:libsdl2_mixer  \
                    port:zlib

checksums   rmd160  bb37d9cf0326226b42bb6164808cb5bb0abb76a9 \
            sha256  e479e0b60074497b3e81b30749e040c423f493d469d630a774c06b3d61d91159 \
            size    8159940

# Don't override CMAKE_OSX_DEPLOYMENT_TARGET
patchfiles-append   patch-julius-deployment.diff

# iconutil introduced in 10.7.5
if {${os.platform} eq "darwin" && ${os.major} < 11} {
    depends_lib-append port:makeicns

    patchfiles-append patch-julius-makeicns.diff

    post-patch {
        if {${os.major} >= 9} {
            reinplace "s|@@MACPORTS_MAKEICNS_ARGS@@|-in julius_256.png -512 julius_512.png -out julius.icns|" CMakeLists.txt
        } else {
            # Tiger doesn't support PNGs in icns files
            reinplace "s|@@MACPORTS_MAKEICNS_ARGS@@|-in julius.ico|" CMakeLists.txt
        }
    }
}

destroot {
    copy ${cmake.build_dir}/julius.app \
        ${destroot}${applications_dir}/Julius.app
}

notes "
    Julius can be found in the MacPorts Applications directory.

    Follow the instructions at:

        ${homepage}/wiki/Running-Julius-on-macOS

    ...to install the required game data.
"
