2020-04-30 15:51:30 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
### Package
|
|
|
|
version = "0.1.0"
|
|
|
|
author = "Status Research & Development GmbH"
|
2020-06-16 12:22:24 +00:00
|
|
|
description = "Waku, Private P2P Messaging for Resource-Restricted Devices"
|
2020-04-30 15:51:30 +00:00
|
|
|
license = "MIT or Apache License 2.0"
|
|
|
|
#bin = @["build/waku"]
|
|
|
|
|
|
|
|
### Dependencies
|
2022-11-02 14:55:09 +00:00
|
|
|
requires "nim >= 1.6.0",
|
2020-04-30 15:51:30 +00:00
|
|
|
"chronicles",
|
|
|
|
"confutils",
|
|
|
|
"chronos",
|
|
|
|
"eth",
|
|
|
|
"json_rpc",
|
|
|
|
"libbacktrace",
|
|
|
|
"nimcrypto",
|
|
|
|
"stew",
|
|
|
|
"stint",
|
|
|
|
"metrics",
|
2020-12-04 04:41:28 +00:00
|
|
|
"libp2p", # Only for Waku v2
|
2022-06-02 09:45:00 +00:00
|
|
|
"web3",
|
2022-11-02 14:55:09 +00:00
|
|
|
"presto",
|
|
|
|
"regex"
|
2020-04-30 15:51:30 +00:00
|
|
|
|
|
|
|
### Helper functions
|
|
|
|
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
|
|
|
if not dirExists "build":
|
|
|
|
mkDir "build"
|
|
|
|
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
|
|
|
var extra_params = params
|
|
|
|
for i in 2..<paramCount():
|
|
|
|
extra_params &= " " & paramStr(i)
|
|
|
|
exec "nim " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"
|
|
|
|
|
2023-05-19 06:20:12 +00:00
|
|
|
proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "static") =
|
2023-05-12 16:08:41 +00:00
|
|
|
if not dirExists "build":
|
|
|
|
mkDir "build"
|
|
|
|
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
|
|
|
var extra_params = params
|
|
|
|
for i in 2..<paramCount():
|
|
|
|
extra_params &= " " & paramStr(i)
|
2023-05-19 06:20:12 +00:00
|
|
|
if `type` == "static":
|
2023-08-02 08:45:15 +00:00
|
|
|
exec "nim c" & " --out:build/" & name & ".a --threads:on --app:staticlib --opt:size --noMain --header " & extra_params & " " & srcDir & name & ".nim"
|
2023-05-12 16:08:41 +00:00
|
|
|
else:
|
2023-08-02 08:45:15 +00:00
|
|
|
exec "nim c" & " --out:build/" & name & ".so --threads:on --app:lib --opt:size --noMain --header " & extra_params & " " & srcDir & name & ".nim"
|
2023-05-12 16:08:41 +00:00
|
|
|
|
2021-06-14 12:40:08 +00:00
|
|
|
proc test(name: string, params = "-d:chronicles_log_level=DEBUG", lang = "c") =
|
2020-09-16 04:23:10 +00:00
|
|
|
# XXX: When running `> NIM_PARAMS="-d:chronicles_log_level=INFO" make test2`
|
|
|
|
# I expect compiler flag to be overridden, however it stays with whatever is
|
|
|
|
# specified here.
|
2021-06-14 12:40:08 +00:00
|
|
|
buildBinary name, "tests/", params
|
2020-04-30 15:51:30 +00:00
|
|
|
exec "build/" & name
|
|
|
|
|
2023-03-31 13:24:04 +00:00
|
|
|
### Waku common tasks
|
|
|
|
task testcommon, "Build & run common tests":
|
|
|
|
test "all_tests_common", "-d:chronicles_log_level=WARN -d:chronosStrictException"
|
|
|
|
|
2023-08-09 17:11:50 +00:00
|
|
|
### Waku tasks
|
2023-04-25 13:34:57 +00:00
|
|
|
task wakunode2, "Build Waku v2 cli node":
|
2022-10-12 19:41:25 +00:00
|
|
|
let name = "wakunode2"
|
2023-05-23 08:44:57 +00:00
|
|
|
buildBinary name, "apps/wakunode2/"
|
2022-10-12 19:41:25 +00:00
|
|
|
|
2024-02-09 16:06:25 +00:00
|
|
|
task benchmarks, "Some benchmarks":
|
|
|
|
let name = "benchmarks"
|
|
|
|
buildBinary name, "apps/benchmarks/"
|
|
|
|
|
2023-04-27 14:25:31 +00:00
|
|
|
task wakucanary, "Build waku-canary tool":
|
|
|
|
let name = "wakucanary"
|
2023-05-23 08:44:57 +00:00
|
|
|
buildBinary name, "apps/wakucanary/"
|
2023-04-25 13:34:57 +00:00
|
|
|
|
2023-04-27 14:25:31 +00:00
|
|
|
task networkmonitor, "Build network monitor tool":
|
|
|
|
let name = "networkmonitor"
|
2023-05-23 08:44:57 +00:00
|
|
|
buildBinary name, "apps/networkmonitor/"
|
2023-04-25 13:34:57 +00:00
|
|
|
|
2023-09-07 12:45:25 +00:00
|
|
|
task rln_db_inspector, "Build the rln db inspector":
|
|
|
|
let name = "rln_db_inspector"
|
|
|
|
buildBinary name, "tools/rln_db_inspector/"
|
|
|
|
|
2023-08-09 17:11:50 +00:00
|
|
|
task test, "Build & run Waku tests":
|
|
|
|
test "all_tests_waku"
|
2022-10-12 19:41:25 +00:00
|
|
|
|
2023-04-27 14:25:31 +00:00
|
|
|
task testwakunode2, "Build & run wakunode2 app tests":
|
|
|
|
test "all_tests_wakunode2"
|
|
|
|
|
2023-08-09 17:11:50 +00:00
|
|
|
task example2, "Build Waku examples":
|
|
|
|
buildBinary "publisher", "examples/"
|
|
|
|
buildBinary "subscriber", "examples/"
|
|
|
|
buildBinary "filter_subscriber", "examples/"
|
|
|
|
buildBinary "lightpush_publisher", "examples/"
|
2020-10-08 09:10:45 +00:00
|
|
|
|
2023-08-09 17:11:50 +00:00
|
|
|
task chat2, "Build example Waku chat usage":
|
2020-10-01 11:38:32 +00:00
|
|
|
# NOTE For debugging, set debug level. For chat usage we want minimal log
|
|
|
|
# output to STDOUT. Can be fixed by redirecting logs to file (e.g.)
|
2023-08-09 17:11:50 +00:00
|
|
|
#buildBinary name, "examples/", "-d:chronicles_log_level=WARN"
|
2020-10-21 09:54:29 +00:00
|
|
|
|
2022-10-12 19:41:25 +00:00
|
|
|
let name = "chat2"
|
2023-05-23 08:44:57 +00:00
|
|
|
buildBinary name, "apps/chat2/", "-d:chronicles_sinks=textlines[file] -d:ssl"
|
2021-05-06 13:43:43 +00:00
|
|
|
|
2022-10-12 19:41:25 +00:00
|
|
|
task chat2bridge, "Build chat2bridge":
|
2021-05-06 13:43:43 +00:00
|
|
|
let name = "chat2bridge"
|
2023-05-23 08:44:57 +00:00
|
|
|
buildBinary name, "apps/chat2bridge/"
|
2021-05-06 13:43:43 +00:00
|
|
|
|
2023-05-12 16:08:41 +00:00
|
|
|
### C Bindings
|
2023-05-19 06:20:12 +00:00
|
|
|
task libwakuStatic, "Build the cbindings waku node library":
|
2023-05-12 16:08:41 +00:00
|
|
|
let name = "libwaku"
|
2023-05-19 06:20:12 +00:00
|
|
|
buildLibrary name, "library/", "-d:chronicles_log_level=ERROR", "static"
|
|
|
|
|
|
|
|
task libwakuDynamic, "Build the cbindings waku node library":
|
|
|
|
let name = "libwaku"
|
|
|
|
buildLibrary name, "library/", "-d:chronicles_log_level=ERROR", "dynamic"
|