[147619] trunk/dports/finance/bitcoin

easieste at macports.org easieste at macports.org
Sun Apr 10 07:05:55 PDT 2016


Revision: 147619
          https://trac.macports.org/changeset/147619
Author:   easieste at macports.org
Date:     2016-04-10 07:05:55 -0700 (Sun, 10 Apr 2016)
Log 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.

Modified Paths:
--------------
    trunk/dports/finance/bitcoin/Portfile

Added Paths:
-----------
    trunk/dports/finance/bitcoin/files/bitcoind.launchd.plist
    trunk/dports/finance/bitcoin/files/patch-issue7845.diff

Modified: trunk/dports/finance/bitcoin/Portfile
===================================================================
--- trunk/dports/finance/bitcoin/Portfile	2016-04-10 11:39:32 UTC (rev 147618)
+++ trunk/dports/finance/bitcoin/Portfile	2016-04-10 14:05:55 UTC (rev 147619)
@@ -1,91 +1,169 @@
 # -*- 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$
 
-PortSystem          1.0
+PortSystem              1.0
 
-name                bitcoin
-categories          finance crypto
-version             0.12.0
-revision            1
-platforms           darwin
-license             MIT
-maintainers         easieste yopmail.com:sami.laine openmaintainer
-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.
+name                    bitcoin
+categories              finance crypto
+version                 0.12.0
+revision                2
+platforms               darwin
+license                 MIT
+maintainers             easieste yopmail.com:sami.laine openmaintainer
+description             server daemon and 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            https://bitcoin.org/
-master_sites        ${homepage}bin/bitcoin-core-${version}/
+homepage                https://bitcoin.org/
+master_sites            ${homepage}bin/bitcoin-core-${version}/
 
-checksums           rmd160  aa6a5601ee4e778a2e52cb16b79e5a5e89ca92bb \
-                    sha256  0f1cda66c841a548a07cc37e80b0727354b1236d9f374c7d44362acdb85eb3e1
+checksums               rmd160  aa6a5601ee4e778a2e52cb16b79e5a5e89ca92bb \
+                        sha256  0f1cda66c841a548a07cc37e80b0727354b1236d9f374c7d44362acdb85eb3e1
 
-depends_build       port:pkgconfig \
-                    port:autoconf \
-                    port:automake \
-                    port:libtool
+patchfiles              patch-issue7845.diff
 
-depends_lib         port:boost \
-                    path:lib/libssl.dylib:openssl \
-                    port:db48 \
-                    port:libevent \
-                    port:miniupnpc \
-                    port:protobuf-cpp \
-                    port:zmq
+depends_build           port:pkgconfig \
+                        port:autoconf \
+                        port:automake \
+                        port:libtool
 
-use_parallel_build  no
+depends_lib             port:boost \
+                        path:lib/libssl.dylib:openssl \
+                        port:db48 \
+                        port:libevent \
+                        port:miniupnpc \
+                        port:protobuf-cpp \
+                        port:zmq
 
-configure.args      --disable-ccache \
-                    --disable-silent-rules
+use_parallel_build      yes
 
-# TODO: Restore GUI: needs to move to qt5, as it doesn't look like qt4
-# is going to get fixed.
-default_variants     +daemon
+configure.args          --disable-ccache \
+                        --disable-silent-rules
 
