# -*- 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 108251 2013-07-17 07:46:53Z vince@macports.org $

PortSystem          1.0
PortGroup           qt4 1.0

name                LyX
conflicts           LyX1
version             2.0.6
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          aqua
license             GPL-2+
maintainers         nomaintainer
description         WYSIWYM document processor
homepage            http://www.lyx.org/
long_description    LyX is an advanced open source document processor \
                    that encourages an approach to writing based on \
                    the structure of your documents, not their \
                    appearance. LyX lets you concentrate on writing, \
                    leaving details of visual layout to the software.

platforms           darwin
depends_lib-append  bin:tex:texlive \
                    port:ImageMagick \
                    port:boost

use_xz              yes
distname            lyx-${version}

master_sites        http://lyx.cybermirror.org/stable/${branch}.x/ \
                    http://sunsite.icm.edu.pl/pub/unix/editors/lyx/stable/${branch}.x/ \
                    ftp://ftp.ntua.gr/pub/X11/LyX/stable/${branch}.x/ \
                    ftp://ftp.lyx.org/pub/lyx/stable/${branch}.x/ \
                    http://gd.tuwien.ac.at/publishing/tex/lyx/stable/${branch}.x/

checksums           rmd160  8e0e3af80726f566fdd8498f7410c36cffa6bdda \
                    sha256  a5cb2bedee6e154b50881acd2316cf9d79162d6754e3aa159a6d579f5a828ad2

patchfiles          patch-configure.diff

configure.pre_args  --prefix=${applications_dir}/LyX.app
configure.args      --with-frontend=qt4 --without-x --with-included-gettext --without-included-boost \
                    --enable-optimization=-Os --disable-concept-checks \
                    --with-version-suffix=-${branch}

variant python25 conflicts python26 python27 description {Use python25} {
    depends_build-append    port:python25
    configure.python        ${prefix}/bin/python2.5
}

variant python26 conflicts python25 python27 description {Use python26} {
    depends_build-append    port:python26
    configure.python        ${prefix}/bin/python2.6
}

variant python27 conflicts python25 python26 description {Use python27} {
    depends_build-append    port:python27
    configure.python        ${prefix}/bin/python2.7
}

if {![variant_isset python25] && ![variant_isset python26] && ![variant_isset python27]} {
    default_variants +python27
}

post-configure {
    reinplace -E \
        "s|mkdir -p \\\$\\(pkgdatadir\\)|\
           mkdir -p \\\$\\(DESTDIR\\)\\\$\\(pkgdatadir\\)|" \
        ${worksrcpath}/development/MacOSX/Makefile
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     "${name} (\\d+\\.\\d+\\.\\d+(\\.\\d+)?) released"
