-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitcoin.rb
73 lines (64 loc) · 2.18 KB
/
bitcoin.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
require "formula"
class Bitcoin < Formula
homepage 'http://bitcoin.org/'
version '0.9.3'
url "https://github.com/bitcoin/bitcoin/archive/v#{version}.tar.gz"
head 'https://github.com/bitcoin/bitcoin.git', :branch => "master"
sha1 'bbfb311c3e02b37aba71385d2d369450a88a601e'
option 'without-upnp', 'Disable uPNP port forwarding'
option 'without-qrc', 'Disable QR codes'
option 'without-qt', 'Disable Qt GUI codes'
depends_on 'automake'
depends_on 'berkeley-db4'
depends_on 'boost'
depends_on 'miniupnpc' if not build.include? 'without-upnp'
depends_on 'openssl'
depends_on 'pkg-config'
depends_on 'protobuf'
depends_on 'qrencode' if not build.include? 'without-qrc'
depends_on 'qt' if not build.include? 'without-qt'
def install
system './autogen.sh'
system './configure', "--prefix=#{prefix}"
system 'make'
system 'strip src/bitcoin-cli'
system 'strip src/bitcoind'
bin.install 'src/bitcoin-cli'
bin.install 'src/bitcoind'
system 'make', 'appbundle'
prefix.install 'Bitcoin-Qt.app'
end
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>PathState</key>
<dict>
<key>~/Library/Application Support/Bitcoin/bitcoind.pid</key>
<false/>
</dict>
</dict>
<key>ProgramArguments</key>
<array>
<string>#{opt_prefix}/bin/bitcoind</string>
<string>-daemon</string>
</array>
</dict>
</plist>
EOS
end
def caveats; <<-EOS.undent
You will need to setup your bitcoin.conf if you haven't already done so:
echo -e "rpcuser=bitcoinrpc\\nrpcpassword=$(xxd -l 16 -p /dev/urandom)" > ~/Library/Application\\ Support/Bitcoin/bitcoin.conf
chmod 600 ~/Library/Application\\ Support/Bitcoin/bitcoin.conf
Use `bitcoind stop` to stop bitcoind if necessary! `brew services stop bitcoind` does not work!
EOS
end
end