# -*- 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
# $Id: Portfile 85606 2011-10-15 06:50:22Z ryandesign@macports.org $

PortSystem                  1.0
PortGroup                   cmake 1.0
PortGroup                   qt4 1.0

name                        PlasmaShop
version                     3.0-158
categories                  devel
platforms                   darwin
maintainers                 ryandesign
license                     GPL-3+
homepage                    https://github.com/H-uru/PlasmaShop

description                 tool for inspecting and manipulating Plasma game files

long_description            ${name} is a tool for inspecting and manipulating \
                            the files that make up games based on the Plasma \
                            engine, such as Myst Online: URU Live. It can do \
                            many age-related tasks that lie outside of what \
                            the PRP Blender Plugin can do: create PAK files, \
                            decompyle/compile Python scripts, sum age files, \
                            etc.

fetch.type                  git
git.url                     https://github.com/H-uru/PlasmaShop.git
git.branch                  c826c6710818e625fea08492b81c952090f3da08

depends_lib-append          port:libhsplasma

patchfiles                  patch-CMakeLists.txt.diff patch-prefix.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" \
                            ${worksrcpath}/CMakeLists.txt \
                            ${worksrcpath}/QScintilla/Qt4/qscintilla.pro \
                            ${worksrcpath}/src/3rdParty/qticonloader.cpp
}

configure.pre_args          -DCMAKE_INSTALL_PREFIX=${applications_dir}

pre-build {
    foreach {badport badfile} "tidy ${prefix}/include/platform.h" {
        if {[file exists ${badfile}]} {
            ui_error "${name} cannot be built while ${badport} is active."
            ui_error "Please deactivate ${badport} and try again."
            ui_error "You can reactivate ${badport} again later."
            return -code error "${badport} is installed"
        }
    }
}

platform darwin {
    # http://www.ogre3d.org/forums/viewtopic.php?t=9949#p71474
    configure.cflags-append     -DGL_GLEXT_LEGACY
    configure.cxxflags-append   -DGL_GLEXT_LEGACY
}

livecheck.type              regex
livecheck.url               https://raw.github.com/H-uru/PlasmaShop/master/src/PlasmaShop/Main.h
livecheck.version           [lindex [split ${version} -] 1]
livecheck.regex             {\(build (\d+)\)}
