# -*- 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
#PortSystem                 wxWidgets 1.0

name                        sounddecompress
version                     1.11
revision                    2
checksums                   rmd160  4adab63b65699aae5fc0e7941da94cc23718f728 \
                            sha256  63ee6f2bf4db4de97fa758ae5bf57744851d4d9ce287210cf7ab13f0aa0fd15e \
                            size    8277

platforms                   any
categories                  games audio sysutils
maintainers                 {ryandesign @ryandesign}
supported_archs             noarch
homepage                    https://uru.zero-factorial.com/tools/
master_sites                ${homepage}

description                 decompresses Myst Online: URU Live sounds

long_description            SoundDecompress is a utility to decompress sounds \
                            used by the game Myst Online: URU Live so that \
                            they can be played by the game. The game should \
                            do this on its own, but in certain configurations \
                            (such as when running the game under Wine) the \
                            sounds get decompressed incorrectly, resulting in \
                            silence or static. Run this tool to fix the sounds.

notes "
To have SoundDecompress decompress the sounds in a Myst Online: URU Live\
installation installed by the mystonline-cider or mystonline-wine ports, run:

sounddecompress.py -u ${prefix}/share/mystonline/data
"

distname                    ${name}_v[strsed ${version} {g/\.//}]
use_bzip2                   yes

depends_lib                 port:libhsplasma \
                            port:sox
#                            port:py26-wxpython-2.8

depends_run                 port:python26

extract.mkdir               yes

patchfiles                  patch-sounddecompress.py.diff \
                            patch-wxSoundDecompress.py.diff

post-patch {
    reinplace "s|^#!/usr/bin/env python$|#!${prefix}/bin/python2.6|g" \
        ${worksrcpath}/sounddecompress.py \
        ${worksrcpath}/wxSoundDecompress.py
    reinplace "s|@PREFIX@|${prefix}|g" \
        ${worksrcpath}/wxSoundDecompress.py
}

use_configure               no

build                       {}

destroot {
    xinstall ${worksrcpath}/sounddecompress.py ${destroot}${prefix}/bin
#    xinstall ${worksrcpath}/wxSoundDecompress.py ${destroot}${prefix}/bin
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 ${worksrcpath}/ReadMe.txt ${docdir}
}

livecheck.type              regex
livecheck.regex             {(?i)SoundDecompress(?:or)? v([0-9.]+)}
