-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblockstor.nimble
150 lines (128 loc) · 5.83 KB
/
blockstor.nimble
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
# Package
version = "0.2.0"
author = "zenywallet"
description = "Block Explorer API for Wallet Service"
license = "MIT"
srcDir = "src"
bin = @["blockstor"]
# Dependencies
requires "nim >= 1.2.0"
requires "nimcrypto"
requires "libcurl"
requires "zip"
requires "templates"
requires "karax"
task debug, "Debug build, and Run":
exec "nim c -r --threads:on -d:DYNAMIC_FILES src/blockstor.nim"
task openssl, "Build OpenSSL":
withDir "deps/openssl":
exec "./Configure"
exec "make -j$(nproc)"
task libressl, "Build LibreSSL":
withDir "deps/libressl":
if dirExists("openbsd"):
exec "rm -rf openbsd"
exec "git checkout master"
exec "./autogen.sh"
exec "./configure"
exec "make -j$(nproc)"
task boringssl, "Build BoringSSL":
withDir "deps/boringssl":
mkDir "build"
cd "build"
exec "cmake .."
exec "make -j$(nproc)"
task depsAll, "Build deps":
exec "nim c -r src/sophia_patch.nim"
withDir "deps/sophia":
if fileExists("sophia/std/ss_lz4filter.c"):
exec "rm sophia/std/ss_lz4filter.c"
if fileExists("sophia/std/ss_zstdfilter.c"):
exec "rm sophia/std/ss_zstdfilter.c"
exec "make -j$(nproc)"
opensslTask()
libresslTask()
withDir "deps/secp256k1":
exec "./autogen.sh"
exec "./configure --enable-module-ecdh --disable-shared --enable-static --disable-tests --disable-benchmark --disable-openssl-tests --disable-exhaustive-tests"
exec "make -j$(nproc)"
withDir "deps/wasm-secp256k1":
exec "./autogen.sh"
exec "emconfigure ./configure --enable-module-ecdh --disable-shared --enable-static --disable-tests --disable-benchmark --disable-openssl-tests --disable-exhaustive-tests"
exec "sed -i 's/\\.\\/\\$(gen_context_BIN)/\\.\\.\\/secp256k1\\/\\$(gen_context_BIN)/' Makefile"
exec "emmake make -j$(nproc)"
withDir "deps/zbar":
exec "sed -i \"s/ -Werror//\" $(pwd)/configure.ac"
exec "autoreconf -vfi"
exec "emconfigure ./configure CPPFLAGS=-DNDEBUG=1 --without-x --without-jpeg --without-imagemagick --without-npapi --without-gtk --without-python --without-qt --without-xshm --disable-video --disable-pthread --enable-codes=all"
exec "emmake make -j$(nproc)"
withDir "deps/rocksdb":
exec "DEBUG_LEVEL=0 make liblz4.a -j$(nproc)"
exec "CPLUS_INCLUDE_PATH=./lz4-1.9.3/lib ROCKSDB_DISABLE_ZLIB=1 ROCKSDB_DISABLE_BZIP=1 ROCKSDB_DISABLE_SNAPPY=1 ROCKSDB_DISABLE_ZSTD=1 make static_lib -j$(nproc)"
task ui, "Build ui":
if dirExists("preload_tmp"):
exec "rm -rf preload_tmp"
exec "mkdir preload_tmp"
exec "cp deps/fonts/Play/Play-Regular.ttf preload_tmp/"
exec "cp deps/fonts/Share_Tech_Mono/ShareTechMono-Regular.ttf preload_tmp/"
exec "cp deps/fonts/themify-icons/fonts/themify.ttf preload_tmp/"
exec "nim js -d:release -o:src/ui_loader.js src/ui_loader.nim"
exec "nim js -d:release -d:nodejs -o:src/ui_externs.js src/ui_externs.nim"
exec "nim c -d:release -d:emscripten -o:public/ui.js_tmp --noMain:on --gc:orc src/ui.nim"
exec "nim c -r src/ui_patch.nim"
exec """
if [ -x "$(command -v google-closure-compiler)" ]; then
closure_compiler="google-closure-compiler"
else
closure_compiler="java -jar $(ls closure-compiler-*.jar | sort -r | head -n1)"
fi
echo "use $closure_compiler"
$closure_compiler --compilation_level ADVANCED --jscomp_off=checkVars --jscomp_off=checkTypes --jscomp_off=uselessCode --js_output_file=public/ui.js --externs src/ui_externs.js public/ui.js_tmp 2>&1 | cut -c 1-240
"""
exec "nim c -r --hints:off src/web_index.nim > public/index.html"
exec "rm src/web_index"
exec "rm public/ui.js_tmp"
exec "rm src/ui_externs.js"
exec "rm src/ui_loader.js"
exec "rm -rf preload_tmp"
task uidebug, "Build ui for debug":
if dirExists("preload_tmp"):
exec "rm -rf preload_tmp"
exec "mkdir preload_tmp"
exec "cp deps/fonts/Play/Play-Regular.ttf preload_tmp/"
exec "cp deps/fonts/Share_Tech_Mono/ShareTechMono-Regular.ttf preload_tmp/"
exec "cp deps/fonts/themify-icons/fonts/themify.ttf preload_tmp/"
exec "nim js -d:release -o:src/ui_loader.js src/ui_loader.nim"
exec "nim js -d:release -d:nodejs -o:src/ui_externs.js src/ui_externs.nim"
exec "nim c -d:emscripten -o:public/ui.js --noMain:on --gc:orc src/ui.nim"
exec "nim c -r src/ui_patch.nim"
exec "nim c -r --hints:off src/web_index.nim > public/index.html"
exec "rm src/web_index"
exec "rm src/ui_externs.js"
exec "rm src/ui_loader.js"
exec "rm -rf preload_tmp"
task webminer, "Build web miner":
exec "nim js -d:release -o:src/web_miner_loader.js src/web_miner_loader.nim"
exec "nim js -d:release -d:nodejs -o:src/web_miner_externs.js src/web_miner_externs.nim"
exec "nim c -d:release -d:emscripten -o:public/miner.js_tmp --gc:orc src/web_miner.nim"
exec "nim c -d:release -d:emscripten -d:ENABLE_SIMD128 -o:public/miner-simd128.js_tmp --gc:orc src/web_miner.nim"
exec """
if [ -x "$(command -v google-closure-compiler)" ]; then
closure_compiler="google-closure-compiler"
else
closure_compiler="java -jar $(ls closure-compiler-*.jar | sort -r | head -n1)"
fi
echo "use $closure_compiler"
$closure_compiler --compilation_level ADVANCED --jscomp_off=checkVars --jscomp_off=checkTypes --jscomp_off=uselessCode --js_output_file=public/miner.js --externs src/web_miner_externs.js public/miner.js_tmp 2>&1 | cut -c 1-240
$closure_compiler --compilation_level ADVANCED --jscomp_off=checkVars --jscomp_off=checkTypes --jscomp_off=uselessCode --js_output_file=public/miner-simd128.js --externs src/web_miner_externs.js public/miner-simd128.js_tmp 2>&1 | cut -c 1-240
"""
exec "rm public/miner-simd128.js_tmp"
exec "rm public/miner.js_tmp"
exec "rm src/web_miner_externs.js"
exec "rm src/web_miner_loader.js"
task webmining, "Build web mining html":
withDir "src/zenyjs":
exec "nim c -r zenyjs_build.nim mining.nim"
exec "mv zenyjs.wasm ../../public"
exec "mv mining.html ../../public"
exec "mv mining.js ../../public"