# -*- 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 88233 2011-12-22 15:41:06Z hum@macports.org $

PortSystem          1.0

name                seekanser
version             1.0.7
categories          textproc java japanese
platforms           darwin
maintainers         hum openmaintainer
license             LGPL-3.0

homepage            http://seekanser.sourceforge.jp/
description         a program to seek answers to a quiz in Japanese
long_description    SeekAnser is ${description}.

master_sites        sourceforge_jp:seekanser/54271/
distname            SeekAnser(${version})
use_zip             yes
checksums           rmd160  a235ca06345903feaa42143bbbc8e219e98928fb \
                    sha256  19548f35146c3a5a67fee3e803f56e45be05764a4887480bd4068554493afefd

worksrcdir          SeekAnser

depends_lib         port:chasen

# directory where SeekAnser.jar is extracted.
set jardir          ${worksrcpath}/seekanser-${version}
set jarname         seekanser-${version}.jar
set jarpatch        ${filespath}/patch-slothlib.properties.diff

post-extract {
    file mkdir ${jardir}
    system -W ${jardir} "jar xf ../SeekAnser\\(${version}\\).jar"
}

post-patch {
    system -W ${jardir} "patch < ${jarpatch}"
    reinplace "s|/usr/|${prefix}/|g" ${jardir}/slothlib.properties
}

use_configure       no
supported_archs     noarch

build {
    system "jar cmf ${jardir}/META-INF/MANIFEST.MF ${worksrcpath}/${jarname} -C ${jardir} ."
}

destroot {
    set seekanserdir   ${prefix}/share/${name}
    xinstall -m 755 -d ${destroot}${seekanserdir}
    xinstall -m 644 -W ${worksrcpath} \
        README.txt ${jarname} examples.txt \
        ${destroot}${seekanserdir}
    set dest_script    ${destroot}${prefix}/bin/seekanser
    xinstall -m 755    ${filespath}/seekanser            ${dest_script}
    reinplace "s|@JARPATH@|${seekanserdir}/${jarname}|g" ${dest_script}
}

notes "Please run 'seekanser' and have fun!"

livecheck.type      regex
livecheck.url       http://sourceforge.jp/projects/seekanser/releases/
livecheck.regex     >(\\d+\\.\\d+\\.\\d+)
