# -*- 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                fluid-soundfont
set orig_version    3.1
set debian_version  5.3
version             ${orig_version}-${debian_version}
categories          audio
license             MIT
maintainers         {gmail.com:rjvbertin @RJVB} openmaintainer
platforms           any
supported_archs     noarch

description         SoundFont definitions for FluidSynth and compatible applications.
long_description    ${description} Provides the Fluid (R3) General Midi Level 1 \
                    SoundFont (GM) as well as older Roland Sound Canvas extensions from the \
                    GeneralUser (GS) SoundFont. Configuration profiles are also \
                    provided for TiMidity++.

homepage            https://github.com/FluidSynth/fluidsynth/wiki/SoundFont
master_sites        http://http.debian.net/debian/pool/main/f/fluid-soundfont/

distname            ${name}_${orig_version}
worksrcdir          ${name}-${orig_version}

set debian_archive  ${distname}-${debian_version}.debian.tar.xz
distfiles           ${distname}.orig.tar.gz ${debian_archive}

checksums           ${distname}.orig.tar.gz \
                    rmd160  edd3d626bd1fe17c18f1ddf0b657f54d02fd8b5a \
                    sha256  2621acaa1c78e4abdb24bdd163230cc577e61276936d6aa6e3180582142f0343 \
                    size    134835922 \
                    ${debian_archive} \
                    rmd160  ebdbc1942a2c58bc7110c724c15686d1ab535622 \
                    sha256  1ffdfe845dbc08db2ca8be7d4fc91743c9eb473092eaee1173fd96b4a9ccc114 \
                    size    14516

depends_build       port:dos2unix

post-extract {
    move ${worksrcpath}/../debian ${worksrcpath}/debian
}

patch {
    foreach f {fluidr3_gm.cfg fluidr3_gs.cfg} {
        reinplace "s|/usr/share/sounds/sf2|${prefix}/share/sounds/sf2|g" ${worksrcpath}/debian/${f}
        system "dos2unix \"${worksrcpath}/debian/${f}\""
    }
}

use_configure       no
build               {}

destroot {
    set dir ${destroot}${prefix}/share/sounds/sf2
    xinstall -m 755 -d ${dir}
    foreach f {FluidR3_GM.sf2 FluidR3_GS.sf2} {
        xinstall -m 644 ${worksrcpath}/${f} ${dir}
    }

    set dir ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${dir}
    foreach f {README COPYING debian/README.Debian debian/changelog debian/copyright} {
        xinstall -m 644 ${worksrcpath}/${f} ${dir}
    }

    set dir ${destroot}${prefix}/share/timidity
    xinstall -m 755 -d ${dir}
    foreach f {fluidr3_gm.cfg fluidr3_gs.cfg} {
        xinstall -m 644 ${worksrcpath}/debian/${f} ${dir}
    }
}

livecheck.regex {fluid\-soundfont_(\d+(?:[.-]\d+)*)}