-variant gui description {NOT WORKING Build with qt5} {
-    configure.cmd-append    --with-gui=qt5
-    depends_lib-append      port:qt5
+configure.args-append   --with-daemon=no
+configure.args-append   --with-gui=no
+configure.args-append   --enable-wallet=no
+
+build.target            all
+
+test.run                yes
+test.target             check
+
+default_variants        +daemon +wallet
+
+set bitcoin_user        "bitcoin"
+set bitcoin_group       "${bitcoin_user}"
+set bitcoin_real_name   "Bitcoin Core"
+
+add_users               ${bitcoin_user} group=${bitcoin_group} realname="${bitcoin_real_name}"
+
+set daemon_path         "${prefix}/bin/bitcoind"
+set daemon_working_dir  "${prefix}/var/run/bitcoind/"
+set daemon_conf_file    "${prefix}/etc/bitcoin/bitcoin.conf"
+set daemon_data_dir     "${prefix}/var/lib/bitcoind/"
+set daemon_pid_file     "${prefix}/var/run/bitcoind/bitcoind.pid"
+
+set gui_app_name        "Bitcoin-Qt.app"
+set gui_app_path        "${applications_dir}/${gui_app_name}"
+set gui_conf_dir        "\$HOME/Library/Application Support/Bitcoin/"
+set gui_conf_file       "${gui_conf_dir}bitcoin.conf"
+set gui_data_dir        "${gui_conf_dir}"
+set gui_pid_file        "${gui_conf_dir}bitcoin.pid"
+
+set launchd_label               "org.macports.${name}"
+set launchd_plist_path          "${prefix}/etc/LaunchDaemons/${launchd_label}/${launchd_label}.plist"
+set launchd_plist_symlink_path  "/Library/LaunchDaemons/${launchd_label}.plist"
+
+variant daemon description {Build and install the daemon} {
+    configure.args-replace  --with-daemon=no    --with-daemon=yes
 }
 
-variant daemon description {Build and install only the bitcoind daemon} {
-    configure.cmd-append    --with-gui=no
+variant gui description {Build the Qt5 GUI} {
+    depends_lib-append port:qt5
+    configure.args-replace --with-gui=no --with-gui=qt5
+    build.target-replace all appbundle
 }
 
-destroot {
-#    if {![variant_isset daemon]} {
-#        copy ${worksrcpath}/Bitcoin-Qt.app ${destroot}${applications_dir}
-#    }
-    xinstall -W ${worksrcpath}/src bitcoin-cli bitcoind ${destroot}${prefix}/bin
+variant wallet description {Build with support for wallet} {
+    configure.args-replace --enable-wallet=no --enable-wallet=yes
+}
 
-    set docdir ${prefix}/share/doc/${name}
-    xinstall -d ${destroot}${docdir}
-    xinstall -m 444 -W ${worksrcpath} {*}[glob ${worksrcpath}/doc/*.md] ${destroot}${docdir}
+post-destroot {
+    set config_args "-conf=\"${daemon_conf_file}\" -datadir=\"${daemon_data_dir}\" -pid=\"${daemon_pid_file}\""
+
+    if {[variant_isset daemon]} {
+        if { [tbool startupitem.install] } {
+            # Install launchd plist for daemon
+            xinstall -d [file dirname "${destroot}/${launchd_plist_path}"]
+            xinstall -m 644 "${filespath}/bitcoind.launchd.plist" "${destroot}/${launchd_plist_path}"
+            reinplace -E "
+                s|@@label@@|${launchd_label}|g;
+                s|@@user_name@@|${bitcoin_user}|g;
+                s|@@group_name@@|${bitcoin_group}|g;
+                s|@@program@@|\"${daemon_path}\" ${config_args}|g;
+                s|@@working_dir@@|${daemon_working_dir}|g;
+                " \
+                "${destroot}/${launchd_plist_path}"
+        }
+    }
+
+    if {[variant_isset gui]} {
+        # Install GUI app
+        copy "${worksrcpath}/${gui_app_name}" "${destroot}/${gui_app_path}"
+    }
 }
 
-# TODO
-#
-## Automate creation of nonce RPC credentials
-## Add launchctl hooks for daemon
+post-activate {
+    if {[variant_isset daemon]} {
+        xinstall -d [file dirname "${daemon_conf_file}"]
+        xinstall -d -o ${bitcoin_user} -g ${bitcoin_group} "${daemon_data_dir}"
+        xinstall -d -o ${bitcoin_user} -g ${bitcoin_group} [file dirname "${daemon_pid_file}"]
 
+        file mkdir -p [file dirname "${launchd_plist_symlink_path}"]
+        ln -sf "${launchd_plist_path}" "${launchd_plist_symlink_path}"
+    }
+}
+
+pre-deactivate {
+    if {[variant_isset daemon]} {
+        file delete "${launchd_plist_symlink_path}"
+    }
+}
+
 notes "
 
-1.  Sanity in scripting:
+1.  A launch daemon entry has been created for ${name}. It is disabled by default. To enable and load the daemon:
 
-    cmd$ ln -s \"~/Library/Application Support/Bitcoin\" ~/.bitcoin
+    cmd$ sudo launchctl load -w \"${launchd_plist_symlink_path}\"
 
-2.  View progress with:
+2.  Start the daemon manually in the background:
 
-    cmd$ tail -F ~/.bitcoin/debug.log
+    cmd$ ${daemon_path} -daemon
 
-3.  Edit ~/.bitcoin/bitcoin.conf with RPC credentials
+3.  Symlink the GUI configuration into your home directory:
 
-4.  Start in background via:
-    
-    cmd$ ${prefix}/sbin/bitcoind -daemon
+    cmd$ ln -s \"${gui_data_dir}\" ~/.bitcoin
 
+4.  View the configuration:
+
+    # Daemon:
+    cmd$ less \"${daemon_conf_file}\"
+    # GUI:
+    cmd$ less \"${gui_conf_file}\"
+
+5.  View the log:
+
+    # Daemon:
+    cmd$ tail -F \"${daemon_data_dir}debug.log\"
+    # GUI:
+    cmd$ tail -F \"${gui_data_dir}debug.log\"
+
+6.  Edit \"${daemon_data_dir}\" and \"${gui_conf_file}\" to include the RPC credentials.
+    See https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md#running for more information.
+
 "
 
 livecheck.type      regex

Added: trunk/dports/finance/bitcoin/files/bitcoind.launchd.plist
===================================================================
(Binary files differ)


Property changes on: trunk/dports/finance/bitcoin/files/bitcoind.launchd.plist
___________________________________________________________________
Added: svn:mime-type
   + application/xml

Added: trunk/dports/finance/bitcoin/files/patch-issue7845.diff
===================================================================
--- trunk/dports/finance/bitcoin/files/patch-issue7845.diff	                        (rev 0)
+++ trunk/dports/finance/bitcoin/files/patch-issue7845.diff	2016-04-10 14:05:55 UTC (rev 147619)
@@ -0,0 +1,10 @@
+--- src/util.cpp	2016-04-10 01:01:33.000000000 +0100
++++ src/util.cpp	2016-04-10 01:01:51.000000000 +0100
+@@ -472,7 +472,6 @@
+ #ifdef MAC_OSX
+     // Mac
+     pathRet /= "Library/Application Support";
+-    TryCreateDirectory(pathRet);
+     return pathRet / "Bitcoin";
+ #else
+     // Unix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160410/a95807f7/attachment.html>


More information about the macports-changes mailing list