Ticket #34903: Portfile.diff

File Portfile.diff, 5.6 KB (added by zan@…, 12 years ago)

Unified diff of Portfile

  • Portfile

    old new  
    11# $Id: Portfile 79338 2011-06-09 19:51:57Z and.damore@macports.org $
    22
    33PortSystem          1.0
     4PortGroup                       github 1.0
    45name                bitcoin
    56categories          finance crypto
    6 version             0.3.22
     7version             0.6.2.2
    78platforms           darwin
    89license             MIT
    910maintainers         singingwolfboy openmaintainer
     
    1516    of the network.
    1617
    1718homepage            http://www.bitcoin.org/
    18 master_sites        sourceforge
    19 distname            ${name}-${version}-macosx
    20 use_zip             yes
    21 checksums           md5     5daa8d577e5ee081a4eae7cf4845f76c \
    22                     sha1    5798efd33d38d530428d22aa4edf37e99731072e \
    23                     rmd160  094c90358ed24be23feb66db6c68c6525e6234fc
     19github.setup            ${name} ${name} v${version}
     20checksums           rmd160  c8ccbc325de2aa794dde48f28df5d175a68bf7f5 \
     21                                        sha256  74231218e76b9f46392a050353debb039ae18bc3a36d93b7279505d8d46be7d2
    2422
    2523depends_lib         port:boost \
    2624                    port:openssl \
    2725                    port:db48 \
    28                     port:wxWidgets-devel \
    2926                    port:miniupnpc
    3027
    31 supported_archs     x86_64
    32 universal_variant   no
    33 worksrcdir          ${name}-${version}/src
    34 set makefile ${worksrcpath}/makefile.osx
    35 configure {
    36     reinplace "s|^DEPSDIR=.*$|DEPSDIR=${prefix}|" ${makefile}
    37     reinplace "s|-I\"\$\(DEPSDIR\)\/include\"|-I${prefix}/include -I${prefix}/include/db48|" ${makefile}
    38     reinplace "s|lib/libdb_cxx-4.8.a|lib/db48/libdb_cxx-4.8.dylib|" ${makefile}
    39     reinplace "s|lib/libboost_thread.a|lib/libboost_thread-mt.dylib|" ${makefile}
    40     reinplace "s|\\\.a|.dylib|" ${makefile}
    41     reinplace "s|/miniupnpc/|/lib/|" ${makefile}
    42 
    43     # The QuickTime framework isn't actually needed, and it doesn't exist for
    44     # x86_64, but wx-config --libs spits it out anyway, so we'll filter it out
    45     # with sed.
    46     reinplace "s|wx-config --libs --static|wx-config --libs \\\| sed -e \"s/-framework QuickTime//\"|g" ${makefile}
    47 
    48     # Building with i386 support seems to make everything explode, so we'll
    49     # remove it.
    50     reinplace "s|-arch i386||" ${makefile}
     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        }
    5164}
    52 build.args          -f ${makefile}
    53 build.target-append bitcoind
    54 destroot {
    55     xinstall -m 755 -W ${worksrcpath} \
    56         bitcoin bitcoind ${destroot}${prefix}/bin
    57 
    58     set docdir ${destroot}${prefix}/share/doc/${name}
    59     xinstall -d ${docdir}
    60     xinstall -m 444 -W ${worksrcpath}/.. readme.txt license.txt ${docdir}
    61  
    62     file copy ${worksrcpath}/../Bitcoin.app ${destroot}${applications_dir}/
     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"
    63109}
    64110
    65 # Tweak the Sourceforge livechecking
    66 livecheck.regex     {/bitcoin-(\d+(?:\.\w+)+)/README}
     111livecheck.type          sourceforge