Ticket #51109: Portfile-bitcoin.diff

File Portfile-bitcoin.diff, 6.6 KB (added by neverpanic (Clemens Lang), 8 years ago)

Unified diff of the Portfile

  • Portfile

    old new  
    66name                bitcoin
    77categories          finance crypto
    88version             0.12.0
    9 revision            1
     9revision                2
    1010platforms           darwin
    1111license             MIT
    1212maintainers         easieste yopmail.com:sami.laine openmaintainer
    13 description         client user interface for a peer-to-peer digital currency
     13description             server daemon and client user interface for a peer-to-peer digital currency
    1414long_description    Bitcoin is a peer-to-peer digital currency. By peer-to-peer,  \
    1515                    we mean that there is no central authority to issue \
    1616                    new Bitcoins or keep track of transactions. Instead, these \
     
    2323checksums           rmd160  aa6a5601ee4e778a2e52cb16b79e5a5e89ca92bb \
    2424                    sha256  0f1cda66c841a548a07cc37e80b0727354b1236d9f374c7d44362acdb85eb3e1
    2525
     26patchfiles              patch-issue7845.diff
     27
    2628depends_build       port:pkgconfig \
    2729                    port:autoconf \
    2830                    port:automake \
     
    3638                    port:protobuf-cpp \
    3739                    port:zmq
    3840
    39 use_parallel_build  no
     41use_parallel_build      yes
    4042
    4143configure.args      --disable-ccache \
    4244                    --disable-silent-rules
    4345
    44 # TODO: Restore GUI: needs to move to qt5, as it doesn't look like qt4
    45 # is going to get fixed.
    46 default_variants     +daemon
     46configure.args-append   --with-daemon=no
     47configure.args-append   --with-gui=no
     48configure.args-append   --enable-wallet=no
     49
     50build.target            all
     51
     52test.run                yes
     53test.target             check
     54
     55default_variants        +daemon +wallet
     56
     57set bitcoin_user        "bitcoin"
     58set bitcoin_group       "${bitcoin_user}"
     59set bitcoin_real_name   "Bitcoin Core"
     60
     61add_users               ${bitcoin_user} group=${bitcoin_group} realname="${bitcoin_real_name}"
     62
     63set daemon_path         "${prefix}/bin/bitcoind"
     64set daemon_working_dir  "${prefix}/var/run/bitcoind/"
     65set daemon_conf_file    "${prefix}/etc/bitcoin/bitcoin.conf"
     66set daemon_data_dir     "${prefix}/var/lib/bitcoind/"
     67set daemon_pid_file     "${prefix}/var/run/bitcoind/bitcoind.pid"
     68
     69set gui_app_name        "Bitcoin-Qt.app"
     70set gui_app_path        "${applications_dir}/${gui_app_name}"
     71set gui_conf_dir        "\$HOME/Library/Application Support/Bitcoin/"
     72set gui_conf_file       "${gui_conf_dir}bitcoin.conf"
     73set gui_data_dir        "${gui_conf_dir}"
     74set gui_pid_file        "${gui_conf_dir}bitcoin.pid"
     75
     76set launchd_label               "org.macports.${name}"
     77set launchd_plist_path          "${prefix}/etc/LaunchDaemons/${launchd_label}/${launchd_label}.plist"
     78set launchd_plist_symlink_path  "/Library/LaunchDaemons/${launchd_label}.plist"
     79
     80variant daemon description {Build and install the daemon} {
     81    configure.args-replace  --with-daemon=no    --with-daemon=yes
     82}
    4783
    48 variant gui description {NOT WORKING Build with qt5} {
    49     configure.cmd-append    --with-gui=qt5
     84variant gui description {Build the Qt5 GUI} {
    5085    depends_lib-append      port:qt5
     86    configure.args-replace --with-gui=no --with-gui=qt5
     87    build.target-replace all appbundle
    5188}
    5289
    53 variant daemon description {Build and install only the bitcoind daemon} {
    54     configure.cmd-append    --with-gui=no
     90variant wallet description {Build with support for wallet} {
     91    configure.args-replace --enable-wallet=no --enable-wallet=yes
    5592}
    5693
    57 destroot {
    58 #    if {![variant_isset daemon]} {
    59 #        copy ${worksrcpath}/Bitcoin-Qt.app ${destroot}${applications_dir}
    60 #    }
    61     xinstall -W ${worksrcpath}/src bitcoin-cli bitcoind ${destroot}${prefix}/bin
     94post-destroot {
     95    set config_args "-conf=\"${daemon_conf_file}\" -datadir=\"${daemon_data_dir}\" -pid=\"${daemon_pid_file}\""
     96
     97    if {[variant_isset daemon]} {
     98        if { [tbool startupitem.install] } {
     99            # Install launchd plist for daemon
     100            xinstall -d [file dirname "${destroot}/${launchd_plist_path}"]
     101            xinstall -m 644 "${filespath}/bitcoind.launchd.plist" "${destroot}/${launchd_plist_path}"
     102            reinplace -E "
     103                s|@@label@@|${launchd_label}|g;
     104                s|@@user_name@@|${bitcoin_user}|g;
     105                s|@@group_name@@|${bitcoin_group}|g;
     106                s|@@program@@|\"${daemon_path}\" ${config_args}|g;
     107                s|@@working_dir@@|${daemon_working_dir}|g;
     108                " \
     109                "${destroot}/${launchd_plist_path}"
     110        }
     111    }
     112
     113    if {[variant_isset gui]} {
     114        # Install GUI app
     115        copy "${worksrcpath}/${gui_app_name}" "${destroot}/${gui_app_path}"
     116    }
     117}
    62118
    63     set docdir ${prefix}/share/doc/${name}
    64     xinstall -d ${destroot}${docdir}
    65     xinstall -m 444 -W ${worksrcpath} {*}[glob ${worksrcpath}/doc/*.md] ${destroot}${docdir}
     119post-activate {
     120    if {[variant_isset daemon]} {
     121        xinstall -d [file dirname "${daemon_conf_file}"]
     122        xinstall -d -o ${bitcoin_user} -g ${bitcoin_group} "${daemon_data_dir}"
     123        xinstall -d -o ${bitcoin_user} -g ${bitcoin_group} [file dirname "${daemon_pid_file}"]
     124
     125        file mkdir -p [file dirname "${launchd_plist_symlink_path}"]
     126        ln -sf "${launchd_plist_path}" "${launchd_plist_symlink_path}"
     127    }
    66128}
    67129
    68 # TODO
    69 #
    70 ## Automate creation of nonce RPC credentials
    71 ## Add launchctl hooks for daemon
     130pre-deactivate {
     131    if {[variant_isset daemon]} {
     132        file delete "${launchd_plist_symlink_path}"
     133    }
     134}
    72135
    73136notes "
    74137
    75 1.  Sanity in scripting:
     1381.  A launch daemon entry has been created for ${name}. It is disabled by default. To enable and load the daemon:
     139
     140    cmd$ sudo launchctl load -w \"${launchd_plist_symlink_path}\"
     141
     1422.  Start the daemon manually in the background:
     143
     144    cmd$ ${daemon_path} -daemon
     145
     1463.  Symlink the GUI configuration into your home directory:
    76147
    77     cmd$ ln -s \"~/Library/Application Support/Bitcoin\" ~/.bitcoin
     148    cmd$ ln -s \"${gui_data_dir}\" ~/.bitcoin
    78149
    79 2.  View progress with:
     1504.  View the configuration:
    80151
    81     cmd$ tail -F ~/.bitcoin/debug.log
     152    # Daemon:
     153    cmd$ less \"${daemon_conf_file}\"
     154    # GUI:
     155    cmd$ less \"${gui_conf_file}\"
    82156
    83 3.  Edit ~/.bitcoin/bitcoin.conf with RPC credentials
     1575.  View the log:
    84158
    85 4.  Start in background via:
     159    # Daemon:
     160    cmd$ tail -F \"${daemon_data_dir}debug.log\"
     161    # GUI:
     162    cmd$ tail -F \"${gui_data_dir}debug.log\"
    86163   
    87     cmd$ ${prefix}/sbin/bitcoind -daemon
     1646.  Edit \"${daemon_conf_file}\" and \"${gui_conf_file}\" to include the RPC credentials.
     165    See https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md#running for more information.
    88166
    89167"
    90168