mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 14:03:06 +00:00
Merge ea9b54f87379bc0b9f8136802295ffda2e169122 into dafdee9f5ffc0460f45307c61fbd8e9832fc3ecd
This commit is contained in:
commit
b1dd7f5795
180
.gitmodules
vendored
180
.gitmodules
vendored
@ -1,184 +1,12 @@
|
||||
[submodule "vendor/nim-eth"]
|
||||
path = vendor/nim-eth
|
||||
url = https://github.com/status-im/nim-eth.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-secp256k1"]
|
||||
path = vendor/nim-secp256k1
|
||||
url = https://github.com/status-im/nim-secp256k1.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-libp2p"]
|
||||
path = vendor/nim-libp2p
|
||||
url = https://github.com/vacp2p/nim-libp2p.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-stew"]
|
||||
path = vendor/nim-stew
|
||||
url = https://github.com/status-im/nim-stew.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nimbus-build-system"]
|
||||
path = vendor/nimbus-build-system
|
||||
url = https://github.com/status-im/nimbus-build-system.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-nat-traversal"]
|
||||
path = vendor/nim-nat-traversal
|
||||
url = https://github.com/status-im/nim-nat-traversal.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-libbacktrace"]
|
||||
path = vendor/nim-libbacktrace
|
||||
url = https://github.com/status-im/nim-libbacktrace.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-confutils"]
|
||||
path = vendor/nim-confutils
|
||||
url = https://github.com/status-im/nim-confutils.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-chronicles"]
|
||||
path = vendor/nim-chronicles
|
||||
url = https://github.com/status-im/nim-chronicles.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-faststreams"]
|
||||
path = vendor/nim-faststreams
|
||||
url = https://github.com/status-im/nim-faststreams.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-chronos"]
|
||||
path = vendor/nim-chronos
|
||||
url = https://github.com/status-im/nim-chronos.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-json-serialization"]
|
||||
path = vendor/nim-json-serialization
|
||||
url = https://github.com/status-im/nim-json-serialization.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-serialization"]
|
||||
path = vendor/nim-serialization
|
||||
url = https://github.com/status-im/nim-serialization.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nimcrypto"]
|
||||
path = vendor/nimcrypto
|
||||
url = https://github.com/cheatfate/nimcrypto.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-metrics"]
|
||||
path = vendor/nim-metrics
|
||||
url = https://github.com/status-im/nim-metrics.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-stint"]
|
||||
path = vendor/nim-stint
|
||||
url = https://github.com/status-im/nim-stint.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-json-rpc"]
|
||||
path = vendor/nim-json-rpc
|
||||
url = https://github.com/status-im/nim-json-rpc.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-http-utils"]
|
||||
path = vendor/nim-http-utils
|
||||
url = https://github.com/status-im/nim-http-utils.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-bearssl"]
|
||||
path = vendor/nim-bearssl
|
||||
url = https://github.com/status-im/nim-bearssl.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-sqlite3-abi"]
|
||||
path = vendor/nim-sqlite3-abi
|
||||
url = https://github.com/arnetheduck/nim-sqlite3-abi.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
[submodule "vendor/nim-web3"]
|
||||
path = vendor/nim-web3
|
||||
url = https://github.com/status-im/nim-web3.git
|
||||
[submodule "vendor/nim-testutils"]
|
||||
path = vendor/nim-testutils
|
||||
url = https://github.com/status-im/nim-testutils.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nim-unittest2"]
|
||||
path = vendor/nim-unittest2
|
||||
url = https://github.com/status-im/nim-unittest2.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nim-websock"]
|
||||
path = vendor/nim-websock
|
||||
url = https://github.com/status-im/nim-websock.git
|
||||
ignore = untracked
|
||||
branch = main
|
||||
[submodule "vendor/nim-zlib"]
|
||||
path = vendor/nim-zlib
|
||||
url = https://github.com/status-im/nim-zlib.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nim-dnsdisc"]
|
||||
path = vendor/nim-dnsdisc
|
||||
url = https://github.com/status-im/nim-dnsdisc.git
|
||||
ignore = untracked
|
||||
branch = main
|
||||
[submodule "vendor/dnsclient.nim"]
|
||||
path = vendor/dnsclient.nim
|
||||
url = https://github.com/ba0f3/dnsclient.nim.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nim-toml-serialization"]
|
||||
path = vendor/nim-toml-serialization
|
||||
url = https://github.com/status-im/nim-toml-serialization.git
|
||||
[submodule "vendor/nim-presto"]
|
||||
path = vendor/nim-presto
|
||||
url = https://github.com/status-im/nim-presto.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
# Only zerokit, waku-rlnv2-contract, and nim-ffi are kept as vendor submodules.
|
||||
# nim-ffi is kept because it has an invalid .nimble file that breaks nimble dependency resolution.
|
||||
# All other dependencies are managed via Nimble.
|
||||
|
||||
[submodule "vendor/zerokit"]
|
||||
path = vendor/zerokit
|
||||
url = https://github.com/vacp2p/zerokit.git
|
||||
ignore = dirty
|
||||
branch = v0.5.1
|
||||
[submodule "vendor/nim-regex"]
|
||||
path = vendor/nim-regex
|
||||
url = https://github.com/nitely/nim-regex.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nim-unicodedb"]
|
||||
path = vendor/nim-unicodedb
|
||||
url = https://github.com/nitely/nim-unicodedb.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nim-taskpools"]
|
||||
path = vendor/nim-taskpools
|
||||
url = https://github.com/status-im/nim-taskpools.git
|
||||
ignore = untracked
|
||||
branch = stable
|
||||
[submodule "vendor/nim-results"]
|
||||
ignore = untracked
|
||||
branch = master
|
||||
path = vendor/nim-results
|
||||
url = https://github.com/arnetheduck/nim-results.git
|
||||
[submodule "vendor/db_connector"]
|
||||
path = vendor/db_connector
|
||||
url = https://github.com/nim-lang/db_connector.git
|
||||
ignore = untracked
|
||||
branch = devel
|
||||
[submodule "vendor/nph"]
|
||||
ignore = untracked
|
||||
branch = master
|
||||
path = vendor/nph
|
||||
url = https://github.com/arnetheduck/nph.git
|
||||
[submodule "vendor/nim-minilru"]
|
||||
path = vendor/nim-minilru
|
||||
url = https://github.com/status-im/nim-minilru.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/waku-rlnv2-contract"]
|
||||
path = vendor/waku-rlnv2-contract
|
||||
url = https://github.com/logos-messaging/waku-rlnv2-contract.git
|
||||
|
||||
154
Makefile
154
Makefile
@ -4,42 +4,55 @@
|
||||
# - MIT license
|
||||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
export BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
||||
export EXCLUDED_NIM_PACKAGES := vendor/nim-dnsdisc/vendor
|
||||
|
||||
# Nimble-only build system (no vendor dependencies except zerokit)
|
||||
SHELL := bash
|
||||
LINK_PCRE := 0
|
||||
FORMAT_MSG := "\\x1B[95mFormatting:\\x1B[39m"
|
||||
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
||||
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
||||
BUILD_MSG := "\\x1B[92mBuilding:\\x1B[39m"
|
||||
|
||||
# Compiler settings
|
||||
CC ?= gcc
|
||||
NIMC ?= nim
|
||||
NIM_PARAMS := $(NIMFLAGS)
|
||||
|
||||
ifeq ($(NIM_PARAMS),)
|
||||
# "variables.mk" was not included, so we update the submodules.
|
||||
GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
|
||||
.DEFAULT:
|
||||
+@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \
|
||||
$(GIT_SUBMODULE_UPDATE); \
|
||||
echo
|
||||
# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself:
|
||||
# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles
|
||||
#
|
||||
# After restarting, it will execute its original goal, so we don't have to start a child Make here
|
||||
# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great?
|
||||
# Verbosity
|
||||
V := 0
|
||||
NIM_PARAMS := $(NIM_PARAMS) --verbosity:$(V)
|
||||
HANDLE_OUTPUT :=
|
||||
ifeq ($(V), 0)
|
||||
NIM_PARAMS := $(NIM_PARAMS) --hints:off
|
||||
HANDLE_OUTPUT := >/dev/null
|
||||
endif
|
||||
|
||||
else # "variables.mk" was included. Business as usual until the end of this file.
|
||||
# Chronicles log level
|
||||
ifdef LOG_LEVEL
|
||||
NIM_PARAMS := $(NIM_PARAMS) -d:chronicles_log_level="$(LOG_LEVEL)"
|
||||
endif
|
||||
|
||||
# Determine the OS
|
||||
# OS detection
|
||||
detected_OS := $(shell uname -s)
|
||||
ifneq (,$(findstring MINGW,$(detected_OS)))
|
||||
detected_OS := Windows
|
||||
endif
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXE_SUFFIX := .exe
|
||||
else
|
||||
EXE_SUFFIX :=
|
||||
endif
|
||||
|
||||
ifeq ($(detected_OS),Windows)
|
||||
# Update MINGW_PATH to standard MinGW location
|
||||
MINGW_PATH = /mingw64
|
||||
NIM_PARAMS += --passC:"-I$(MINGW_PATH)/include"
|
||||
NIM_PARAMS += --passL:"-L$(MINGW_PATH)/lib"
|
||||
NIM_PARAMS += --passL:"-Lvendor/nim-nat-traversal/vendor/miniupnp/miniupnpc"
|
||||
NIM_PARAMS += --passL:"-Lvendor/nim-nat-traversal/vendor/libnatpmp-upstream"
|
||||
# NAT libs paths resolved via nimble packages
|
||||
NAT_TRAVERSAL_PKG := $(shell nimble path nat_traversal 2>/dev/null)
|
||||
ifneq ($(NAT_TRAVERSAL_PKG),)
|
||||
NIM_PARAMS += --passL:"-L$(NAT_TRAVERSAL_PKG)/vendor/miniupnp/miniupnpc"
|
||||
NIM_PARAMS += --passL:"-L$(NAT_TRAVERSAL_PKG)/vendor/libnatpmp-upstream"
|
||||
endif
|
||||
|
||||
LIBS = -lws2_32 -lbcrypt -liphlpapi -luserenv -lntdll -lminiupnpc -lnatpmp -lpq
|
||||
NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)")
|
||||
@ -75,7 +88,8 @@ endif
|
||||
waku.nims:
|
||||
ln -s waku.nimble $@
|
||||
|
||||
update: | update-common
|
||||
update:
|
||||
nimble install -y
|
||||
rm -rf waku.nims && \
|
||||
$(MAKE) waku.nims $(HANDLE_OUTPUT)
|
||||
$(MAKE) build-nph
|
||||
@ -83,8 +97,9 @@ update: | update-common
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
# must be included after the default target
|
||||
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
||||
# Build directory
|
||||
build:
|
||||
mkdir -p $@
|
||||
|
||||
## Possible values: prod; debug
|
||||
TARGET ?= prod
|
||||
@ -134,7 +149,8 @@ endif
|
||||
rln-deps: rustup
|
||||
./scripts/install_rln_tests_dependencies.sh $(FOUNDRY_VERSION) $(PNPM_VERSION)
|
||||
|
||||
deps: | deps-common nat-libs waku.nims
|
||||
deps: | waku.nims
|
||||
nimble install -y
|
||||
|
||||
|
||||
### nim-libbacktrace
|
||||
@ -153,16 +169,9 @@ endif
|
||||
# enable experimental exit is dest feature in libp2p mix
|
||||
NIM_PARAMS := $(NIM_PARAMS) -d:libp2p_mix_experimental_exit_is_dest
|
||||
|
||||
libbacktrace:
|
||||
+ $(MAKE) -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0
|
||||
|
||||
# libbacktrace is now managed via nimble package
|
||||
clean-libbacktrace:
|
||||
+ $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT)
|
||||
|
||||
# Extend deps and clean targets
|
||||
ifneq ($(USE_LIBBACKTRACE), 0)
|
||||
deps: | libbacktrace
|
||||
endif
|
||||
@true
|
||||
|
||||
ifeq ($(POSTGRES), 1)
|
||||
NIM_PARAMS := $(NIM_PARAMS) -d:postgres -d:nimDebugDlOpen
|
||||
@ -216,7 +225,7 @@ clean: | clean-librln
|
||||
|
||||
testcommon: | build deps
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim testcommon $(NIM_PARAMS) waku.nims
|
||||
nimble testcommon $(NIM_PARAMS)
|
||||
|
||||
|
||||
##########
|
||||
@ -227,57 +236,56 @@ testcommon: | build deps
|
||||
# install rln-deps only for the testwaku target
|
||||
testwaku: | build deps rln-deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim test -d:os=$(shell uname) $(NIM_PARAMS) waku.nims
|
||||
nimble test -d:os=$(shell uname) $(NIM_PARAMS)
|
||||
|
||||
wakunode2: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
\
|
||||
$(ENV_SCRIPT) nim wakunode2 $(NIM_PARAMS) waku.nims
|
||||
nimble wakunode2 $(NIM_PARAMS)
|
||||
|
||||
benchmarks: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim benchmarks $(NIM_PARAMS) waku.nims
|
||||
nim benchmarks $(NIM_PARAMS) waku.nims
|
||||
|
||||
testwakunode2: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim testwakunode2 $(NIM_PARAMS) waku.nims
|
||||
nim testwakunode2 $(NIM_PARAMS) waku.nims
|
||||
|
||||
example2: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims
|
||||
nim example2 $(NIM_PARAMS) waku.nims
|
||||
|
||||
chat2: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim chat2 $(NIM_PARAMS) waku.nims
|
||||
nim chat2 $(NIM_PARAMS) waku.nims
|
||||
|
||||
chat2mix: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim chat2mix $(NIM_PARAMS) waku.nims
|
||||
nim chat2mix $(NIM_PARAMS) waku.nims
|
||||
|
||||
rln-db-inspector: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim rln_db_inspector $(NIM_PARAMS) waku.nims
|
||||
nim rln_db_inspector $(NIM_PARAMS) waku.nims
|
||||
|
||||
chat2bridge: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim chat2bridge $(NIM_PARAMS) waku.nims
|
||||
nim chat2bridge $(NIM_PARAMS) waku.nims
|
||||
|
||||
liteprotocoltester: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim liteprotocoltester $(NIM_PARAMS) waku.nims
|
||||
nim liteprotocoltester $(NIM_PARAMS) waku.nims
|
||||
|
||||
lightpushwithmix: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim lightpushwithmix $(NIM_PARAMS) waku.nims
|
||||
nim lightpushwithmix $(NIM_PARAMS) waku.nims
|
||||
|
||||
build/%: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$*" && \
|
||||
$(ENV_SCRIPT) nim buildone $(NIM_PARAMS) waku.nims $*
|
||||
nim buildone $(NIM_PARAMS) waku.nims $*
|
||||
|
||||
compile-test: | build deps librln
|
||||
echo -e $(BUILD_MSG) "$(TEST_FILE)" "\"$(TEST_NAME)\"" && \
|
||||
$(ENV_SCRIPT) nim buildTest $(NIM_PARAMS) waku.nims $(TEST_FILE) && \
|
||||
$(ENV_SCRIPT) nim execTest $(NIM_PARAMS) waku.nims $(TEST_FILE) "\"$(TEST_NAME)\""; \
|
||||
nim buildTest $(NIM_PARAMS) waku.nims $(TEST_FILE) && \
|
||||
nim execTest $(NIM_PARAMS) waku.nims $(TEST_FILE) "\"$(TEST_NAME)\""; \
|
||||
|
||||
################
|
||||
## Waku tools ##
|
||||
@ -288,25 +296,25 @@ tools: networkmonitor wakucanary
|
||||
|
||||
wakucanary: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim wakucanary $(NIM_PARAMS) waku.nims
|
||||
nim wakucanary $(NIM_PARAMS) waku.nims
|
||||
|
||||
networkmonitor: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim networkmonitor $(NIM_PARAMS) waku.nims
|
||||
nim networkmonitor $(NIM_PARAMS) waku.nims
|
||||
|
||||
############
|
||||
## Format ##
|
||||
############
|
||||
.PHONY: build-nph install-nph clean-nph print-nph-path
|
||||
|
||||
# Default location for nph binary shall be next to nim binary to make it available on the path.
|
||||
NPH:=$(shell dirname $(NIM_BINARY))/nph
|
||||
# nph is installed via nimble
|
||||
NPH:=$(shell which nph 2>/dev/null || echo "")
|
||||
|
||||
build-nph: | build deps
|
||||
ifeq ("$(wildcard $(NPH))","")
|
||||
$(ENV_SCRIPT) nim c --skipParentCfg:on vendor/nph/src/nph.nim && \
|
||||
mv vendor/nph/src/nph $(shell dirname $(NPH))
|
||||
echo "nph utility is available at " $(NPH)
|
||||
ifeq ($(NPH),)
|
||||
nimble install nph -y
|
||||
$(eval NPH := $(shell which nph))
|
||||
echo "nph utility installed via nimble"
|
||||
else
|
||||
echo "nph utility already exists at " $(NPH)
|
||||
endif
|
||||
@ -342,11 +350,11 @@ clean: | clean-nph
|
||||
# TODO: Remove unused target
|
||||
docs: | build deps
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim doc --run --index:on --project --out:.gh-pages waku/waku.nim waku.nims
|
||||
nim doc --run --index:on --project --out:.gh-pages waku/waku.nim waku.nims
|
||||
|
||||
coverage:
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) ./scripts/run_cov.sh -y
|
||||
./scripts/run_cov.sh -y
|
||||
|
||||
|
||||
#####################
|
||||
@ -450,7 +458,7 @@ ifeq ($(STATIC), 1)
|
||||
endif
|
||||
|
||||
libwaku: | build deps librln
|
||||
echo -e $(BUILD_MSG) "build/$@.$(LIB_EXT)" && $(ENV_SCRIPT) nim $(BUILD_COMMAND) $(NIM_PARAMS) waku.nims $@.$(LIB_EXT)
|
||||
echo -e $(BUILD_MSG) "build/$@.$(LIB_EXT)" && nim $(BUILD_COMMAND) $(NIM_PARAMS) waku.nims $@.$(LIB_EXT)
|
||||
|
||||
#####################
|
||||
## Mobile Bindings ##
|
||||
@ -481,7 +489,7 @@ endif
|
||||
build-libwaku-for-android-arch:
|
||||
$(MAKE) rebuild-nat-libs CC=$(ANDROID_TOOLCHAIN_DIR)/bin/$(ANDROID_COMPILER) && \
|
||||
./scripts/build_rln_android.sh $(CURDIR)/build $(LIBRLN_BUILDDIR) $(LIBRLN_VERSION) $(CROSS_TARGET) $(ABIDIR) && \
|
||||
CPU=$(CPU) ABIDIR=$(ABIDIR) ANDROID_ARCH=$(ANDROID_ARCH) ANDROID_COMPILER=$(ANDROID_COMPILER) ANDROID_TOOLCHAIN_DIR=$(ANDROID_TOOLCHAIN_DIR) $(ENV_SCRIPT) nim libWakuAndroid $(NIM_PARAMS) waku.nims
|
||||
CPU=$(CPU) ABIDIR=$(ABIDIR) ANDROID_ARCH=$(ANDROID_ARCH) ANDROID_COMPILER=$(ANDROID_COMPILER) ANDROID_TOOLCHAIN_DIR=$(ANDROID_TOOLCHAIN_DIR) nim libWakuAndroid $(NIM_PARAMS) waku.nims
|
||||
|
||||
libwaku-android-arm64: ANDROID_ARCH=aarch64-linux-android
|
||||
libwaku-android-arm64: CPU=arm64
|
||||
@ -541,7 +549,7 @@ endif
|
||||
|
||||
# Build for iOS architecture
|
||||
build-libwaku-for-ios-arch:
|
||||
IOS_SDK=$(IOS_SDK) IOS_ARCH=$(IOS_ARCH) IOS_SDK_PATH=$(IOS_SDK_PATH) $(ENV_SCRIPT) nim libWakuIOS $(NIM_PARAMS) waku.nims
|
||||
IOS_SDK=$(IOS_SDK) IOS_ARCH=$(IOS_ARCH) IOS_SDK_PATH=$(IOS_SDK_PATH) nim libWakuIOS $(NIM_PARAMS) waku.nims
|
||||
|
||||
# iOS device (arm64)
|
||||
libwaku-ios-device: IOS_ARCH=arm64
|
||||
@ -562,6 +570,10 @@ libwaku-ios:
|
||||
$(MAKE) libwaku-ios-device
|
||||
$(MAKE) libwaku-ios-simulator
|
||||
|
||||
# Get nimble package paths for C examples
|
||||
NAT_TRAVERSAL_PKG_PATH := $(shell nimble path nat_traversal 2>/dev/null)
|
||||
LIBBACKTRACE_PKG_PATH := $(shell nimble path libbacktrace 2>/dev/null)
|
||||
|
||||
cwaku_example: | build libwaku
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
cc -o "build/$@" \
|
||||
@ -569,10 +581,10 @@ cwaku_example: | build libwaku
|
||||
./examples/cbindings/base64.c \
|
||||
-lwaku -Lbuild/ \
|
||||
-pthread -ldl -lm \
|
||||
-lminiupnpc -Lvendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/build/ \
|
||||
-lnatpmp -Lvendor/nim-nat-traversal/vendor/libnatpmp-upstream/ \
|
||||
vendor/nim-libbacktrace/libbacktrace_wrapper.o \
|
||||
vendor/nim-libbacktrace/install/usr/lib/libbacktrace.a
|
||||
-lminiupnpc -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/miniupnp/miniupnpc/build/ \
|
||||
-lnatpmp -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/libnatpmp-upstream/ \
|
||||
$(LIBBACKTRACE_PKG_PATH)/libbacktrace_wrapper.o \
|
||||
$(LIBBACKTRACE_PKG_PATH)/install/usr/lib/libbacktrace.a
|
||||
|
||||
cppwaku_example: | build libwaku
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
@ -581,17 +593,15 @@ cppwaku_example: | build libwaku
|
||||
./examples/cpp/base64.cpp \
|
||||
-lwaku -Lbuild/ \
|
||||
-pthread -ldl -lm \
|
||||
-lminiupnpc -Lvendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/build/ \
|
||||
-lnatpmp -Lvendor/nim-nat-traversal/vendor/libnatpmp-upstream/ \
|
||||
vendor/nim-libbacktrace/libbacktrace_wrapper.o \
|
||||
vendor/nim-libbacktrace/install/usr/lib/libbacktrace.a
|
||||
-lminiupnpc -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/miniupnp/miniupnpc/build/ \
|
||||
-lnatpmp -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/libnatpmp-upstream/ \
|
||||
$(LIBBACKTRACE_PKG_PATH)/libbacktrace_wrapper.o \
|
||||
$(LIBBACKTRACE_PKG_PATH)/install/usr/lib/libbacktrace.a
|
||||
|
||||
nodejswaku: | build deps
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
node-gyp build --directory=examples/nodejs/
|
||||
|
||||
endif # "variables.mk" was not included
|
||||
|
||||
###################
|
||||
# Release Targets #
|
||||
###################
|
||||
|
||||
24
README.md
24
README.md
@ -21,6 +21,12 @@ These instructions are generic. For more detailed instructions, see the source c
|
||||
|
||||
The standard developer tools, including a C compiler, GNU Make, Bash, and Git. More information on these installations can be found [here](https://docs.waku.org/guides/nwaku/build-source#install-dependencies).
|
||||
|
||||
**Nimble 0.99.0** or later is required for dependency management. Verify your version with:
|
||||
```bash
|
||||
nimble -v
|
||||
# Expected output: 0.99.0 or higher
|
||||
```
|
||||
|
||||
> In some distributions (Fedora linux for example), you may need to install `which` utility separately. Nimbus build system is relying on it.
|
||||
|
||||
You'll also need an installation of Rust and its toolchain (specifically `rustc` and `cargo`).
|
||||
@ -100,17 +106,17 @@ If `wakunode2.exe` isn't generated:
|
||||
|
||||
### Developing
|
||||
|
||||
#### Nim Runtime
|
||||
This repository is bundled with a Nim runtime that includes the necessary dependencies for the project.
|
||||
|
||||
Before you can utilize the runtime you'll need to build the project, as detailed in a previous section.
|
||||
This will generate a `vendor` directory containing various dependencies, including the `nimbus-build-system` which has the bundled nim runtime.
|
||||
|
||||
After successfully building the project, you may bring the bundled runtime into scope by running:
|
||||
#### Dependencies
|
||||
This project uses **Nimble** for dependency management. All dependencies are automatically installed when you run:
|
||||
```bash
|
||||
source env.sh
|
||||
make deps
|
||||
# or directly:
|
||||
nimble install -y
|
||||
```
|
||||
If everything went well, you should see your prompt suffixed with `[Nimbus env]$`. Now you can run `nim` commands as usual.
|
||||
|
||||
The only vendor submodules kept are:
|
||||
- `vendor/zerokit` - RLN (Rate Limiting Nullifier) library
|
||||
- `vendor/waku-rlnv2-contract` - Smart contract for RLN tests
|
||||
|
||||
### Test Suite
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import
|
||||
chronos/timer as ctime,
|
||||
confutils,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/nameresolving/dnsresolver,
|
||||
libp2p/protocols/ping,
|
||||
|
||||
@ -9,11 +9,7 @@ if defined(windows):
|
||||
switch("passL", "rln.lib")
|
||||
switch("define", "postgres=false")
|
||||
|
||||
# Automatically add all vendor subdirectories
|
||||
for dir in walkDir("./vendor"):
|
||||
if dir.kind == pcDir:
|
||||
switch("path", dir.path)
|
||||
switch("path", dir.path / "src")
|
||||
# Dependencies are now managed via nimble, no vendor paths needed
|
||||
|
||||
# disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries
|
||||
switch("passL", "-Wl,--no-insert-timestamp")
|
||||
@ -117,7 +113,6 @@ if defined(android):
|
||||
var clang = getEnv("ANDROID_COMPILER")
|
||||
var ndk_home = getEnv("ANDROID_TOOLCHAIN_DIR")
|
||||
var sysroot = ndk_home & "/sysroot"
|
||||
var cincludes = sysroot & "/usr/include/" & getEnv("ANDROID_ARCH")
|
||||
|
||||
switch("clang.path", ndk_home & "/bin")
|
||||
switch("clang.exe", clang)
|
||||
|
||||
@ -6,7 +6,7 @@ import
|
||||
confutils,
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
waku/[
|
||||
|
||||
@ -11,7 +11,7 @@ import
|
||||
libp2p/protocols/mix/curve25519,
|
||||
libp2p/multiaddress,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
metrics,
|
||||
metrics/chronos_httpserver
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import
|
||||
confutils,
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
waku/[
|
||||
|
||||
@ -6,7 +6,7 @@ import
|
||||
confutils,
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
waku/[
|
||||
|
||||
@ -6,7 +6,7 @@ import
|
||||
confutils,
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
waku/[
|
||||
|
||||
@ -3,7 +3,7 @@ import
|
||||
chronicles,
|
||||
chronos,
|
||||
results,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
strutils,
|
||||
libp2p/peerid,
|
||||
metrics,
|
||||
|
||||
@ -4,7 +4,7 @@ import
|
||||
libp2p/[multiaddress, peerid],
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
nimcrypto/utils
|
||||
|
||||
import waku/waku_core/peers, waku/node/peer_manager/peer_store/waku_peer_storage
|
||||
|
||||
@ -9,7 +9,7 @@ import
|
||||
libp2p/peerId,
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
waku/[
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{.used.}
|
||||
|
||||
import std/options, testutils/unittests, eth/p2p/discoveryv5/enr, libp2p/crypto/crypto
|
||||
import std/options, testutils/unittests, eth/enr/enr, libp2p/crypto/crypto
|
||||
import
|
||||
waku/[
|
||||
common/databases/db_sqlite,
|
||||
|
||||
@ -11,7 +11,7 @@ import
|
||||
libp2p/multistream,
|
||||
libp2p/muxers/muxer,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
import
|
||||
waku/
|
||||
[
|
||||
|
||||
@ -14,7 +14,7 @@ import
|
||||
libp2p/protocols/pubsub/pubsub,
|
||||
libp2p/protocols/pubsub/gossipsub,
|
||||
libp2p/nameresolving/mockresolver,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
eth/net/utils
|
||||
import
|
||||
waku/[waku_core, waku_node, node/peer_manager], ./testlib/wakucore, ./testlib/wakunode
|
||||
|
||||
@ -8,7 +8,7 @@ import
|
||||
testutils/unittests,
|
||||
libp2p/crypto/crypto as libp2p_keys,
|
||||
eth/keys as eth_keys,
|
||||
eth/p2p/discoveryv5/enr as ethEnr,
|
||||
eth/enr/enr as ethEnr,
|
||||
libp2p/crypto/secp,
|
||||
libp2p/protocols/rendezvous
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import
|
||||
libp2p/peerId,
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
waku/[
|
||||
|
||||
@ -8,7 +8,7 @@ import
|
||||
libp2p/peerId,
|
||||
libp2p/crypto/crypto,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
waku/[
|
||||
|
||||
1
vendor/db_connector
vendored
1
vendor/db_connector
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 74aef399e5c232f95c9fc5c987cebac846f09d62
|
||||
1
vendor/dnsclient.nim
vendored
1
vendor/dnsclient.nim
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 23214235d4784d24aceed99bbfe153379ea557c8
|
||||
1
vendor/nim-bearssl
vendored
1
vendor/nim-bearssl
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 11e798b62b8e6beabe958e048e9e24c7e0f9ee63
|
||||
1
vendor/nim-chronicles
vendored
1
vendor/nim-chronicles
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 54f5b726025e8c7385e3a6529d3aa27454c6e6ff
|
||||
1
vendor/nim-chronos
vendored
1
vendor/nim-chronos
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 0646c444fce7c7ed08ef6f2c9a7abfd172ffe655
|
||||
1
vendor/nim-confutils
vendored
1
vendor/nim-confutils
vendored
@ -1 +0,0 @@
|
||||
Subproject commit e214b3992a31acece6a9aada7d0a1ad37c928f3b
|
||||
1
vendor/nim-dnsdisc
vendored
1
vendor/nim-dnsdisc
vendored
@ -1 +0,0 @@
|
||||
Subproject commit b71d029f4da4ec56974d54c04518bada00e1b623
|
||||
1
vendor/nim-eth
vendored
1
vendor/nim-eth
vendored
@ -1 +0,0 @@
|
||||
Subproject commit d9135e6c3c5d6d819afdfb566aa8d958756b73a8
|
||||
1
vendor/nim-faststreams
vendored
1
vendor/nim-faststreams
vendored
@ -1 +0,0 @@
|
||||
Subproject commit c3ac3f639ed1d62f59d3077d376a29c63ac9750c
|
||||
1
vendor/nim-http-utils
vendored
1
vendor/nim-http-utils
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 79cbab1460f4c0cdde2084589d017c43a3d7b4f1
|
||||
1
vendor/nim-json-rpc
vendored
1
vendor/nim-json-rpc
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 9665c265035f49f5ff94bbffdeadde68e19d6221
|
||||
1
vendor/nim-json-serialization
vendored
1
vendor/nim-json-serialization
vendored
@ -1 +0,0 @@
|
||||
Subproject commit b65fd6a7e64c864dabe40e7dfd6c7d07db0014ac
|
||||
1
vendor/nim-libbacktrace
vendored
1
vendor/nim-libbacktrace
vendored
@ -1 +0,0 @@
|
||||
Subproject commit d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb
|
||||
1
vendor/nim-libp2p
vendored
1
vendor/nim-libp2p
vendored
@ -1 +0,0 @@
|
||||
Subproject commit e82080f7b1aa61c6d35fa5311b873f41eff4bb52
|
||||
1
vendor/nim-metrics
vendored
1
vendor/nim-metrics
vendored
@ -1 +0,0 @@
|
||||
Subproject commit ecf64c6078d1276d3b7d9b3d931fbdb70004db11
|
||||
1
vendor/nim-minilru
vendored
1
vendor/nim-minilru
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 0c4b2bce959591f0a862e9b541ba43c6d0cf3476
|
||||
1
vendor/nim-nat-traversal
vendored
1
vendor/nim-nat-traversal
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 860e18c37667b5dd005b94c63264560c35d88004
|
||||
1
vendor/nim-presto
vendored
1
vendor/nim-presto
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 92b1c7ff141e6920e1f8a98a14c35c1fa098e3be
|
||||
1
vendor/nim-regex
vendored
1
vendor/nim-regex
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 4593305ed1e49731fc75af1dc572dd2559aad19c
|
||||
1
vendor/nim-results
vendored
1
vendor/nim-results
vendored
@ -1 +0,0 @@
|
||||
Subproject commit df8113dda4c2d74d460a8fa98252b0b771bf1f27
|
||||
1
vendor/nim-secp256k1
vendored
1
vendor/nim-secp256k1
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 9dd3df62124aae79d564da636bb22627c53c7676
|
||||
1
vendor/nim-serialization
vendored
1
vendor/nim-serialization
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 6f525d5447d97256750ca7856faead03e562ed20
|
||||
1
vendor/nim-sqlite3-abi
vendored
1
vendor/nim-sqlite3-abi
vendored
@ -1 +0,0 @@
|
||||
Subproject commit bdf01cf4236fb40788f0733466cdf6708783cbac
|
||||
1
vendor/nim-stew
vendored
1
vendor/nim-stew
vendored
@ -1 +0,0 @@
|
||||
Subproject commit e5740014961438610d336cd81706582dbf2c96f0
|
||||
1
vendor/nim-stint
vendored
1
vendor/nim-stint
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 470b7892561b5179ab20bd389a69217d6213fe58
|
||||
1
vendor/nim-taskpools
vendored
1
vendor/nim-taskpools
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 9e8ccc754631ac55ac2fd495e167e74e86293edb
|
||||
1
vendor/nim-testutils
vendored
1
vendor/nim-testutils
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 94d68e796c045d5b37cabc6be32d7bfa168f8857
|
||||
1
vendor/nim-toml-serialization
vendored
1
vendor/nim-toml-serialization
vendored
@ -1 +0,0 @@
|
||||
Subproject commit fea85b27f0badcf617033ca1bc05444b5fd8aa7a
|
||||
1
vendor/nim-unicodedb
vendored
1
vendor/nim-unicodedb
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 66f2458710dc641dd4640368f9483c8a0ec70561
|
||||
1
vendor/nim-unittest2
vendored
1
vendor/nim-unittest2
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 8b51e99b4a57fcfb31689230e75595f024543024
|
||||
1
vendor/nim-web3
vendored
1
vendor/nim-web3
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 81ee8ce479d86acb73be7c4f365328e238d9b4a3
|
||||
1
vendor/nim-websock
vendored
1
vendor/nim-websock
vendored
@ -1 +0,0 @@
|
||||
Subproject commit ebe308a79a7b440a11dfbe74f352be86a3883508
|
||||
1
vendor/nim-zlib
vendored
1
vendor/nim-zlib
vendored
@ -1 +0,0 @@
|
||||
Subproject commit daa8723fd32299d4ca621c837430c29a5a11e19a
|
||||
1
vendor/nimbus-build-system
vendored
1
vendor/nimbus-build-system
vendored
@ -1 +0,0 @@
|
||||
Subproject commit e6c2c9da39c2d368d9cf420ac22692e99715d22c
|
||||
1
vendor/nimcrypto
vendored
1
vendor/nimcrypto
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 721fb99ee099b632eb86dfad1f0d96ee87583774
|
||||
1
vendor/nph
vendored
1
vendor/nph
vendored
@ -1 +0,0 @@
|
||||
Subproject commit c6e03162dc2820d3088660f644818d7040e95791
|
||||
126
waku.nimble
126
waku.nimble
@ -12,28 +12,51 @@ license = "MIT or Apache License 2.0"
|
||||
|
||||
### Dependencies
|
||||
requires "nim >= 2.2.4",
|
||||
"chronicles",
|
||||
"confutils",
|
||||
"chronos",
|
||||
"dnsdisc",
|
||||
"eth",
|
||||
"json_rpc",
|
||||
"libbacktrace",
|
||||
"nimcrypto",
|
||||
"serialization",
|
||||
"stew",
|
||||
"stint",
|
||||
"metrics",
|
||||
"libp2p >= 1.14.3",
|
||||
"web3",
|
||||
"presto",
|
||||
"regex",
|
||||
"results",
|
||||
"db_connector",
|
||||
"minilru",
|
||||
"ffi"
|
||||
"https://github.com/status-im/nim-chronicles.git#54f5b726025e8c7385e3a6529d3aa27454c6e6ff",
|
||||
"https://github.com/status-im/nim-confutils.git#e214b3992a31acece6a9aada7d0a1ad37c928f3b",
|
||||
"https://github.com/status-im/nim-chronos.git#0646c444fce7c7ed08ef6f2c9a7abfd172ffe655",
|
||||
"https://github.com/status-im/nim-dnsdisc.git#b71d029f4da4ec56974d54c04518bada00e1b623",
|
||||
"https://github.com/status-im/nim-eth.git#d9135e6c3c5d6d819afdfb566aa8d958756b73a8",
|
||||
"https://github.com/status-im/nim-json-rpc.git#9665c265035f49f5ff94bbffdeadde68e19d6221",
|
||||
"https://github.com/status-im/nim-libbacktrace.git#d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb",
|
||||
"https://github.com/cheatfate/nimcrypto.git#721fb99ee099b632eb86dfad1f0d96ee87583774",
|
||||
"https://github.com/status-im/nim-serialization.git#6f525d5447d97256750ca7856faead03e562ed20",
|
||||
"https://github.com/status-im/nim-toml-serialization.git#fea85b27f0badcf617033ca1bc05444b5fd8aa7a",
|
||||
"https://github.com/status-im/nim-stew.git#e5740014961438610d336cd81706582dbf2c96f0",
|
||||
"https://github.com/status-im/nim-stint.git#470b7892561b5179ab20bd389a69217d6213fe58",
|
||||
"https://github.com/status-im/nim-metrics.git#ecf64c6078d1276d3b7d9b3d931fbdb70004db11",
|
||||
"https://github.com/vacp2p/nim-libp2p.git#e82080f7b1aa61c6d35fa5311b873f41eff4bb52",
|
||||
"https://github.com/status-im/nim-web3.git#81ee8ce479d86acb73be7c4f365328e238d9b4a3",
|
||||
"https://github.com/status-im/nim-presto.git#92b1c7ff141e6920e1f8a98a14c35c1fa098e3be",
|
||||
"https://github.com/nitely/nim-regex.git#4593305ed1e49731fc75af1dc572dd2559aad19c",
|
||||
"https://github.com/arnetheduck/nim-results.git#df8113dda4c2d74d460a8fa98252b0b771bf1f27",
|
||||
"https://github.com/nim-lang/db_connector.git#74aef399e5c232f95c9fc5c987cebac846f09d62",
|
||||
"https://github.com/status-im/nim-minilru.git#0c4b2bce959591f0a862e9b541ba43c6d0cf3476",
|
||||
"https://github.com/status-im/nim-unittest2.git#8b51e99b4a57fcfb31689230e75595f024543024",
|
||||
"https://github.com/status-im/nim-testutils.git#94d68e796c045d5b37cabc6be32d7bfa168f8857",
|
||||
"https://github.com/status-im/nim-bearssl.git#11e798b62b8e6beabe958e048e9e24c7e0f9ee63",
|
||||
"https://github.com/status-im/nim-secp256k1.git#9dd3df62124aae79d564da636bb22627c53c7676",
|
||||
"https://github.com/status-im/nim-nat-traversal.git#860e18c37667b5dd005b94c63264560c35d88004",
|
||||
"https://github.com/status-im/nim-faststreams.git#c3ac3f639ed1d62f59d3077d376a29c63ac9750c",
|
||||
"https://github.com/status-im/nim-http-utils.git#79cbab1460f4c0cdde2084589d017c43a3d7b4f1",
|
||||
"https://github.com/status-im/nim-json-serialization.git#b65fd6a7e64c864dabe40e7dfd6c7d07db0014ac",
|
||||
"https://github.com/status-im/nim-websock.git#ebe308a79a7b440a11dfbe74f352be86a3883508",
|
||||
"https://github.com/status-im/nim-zlib.git#daa8723fd32299d4ca621c837430c29a5a11e19a",
|
||||
"https://github.com/arnetheduck/nim-sqlite3-abi.git#bdf01cf4236fb40788f0733466cdf6708783cbac",
|
||||
"https://github.com/status-im/nim-taskpools.git#9e8ccc754631ac55ac2fd495e167e74e86293edb",
|
||||
"https://github.com/nitely/nim-unicodedb.git#66f2458710dc641dd4640368f9483c8a0ec70561",
|
||||
"https://github.com/ba0f3/dnsclient.nim.git#23214235d4784d24aceed99bbfe153379ea557c8"
|
||||
|
||||
### Helper functions
|
||||
|
||||
# Get nimble package paths for compilation
|
||||
proc getNimblePkgDir(): string =
|
||||
# Get nimble's package directory
|
||||
when defined(windows):
|
||||
getEnv("USERPROFILE") / ".nimble" / "pkgs2"
|
||||
else:
|
||||
getEnv("HOME") / ".nimble" / "pkgs2"
|
||||
|
||||
proc buildModule(filePath, params = "", lang = "c"): bool =
|
||||
if not dirExists "build":
|
||||
mkDir "build"
|
||||
@ -55,12 +78,10 @@ proc buildModule(filePath, params = "", lang = "c"): bool =
|
||||
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 & " --mm:refc " & extra_params & " " &
|
||||
srcDir & name & ".nim"
|
||||
# Use nimble c command which automatically handles package paths
|
||||
# Add vendor/nim-ffi explicitly since it's a submodule
|
||||
let nimbleCmd = "nimble c --out:build/" & name & " --mm:refc --path:vendor/nim-ffi " & params & " " & srcDir & name & ".nim"
|
||||
exec nimbleCmd
|
||||
|
||||
proc buildLibrary(lib_name: string, srcDir = "./", params = "", `type` = "static") =
|
||||
if not dirExists "build":
|
||||
@ -217,6 +238,23 @@ task libWakuAndroid, "Build the mobile bindings for Android":
|
||||
### Mobile iOS
|
||||
import std/sequtils
|
||||
|
||||
# Helper to get nimble package path
|
||||
proc getNimblePkgPath(pkgName: string): string =
|
||||
let (output, exitCode) = gorgeEx("nimble path " & pkgName)
|
||||
if exitCode != 0:
|
||||
quit "Error: Could not find nimble package: " & pkgName
|
||||
result = output.strip()
|
||||
|
||||
# Helper to get Nim lib path
|
||||
proc getNimLibPath(): string =
|
||||
let (output, exitCode) = gorgeEx("nim --verbosity:0 --hints:off dump --dump.format:json 2>/dev/null | grep -o '\"libpath\":\"[^\"]*\"' | cut -d'\"' -f4")
|
||||
if exitCode != 0 or output.strip().len == 0:
|
||||
# Fallback: try to find it relative to nim binary
|
||||
let (nimPath, _) = gorgeEx("which nim")
|
||||
result = nimPath.strip().parentDir().parentDir() / "lib"
|
||||
else:
|
||||
result = output.strip()
|
||||
|
||||
proc buildMobileIOS(srcDir = ".", params = "") =
|
||||
echo "Building iOS libwaku library"
|
||||
|
||||
@ -265,12 +303,18 @@ proc buildMobileIOS(srcDir = ".", params = "") =
|
||||
" " & extra_params &
|
||||
" " & srcDir & "/libwaku.nim"
|
||||
|
||||
# Compile vendor C libraries for iOS
|
||||
# Get nimble package paths
|
||||
let bearSslPkgDir = getNimblePkgPath("bearssl")
|
||||
let secp256k1PkgDir = getNimblePkgPath("secp256k1")
|
||||
let natTraversalPkgDir = getNimblePkgPath("nat_traversal")
|
||||
let nimLibDir = getNimLibPath()
|
||||
|
||||
# Compile C libraries for iOS
|
||||
|
||||
# --- BearSSL ---
|
||||
echo "Compiling BearSSL for iOS..."
|
||||
let bearSslSrcDir = "./vendor/nim-bearssl/bearssl/csources/src"
|
||||
let bearSslIncDir = "./vendor/nim-bearssl/bearssl/csources/inc"
|
||||
let bearSslSrcDir = bearSslPkgDir / "bearssl/csources/src"
|
||||
let bearSslIncDir = bearSslPkgDir / "bearssl/csources/inc"
|
||||
for path in walkDirRec(bearSslSrcDir):
|
||||
if path.endsWith(".c"):
|
||||
let relPath = path.replace(bearSslSrcDir & "/", "").replace("/", "_")
|
||||
@ -281,7 +325,7 @@ proc buildMobileIOS(srcDir = ".", params = "") =
|
||||
|
||||
# --- secp256k1 ---
|
||||
echo "Compiling secp256k1 for iOS..."
|
||||
let secp256k1Dir = "./vendor/nim-secp256k1/vendor/secp256k1"
|
||||
let secp256k1Dir = secp256k1PkgDir / "vendor/secp256k1"
|
||||
let secp256k1Flags = " -I" & secp256k1Dir & "/include" &
|
||||
" -I" & secp256k1Dir & "/src" &
|
||||
" -I" & secp256k1Dir &
|
||||
@ -306,9 +350,9 @@ proc buildMobileIOS(srcDir = ".", params = "") =
|
||||
|
||||
# --- miniupnpc ---
|
||||
echo "Compiling miniupnpc for iOS..."
|
||||
let miniupnpcSrcDir = "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/src"
|
||||
let miniupnpcIncDir = "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/include"
|
||||
let miniupnpcBuildDir = "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/build"
|
||||
let miniupnpcSrcDir = natTraversalPkgDir / "vendor/miniupnp/miniupnpc/src"
|
||||
let miniupnpcIncDir = natTraversalPkgDir / "vendor/miniupnp/miniupnpc/include"
|
||||
let miniupnpcBuildDir = natTraversalPkgDir / "vendor/miniupnp/miniupnpc/build"
|
||||
let miniupnpcFiles = @[
|
||||
"addr_is_reserved.c", "connecthostport.c", "igd_desc_parse.c",
|
||||
"minisoap.c", "minissdpc.c", "miniupnpc.c", "miniwget.c",
|
||||
@ -329,7 +373,7 @@ proc buildMobileIOS(srcDir = ".", params = "") =
|
||||
|
||||
# --- libnatpmp ---
|
||||
echo "Compiling libnatpmp for iOS..."
|
||||
let natpmpSrcDir = "./vendor/nim-nat-traversal/vendor/libnatpmp-upstream"
|
||||
let natpmpSrcDir = natTraversalPkgDir / "vendor/libnatpmp-upstream"
|
||||
# Only compile natpmp.c - getgateway.c uses net/route.h which is not available on iOS
|
||||
let natpmpObj = vendorObjDir / "natpmp_natpmp.o"
|
||||
if not fileExists(natpmpObj):
|
||||
@ -363,13 +407,13 @@ proc buildMobileIOS(srcDir = ".", params = "") =
|
||||
let oFile = objDir / baseName
|
||||
exec clangBase &
|
||||
" -DENABLE_STRNATPMPERR" &
|
||||
" -I./vendor/nimbus-build-system/vendor/Nim/lib/" &
|
||||
" -I./vendor/nim-bearssl/bearssl/csources/inc/" &
|
||||
" -I./vendor/nim-bearssl/bearssl/csources/tools/" &
|
||||
" -I./vendor/nim-bearssl/bearssl/abi/" &
|
||||
" -I./vendor/nim-secp256k1/vendor/secp256k1/include/" &
|
||||
" -I./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/include/" &
|
||||
" -I./vendor/nim-nat-traversal/vendor/libnatpmp-upstream/" &
|
||||
" -I" & nimLibDir & "/" &
|
||||
" -I" & bearSslPkgDir & "/bearssl/csources/inc/" &
|
||||
" -I" & bearSslPkgDir & "/bearssl/csources/tools/" &
|
||||
" -I" & bearSslPkgDir & "/bearssl/abi/" &
|
||||
" -I" & secp256k1PkgDir & "/vendor/secp256k1/include/" &
|
||||
" -I" & natTraversalPkgDir & "/vendor/miniupnp/miniupnpc/include/" &
|
||||
" -I" & natTraversalPkgDir & "/vendor/libnatpmp-upstream/" &
|
||||
" -I" & nimcacheDir &
|
||||
" -c " & cFile &
|
||||
" -o " & oFile
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import std/strutils
|
||||
|
||||
import results, eth/p2p/discoveryv5/enr
|
||||
import results, eth/enr/enr
|
||||
|
||||
import waku/waku_core/peers
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
## An extension wrapper around nim-eth's ENR module
|
||||
|
||||
import eth/p2p/discoveryv5/enr
|
||||
import eth/enr/enr
|
||||
import ./enr/builder, ./enr/typed_record
|
||||
|
||||
export
|
||||
|
||||
@ -4,7 +4,7 @@ import
|
||||
std/[options, net],
|
||||
results,
|
||||
eth/keys as eth_keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto as libp2p_crypto
|
||||
|
||||
import ./typed_record
|
||||
@ -49,7 +49,7 @@ proc addFieldPair*[V](builder: var EnrBuilder, key: string, value: V) =
|
||||
|
||||
proc build*(builder: EnrBuilder): EnrResult[enr.Record] =
|
||||
# Note that nim-eth's `Record.init` does not deduplicate the field pairs.
|
||||
# See: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/p2p/discoveryv5/enr.nim#L143-L144
|
||||
# See: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/enr/enr.nim#L143-L144
|
||||
enr.Record.init(
|
||||
seqNum = builder.seqNumber,
|
||||
pk = builder.privateKey,
|
||||
@ -69,7 +69,7 @@ proc addAddressAndPorts(
|
||||
builder.udpPort = udpPort.toOpt()
|
||||
|
||||
proc addPorts(builder: var EnrBuilder, tcp, udp: Option[Port]) =
|
||||
# Based on: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/p2p/discoveryv5/enr.nim#L166
|
||||
# Based on: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/enr/enr.nim#L166
|
||||
builder.tcpPort = tcp.toOpt()
|
||||
builder.udpPort = udp.toOpt()
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import std/options, results, eth/keys as eth_keys, libp2p/crypto/crypto as libp2p_crypto
|
||||
|
||||
import eth/p2p/discoveryv5/enr except TypedRecord, toTypedRecord
|
||||
import eth/enr/enr except TypedRecord, toTypedRecord
|
||||
|
||||
## Since enr changed to result.Opt[T] from Option[T] for intercompatibility introduce a conversion between
|
||||
func toOpt*[T](o: Option[T]): Opt[T] =
|
||||
|
||||
@ -11,7 +11,7 @@ import
|
||||
chronos,
|
||||
metrics,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/crypto/secp,
|
||||
libp2p/multiaddress,
|
||||
|
||||
@ -15,7 +15,7 @@ import
|
||||
libp2p/peerid,
|
||||
libp2p/discovery/rendezvousinterface,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
presto,
|
||||
metrics,
|
||||
metrics/chronos_httpserver
|
||||
|
||||
@ -9,7 +9,7 @@ import
|
||||
stew/byteutils,
|
||||
eth/keys,
|
||||
nimcrypto,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/protocols/ping,
|
||||
libp2p/protocols/pubsub/gossipsub,
|
||||
|
||||
@ -8,7 +8,7 @@ import
|
||||
results,
|
||||
stew/byteutils,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/protocols/ping,
|
||||
libp2p/protocols/pubsub/gossipsub,
|
||||
|
||||
@ -7,7 +7,7 @@ import
|
||||
metrics,
|
||||
results,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/protocols/ping,
|
||||
libp2p/protocols/pubsub/gossipsub,
|
||||
|
||||
@ -8,7 +8,7 @@ import
|
||||
results,
|
||||
stew/byteutils,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/protocols/ping,
|
||||
libp2p/protocols/pubsub/gossipsub,
|
||||
|
||||
@ -7,7 +7,7 @@ import
|
||||
metrics,
|
||||
results,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/protocols/ping,
|
||||
libp2p/protocols/pubsub/gossipsub,
|
||||
|
||||
@ -4,7 +4,7 @@ import
|
||||
std/[sets, options],
|
||||
results,
|
||||
sqlite3_abi,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/protobuf/minprotobuf
|
||||
import
|
||||
../../../common/databases/db_sqlite,
|
||||
|
||||
@ -4,7 +4,7 @@ import
|
||||
std/[tables, sequtils, sets, options, strutils],
|
||||
chronos,
|
||||
chronicles,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/builders,
|
||||
libp2p/peerstore,
|
||||
libp2p/crypto/curve25519
|
||||
|
||||
@ -10,7 +10,7 @@ import
|
||||
nimcrypto,
|
||||
bearssl/rand,
|
||||
stew/byteutils,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/crypto/curve25519,
|
||||
libp2p/[multiaddress, multicodec],
|
||||
|
||||
@ -6,7 +6,7 @@ import
|
||||
chronos,
|
||||
chronicles,
|
||||
eth/keys,
|
||||
eth/p2p/discoveryv5/enr,
|
||||
eth/enr/enr,
|
||||
eth/net/utils,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/crypto/curve25519,
|
||||
|
||||
@ -9,7 +9,7 @@ import
|
||||
libp2p/protocols/protocol,
|
||||
libp2p/stream/connection,
|
||||
libp2p/crypto/crypto,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
import ../common/nimchronos, ../waku_core, ./rpc, ../common/callbacks
|
||||
|
||||
from ../waku_core/codecs import WakuMetadataCodec
|
||||
|
||||
@ -6,7 +6,7 @@ import
|
||||
metrics,
|
||||
libp2p/protocols/protocol,
|
||||
libp2p/crypto/crypto,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
import
|
||||
../common/nimchronos,
|
||||
../node/peer_manager,
|
||||
|
||||
@ -9,7 +9,7 @@ import
|
||||
libp2p/protocols/protocol,
|
||||
libp2p/stream/connection,
|
||||
libp2p/crypto/crypto,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
|
||||
import
|
||||
../common/databases/db_sqlite,
|
||||
|
||||
@ -11,7 +11,7 @@ import
|
||||
libp2p/protocols/protocol,
|
||||
libp2p/stream/connection,
|
||||
libp2p/crypto/crypto,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
import
|
||||
../common/nimchronos,
|
||||
../common/protobuf,
|
||||
|
||||
@ -10,7 +10,7 @@ import
|
||||
libp2p/protocols/protocol,
|
||||
libp2p/stream/connection,
|
||||
libp2p/crypto/crypto,
|
||||
eth/p2p/discoveryv5/enr
|
||||
eth/enr/enr
|
||||
import
|
||||
../common/nimchronos,
|
||||
../common/protobuf,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user