# -*- 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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           makefile 1.0

name                xephem
github.setup        XEphem XEphem 4.2.0
github.tarball_from archive
revision            1
categories          science
maintainers         nomaintainer
license             MIT
description         interactive astronomical ephemeris program
long_description    XEphem is an interactive astronomical ephemeris program for \
                    X Windows systems. It computes heliocentric, geocentric and \
                    topocentric information for fixed celestial objects and \
                    objects in heliocentric and geocentric orbits\; has built-in \
                    support for all planet positions\; the moons of Jupiter, \
                    Saturn and Earth\; Mars' and Jupiter's central meridian \
                    longitude\; Saturn's rings\; and Jupiter's Great Red Spot

homepage            https://xephem.github.io/XEphem/Site

checksums           rmd160  35605645c20735e8b0aae17d2e98832bddc81be3 \
                    sha256  4d67b923e342e56b2a4a49f574e576fc183f1747edb693bab3709e83c8ad9c1b \
                    size    17317398

depends_build       bin:nroff:groff

depends_lib         port:xorg-libXp \
                    port:xorg-libXt \
                    port:xorg-libXext \
                    port:xorg-libXmu \
                    port:xorg-libX11 \
                    port:openmotif \
                    port:openssl

worksrcdir          ${distname}/GUI/xephem

patchfiles-append   parallel.patch
patchfiles-append   system-libs.patch

build.args          MOTIFI="${prefix}/include" \
                    MOTIFL="${prefix}/lib" \
                    PLATI="${configure.cflags}" \
                    PLATL="${configure.ldflags}"

destroot {
    set share ${prefix}/share/xephem
    set appdefaults ${prefix}/lib/X11/app-defaults

    xinstall -m 0755 ${worksrcpath}/xephem ${destroot}${prefix}/bin
    xinstall -m 0644 ${worksrcpath}/xephem.man ${destroot}${prefix}/share/man/man1/xephem.1

    file mkdir ${destroot}${share}
    file copy \
        ${worksrcpath}/auxil \
        ${worksrcpath}/catalogs \
        ${worksrcpath}/fifos \
        ${worksrcpath}/fits \
        ${worksrcpath}/gallery \
        ${worksrcpath}/help \
        ${worksrcpath}/lo \
        ${destroot}${share}

    file mkdir ${destroot}${appdefaults}
    system "echo XEphem.ShareDir: ${share} > ${destroot}${appdefaults}/XEphem"
}
