Ticket #34903: Portfile

File Portfile, 3.8 KB (added by zan@…, 12 years ago)

Bitcoin Portfile

Line 
1# $Id: Portfile 79338 2011-06-09 19:51:57Z and.damore@macports.org $
2
3PortSystem          1.0
4PortGroup                       github 1.0
5name                bitcoin
6categories          finance crypto
7version             0.6.2.2
8platforms           darwin
9license             MIT
10maintainers         singingwolfboy openmaintainer
11description         a peer-to-peer digital currency
12long_description    \
13    Bitcoin is a peer-to-peer digital currency. Peer-to-peer (P2P) means that \
14    there is no central authority to issue new money or keep track of \
15    transactions. Instead, these tasks are managed collectively by the nodes \
16    of the network.
17
18homepage            http://www.bitcoin.org/
19github.setup            ${name} ${name} v${version}
20checksums           rmd160  c8ccbc325de2aa794dde48f28df5d175a68bf7f5 \
21                                        sha256  74231218e76b9f46392a050353debb039ae18bc3a36d93b7279505d8d46be7d2
22
23depends_lib         port:boost \
24                    port:openssl \
25                    port:db48 \
26                    port:miniupnpc
27
28supported_archs     i386 x86_64
29
30default_variants        +qt4
31
32variant no_gui conflicts qt4 description "Build bitcoin without a GUI" {
33        global makefile
34        set makefile makefile.osx
35
36        post-patch {
37                # get correct compilers and flags
38                # -Wformat is needed for -Wformat-security
39                reinplace "s|^CXX=.*$|CXX=${configure.cxx}|" src/${makefile}
40            reinplace "s|^DEPSDIR=.*$|DEPSDIR=${prefix}|" src/${makefile}
41                reinplace "s|^CFLAGS = -m.*$|CFLAGS = ${configure.cxxflags} -Wformat|" src/${makefile}
42                reinplace "s|^CFLAGS = -g.*$|CFLAGS = -g ${configure.cxxflags} -Wformat|" src/${makefile}
43            reinplace "s|-arch i386|${configure.cxx_archflags}|" src/${makefile}
44        }
45
46        use_configure   no
47
48        build.cmd               cd src && ${build.cmd}
49        build.args              -w -f ${makefile} "RELEASE=1" "USE_UPNP=1" "USE_SSL=1"
50
51        test.run                yes
52        # Why won't port recognise build.args here?
53        test.cmd                ${build.cmd} -w -f ${makefile} "RELEASE=1" "USE_UPNP=1" "USE_SSL=1" test_bitcoin && ./test_bitcoin
54       
55        destroot {
56            xinstall -m 755 -W ${worksrcpath}/src \
57                bitcoind ${destroot}${prefix}/bin
58
59            set docdir ${destroot}${prefix}/share/doc/${name}
60            xinstall -d ${docdir}
61            eval xinstall -m 644 [glob ${worksrcpath}/doc/*] \
62                        ${destroot}${prefix}/share/doc/${name}
63        }
64}
65
66variant qt4 conflicts no_gui description "Build the Qt4 GUI front-end for bitcoin" {
67        PortGroup qt4 1.0
68       
69        global makefile
70        set makefile bitcoin-qt.pro
71       
72        if {${configure.compiler} == "clang"} {
73                # Clang gives 2 errors. Mac dock icon handler has work-around.
74                # QtIPCServer is completely disabled: ipcInit() was disabled for Mac
75                # anyway, there is a TODO comment. The compile error has actually to do
76                # with Boost. An update to Boost may make this work in the future.
77                patchfiles-append       patch-clang-src_qt_macdockiconhandler_mm.diff \
78                                                        patch-clang-src_qt_qtipcserver_cpp.diff
79        }
80       
81        post-patch {
82                # Use correct compilers and flags
83                reinplace "s|macx:QMAKE_CXXFLAGS += .*||g" ${makefile}
84                reinplace "s|-fstack-protector|-fstack-protector-all -D_FORTIFY_SOURCE=2|g" ${makefile}
85                reinplace "s|CONFIG += no_include_pwd|CONFIG += no_include_pwd \
86                \\\nQMAKE_CC = ${configure.cc} \
87                \\\nQMAKE_CXX = ${configure.cxx} \
88                \\\nQMAKE_LINK = ${configure.cxx} \
89                \\\nQMAKE_CFLAGS_RELEASE = ${configure.cflags} \
90                \\\nQMAKE_CXXFLAGS_RELEASE = ${configure.cxxflags}|" ${makefile}
91                reinplace "s|macx:TARGET = \"Bitcoin-Qt\"|macx:TARGET = \"Bitcoin\"|" ${makefile}
92        }
93       
94        configure.cmd           ${qt_qmake_cmd}
95        # remove --prefix
96        configure.pre_args      {}
97        configure.args          "USE_UPNP=1" "USE_SSL=1" "FIRST_CLASS_MESSAGING=1" "RELEASE=1" ${makefile}
98       
99        test.run                        no
100       
101        destroot {
102            file copy ${worksrcpath}/Bitcoin.app ${destroot}${applications_dir}/
103        }
104}
105
106variant qrcode requires qt4 description "Include ability to save transactions as QR codes" {
107        depends_lib-append              port:qrencode
108        configure.args-append   "USE_QRCODE=1"
109}
110
111livecheck.type          sourceforge