# -*- 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 118723 2014-04-09 08:44:45Z and.damore@macports.org $

PortSystem          1.0

name                bitcoin
categories          finance crypto
version             0.9.1
platforms           darwin
license             MIT
maintainers         easieste openmaintainer yopmail.com:sami.laine
description         client user interface for a 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/

master_sites        https://github.com/[string repeat "$name/" 2]archive/
distname            v${version}
worksrcdir          ${name}-${version}
checksums           rmd160  f331dd64675b989f281caf5846ad89a9b034a5b2 \
                    sha256  bf5021a426b5e38a741a5294a0ceb22daa74cda11c6dc0478c4aa48c55fdccb3

depends_build       port:pkgconfig \
                    port:autoconf \
                    port:automake \
                    port:libtool

depends_lib         port:boost \
                    port:openssl \
                    port:db48 \
                    port:miniupnpc \
                    port:qt4-mac \
                    port:protobuf-cpp

use_autoreconf      yes
autoreconf.cmd      ./autogen.sh
autoreconf.args

build.args          appbundle
use_parallel_build  no
variant daemon description {Build and install only the bitcoind daemon} {
    configure.cmd-append    --with-gui=no
    depends_lib-delete      port:qt4-mac
    build.args-delete       appbundle
}

destroot {
    xinstall -d ${destroot}${prefix}/bin
    if {![variant_isset daemon]} {
        set bundle_name Bitcoin-Qt.app
        xinstall -m 755 -d ${destroot}${applications_dir}
        copy ${worksrcpath}/${bundle_name} ${destroot}${applications_dir}/${bundle_name}
    }
    xinstall -m 755 -W ${worksrcpath} src/bitcoind ${destroot}${prefix}/bin
    xinstall -m 755 -W ${worksrcpath} src/bitcoin-cli ${destroot}${prefix}/bin

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

