# -*- 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                xmp
categories          audio
maintainers         {dcarmichael.net:dcarmich @douglas-carmichael}

description         Extended Module Player
homepage            https://xmp.sourceforge.net

build.type          gnu

# Disable silent rules.
build.args-append   V=1

if {${subport} eq ${name}} {
    version             4.3.1
    revision            0
    license             GPL-2+

    long_description    The Extended Module Player is a portable \
                        command-line module player for Unix and \
                        Unix-like systems. It plays over 90 mainstream \
                        and obscure module formats from Amiga, Atari, \
                        Acorn, Apple IIgs and PC, including Protracker \
                        (MOD), Scream Tracker 3 (S3M), Fast Tracker II \
                        (XM) and Impulse Tracker (IT).

    master_sites        sourceforge:project/xmp/xmp/${version}
    checksums           rmd160  d6ce311d3fe36cca38aa6a0cfe9dfd3105a33635 \
                        sha256  cbfdab11233708c4de6ab965f64d96d4cb5b9d8e14d2d23df3b1b896386f870f \
                        size    230519

    depends_build       path:bin/pkg-config:pkgconfig

    depends_lib         port:libxmp

    set etc_xmp ${prefix}/etc/xmp
    post-destroot {
        move ${destroot}${etc_xmp}/modules.conf \
            ${destroot}${etc_xmp}/modules.conf.default
        move ${destroot}${etc_xmp}/xmp.conf \
            ${destroot}${etc_xmp}/xmp.conf.default
    }
    post-activate {
        if {![file exists ${etc_xmp}/modules.conf]} {
            copy ${etc_xmp}/modules.conf.default ${etc_xmp}/modules.conf
        }
        if {![file exists ${etc_xmp}/xmp.conf]} {
            copy ${etc_xmp}/xmp.conf.default ${etc_xmp}/xmp.conf
        }
    }
} else {
    livecheck.type      none
}

subport libxmp {
    version             4.7.2
    revision            0
    license             MIT

    long_description    Libxmp is a library that renders module files to \
                        PCM data. It supports over 90 mainstream and \
                        obscure module formats including Protracker \
                        (MOD), Scream Tracker 3 (S3M), Fast Tracker II \
                        (XM), and Impulse Tracker (IT).

    master_sites        sourceforge:project/xmp/libxmp/${version}
    distname            ${subport}-${version}
    checksums           rmd160  de34d0c805c8c9ca3116d499010560a58873676c \
                        sha256  510a96eefd79e4558fb1fa41fb5494870328776b3f77563f94f61f241f64bde1 \
                        size    857784

    patchfiles-append   flag-order.patch

    test.run            yes
    test.target         check

    livecheck.type      sourceforge
    livecheck.distname  ${subport}
}
