# -*- 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
# $Id: Portfile 51779 2009-06-03 06:02:53Z snc@macports.org $

PortSystem          1.0

name                lilypond
version             2.12.2
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          textproc
maintainers         snc openmaintainer
description         An automated engraving system for typesetting sheet music.
long_description    Lilypond is a unix-based automated engraving system that \
                    generates beautiful sheet music from input files. Lilypond \
                    uses its own input format, .ly, which in many ways is \
                    similar to LaTeX. Lilypond can export sheet music to PDF, \
                    EPS, SVG, and PNG formats, and can also create MIDI files.

homepage            http://lilypond.org/
platforms           darwin
master_sites        http://download.linuxaudio.org/lilypond/sources/v${branch}/
checksums           md5     681dfbecf8a3710d1400cf9488be716b \
                    sha1    92afe4ef926d966e7855f64ae93ee762f1fa5178 \
                    rmd160  0ef1e1cbceb4fbf69a31b00a030ee40c4280091d

depends_lib         port:fontforge \
                    port:ghostscript \
                    port:mftrace \
                    port:guile \
                    port:texinfo \
                    path:lib/pkgconfig/pango.pc:pango \
                    port:flex \
                    port:urw-fonts

configure.args  --with-ncsb-dir=${prefix}/share/fonts/urw-fonts \
    --disable-documentation \
    --disable-gui
configure.env       LTDL_LIBRARY_PATH=${prefix}/lib

build.env           LTDL_LIBRARY_PATH=${prefix}/lib

destroot.env        LTDL_LIBRARY_PATH=${prefix}/lib
post-destroot {
    move ${destroot}${prefix}/bin/lilypond \
        ${destroot}${prefix}/libexec/lilypond-bin
    xinstall -m 755 ${filespath}/lilypond.in ${destroot}${prefix}/bin/lilypond
    reinplace "s|@@PREFIX@@|${prefix}|g" ${destroot}${prefix}/bin/lilypond
}

variant docs description {Build documentation files} {
    configure.args-delete   --disable-documentation
    configure.args-append   --enable-documentation
    depends_lib-append      port:netpbm
}

variant gui description {Build GNOME GUI (X11)} {
    configure.args-delete   --disable-gui
    configure.args-append   --enable-gui
}

default_variants    +docs

livecheck.check regex
livecheck.url   [lindex ${master_sites} 0]
livecheck.regex "${name}-(\\d\\.\\d+\\.\\d)"
