# -*- 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 64694 2010-03-14 20:06:58Z snc@macports.org $

PortSystem          1.0

name                lilypond
version             2.12.3
revision            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}/
dist_subdir         ${name}/${version}_${revision}
checksums           md5     2303bf5f2ea8d4628f33a68f016f3866 \
                    sha1    f36072d5f57b2a3d3877e82879be375d548aa951 \
                    rmd160  275b34b2517780a8c94d9c0a38c3f42b22d49703

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

post-patch {
    reinplace s|__vector|lily_vector|g ${worksrcpath}/flower/include/std-vector.hh
}

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.type  regex
livecheck.url   [lindex ${master_sites} 0]
livecheck.regex "${name}-(\\d\\.\\d+\\.\\d)"
