# $Id: Portfile 115339 2013-12-31 11:55:29Z jmr@macports.org $

PortSystem 1.0

name					xtide
version                 2.13.2
categories				x11 science
platforms				darwin
maintainers             nomaintainer

description				Tide prediction software, with a large database of locations.
long_description		XTide is a package that provides tide and current predictions \
						in a wide variety of formats. Graphs, text listings, and calendars \
						can be generated, or a tide clock can be provided on your desktop. \
						For x11, plain command line, and as an http server.

use_bzip2               yes
homepage                http://www.flaterco.com/xtide/
master_sites            ftp://ftp.flaterco.com/xtide/

set docdir              ${prefix}/share/doc/${subport}
set harmonics_dir       ${prefix}/share/${name}/harmonics

if {${name} eq ${subport}} {
    revision            1
    license             GPL-3+
    master_sites-append http://pkgs.fedoraproject.org/repo/pkgs/${name}/${distfiles}/59de866e0684e123419d7a1c97ea23a5/

    checksums           rmd160  1a6cb8885fb71361cc7ce035186a6ac627a9cb0d \
                        sha256  fabf6b3097bb345598649ea55d1f2db269cbb651cddd73c60a9768088173d542

    depends_lib         port:libpng \
                        port:libtcd \
                        port:xorg-libXaw \
                        port:${name}-data

    patchfiles          patch-configure.ac.diff

    post-patch {
        # Make the default harmonics path conveniently point to our directory.
        reinplace s|harmonics\\.tcd|${harmonics_dir}| ${worksrcpath}/HarmonicsPath.cc
    }

    # Per the configure script: "if using GCC, version 4.4 or later is required"
    compiler.blacklist  *gcc-4.2 gcc-4.0 gcc-3.3
    if {[vercmp $xcodeversion 4.0] < 0} {
        compiler.blacklist-append clang
    }

    # Regenerate configure after patching configure.ac for clang compatibility.
    use_autoreconf      yes

    livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
}

subport ${name}-data {
    version             20121224
    revision            0
    license             public-domain
    supported_archs     noarch

    description         Harmonics data for XTide.

    long_description    ${description}

    worksrcdir          harmonics-dwf-${version}
    distname            ${worksrcdir}-free
    master_sites-append http://pkgs.fedoraproject.org/repo/pkgs/${name}/${distfiles}/f9a8c5414aa14bd6b08d1be4e6a3eea7/

    checksums           rmd160  40ef64cff50ddcaf91b8648441a12ce2c6b07734 \
                        sha256  d80d7e99181c60a42660392abbe25789c395453dd88944c41dc19c7f4b0f11be

    use_configure       no

    build {}

    destroot {
        xinstall -d -m 755 ${destroot}${harmonics_dir} ${destroot}${docdir}
        xinstall -m 644 -W ${worksrcpath} ${distname}.tcd ${destroot}${harmonics_dir}
        xinstall -m 644 -W ${worksrcpath} COPYING ChangeLog ${destroot}${docdir}
    }

    livecheck.regex     harmonics-dwf-(\[0-9\]+)-free${extract.suffix}

    notes "
Only public domain harmonics for the United States are included in this port.\
Additional harmonics licensed for non-commercial use only can be downloaded\
from

[lindex ${master_sites} 0]harmonics-dwf-20111230-nonfree${extract.suffix}

and extracted into ${harmonics_dir} to make them available to ${name}.
"
}

livecheck.type          regex
livecheck.url           ${homepage}files.html
