forked from wavesplatform/gowaves
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
379 lines (301 loc) · 22.8 KB
/
Makefile
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
PROJECT=ymcore
ORGANISATION=youngmarket
MODULE=github.com/Young-Market/ymcore
SOURCE=$(shell find . -name '*.go' | grep -v vendor/)
SOURCE_DIRS = cmd pkg
VERSION=$(shell git describe --tags --always --dirty)
DEB_VER=$(shell git describe --tags --abbrev=0 | cut -c 2-)
DEB_HASH=$(shell git rev-parse HEAD)
export GO111MODULE=on
.PHONY: vendor vetcheck fmtcheck clean build gotest update-go-deps
all: vendor vetcheck fmtcheck gotest mod-clean build-node-native
ci: vendor vetcheck fmtcheck release-node build-importer-native gotest-race-coverage mod-clean
ver:
@echo Building version: $(VERSION)
gotest:
go test -cover $$(go list ./... | grep -v "/itests")
gotest-race-coverage:
go test -timeout 20m -race -coverprofile=coverage.txt -covermode=atomic $$(go list ./... | grep -v "/itests")
gotest-real-node:
@REAL_NODE=true go test -cover $$(go list ./... | grep -v "/itests")
itest:
mkdir -p build/config
mkdir -p build/logs
go test -timeout 40m -parallel 3 $$(go list ./... | grep "/itests")
itest-race:
mkdir -p build/config
mkdir -p build/logs
ITESTS_WITH_RACE_DETECTOR="true" go test -timeout 60m -parallel 3 $$(go list ./... | grep "/itests")
smoke:
mkdir -p build/config
mkdir -p build/logs
go test -timeout 20m -parallel 3 -tags=smoke $$(go list ./... | grep "/itests")
fmtcheck:
@gofmt -l -s $(SOURCE_DIRS) | grep ".*\.go"; if [ "$$?" = "0" ]; then exit 1; fi
mod-clean:
go mod tidy
update-go-deps: mod-clean
@echo ">> updating Go dependencies"
@for m in $$(go list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
go get $$m; \
done
go mod tidy
ifneq (,$(wildcard vendor))
go mod vendor
endif
clean:
@rm -rf build
go mod tidy
vendor:
go mod vendor
vetcheck:
go vet ./...
golangci-lint run -c .golangci.yml
golangci-lint run -c .golangci-strict.yml --new-from-rev=origin/master
strict-vet-check:
golangci-lint run -c .golangci-strict.yml
build-chaincmp-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/chaincmp -ldflags="-X main.version=$(VERSION)" ./cmd/chaincmp
build-chaincmp-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/chaincmp -ldflags="-X main.version=$(VERSION)" ./cmd/chaincmp
build-chaincmp-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/chaincmp.exe -ldflags="-X main.version=$(VERSION)" ./cmd/chaincmp
release-chaincmp: ver build-chaincmp-linux build-chaincmp-darwin build-chaincmp-windows
dist-chaincmp: release-chaincmp
@mkdir -p build/dist
@cd ./build/; zip -j ./dist/chaincmp_$(VERSION)_Windows-amd64.zip ./bin/windows-amd64/chaincmp*
@cd ./build/bin/linux-amd64/; tar pzcvf ../../dist/chaincmp_$(VERSION)_Linux-amd64.tar.gz ./chaincmp*
@cd ./build/bin/darwin-amd64/; tar pzcvf ../../dist/chaincmp_$(VERSION)_macOS-amd64.tar.gz ./chaincmp*
build-blockcmp-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/blockcmp -ldflags="-X main.version=$(VERSION)" ./cmd/blockcmp
build-blockcmp-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/blockcmp -ldflags="-X main.version=$(VERSION)" ./cmd/blockcmp
build-blockcmp-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/blockcmp.exe -ldflags="-X main.version=$(VERSION)" ./cmd/blockcmp
release-blockcmp: ver build-blockcmp-linux build-blockcmp-darwin build-blockcmp-windows
dist-blockcmp: release-blockcmp
@mkdir -p build/dist
@cd ./build/; zip -j ./dist/blockcmp_$(VERSION)_Windows-amd64.zip ./bin/windows-amd64/blockcmp*
@cd ./build/bin/linux-amd64/; tar pzcvf ../../dist/blockcmp_$(VERSION)_Linux-amd64.tar.gz ./blockcmp*
@cd ./build/bin/darwin-amd64/; tar pzcvf ../../dist/blockcmp_$(VERSION)_macOS-amd64.tar.gz ./blockcmp*
build-node-native:
@go build -o build/bin/native/node -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
build-node-linux-amd64:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/node -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
build-node-linux-amd64-with-race:
@CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -race -o build/bin/linux-amd64/node -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
build-node-linux-i386:
@CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -o build/bin/linux-i386/node -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
build-node-linux-arm:
@CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -o build/bin/linux-arm/node -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
build-node-linux-arm64:
@CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o build/bin/linux-arm64/node -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
build-node-darwin-amd64:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/node -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
build-node-windows-amd64:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/node.exe -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/node
release-node: ver build-node-linux-amd64 build-node-linux-i386 build-node-linux-arm64 build-node-linux-arm build-node-darwin-amd64 build-node-windows-amd64
dist-node: release-node build-node-mainnet-amd64-deb-package build-node-testnet-amd64-deb-package build-node-testnet-arm64-deb-package build-node-stagenet-amd64-deb-package build-node-stagenet-arm64-deb-package
@mkdir -p build/dist
@cd ./build/; zip -j ./dist/node_$(VERSION)_Windows-amd64.zip ./bin/windows-amd64/node*
@cd ./build/bin/linux-amd64/; tar pzcvf ../../dist/node_$(VERSION)_Linux-amd64.tar.gz ./node*
@cd ./build/bin/linux-arm64/; tar pzcvf ../../dist/node_$(VERSION)_Linux-arm64.tar.gz ./node*
@cd ./build/bin/darwin-amd64/; tar pzcvf ../../dist/node_$(VERSION)_macOS-amd64.tar.gz ./node*
build-importer-native:
@go build -pgo=importer.pgo -o build/bin/native/importer -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/importer
build-importer-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -pgo=importer.pgo -o build/bin/linux-amd64/importer -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/importer
build-importer-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -pgo=importer.pgo -o build/bin/darwin-amd64/importer -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/importer
build-importer-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -pgo=importer.pgo -o build/bin/windows-amd64/importer.exe -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/importer
release-importer: ver build-importer-linux build-importer-darwin build-importer-windows
dist-importer: release-importer
@mkdir -p build/dist
@cd ./build/; zip -j ./dist/importer_$(VERSION)_Windows-amd64.zip ./bin/windows-amd64/importer*
@cd ./build/bin/linux-amd64/; tar pzcvf ../../dist/importer_$(VERSION)_Linux-amd64.tar.gz ./importer*
@cd ./build/bin/darwin-amd64/; tar pzcvf ../../dist/importer_$(VERSION)_macOS-amd64.tar.gz ./importer*
build-wallet-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/wallet ./cmd/wallet
build-wallet-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/wallet ./cmd/wallet
build-wallet-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/wallet.exe ./cmd/wallet
release-wallet: ver build-wallet-linux build-wallet-darwin build-wallet-windows
dist-wallet: release-wallet
@mkdir -p build/dist
@cd ./build/; zip -j ./dist/wallet_$(VERSION)_Windows-amd64.zip ./bin/windows-amd64/wallet*
@cd ./build/bin/linux-amd64/; tar pzcvf ../../dist/wallet_$(VERSION)_Linux-amd64.tar.gz ./wallet*
@cd ./build/bin/darwin-amd64/; tar pzcvf ../../dist/wallet_$(VERSION)_macOS-amd64.tar.gz ./wallet*
build-rollback-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/rollback -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/rollback
build-rollback-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/rollback -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/rollback
build-rollback-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/rollback.exe -ldflags="-X 'github.com/young-market/ymcore/pkg/versioning.Version=$(VERSION)'" ./cmd/rollback
release-rollback: ver build-rollback-linux build-rollback-darwin build-rollback-windows
build-compiler-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/compiler ./cmd/compiler
build-compiler-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/compiler ./cmd/compiler
build-compiler-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/compiler.exe ./cmd/compiler
release-compiler: ver build-compiler-linux build-compiler-darwin build-compiler-windows
dist-compiler: release-compiler
@mkdir -p build/dist
@cd ./build/; zip -j ./dist/compiler_$(VERSION)_Windows-amd64.zip ./bin/windows-amd64/compiler*
@cd ./build/bin/linux-amd64/; tar pzcvf ../../dist/compiler_$(VERSION)_Linux-amd64.tar.gz ./compiler*
@cd ./build/bin/darwin-amd64/; tar pzcvf ../../dist/compiler_$(VERSION)_macOS-amd64.tar.gz ./compiler*
build-statehash-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/statehash ./cmd/statehash
build-statehash-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/statehash ./cmd/statehash
build-statehash-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/statehash.exe ./cmd/statehash
release-statehash: ver build-statehash-linux build-statehash-darwin build-statehash-windows
build-convert-linux:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bin/linux-amd64/convert ./cmd/convert
build-convert-darwin:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bin/darwin-amd64/convert ./cmd/convert
build-convert-windows:
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bin/windows-amd64/convert.exe ./cmd/convert
release-convert: ver build-convert-linux build-convert-darwin build-convert-windows
dist-convert: release-convert
@mkdir -p build/dist
@cd ./build/; zip -j ./dist/convert_$(VERSION)_Windows-amd64.zip ./bin/windows-amd64/convert*
@cd ./build/bin/linux-amd64/; tar pzcvf ../../dist/convert_$(VERSION)_Linux-amd64.tar.gz ./convert*
@cd ./build/bin/darwin-amd64/; tar pzcvf ../../dist/convert_$(VERSION)_macOS-amd64.tar.gz ./convert*
dist: clean dist-chaincmp dist-importer dist-node dist-wallet dist-compiler
mock:
mockgen -source pkg/miner/utxpool/cleaner.go -destination pkg/miner/utxpool/mock.go -package utxpool stateWrapper
mockgen -source pkg/node/peers/peer_manager.go -destination pkg/mock/peer_manager.go -package mock PeerManager
mockgen -source pkg/node/peers/peer_storage.go -destination pkg/mock/peer_storage.go -package mock PeerStorage
mockgen -source pkg/p2p/peer/peer.go -destination pkg/mock/peer.go -package mock Peer
mockgen -source pkg/state/api.go -destination pkg/mock/state.go -package mock State
mockgen -source pkg/grpc/server/api.go -destination pkg/mock/grpc.go -package mock GrpcHandlers
proto:
@protoc --proto_path=pkg/grpc/protobuf-schemas/proto/ --go_out=./ --go_opt=module=$(MODULE) --go-vtproto_out=./ --go-vtproto_opt=features=marshal_strict+unmarshal+size --go-vtproto_opt=module=$(MODULE) pkg/grpc/protobuf-schemas/proto/waves/*.proto
@protoc --proto_path=pkg/grpc/protobuf-schemas/proto/ --go_out=./ --go_opt=module=$(MODULE) --go-grpc_out=./ --go-grpc_opt=require_unimplemented_servers=false --go-grpc_opt=module=$(MODULE) pkg/grpc/protobuf-schemas/proto/waves/node/grpc/*.proto
@protoc --proto_path=pkg/grpc/protobuf-schemas/proto/ --go_out=./ --go_opt=module=$(MODULE) --go-vtproto_out=./ --go-vtproto_opt=features=marshal_strict+unmarshal+size --go-vtproto_opt=module=$(MODULE) pkg/grpc/protobuf-schemas/proto/waves/lang/*.proto
@protoc --proto_path=pkg/grpc/protobuf-schemas/proto/ --go_out=./ --go_opt=module=$(MODULE) --go-vtproto_out=./ --go-vtproto_opt=features=marshal_strict+unmarshal+size --go-vtproto_opt=module=$(MODULE) pkg/grpc/protobuf-schemas/proto/waves/events/*.proto
@protoc --proto_path=pkg/grpc/protobuf-schemas/proto/ --go_out=./ --go_opt=module=$(MODULE) --go-grpc_out=./ --go-grpc_opt=require_unimplemented_servers=false --go-grpc_opt=module=$(MODULE) pkg/grpc/protobuf-schemas/proto/waves/events/grpc/*.proto
build-node-mainnet-amd64-deb-package: release-node
@mkdir -p build/dist
@mkdir -p ./build/ymcore-mainnet-amd64/DEBIAN
@sed "s/DEB_VER/$(DEB_VER)/g; s/VERSION/$(VERSION)/g; s/DESCRIPTION/ymcore Node for MainNet System Service/g; s/PACKAGE/ymcore-mainnet/g; s/ARCH/amd64/g" ./dpkg/control > ./build/ymcore-mainnet-amd64/DEBIAN/control
@sed "s/PACKAGE/ymcore-mainnet/g; s/NAME/ymcore/g;" ./dpkg/postinst > ./build/ymcore-mainnet-amd64/DEBIAN/postinst
@sed "s/PACKAGE/ymcore-mainnet/g" ./dpkg/postrm > ./build/ymcore-mainnet-amd64/DEBIAN/postrm
@sed "s/PACKAGE/ymcore-mainnet/g" ./dpkg/prerm > ./build/ymcore-mainnet-amd64/DEBIAN/prerm
@chmod 0644 ./build/ymcore-mainnet-amd64/DEBIAN/control
@chmod 0775 ./build/ymcore-mainnet-amd64/DEBIAN/postinst
@chmod 0775 ./build/ymcore-mainnet-amd64/DEBIAN/postrm
@chmod 0775 ./build/ymcore-mainnet-amd64/DEBIAN/prerm
@mkdir -p ./build/ymcore-mainnet-amd64/lib/systemd/system
@sed "s|VERSION|$(VERSION)|g; s|DESCRIPTION|ymcore Node for MainNet System Service|g; s|PACKAGE|ymcore-mainnet|g; s|EXECUTABLE|node|g; s|PARAMS|-state-path /var/lib/ymcore-mainnet/ -api-address 0.0.0.0:8080|g; s|NAME|ymcore|g" ./dpkg/service.service > ./build/ymcore-mainnet-amd64/lib/systemd/system/ymcore-mainnet.service
@mkdir -p ./build/ymcore-mainnet-amd64/usr/share/ymcore-mainnet
@cp ./build/bin/linux-amd64/node ./build/ymcore-mainnet-amd64/usr/share/ymcore-mainnet
@mkdir -p ./build/ymcore-mainnet-amd64/var/lib/ymcore-mainnet/
@mkdir -p ./build/ymcore-mainnet-amd64/var/log/ymcore-mainnet/
@dpkg-deb --build ./build/ymcore-mainnet-amd64
@mv ./build/ymcore-mainnet-amd64.deb ./build/dist/ymcore-mainnet-amd64_${VERSION}.deb
@rm -rf ./build/ymcore-mainnet-amd64
build-node-mainnet-arm64-deb-package: release-node
@mkdir -p build/dist
@mkdir -p ./build/ymcore-mainnet-arm64/DEBIAN
@sed "s/DEB_VER/$(DEB_VER)/g; s/VERSION/$(VERSION)/g; s/DESCRIPTION/ymcore Node for MainNet System Service/g; s/PACKAGE/ymcore-mainnet/g; s/ARCH/arm64/g" ./dpkg/control > ./build/ymcore-mainnet-arm64/DEBIAN/control
@sed "s/PACKAGE/ymcore-mainnet/g; s/NAME/ymcore/g;" ./dpkg/postinst > ./build/ymcore-mainnet-arm64/DEBIAN/postinst
@sed "s/PACKAGE/ymcore-mainnet/g" ./dpkg/postrm > ./build/ymcore-mainnet-arm64/DEBIAN/postrm
@sed "s/PACKAGE/ymcore-mainnet/g" ./dpkg/prerm > ./build/ymcore-mainnet-arm64/DEBIAN/prerm
@chmod 0644 ./build/ymcore-mainnet-arm64/DEBIAN/control
@chmod 0775 ./build/ymcore-mainnet-arm64/DEBIAN/postinst
@chmod 0775 ./build/ymcore-mainnet-arm64/DEBIAN/postrm
@chmod 0775 ./build/ymcore-mainnet-arm64/DEBIAN/prerm
@mkdir -p ./build/ymcore-mainnet-arm64/lib/systemd/system
@sed "s|VERSION|$(VERSION)|g; s|DESCRIPTION|ymcore Node for MainNet System Service|g; s|PACKAGE|ymcore-mainnet|g; s|EXECUTABLE|node|g; s|PARAMS|-state-path /var/lib/ymcore-mainnet/ -api-address 0.0.0.0:8080|g; s|NAME|ymcore|g" ./dpkg/service.service > ./build/ymcore-mainnet-arm64/lib/systemd/system/ymcore-mainnet.service
@mkdir -p ./build/ymcore-mainnet-arm64/usr/share/ymcore-mainnet
@cp ./build/bin/linux-arm64/node ./build/ymcore-mainnet-arm64/usr/share/ymcore-mainnet
@mkdir -p ./build/ymcore-mainnet-arm64/var/lib/ymcore-mainnet/
@mkdir -p ./build/ymcore-mainnet-arm64/var/log/ymcore-mainnet/
@dpkg-deb --build ./build/ymcore-mainnet-arm64
@mv ./build/ymcore-mainnet-arm64.deb ./build/dist/ymcore-mainnet-arm64_${VERSION}.deb
@rm -rf ./build/ymcore-mainnet-arm64
build-node-testnet-amd64-deb-package: release-node
@mkdir -p build/dist
@mkdir -p ./build/ymcore-testnet-amd64/DEBIAN
@sed "s/DEB_VER/$(DEB_VER)/g; s/VERSION/$(VERSION)/g; s/DESCRIPTION/ymcore Node for TestNet System Service/g; s/PACKAGE/ymcore-testnet/g; s/ARCH/amd64/g" ./dpkg/control > ./build/ymcore-testnet-amd64/DEBIAN/control
@sed "s/PACKAGE/ymcore-testnet/g; s/NAME/ymcore/g;" ./dpkg/postinst > ./build/ymcore-testnet-amd64/DEBIAN/postinst
@sed "s/PACKAGE/ymcore-testnet/g" ./dpkg/postrm > ./build/ymcore-testnet-amd64/DEBIAN/postrm
@sed "s/PACKAGE/ymcore-testnet/g" ./dpkg/prerm > ./build/ymcore-testnet-amd64/DEBIAN/prerm
@chmod 0644 ./build/ymcore-testnet-amd64/DEBIAN/control
@chmod 0775 ./build/ymcore-testnet-amd64/DEBIAN/postinst
@chmod 0775 ./build/ymcore-testnet-amd64/DEBIAN/postrm
@chmod 0775 ./build/ymcore-testnet-amd64/DEBIAN/prerm
@mkdir -p ./build/ymcore-testnet-amd64/lib/systemd/system
@sed "s|VERSION|$(VERSION)|g; s|DESCRIPTION|ymcore Node for TestNet System Service|g; s|PACKAGE|ymcore-testnet|g; s|EXECUTABLE|node|g; s|PARAMS|-state-path /var/lib/ymcore-testnet/ -api-address 0.0.0.0:8090 -blockchain-type testnet|g; s|NAME|ymcore|g" ./dpkg/service.service > ./build/ymcore-testnet-amd64/lib/systemd/system/ymcore-testnet.service
@mkdir -p ./build/ymcore-testnet-amd64/usr/share/ymcore-testnet
@cp ./build/bin/linux-amd64/node ./build/ymcore-testnet-amd64/usr/share/ymcore-testnet
@mkdir -p ./build/ymcore-testnet-amd64/var/lib/ymcore-testnet/
@mkdir -p ./build/ymcore-testnet-amd64/var/log/ymcore-testnet/
@dpkg-deb --build ./build/ymcore-testnet-amd64
@mv ./build/ymcore-testnet-amd64.deb ./build/dist/ymcore-testnet-amd64_${VERSION}.deb
@rm -rf ./build/ymcore-testnet-amd64
build-node-testnet-arm64-deb-package: release-node
@mkdir -p build/dist
@mkdir -p ./build/ymcore-testnet-arm64/DEBIAN
@sed "s/DEB_VER/$(DEB_VER)/g; s/VERSION/$(VERSION)/g; s/DESCRIPTION/ymcore Node for TestNet System Service/g; s/PACKAGE/ymcore-testnet/g; s/ARCH/arm64/g" ./dpkg/control > ./build/ymcore-testnet-arm64/DEBIAN/control
@sed "s/PACKAGE/ymcore-testnet/g; s/NAME/ymcore/g;" ./dpkg/postinst > ./build/ymcore-testnet-arm64/DEBIAN/postinst
@sed "s/PACKAGE/ymcore-testnet/g" ./dpkg/postrm > ./build/ymcore-testnet-arm64/DEBIAN/postrm
@sed "s/PACKAGE/ymcore-testnet/g" ./dpkg/prerm > ./build/ymcore-testnet-arm64/DEBIAN/prerm
@chmod 0644 ./build/ymcore-testnet-arm64/DEBIAN/control
@chmod 0775 ./build/ymcore-testnet-arm64/DEBIAN/postinst
@chmod 0775 ./build/ymcore-testnet-arm64/DEBIAN/postrm
@chmod 0775 ./build/ymcore-testnet-arm64/DEBIAN/prerm
@mkdir -p ./build/ymcore-testnet-arm64/lib/systemd/system
@sed "s|VERSION|$(VERSION)|g; s|DESCRIPTION|ymcore Node for TestNet System Service|g; s|PACKAGE|ymcore-testnet|g; s|EXECUTABLE|node|g; s|PARAMS|-state-path /var/lib/ymcore-testnet/ -api-address 0.0.0.0:8090 -blockchain-type testnet|g; s|NAME|ymcore|g" ./dpkg/service.service > ./build/ymcore-testnet-arm64/lib/systemd/system/ymcore-testnet.service
@mkdir -p ./build/ymcore-testnet-arm64/usr/share/ymcore-testnet
@cp ./build/bin/linux-arm64/node ./build/ymcore-testnet-arm64/usr/share/ymcore-testnet
@mkdir -p ./build/ymcore-testnet-arm64/var/lib/ymcore-testnet/
@mkdir -p ./build/ymcore-testnet-arm64/var/log/ymcore-testnet/
@dpkg-deb --build ./build/ymcore-testnet-arm64
@mv ./build/ymcore-testnet-arm64.deb ./build/dist/ymcore-testnet-arm64_${VERSION}.deb
@rm -rf ./build/ymcore-testnet-arm64
build-node-stagenet-amd64-deb-package: release-node
@mkdir -p build/dist
@mkdir -p ./build/ymcore-stagenet-amd64/DEBIAN
@sed "s/DEB_VER/$(DEB_VER)/g; s/VERSION/$(VERSION)/g; s/DESCRIPTION/ymcore Node for StageNet System Service/g; s/PACKAGE/ymcore-stagenet/g; s/ARCH/amd64/g" ./dpkg/control > ./build/ymcore-stagenet-amd64/DEBIAN/control
@sed "s/PACKAGE/ymcore-stagenet/g; s/NAME/ymcore/g;" ./dpkg/postinst > ./build/ymcore-stagenet-amd64/DEBIAN/postinst
@sed "s/PACKAGE/ymcore-stagenet/g" ./dpkg/postrm > ./build/ymcore-stagenet-amd64/DEBIAN/postrm
@sed "s/PACKAGE/ymcore-stagenet/g" ./dpkg/prerm > ./build/ymcore-stagenet-amd64/DEBIAN/prerm
@chmod 0644 ./build/ymcore-stagenet-amd64/DEBIAN/control
@chmod 0775 ./build/ymcore-stagenet-amd64/DEBIAN/postinst
@chmod 0775 ./build/ymcore-stagenet-amd64/DEBIAN/postrm
@chmod 0775 ./build/ymcore-stagenet-amd64/DEBIAN/prerm
@mkdir -p ./build/ymcore-stagenet-amd64/lib/systemd/system
@sed "s|VERSION|$(VERSION)|g; s|DESCRIPTION|ymcore Node for StageNet System Service|g; s|PACKAGE|ymcore-stagenet|g; s|EXECUTABLE|node|g; s|PARAMS|-state-path /var/lib/ymcore-stagenet/ -api-address 0.0.0.0:8100 -blockchain-type stagenet|g; s|NAME|ymcore|g" ./dpkg/service.service > ./build/ymcore-stagenet-amd64/lib/systemd/system/ymcore-stagenet.service
@mkdir -p ./build/ymcore-stagenet-amd64/usr/share/ymcore-stagenet
@cp ./build/bin/linux-amd64/node ./build/ymcore-stagenet-amd64/usr/share/ymcore-stagenet
@mkdir -p ./build/ymcore-stagenet-amd64/var/lib/ymcore-stagenet/
@mkdir -p ./build/ymcore-stagenet-amd64/var/log/ymcore-stagenet/
@dpkg-deb --build ./build/ymcore-stagenet-amd64
@mv ./build/ymcore-stagenet-amd64.deb ./build/dist/ymcore-stagenet-amd64_${VERSION}.deb
@rm -rf ./build/ymcore-stagenet-amd64
build-node-stagenet-arm64-deb-package: release-node
@mkdir -p build/dist
@mkdir -p ./build/ymcore-stagenet-arm64/DEBIAN
@sed "s/DEB_VER/$(DEB_VER)/g; s/VERSION/$(VERSION)/g; s/DESCRIPTION/ymcore Node for StageNet System Service/g; s/PACKAGE/ymcore-stagenet/g; s/ARCH/arm64/g" ./dpkg/control > ./build/ymcore-stagenet-arm64/DEBIAN/control
@sed "s/PACKAGE/ymcore-stagenet/g; s/NAME/ymcore/g;" ./dpkg/postinst > ./build/ymcore-stagenet-arm64/DEBIAN/postinst
@sed "s/PACKAGE/ymcore-stagenet/g" ./dpkg/postrm > ./build/ymcore-stagenet-arm64/DEBIAN/postrm
@sed "s/PACKAGE/ymcore-stagenet/g" ./dpkg/prerm > ./build/ymcore-stagenet-arm64/DEBIAN/prerm
@chmod 0644 ./build/ymcore-stagenet-arm64/DEBIAN/control
@chmod 0775 ./build/ymcore-stagenet-arm64/DEBIAN/postinst
@chmod 0775 ./build/ymcore-stagenet-arm64/DEBIAN/postrm
@chmod 0775 ./build/ymcore-stagenet-arm64/DEBIAN/prerm
@mkdir -p ./build/ymcore-stagenet-arm64/lib/systemd/system
@sed "s|VERSION|$(VERSION)|g; s|DESCRIPTION|ymcore Node for StageNet System Service|g; s|PACKAGE|ymcore-stagenet|g; s|EXECUTABLE|node|g; s|PARAMS|-state-path /var/lib/ymcore-stagenet/ -api-address 0.0.0.0:8100 -blockchain-type stagenet|g; s|NAME|ymcore|g" ./dpkg/service.service > ./build/ymcore-stagenet-arm64/lib/systemd/system/ymcore-stagenet.service
@mkdir -p ./build/ymcore-stagenet-arm64/usr/share/ymcore-stagenet
@cp ./build/bin/linux-arm64/node ./build/ymcore-stagenet-arm64/usr/share/ymcore-stagenet
@mkdir -p ./build/ymcore-stagenet-arm64/var/lib/ymcore-stagenet/
@mkdir -p ./build/ymcore-stagenet-arm64/var/log/ymcore-stagenet/
@dpkg-deb --build ./build/ymcore-stagenet-arm64
@mv ./build/ymcore-stagenet-arm64.deb ./build/dist/ymcore-stagenet-arm64_${VERSION}.deb
@rm -rf ./build/ymcore-stagenet-arm64