# -*- 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 116432 2014-01-25 01:50:19Z cal@macports.org $

PortSystem          1.0
PortGroup           github 1.0

set commitish       08b93f9a65ce70e650244f94725fcd042d97f0ee

github.setup        bitcoin bitcoin ${commitish}
name                bitcoind
version             0.8.6.${commitish}
checksums           rmd160  07d77e45837b45c84bacae713b680f8027a93af2 \
                    sha256  b5e299a922a501e0c21b9037a7793a3cc27c5d09192aa9029552ccbbebc47418

categories          finance crypto
epoch               2013121401
platforms           darwin
license             MIT
maintainers         easieste openmaintainer
description         mainline bitcoind from Satoshi github source installing a node for the BTC peer-to-peer digital currency
long_description    Bitcoin is a peer-to-peer digital currency. By peer-to-peer,  \
                    we mean that there is no central authority to issue \
                    new Bitcoins or keep track of transactions. Instead, these \
                    tasks are managed collectively by the Bitcoin protocol \
                    operating through the nodes of the network. 
homepage            http://www.bitcoin.org/

use_autoreconf      yes

depends_lib         port:boost \
                    port:openssl \
                    port:db48 \
                    port:miniupnpc

depends_build-append \
                    port:pkgconfig

configure.args      --without-qt

build.args          V=1

test.run            yes
test.target         check
test.args           V=1

destroot {
    xinstall -d ${destroot}${prefix}/sbin
    xinstall -m 755 -W ${worksrcpath} src/bitcoind ${destroot}${prefix}/sbin

    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    eval xinstall -m 444 -W ${worksrcpath} [glob ${worksrcpath}/doc/*] ${docdir}
}

variant qt description {Build and install both the daemon and the graphical Satoshi QT client. } {
    error "see ../bitcoin for last working version."
    build.cmd "cd src && make -f makefile.osx"
    depends_lib-delete port:qt4-mac
}

notes "

1.  Sanity in scripting:

    cmd$ ln -s \"~/Library/Application Support/Bitcoin\" ~/.bitcoin

2.  View progress with:

    cmd$ tail -F ~/.bitcoin/debug.log

3.  Edit ~/.bitcoin/bitcoin.conf with RPC credentials 

4.  Start in background via:
    
    cmd$ ${prefix}/sbin/bitcoind -daemon


"
