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

name                xld
version             20250302
revision            0

categories          audio
supported_archs     x86_64 arm64 i386 ppc
license             GPL-2
maintainers         {judaew @judaew} openmaintainer

description         Lossless audio decoder for Mac OS X
long_description    \
    X Lossless Decoder(XLD) is a tool for Mac OS X that is able to \
    decode/convert/play various 'lossless' audio files. The supported audio \
    files can be split into some tracks with cue sheet when decoding. It works \
    on Mac OS X 10.4 and later.
homepage            https://tmkk.undo.jp/xld/index_e.html

master_sites        sourceforge:xld
distname            xld-${version}
use_dmg             yes

checksums           rmd160  8787f76384560cabcf3e1c71f1566b0c9b09efa3 \
                    sha256  0032a5470ea4e32a11a35b8077ebf4986102891f8eb82743094f2c6621ad8aeb \
                    size    11310447

variant universal {}
default_variants +universal

use_configure       no
build {}

patchfiles          patch-use-macports-applications-dir.diff

post-patch {
    reinplace "s,@@APPLICATIONS_DIR@@,${applications_dir},g" \
        ${worksrcpath}/CLI/xld
}

destroot {
    move ${worksrcpath}/XLD.app ${destroot}${applications_dir}
    xinstall -m 0755 ${worksrcpath}/CLI/${name} ${destroot}${prefix}/bin
}
