-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbitcoind.mk
164 lines (142 loc) · 5.7 KB
/
bitcoind.mk
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
bitcoin-core_install: |\
required_for_configure_install\
gcc_install_11_2_0_min\
binutils_install\
boost_install\
openssl_install\
libevent_install\
zlib_install\
zeromq_install\
python3_install\
miniupnpc_install
cd external/bitcoin-core && git checkout -f && git clean -fx && { \
./autogen.sh && \
./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) --with-incompatible-bdb --disable-wallet --without-gui --with-boost=$(BASE_INSTALL_DIR) --with-boost-libdir=$(BASE_INSTALL_DIR)/lib && $(MAKE) -j4 && $(MAKE) install && echo "The bitcoin-core was installed - OK"; \
} &> make_out.txt && tail make_out.txt
@touch $@
MAKE_DIRS += $(CREDENTIALS_DIR)
$(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt\
$(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt: |\
bitcoin-core_install\
$(CREDENTIALS_DIR)
cd external/bitcoin-core && umask 077 && LANG=C ./share/rpcauth/rpcauth.py lnd >$@
prepare-bitcoin-core-update: this_repo_update
-rm -f bitcoin-core_install zeromq_install openssl_install libevent_install binutils_install boost_install
-cd external/bitcoin-core
-$(MAKE) clean
bitcoin-core-update:
$(MAKE) bitcoin-core_install
bitcoin_iptables_install:
if [ `grep -c -- '-dport 8333' /etc/sysconfig/iptables` -le 0 ]; then \
sed -ri -e 's#^.*--reject-with tcp-reset#-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 8333 -j ACCEPT\n&#' /etc/sysconfig/iptables; \
fi
$(reloadIPTables)
@touch $@
####################### CONFIGS ###################################
MAKE_DIRS += build/bitcoind
MAKE_DIRS += $(HOME)/.bitcoin
$(HOME)/.bitcoin/bitcoin-testnet.conf: build/bitcoind/bitcoin-testnet.conf | $(HOME)/.bitcoin
umask 077 && \
if [ -f $@ ]; then \
cp -f $< $@.new.conf && \
touch $@; \
else \
cp -f $< $@; \
fi
$(HOME)/.bitcoin/bitcoin-mainnet.conf: build/bitcoind/bitcoin-mainnet.conf | $(HOME)/.bitcoin
umask 077 && \
if [ -f $@ ]; then \
cp -f $< $@.new.conf && \
touch $@; \
else \
cp -f $< $@; \
fi
build/bitcoind/bitcoin-testnet.conf :\
$(NETWORK_MK_FILE)\
configs/bitcoind/bitcoin-testnet.conf\
$(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt\
|\
build/bitcoind
cp -f configs/bitcoind/bitcoin-testnet.conf $@ &&\
LND_RPC_PASS=`awk '/String to be appended to bitcoin.conf:/{getline; print}' $(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt` && \
sed -ri \
-e 's#\$$\$$HOME\$$\$$#$(HOME)#g' \
-e 's#\$$\$$BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET\$$\$$#$(BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET)#g' \
-e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \
-e 's#\$$\$$LND_RPC_PASS\$$\$$#'$$LND_RPC_PASS'#g' \
$@
build/bitcoind/bitcoin-mainnet.conf :\
$(NETWORK_MK_FILE)\
configs/bitcoind/bitcoin-mainnet.conf\
$(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt\
|\
build/bitcoind
cp -f configs/bitcoind/bitcoin-mainnet.conf $@ &&\
LND_RPC_PASS=`awk '/String to be appended to bitcoin.conf:/{getline; print}' $(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt` && \
sed -ri \
-e 's#\$$\$$HOME\$$\$$#$(HOME)#g' \
-e 's#\$$\$$BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET\$$\$$#$(BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET)#g' \
-e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \
-e 's#\$$\$$LND_RPC_PASS\$$\$$#'$$LND_RPC_PASS'#g' \
$@
bitcoind_configs_install: |\
$(HOME)/.bitcoin/bitcoin-testnet.conf\
$(HOME)/.bitcoin/bitcoin-mainnet.conf
@touch $@
MAKE_DIRS += build/bin/bitcoind
build/bin/bitcoind/mainnet-bitcoind-start: \
$(NETWORK_MK_FILE)\
configs/bin/bitcoind/mainnet-bitcoind-start\
|\
bitcoin-core_install\
bitcoind_configs_install\
build/bin/bitcoind
cp -f configs/bin/bitcoind/mainnet-bitcoind-start $@ && \
sed -ri \
-e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \
-e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \
chmod 755 $@
build/bin/bitcoind/testnet-bitcoind-start: \
$(NETWORK_MK_FILE)\
configs/bin/bitcoind/testnet-bitcoind-start\
|\
bitcoin-core_install\
bitcoind_configs_install\
build/bin/bitcoind
cp -f configs/bin/bitcoind/testnet-bitcoind-start $@ && \
sed -ri \
-e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \
-e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \
chmod 755 $@
build/bin/bitcoind/mainnet-bitcoind-stop: \
$(NETWORK_MK_FILE)\
configs/bin/bitcoind/mainnet-bitcoind-stop\
|\
bitcoin-core_install\
bitcoind_configs_install\
build/bin/bitcoind
cp -f configs/bin/bitcoind/mainnet-bitcoind-stop $@ && \
sed -ri \
-e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \
-e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \
chmod 755 $@
build/bin/bitcoind/testnet-bitcoind-stop: \
$(NETWORK_MK_FILE)\
configs/bin/bitcoind/testnet-bitcoind-stop\
|\
bitcoin-core_install\
bitcoind_configs_install\
build/bin/bitcoind
cp -f configs/bin/bitcoind/testnet-bitcoind-stop $@ && \
sed -ri \
-e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \
-e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \
chmod 755 $@
$(HOME)/bin/mainnet-bitcoind-start: build/bin/bitcoind/mainnet-bitcoind-start | miniupnpc_install $(HOME)/bin
umask 077 && cp -f $< $@
$(HOME)/bin/testnet-bitcoind-start: build/bin/bitcoind/testnet-bitcoind-start | miniupnpc_install $(HOME)/bin
umask 077 && cp -f $< $@
$(HOME)/bin/mainnet-bitcoind-stop: build/bin/bitcoind/mainnet-bitcoind-stop | miniupnpc_install $(HOME)/bin
umask 077 && cp -f $< $@
$(HOME)/bin/testnet-bitcoind-stop: build/bin/bitcoind/testnet-bitcoind-stop | miniupnpc_install $(HOME)/bin
umask 077 && cp -f $< $@