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

name                        PlasmaClient
epoch                       2
version                     0.0.4a-434
revision                    7
categories                  games
platforms                   darwin
maintainers                 ryandesign
license                     GPL-3+
homepage                    http://web.archive.org/web/20110510024500/http://plasmaclient.info/

description                 open-source Plasma engine

long_description            ${name} is an open-source cross-platform \
                            re-implementation of the Plasma engine, \
                            originally created by HeadSpin Technologies and \
                            Cyan Worlds. The Plasma engine powers Myst \
                            Online: URU Live again.

fetch.type                  hg
hg.url                      http://uru.zrax.net/hg/plasmaclient
hg.tag                      18eaf1280f8f

depends_lib                 port:bullet \
                            port:python26 \
                            port:boost \
                            path:include/turbojpeg.h:libjpeg-turbo \
                            port:zlib \
                            path:lib/libssl.dylib:openssl \
                            port:libsdl \
                            port:libhsplasma

if {![file exists ${prefix}/lib/libboost_python-mt.dylib]} {
    depends_lib-delete port:boost
    pre-configure {
        ui_error "
****
**** ${name} requires port boost installed with variant +python26.
**** Please do the following then try installing ${name} again:
****
****     sudo port install boost +python26
****

"
        return -code error "incompatible boost installation"
    }
}

post-extract {
    move ${worksrcpath}/README.win32 ${worksrcpath}/README.mac
}

patchfiles                  patch-README.diff

configure.args              -DBULLET_INCLUDE_DIR:PATH=${prefix}/include/bullet \
                            -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
                            -DPYTHON_INCLUDE_DIR:PATH=${frameworks_dir}/Python.framework/Versions/2.6/Headers \
                            -DPYTHON_LIBRARY:FILEPATH=${frameworks_dir}/Python.framework/Versions/2.6/lib/python2.6/config/libpython2.6.dylib \
                            -DSDL_INCLUDE_DIR=${prefix}/include/SDL \
                            -DSDL_LIBRARY="${prefix}/lib/libSDLmain.a\;${prefix}/lib/libSDL.dylib\;-framework Cocoa"

build.target-append         default_ini

destroot.keepdirs           ${destroot}${prefix}/var/log/${name}

set docdir ${prefix}/share/doc/${name}
post-destroot {
    xinstall -d ${destroot}${prefix}/share/mystonline/data/servers
    xinstall -W ${worksrcpath} default.ini ${destroot}${prefix}/share/mystonline/data/servers
    xinstall -W ${worksrcpath}/win32dist global.wpm ${destroot}${prefix}/share/mystonline/data
    
    xinstall -d ${destroot}${docdir}
    xinstall -W ${worksrcpath} CHANGELOG README README.mac win32dist/gpl.txt ${destroot}${docdir}
    
    xinstall -d -m 777 ${destroot}${prefix}/var/log/${name}
}

notes "
${name} is obsolete. Now that the source code of the CyanWorlds.com Engine\
has been released, the developer of ${name} is focusing his efforts on that\
project. Check https://github.com/H-uru/Plasma for more info.

To start ${name}, install the PCLauncher port and run PCLauncher in ${applications_dir}

Instructions for using PlasmaClient are in the files ${docdir}/README and ${docdir}/README.mac

For more information, please visit the Guild of Writers' IRC channel at irc://irc.guildofwriters.com/#writers
"

platform darwin powerpc {
    notes-append "\n\n${name} probably does not work at all on PowerPC Macs at this time; try an Intel Mac."
}

platform darwin 8 {
    configure.ldflags-append -lcrypto -ljpeg -lz
}

variant chatlog description {Log all chat messages to /tmp/pcchat.log} {
    patchfiles-append patch-chatlog.diff
}

if {[variant_isset debug]} {
    configure.optflags -O1
    configure.cflags-append -ggdb
    configure.cxxflags-append -ggdb
}

livecheck.type              none
