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

name                dnetc
version             2.9112.521
set branch          [join [lrange [split ${version} .] 0 1] .]
set minor           [lindex [split ${version} .] end]
categories          net
platforms           darwin
maintainers         nomaintainer

description         distributed.net client

long_description    distributed.net believes in the capability and potential \
                    of distributed computing. Their mission consists of three \
                    interdependent goals: development, deployment, and \
                    advocacy, to be pursued in the advancement of distributed \
                    computing. \
                    They advocate distributed computing, by encouraging global \
                    participation and contributions of processing power, \
                    bandwidth, and expertise\; by providing a forum for \
                    discussion\; and by raising awareness on the Internet and \
                    in the mainstream.

homepage            http://www.distributed.net
master_sites        ftp://ftp.distributed.net/pub/dcti/v${branch}/ \
                    http://http.distributed.net/pub/dcti/v${branch}/

platform i386 {
    use_zip         yes
    if {${configure.build_arch} eq "x86_64"} {
        distname    ${name}${minor}-macosx-amd64
        checksums   rmd160  b89cf96ed6aed3a316638fe2676f563140109013 \
                    sha256  035401485ba2968888d1fea42f583a71b9d1b75ca855921b604e34bc10ec210c \
                    size    639441
    } else {
        distname    ${name}${minor}-macosx-x86
        checksums   rmd160  f54e536ec3601b794d879f55a80b8de1e67817c9 \
                    sha256  b7d4b97d648de67c0bdc4d532e778c00416a898b1364e991b56f704e73e961a4 \
                    size    650821
    }
}

platform powerpc {
    distname        ${name}${minor}-macosx-ppc
    checksums       rmd160  4ca8416102966104c56b77271d7356b7f4fa2a80 \
                    sha256  bba507d2b4a4bb9231f78286c5d9d47e4e4d448221fa0c867967149a7de163b3 \
                    size    620190
}

startupitem.create    yes
startupitem.start "${prefix}/share/${name}/dnetc.init start"
startupitem.stop "${prefix}/share/${name}/dnetc.init stop"

use_configure   no

build     {}

destroot  {
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    xinstall -m 755 -d ${destroot}${prefix}/var/db/${name}
    destroot.keepdirs  ${destroot}${prefix}/var/db/${name}
    xinstall -m 755 ${worksrcpath}/dnetc ${destroot}${prefix}/bin

    copy ${worksrcpath}/docs ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 ${filespath}/dnetc.init ${destroot}${prefix}/share/${name}

reinplace "s|__PREFIX__|${prefix}|g" \
    ${destroot}${prefix}/share/${name}/dnetc.init
}

notes "
Please Note! Run dnetc with script ${prefix}/share/${name}/dnetc.init start.\
This script places the dnetc.ini and buffer files in ${prefix}/var/db/${name}.\
The first time the script runs you will be asked to set configuration parameters.\
To change parameters later on, use ${prefix}/share/${name}/dnetc.init config.\
dnetc is also started at system boot via the same startup script.
"

livecheck.url       ${homepage}/Download_clients
livecheck.regex     {<td><b>v([0-9.]+)[^<]*</b></td><td[^>]*>[^<]*</td><td[^>]*>[^<]*<a href="[^"]*macos}
