# -*- 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                generaluser-soundfont
version             1.471
categories          audio
#                   GeneralUser GS License v2.0
license             Permissive
maintainers         {gmail.com:rjvbertin @RJVB} openmaintainer
platforms           any
supported_archs     noarch

description         SoundFont definitions for FluidSynth and compatible applications.
long_description    {*}${description} Provides the GeneralUser SoundFont by S. Christian Collins (GS), \
                    a GM and GS compatible SoundFont bank for composing, playing MIDI files, and retro gaming. \
                    It features 259 instrument presets and 11 drum kits, all while possessing a very low memory \
                    footprint (less than 30 MB of RAM). Due to its clever, detailed sound programming, \
                    GeneralUser GS can sound as good or better than SoundFonts that are 2-3 times its size.
homepage            http://www.schristiancollins.com/generaluser.php
master_sites        https://dl.dropbox.com/s/4x27l49kxcwamp5/
use_zip             yes

distname            GeneralUser_GS_${version}

# This line can be removed once backward compatibility with MacPorts
# base versions prior to PR macports/macports-base#55 is not needed.
worksrcdir          "GeneralUser GS ${version}"

checksums           rmd160  aa8eabb515b0e27ff94b05b6be30ac7e1afc0414 \
                    sha256  4203835164766f428c4926c097c9ea58dae431c7fb8f9dbe277b92d80da45ec2 \
                    size    28373045

use_configure       no
build               {}

destroot {
    set dir ${destroot}${prefix}/share/sounds/sf2
    xinstall -m 755 -d ${dir}
    xinstall -m 644 "${worksrcpath}/GeneralUser GS v${version}.sf2" ${dir}/GeneralUser_GS_v${version}.sf2

    set dir ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${dir}
    foreach f {CHANGELOG.txt LICENSE.txt README.txt "instrument lists/GU1.43 Percussion Map.pdf"} {
        xinstall -m 644 "${worksrcpath}/${f}" ${dir}
    }

    set dir ${destroot}${prefix}/share/examples/${name}
    xinstall -m 755 -d ${dir}
    xinstall -m 644 "${worksrcpath}/GUTest.mid" ${dir}
    foreach f [glob -nocomplain "${worksrcpath}/demo MIDIs/*"] {
        xinstall -m 644 "${f}" ${dir}
    }
}

# The following doesn't work because the site is blocking
# any clients presenting themselves as 'libcurl'.
#
# Dropbox doesn't allow directory browsing either.
#
# livecheck.url       ${homepage}
# livecheck.type      regex
# livecheck.regex     GeneralUser_GS_(\\d+(\\.\\d+)+).zip
#
# The best we can do is a workaround: check another package manager for updates.
#
livecheck.url       https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=soundfont-generaluser
livecheck.type      regex
livecheck.regex     pkgver\=(\\d+(\\.\\d+)+)
