Changeset 147619


Ignore:
Timestamp:
Apr 10, 2016, 2:05:55 PM (4 years ago)
Author:
easieste@…
Message:

Major reorganization of bitcoin port (alexreg)

GUI now builds correctly using OS X application bundle.

Parallel build working and enabled.

Daemon now runs system-wide using a dedicated 'bitcoin' user/group,
while the GUI runs as the invoking user.

Daemon uses system-wide config in ${prefix} and GUI uses user
configuration in <file:~/Library/Application Support>.

Added launchd support for daemon.

Added variant for enabling wallet, selected as default.

Location:
trunk/dports/finance/bitcoin
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/finance/bitcoin/Portfile

    r146245 r147619  
    22# $Id$
    33
    4 PortSystem          1.0
     4PortSystem              1.0
    55
    6 name                bitcoin
    7 categories          finance crypto
    8 version             0.12.0
    9 revision            1
    10 platforms           darwin
    11 license             MIT
    12 maintainers         easieste yopmail.com:sami.laine openmaintainer
    13 description         client user interface for a peer-to-peer digital currency
    14 long_description    Bitcoin is a peer-to-peer digital currency. By peer-to-peer,  \
    15                     we mean that there is no central authority to issue \
    16                     new Bitcoins or keep track of transactions. Instead, these \
    17                     tasks are managed collectively by the Bitcoin protocol \
    18                     operating through the nodes of the network.
     6name                    bitcoin
     7categories              finance crypto
     8version                 0.12.0
     9revision                2
     10platforms               darwin
     11license                 MIT
     12maintainers             easieste yopmail.com:sami.laine openmaintainer
     13description             server daemon and client user interface for a peer-to-peer digital currency
     14long_description        Bitcoin is a peer-to-peer digital currency. By peer-to-peer,  \
     15                        we mean that there is no central authority to issue \
     16                        new Bitcoins or keep track of transactions. Instead, these \
     17                        tasks are managed collectively by the Bitcoin protocol \
     18                        operating through the nodes of the network.
    1919
    20 homepage            https://bitcoin.org/
    21 master_sites        ${homepage}bin/bitcoin-core-${version}/
     20homepage                https://bitcoin.org/
     21master_sites            ${homepage}bin/bitcoin-core-${version}/
    2222
    23 checksums           rmd160  aa6a5601ee4e778a2e52cb16b79e5a5e89ca92bb \
    24                     sha256  0f1cda66c841a548a07cc37e80b0727354b1236d9f374c7d44362acdb85eb3e1
     23checksums               rmd160  aa6a5601ee4e778a2e52cb16b79e5a5e89ca92bb \
     24                        sha256  0f1cda66c841a548a07cc37e80b0727354b1236d9f374c7d44362acdb85eb3e1
    2525
    26 depends_build       port:pkgconfig \
    27                     port:autoconf \
    28                     port:automake \
    29                     port:libtool
     26patchfiles              patch-issue7845.diff
    3027
    31 depends_lib         port:boost \
    32                     path:lib/libssl.dylib:openssl \
    33                     port:db48 \
    34                     port:libevent \
    35                     port:miniupnpc \
    36                     port:protobuf-cpp \
    37                     port:zmq
     28depends_build           port:pkgconfig \
     29                        port:autoconf \
     30                        port:automake \
     31                        port:libtool
    3832
    39 use_parallel_build  no
     33depends_lib             port:boost \
     34                        path:lib/libssl.dylib:openssl \
     35                        port:db48 \
     36                        port:libevent \
     37                        port:miniupnpc \
     38                        port:protobuf-cpp \
     39                        port:zmq
    4040
    41 configure.args      --disable-ccache \
    42                     --disable-silent-rules
     41use_parallel_build      yes
    4342
    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
     43configure.args          --disable-ccache \
     44                        --disable-silent-rules
    4745
    48 variant gui description {NOT WORKING Build with qt5} {
    49     configure.cmd-append    --with-gui=qt5
    50     depends_lib-append      port:qt5
     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
    5182}
    5283
    53 variant daemon description {Build and install only the bitcoind daemon} {
    54     configure.cmd-append    --with-gui=no
     84variant gui description {Build the Qt5 GUI} {
     85    depends_lib-append port:qt5
     86    configure.args-replace --with-gui=no --with-gui=qt5
     87    build.target-replace all appbundle
    5588}
    5689
    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
    62 
    63     set docdir ${prefix}/share/doc/${name}
    64     xinstall -d ${destroot}${docdir}
    65     xinstall -m 444 -W ${worksrcpath} {*}[glob ${worksrcpath}/doc/*.md] ${destroot}${docdir}
     90variant wallet description {Build with support for wallet} {
     91    configure.args-replace --enable-wallet=no --enable-wallet=yes
    6692}
    6793
    68 # TODO
    69 #
    70 ## Automate creation of nonce RPC credentials
    71 ## Add launchctl hooks for daemon
     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}
     118
     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    }
     128}
     129
     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:
    76139
    77     cmd$ ln -s \"~/Library/Application Support/Bitcoin\" ~/.bitcoin
     140    cmd$ sudo launchctl load -w \"${launchd_plist_symlink_path}\"
    78141
    79 2.  View progress with:
     1422.  Start the daemon manually in the background:
    80143
    81     cmd$ tail -F ~/.bitcoin/debug.log
     144    cmd$ ${daemon_path} -daemon
    82145
    83 3.  Edit ~/.bitcoin/bitcoin.conf with RPC credentials
     1463.  Symlink the GUI configuration into your home directory:
    84147
    85 4.  Start in background via:
    86    
    87     cmd$ ${prefix}/sbin/bitcoind -daemon
     148    cmd$ ln -s \"${gui_data_dir}\" ~/.bitcoin
     149
     1504.  View the configuration:
     151
     152    # Daemon:
     153    cmd$ less \"${daemon_conf_file}\"
     154    # GUI:
     155    cmd$ less \"${gui_conf_file}\"
     156
     1575.  View the log:
     158
     159    # Daemon:
     160    cmd$ tail -F \"${daemon_data_dir}debug.log\"
     161    # GUI:
     162    cmd$ tail -F \"${gui_data_dir}debug.log\"
     163
     1646.  Edit \"${daemon_data_dir}\" 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"
Note: See TracChangeset for help on using the changeset viewer.