# -*- 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 118082 2014-03-21 09:50:47Z nicos@macports.org $

PortSystem          1.0

name                jabref
version             2.10
categories          java
platforms           darwin
license             GPL-2+
maintainers         nicos openmaintainer

description         JabRef is an java-based bibliography reference manager. 
long_description    JabRef is an open source bibliography reference manager. \
                    The native file format used by JabRef is BibTeX, the standard \
                    LaTeX bibliography format.\

homepage            http://jabref.sourceforge.net/index.php
distname            JabRef-${version}-src
master_sites        sourceforge:project/jabref/jabref/${version}

checksums           rmd160  7144b51058f69953ef0440900f38311a7a4a916c \
                    sha256  09b57afcfeb1730b58a887dc28f0f4c803e9c00fade1f57245ab70e2a98ce6ad

worksrcdir          ${name}-${version}

use_bzip2           yes

depends_build       port:apache-ant \
                    port:jarbundler

use_configure       no

build.cmd           ant
build.target        build osx

destroot.cmd        ant
destroot.target     jars osxjar
destroot.destdir    

pre-configure {
    #Using macports jarbundler
    reinplace "s|classpath=\"\${lib.dir}/jarbundler-2.2.0.jar\"|classpath=\"${prefix}/share/java/jarbundler.jar\"|g" \
        ${worksrcpath}/build.xml
    #Putting destination to destroot
    reinplace "s|<jarbundler dir=\"\${build.lib}\"|<jarbundler \
        dir=\"${destroot}${applications_dir}\"|g" ${worksrcpath}/build.xml
    reinplace "s|<replace file=\"\${build.lib}|<replace \
        file=\"${destroot}${applications_dir}|g" ${worksrcpath}/build.xml
}

livecheck.type      sourceforge
livecheck.url       http://sourceforge.net/projects/jabref/files/jabref/
