From 7125274b844ed22f7ae6fe03d3795c8f66f280a4 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Fri, 30 Jan 2026 15:04:34 +0530 Subject: [PATCH] initial commit for nimble --- .gitmodules | 187 ----------------- Makefile | 168 +++++++-------- config.nims | 6 - nimble.lock | 377 ++++++++++++++++++++++++++++++++++ scripts/build_native_deps.sh | 71 +++++++ vendor/db_connector | 1 - vendor/dnsclient.nim | 1 - vendor/nim-bearssl | 1 - vendor/nim-chronicles | 1 - vendor/nim-chronos | 1 - vendor/nim-confutils | 1 - vendor/nim-dnsdisc | 1 - vendor/nim-eth | 1 - vendor/nim-faststreams | 1 - vendor/nim-ffi | 1 - vendor/nim-http-utils | 1 - vendor/nim-json-rpc | 1 - vendor/nim-json-serialization | 1 - vendor/nim-jwt | 1 - vendor/nim-libbacktrace | 1 - vendor/nim-libp2p | 1 - vendor/nim-lsquic | 1 - vendor/nim-metrics | 1 - vendor/nim-minilru | 1 - vendor/nim-nat-traversal | 1 - vendor/nim-presto | 1 - vendor/nim-regex | 1 - vendor/nim-results | 1 - vendor/nim-secp256k1 | 1 - vendor/nim-serialization | 1 - vendor/nim-sqlite3-abi | 1 - vendor/nim-stew | 1 - vendor/nim-stint | 1 - vendor/nim-taskpools | 1 - vendor/nim-testutils | 1 - vendor/nim-toml-serialization | 1 - vendor/nim-unicodedb | 1 - vendor/nim-unittest2 | 1 - vendor/nim-web3 | 1 - vendor/nim-websock | 1 - vendor/nim-zlib | 1 - vendor/nimbus-build-system | 1 - vendor/nimcrypto | 1 - vendor/nph | 1 - waku.nimble | 70 +++++-- 45 files changed, 589 insertions(+), 329 deletions(-) create mode 100644 nimble.lock create mode 100755 scripts/build_native_deps.sh delete mode 160000 vendor/db_connector delete mode 160000 vendor/dnsclient.nim delete mode 160000 vendor/nim-bearssl delete mode 160000 vendor/nim-chronicles delete mode 160000 vendor/nim-chronos delete mode 160000 vendor/nim-confutils delete mode 160000 vendor/nim-dnsdisc delete mode 160000 vendor/nim-eth delete mode 160000 vendor/nim-faststreams delete mode 160000 vendor/nim-ffi delete mode 160000 vendor/nim-http-utils delete mode 160000 vendor/nim-json-rpc delete mode 160000 vendor/nim-json-serialization delete mode 160000 vendor/nim-jwt delete mode 160000 vendor/nim-libbacktrace delete mode 160000 vendor/nim-libp2p delete mode 160000 vendor/nim-lsquic delete mode 160000 vendor/nim-metrics delete mode 160000 vendor/nim-minilru delete mode 160000 vendor/nim-nat-traversal delete mode 160000 vendor/nim-presto delete mode 160000 vendor/nim-regex delete mode 160000 vendor/nim-results delete mode 160000 vendor/nim-secp256k1 delete mode 160000 vendor/nim-serialization delete mode 160000 vendor/nim-sqlite3-abi delete mode 160000 vendor/nim-stew delete mode 160000 vendor/nim-stint delete mode 160000 vendor/nim-taskpools delete mode 160000 vendor/nim-testutils delete mode 160000 vendor/nim-toml-serialization delete mode 160000 vendor/nim-unicodedb delete mode 160000 vendor/nim-unittest2 delete mode 160000 vendor/nim-web3 delete mode 160000 vendor/nim-websock delete mode 160000 vendor/nim-zlib delete mode 160000 vendor/nimbus-build-system delete mode 160000 vendor/nimcrypto delete mode 160000 vendor/nph diff --git a/.gitmodules b/.gitmodules index 6a63491e3..ac07235b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,197 +1,10 @@ -[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 [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 ignore = untracked branch = master -[submodule "vendor/nim-lsquic"] - path = vendor/nim-lsquic - url = https://github.com/vacp2p/nim-lsquic -[submodule "vendor/nim-jwt"] - path = vendor/nim-jwt - url = https://github.com/vacp2p/nim-jwt.git -[submodule "vendor/nim-ffi"] - path = vendor/nim-ffi - url = https://github.com/logos-messaging/nim-ffi/ - ignore = untracked - branch = master diff --git a/Makefile b/Makefile index 13882253e..12f7dfcd6 100644 --- a/Makefile +++ b/Makefile @@ -4,28 +4,10 @@ # - 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 + 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 - - -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? - -else # "variables.mk" was included. Business as usual until the end of this file. +BUILD_MSG := "\\x1B[92mBuilding:\\x1B[39m" # Determine the OS detected_OS := $(shell uname -s) @@ -38,8 +20,13 @@ ifeq ($(detected_OS),Windows) 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" + + # Get nat-traversal path from nimble + NAT_TRAVERSAL_PATH := $(shell nimble path nat_traversal 2>/dev/null) + ifneq ($(NAT_TRAVERSAL_PATH),) + NIM_PARAMS += --passL:"-L$(NAT_TRAVERSAL_PATH)/vendor/miniupnp/miniupnpc" + NIM_PARAMS += --passL:"-L$(NAT_TRAVERSAL_PATH)/vendor/libnatpmp-upstream" + endif LIBS = -lws2_32 -lbcrypt -liphlpapi -luserenv -lntdll -lminiupnpc -lnatpmp -lpq NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)") @@ -51,7 +38,7 @@ endif ########## ## Main ## ########## -.PHONY: all test update clean examples +.PHONY: all test update clean examples deps # default target, because it's the first one that doesn't start with '.' all: | wakunode2 libwaku @@ -77,16 +64,15 @@ endif waku.nims: ln -s waku.nimble $@ -update: | update-common - rm -rf waku.nims && \ - $(MAKE) waku.nims $(HANDLE_OUTPUT) +update: | waku.nims + nimble setup && nimble sync $(MAKE) build-nph clean: rm -rf build -# must be included after the default target --include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk +build: + mkdir -p build ## Possible values: prod; debug TARGET ?= prod @@ -119,7 +105,7 @@ endif ################## ## Dependencies ## ################## -.PHONY: deps libbacktrace +.PHONY: deps libbacktrace nat-libs FOUNDRY_VERSION := 1.5.0 PNPM_VERSION := 10.23.0 @@ -136,7 +122,8 @@ endif rln-deps: rustup ./scripts/install_rln_tests_dependencies.sh $(FOUNDRY_VERSION) $(PNPM_VERSION) -deps: | deps-common nat-libs waku.nims +deps: | nat-libs waku.nims + nimble setup && nimble sync ### nim-libbacktrace @@ -155,11 +142,35 @@ endif # enable experimental exit is dest feature in libp2p mix NIM_PARAMS := $(NIM_PARAMS) -d:libp2p_mix_experimental_exit_is_dest +# Get libbacktrace path from nimble +LIBBACKTRACE_PATH := $(shell nimble path libbacktrace 2>/dev/null) + libbacktrace: - + $(MAKE) -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0 +ifneq ($(LIBBACKTRACE_PATH),) + + $(MAKE) -C $(LIBBACKTRACE_PATH) --no-print-directory BUILD_CXX_LIB=0 +endif clean-libbacktrace: - + $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT) +ifneq ($(LIBBACKTRACE_PATH),) + + $(MAKE) -C $(LIBBACKTRACE_PATH) clean $(HANDLE_OUTPUT) +endif + +# Get nat-traversal path from nimble for building native libs +nat-libs: + @NAT_PATH=$$(nimble path nat_traversal 2>/dev/null); \ + if [ -n "$$NAT_PATH" ]; then \ + echo "Building miniupnpc..."; \ + $(MAKE) -C $$NAT_PATH/vendor/miniupnp/miniupnpc build/libminiupnpc.a; \ + echo "Building libnatpmp..."; \ + $(MAKE) -C $$NAT_PATH/vendor/libnatpmp-upstream libnatpmp.a; \ + fi + +clean-nat-libs: + @NAT_PATH=$$(nimble path nat_traversal 2>/dev/null); \ + if [ -n "$$NAT_PATH" ]; then \ + $(MAKE) -C $$NAT_PATH/vendor/miniupnp/miniupnpc clean; \ + $(MAKE) -C $$NAT_PATH/vendor/libnatpmp-upstream clean; \ + fi # Extend deps and clean targets ifneq ($(USE_LIBBACKTRACE), 0) @@ -174,14 +185,7 @@ ifeq ($(DEBUG_DISCV5), 1) NIM_PARAMS := $(NIM_PARAMS) -d:debugDiscv5 endif -clean: | clean-libbacktrace - -### Create nimble links (used when building with Nix) - -nimbus-build-system-nimble-dir: - NIMBLE_DIR="$(CURDIR)/$(NIMBLE_DIR)" \ - PWD_CMD="$(PWD)" \ - $(CURDIR)/scripts/generate_nimble_links.sh +clean: | clean-libbacktrace clean-nat-libs ################## ## RLN ## @@ -218,7 +222,7 @@ clean: | clean-librln testcommon: | build deps echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim testcommon $(NIM_PARAMS) waku.nims + nimble testcommon $(NIM_PARAMS) ########## @@ -229,61 +233,61 @@ 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 + nimble benchmarks $(NIM_PARAMS) testwakunode2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim testwakunode2 $(NIM_PARAMS) waku.nims + nimble testwakunode2 $(NIM_PARAMS) example2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims + nimble example2 $(NIM_PARAMS) chat2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim chat2 $(NIM_PARAMS) waku.nims + nimble chat2 $(NIM_PARAMS) chat2mix: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim chat2mix $(NIM_PARAMS) waku.nims + nimble chat2mix $(NIM_PARAMS) rln-db-inspector: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim rln_db_inspector $(NIM_PARAMS) waku.nims + nimble rln_db_inspector $(NIM_PARAMS) chat2bridge: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim chat2bridge $(NIM_PARAMS) waku.nims + nimble chat2bridge $(NIM_PARAMS) liteprotocoltester: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim liteprotocoltester $(NIM_PARAMS) waku.nims + nimble liteprotocoltester $(NIM_PARAMS) lightpushwithmix: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim lightpushwithmix $(NIM_PARAMS) waku.nims + nimble lightpushwithmix $(NIM_PARAMS) api_example: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim api_example $(NIM_PARAMS) waku.nims + nimble api_example $(NIM_PARAMS) build/%: | build deps librln echo -e $(BUILD_MSG) "build/$*" && \ - $(ENV_SCRIPT) nim buildone $(NIM_PARAMS) waku.nims $* + nimble buildone $(NIM_PARAMS) $* 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)\""; \ + nimble buildTest $(NIM_PARAMS) $(TEST_FILE) && \ + nimble execTest $(NIM_PARAMS) $(TEST_FILE) "\"$(TEST_NAME)\""; \ ################ ## Waku tools ## @@ -294,27 +298,27 @@ tools: networkmonitor wakucanary wakucanary: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim wakucanary $(NIM_PARAMS) waku.nims + nimble wakucanary $(NIM_PARAMS) networkmonitor: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim networkmonitor $(NIM_PARAMS) waku.nims + nimble networkmonitor $(NIM_PARAMS) ############ ## 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 binary location +NPH := $(shell which nph 2>/dev/null || echo "build/nph") 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) + @echo "Building nph..." + nimble install nph + @echo "nph utility installed" else - echo "nph utility already exists at " $(NPH) + @echo "nph utility already exists at " $(NPH) endif GIT_PRE_COMMIT_HOOK := .git/hooks/pre-commit @@ -348,11 +352,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 ##################### @@ -371,7 +375,6 @@ docker-image: docker build \ --build-arg="MAKE_TARGET=$(MAKE_TARGET)" \ --build-arg="NIMFLAGS=$(DOCKER_IMAGE_NIMFLAGS)" \ - --build-arg="NIM_COMMIT=$(DOCKER_NIM_COMMIT)" \ --build-arg="LOG_LEVEL=$(LOG_LEVEL)" \ --build-arg="HEAPTRACK_BUILD=$(HEAPTRACKER)" \ --label="commit=$(shell git rev-parse HEAD)" \ @@ -409,7 +412,6 @@ docker-liteprotocoltester: docker build \ --build-arg="MAKE_TARGET=liteprotocoltester" \ --build-arg="NIMFLAGS=$(DOCKER_LPT_NIMFLAGS)" \ - --build-arg="NIM_COMMIT=$(DOCKER_NIM_COMMIT)" \ --build-arg="LOG_LEVEL=TRACE" \ --label="commit=$(shell git rev-parse HEAD)" \ --label="version=$(GIT_VERSION)" \ @@ -456,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)" && nimble $(BUILD_COMMAND) $(NIM_PARAMS) $@.$(LIB_EXT) ##################### ## Mobile Bindings ## @@ -477,7 +479,7 @@ else ANDROID_TOOLCHAIN_DIR := $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/linux-x86_64 endif -rebuild-nat-libs: | clean-cross nat-libs +rebuild-nat-libs: | clean-nat-libs nat-libs libwaku-android-precheck: ifndef ANDROID_NDK_HOME @@ -492,7 +494,7 @@ else ./scripts/build_rln_android.sh $(CURDIR)/build $(LIBRLN_BUILDDIR) $(LIBRLN_VERSION) $(CROSS_TARGET) $(ABIDIR) endif $(MAKE) rebuild-nat-libs CC=$(ANDROID_TOOLCHAIN_DIR)/bin/$(ANDROID_COMPILER) - 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) nimble libWakuAndroid $(NIM_PARAMS) libwaku-android-arm64: ANDROID_ARCH=aarch64-linux-android libwaku-android-arm64: CPU=arm64 @@ -552,7 +554,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) nimble libWakuIOS $(NIM_PARAMS) # iOS device (arm64) libwaku-ios-device: IOS_ARCH=arm64 @@ -574,35 +576,37 @@ libwaku-ios: $(MAKE) libwaku-ios-simulator cwaku_example: | build libwaku + @LIBBACKTRACE_PATH=$$(nimble path libbacktrace 2>/dev/null); \ + NAT_PATH=$$(nimble path nat_traversal 2>/dev/null); \ echo -e $(BUILD_MSG) "build/$@" && \ cc -o "build/$@" \ ./examples/cbindings/waku_example.c \ ./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_PATH/vendor/miniupnp/miniupnpc/build/ \ + -lnatpmp -L$$NAT_PATH/vendor/libnatpmp-upstream/ \ + $$LIBBACKTRACE_PATH/libbacktrace_wrapper.o \ + $$LIBBACKTRACE_PATH/install/usr/lib/libbacktrace.a cppwaku_example: | build libwaku + @LIBBACKTRACE_PATH=$$(nimble path libbacktrace 2>/dev/null); \ + NAT_PATH=$$(nimble path nat_traversal 2>/dev/null); \ echo -e $(BUILD_MSG) "build/$@" && \ g++ -o "build/$@" \ ./examples/cpp/waku.cpp \ ./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_PATH/vendor/miniupnp/miniupnpc/build/ \ + -lnatpmp -L$$NAT_PATH/vendor/libnatpmp-upstream/ \ + $$LIBBACKTRACE_PATH/libbacktrace_wrapper.o \ + $$LIBBACKTRACE_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 # ################### diff --git a/config.nims b/config.nims index f74fe183f..babfd687a 100644 --- a/config.nims +++ b/config.nims @@ -9,12 +9,6 @@ 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") - # disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries switch("passL", "-Wl,--no-insert-timestamp") # increase stack size diff --git a/nimble.lock b/nimble.lock new file mode 100644 index 000000000..4591bef39 --- /dev/null +++ b/nimble.lock @@ -0,0 +1,377 @@ +{ + "version": 2, + "packages": { + "chronicles": { + "version": "0.12.1", + "vcsRevision": "54f5b726025e8c7385e3a6529d3aa27454c6e6ff", + "url": "https://github.com/status-im/nim-chronicles.git", + "downloadMethod": "git", + "dependencies": [ + "testutils", + "json_serialization" + ] + }, + "chronos": { + "version": "4.0.4", + "vcsRevision": "85af4db764ecd3573c4704139560df3943216cf1", + "url": "https://github.com/status-im/nim-chronos.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "bearssl", + "unittest2", + "results" + ] + }, + "confutils": { + "version": "0.1.0", + "vcsRevision": "e214b3992a31acece6a9aada7d0a1ad37c928f3b", + "url": "https://github.com/status-im/nim-confutils.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "serialization" + ] + }, + "db_connector": { + "version": "0.1.0", + "vcsRevision": "74aef399e5c232f95c9fc5c987cebac846f09d62", + "url": "https://github.com/nim-lang/db_connector.git", + "downloadMethod": "git", + "dependencies": [] + }, + "dnsclient": { + "version": "0.3.4", + "vcsRevision": "23214235d4784d24aceed99bbfe153379ea557c8", + "url": "https://github.com/ba0f3/dnsclient.nim.git", + "downloadMethod": "git", + "dependencies": [] + }, + "dnsdisc": { + "version": "0.1.0", + "vcsRevision": "b71d029f4da4ec56974d54c04518bada00e1b623", + "url": "https://github.com/status-im/nim-dnsdisc.git", + "downloadMethod": "git", + "dependencies": [ + "chronos", + "chronicles", + "stew", + "eth", + "dnsclient", + "metrics" + ] + }, + "eth": { + "version": "1.0.0", + "vcsRevision": "d9135e6c3c5d6d819afdfb566aa8d958756b73a8", + "url": "https://github.com/status-im/nim-eth.git", + "downloadMethod": "git", + "dependencies": [ + "nimcrypto", + "stint", + "secp256k1", + "chronos", + "chronicles", + "stew", + "nat_traversal", + "metrics", + "sqlite3_abi", + "results", + "unittest2" + ] + }, + "faststreams": { + "version": "0.3.0", + "vcsRevision": "c3ac3f639ed1d62f59d3077d376a29c63ac9750c", + "url": "https://github.com/status-im/nim-faststreams.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "testutils", + "unittest2" + ] + }, + "ffi": { + "version": "0.1.3", + "vcsRevision": "06111de155253b34e47ed2aaed1d61d08d62cc1b", + "url": "https://github.com/logos-messaging/nim-ffi.git", + "downloadMethod": "git", + "dependencies": [] + }, + "http_utils": { + "version": "0.3.0", + "vcsRevision": "79cbab1460f4c0cdde2084589d017c43a3d7b4f1", + "url": "https://github.com/status-im/nim-http-utils.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "results" + ] + }, + "json_rpc": { + "version": "0.4.3", + "vcsRevision": "9665c265035f49f5ff94bbffdeadde68e19d6221", + "url": "https://github.com/status-im/nim-json-rpc.git", + "downloadMethod": "git", + "dependencies": [ + "json_serialization", + "chronos", + "websock", + "chronicles", + "unittest2", + "stew" + ] + }, + "json_serialization": { + "version": "0.2.6", + "vcsRevision": "b65fd6a7e64c864dabe40e7dfd6c7d07db0014ac", + "url": "https://github.com/status-im/nim-json-serialization.git", + "downloadMethod": "git", + "dependencies": [ + "serialization", + "stew" + ] + }, + "jwt": { + "version": "0.2", + "vcsRevision": "18f8378de52b241f321c1f9ea905456e89b95c6f", + "url": "https://github.com/vacp2p/nim-jwt.git", + "downloadMethod": "git", + "dependencies": [] + }, + "libbacktrace": { + "version": "0.0.8", + "vcsRevision": "d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb", + "url": "https://github.com/status-im/nim-libbacktrace.git", + "downloadMethod": "git", + "dependencies": [] + }, + "libp2p": { + "version": "1.6.0", + "vcsRevision": "eb7e6ff89889e41b57515f891ba82986c54809fb", + "url": "https://github.com/vacp2p/nim-libp2p.git", + "downloadMethod": "git", + "dependencies": [ + "nimcrypto", + "dnsclient", + "bearssl", + "chronicles", + "chronos", + "metrics", + "secp256k1", + "stew", + "websock", + "results", + "lsquic", + "unittest2" + ] + }, + "lsquic": { + "version": "0.1.0", + "vcsRevision": "f3fe33462601ea34eb2e8e9c357c92e61f8d121b", + "url": "https://github.com/vacp2p/nim-lsquic.git", + "downloadMethod": "git", + "dependencies": [] + }, + "metrics": { + "version": "0.0.1", + "vcsRevision": "ecf64c6078d1276d3b7d9b3d931fbdb70004db11", + "url": "https://github.com/status-im/nim-metrics.git", + "downloadMethod": "git", + "dependencies": [ + "chronos" + ] + }, + "minilru": { + "version": "1.0.0", + "vcsRevision": "0c4b2bce959591f0a862e9b541ba43c6d0cf3476", + "url": "https://github.com/status-im/nim-minilru.git", + "downloadMethod": "git", + "dependencies": [ + "results" + ] + }, + "nat_traversal": { + "version": "0.0.1", + "vcsRevision": "860e18c37667b5dd005b94c63264560c35d88004", + "url": "https://github.com/status-im/nim-nat-traversal.git", + "downloadMethod": "git", + "dependencies": [ + "chronicles", + "stew", + "results" + ] + }, + "nimcrypto": { + "version": "0.6.0", + "vcsRevision": "721fb99ee099b632eb86dfad1f0d96ee87583774", + "url": "https://github.com/cheatfate/nimcrypto.git", + "downloadMethod": "git", + "dependencies": [] + }, + "presto": { + "version": "0.1.0", + "vcsRevision": "92b1c7ff141e6920e1f8a98a14c35c1fa098e3be", + "url": "https://github.com/status-im/nim-presto.git", + "downloadMethod": "git", + "dependencies": [ + "chronos", + "chronicles", + "stew", + "results" + ] + }, + "regex": { + "version": "0.26.1", + "vcsRevision": "4593305ed1e49731fc75af1dc572dd2559aad19c", + "url": "https://github.com/nitely/nim-regex.git", + "downloadMethod": "git", + "dependencies": [ + "unicodedb" + ] + }, + "results": { + "version": "0.5.1", + "vcsRevision": "df8113dda4c2d74d460a8fa98252b0b771bf1f27", + "url": "https://github.com/arnetheduck/nim-results.git", + "downloadMethod": "git", + "dependencies": [] + }, + "secp256k1": { + "version": "0.6.0", + "vcsRevision": "9dd3df62124aae79d564da636bb22627c53c7676", + "url": "https://github.com/status-im/nim-secp256k1.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "results" + ] + }, + "serialization": { + "version": "0.2.4", + "vcsRevision": "6f525d5447d97256750ca7856faead03e562ed20", + "url": "https://github.com/status-im/nim-serialization.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "faststreams" + ] + }, + "sqlite3_abi": { + "version": "1.3.2", + "vcsRevision": "bdf01cf4236fb40788f0733466cdf6708783cbac", + "url": "https://github.com/arnetheduck/nim-sqlite3-abi.git", + "downloadMethod": "git", + "dependencies": [] + }, + "stew": { + "version": "0.2.0", + "vcsRevision": "e5740014961438610d336cd81706582dbf2c96f0", + "url": "https://github.com/status-im/nim-stew.git", + "downloadMethod": "git", + "dependencies": [ + "results" + ] + }, + "stint": { + "version": "0.9.0", + "vcsRevision": "470b7892561b5179ab20bd389a69217d6213fe58", + "url": "https://github.com/status-im/nim-stint.git", + "downloadMethod": "git", + "dependencies": [ + "stew" + ] + }, + "taskpools": { + "version": "0.0.5", + "vcsRevision": "9e8ccc754631ac55ac2fd495e167e74e86293edb", + "url": "https://github.com/status-im/nim-taskpools.git", + "downloadMethod": "git", + "dependencies": [] + }, + "testutils": { + "version": "0.5.0", + "vcsRevision": "94d68e796c045d5b37cabc6be32d7bfa168f8857", + "url": "https://github.com/status-im/nim-testutils.git", + "downloadMethod": "git", + "dependencies": [ + "unittest2" + ] + }, + "toml_serialization": { + "version": "0.2.12", + "vcsRevision": "fea85b27f0badcf617033ca1bc05444b5fd8aa7a", + "url": "https://github.com/status-im/nim-toml-serialization.git", + "downloadMethod": "git", + "dependencies": [ + "serialization", + "stew" + ] + }, + "unicodedb": { + "version": "0.12.0", + "vcsRevision": "66f2458710dc641dd4640368f9483c8a0ec70561", + "url": "https://github.com/nitely/nim-unicodedb.git", + "downloadMethod": "git", + "dependencies": [] + }, + "unittest2": { + "version": "0.2.3", + "vcsRevision": "8b51e99b4a57fcfb31689230e75595f024543024", + "url": "https://github.com/status-im/nim-unittest2.git", + "downloadMethod": "git", + "dependencies": [] + }, + "web3": { + "version": "0.4.2", + "vcsRevision": "81ee8ce479d86acb73be7c4f365328e238d9b4a3", + "url": "https://github.com/status-im/nim-web3.git", + "downloadMethod": "git", + "dependencies": [ + "chronicles", + "chronos", + "json_rpc", + "json_serialization", + "nimcrypto", + "stint", + "stew", + "eth", + "results" + ] + }, + "websock": { + "version": "0.2.0", + "vcsRevision": "ebe308a79a7b440a11dfbe74f352be86a3883508", + "url": "https://github.com/status-im/nim-websock.git", + "downloadMethod": "git", + "dependencies": [ + "chronos", + "http_utils", + "chronicles", + "stew", + "nimcrypto", + "bearssl", + "zlib" + ] + }, + "zlib": { + "version": "0.1.0", + "vcsRevision": "daa8723fd32299d4ca621c837430c29a5a11e19a", + "url": "https://github.com/status-im/nim-zlib.git", + "downloadMethod": "git", + "dependencies": [ + "stew" + ] + }, + "bearssl": { + "version": "0.2.5", + "vcsRevision": "11e798b62b8e6beabe958e048e9e24c7e0f9ee63", + "url": "https://github.com/status-im/nim-bearssl.git", + "downloadMethod": "git", + "dependencies": [ + "unittest2" + ] + } + }, + "tasks": {} +} diff --git a/scripts/build_native_deps.sh b/scripts/build_native_deps.sh new file mode 100755 index 000000000..40ff9a6f7 --- /dev/null +++ b/scripts/build_native_deps.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# Build native C dependencies from nimble cache paths +# This script builds the C libraries required by Nim packages + +set -e + +# Get package paths from nimble +BEARSSL_PATH=$(nimble path bearssl 2>/dev/null || echo "") +SECP256K1_PATH=$(nimble path secp256k1 2>/dev/null || echo "") +NAT_TRAVERSAL_PATH=$(nimble path nat_traversal 2>/dev/null || echo "") +LIBBACKTRACE_PATH=$(nimble path libbacktrace 2>/dev/null || echo "") + +# Optional cross-compilation support +CC="${CC:-cc}" +AR="${AR:-ar}" + +echo "Building native dependencies..." +echo "CC=$CC" +echo "AR=$AR" + +# Build BearSSL +if [ -n "$BEARSSL_PATH" ] && [ -d "$BEARSSL_PATH/bearssl/csources" ]; then + echo "Building BearSSL..." + make -C "$BEARSSL_PATH/bearssl/csources" lib CC="$CC" AR="$AR" +else + echo "Warning: BearSSL path not found or csources missing" +fi + +# Build secp256k1 +if [ -n "$SECP256K1_PATH" ] && [ -d "$SECP256K1_PATH/vendor/secp256k1" ]; then + echo "Building secp256k1..." + SECP_DIR="$SECP256K1_PATH/vendor/secp256k1" + if [ ! -f "$SECP_DIR/configure" ]; then + echo "Running autogen.sh..." + (cd "$SECP_DIR" && ./autogen.sh) + fi + if [ ! -f "$SECP_DIR/Makefile" ]; then + echo "Running configure..." + (cd "$SECP_DIR" && ./configure --enable-module-recovery --enable-module-ecdh CC="$CC") + fi + make -C "$SECP_DIR" CC="$CC" +else + echo "Warning: secp256k1 path not found" +fi + +# Build miniupnpc +if [ -n "$NAT_TRAVERSAL_PATH" ] && [ -d "$NAT_TRAVERSAL_PATH/vendor/miniupnp/miniupnpc" ]; then + echo "Building miniupnpc..." + make -C "$NAT_TRAVERSAL_PATH/vendor/miniupnp/miniupnpc" build/libminiupnpc.a CC="$CC" AR="$AR" +else + echo "Warning: miniupnpc path not found" +fi + +# Build libnatpmp +if [ -n "$NAT_TRAVERSAL_PATH" ] && [ -d "$NAT_TRAVERSAL_PATH/vendor/libnatpmp-upstream" ]; then + echo "Building libnatpmp..." + make -C "$NAT_TRAVERSAL_PATH/vendor/libnatpmp-upstream" libnatpmp.a CC="$CC" AR="$AR" +else + echo "Warning: libnatpmp path not found" +fi + +# Build libbacktrace +if [ -n "$LIBBACKTRACE_PATH" ]; then + echo "Building libbacktrace..." + make -C "$LIBBACKTRACE_PATH" BUILD_CXX_LIB=0 CC="$CC" +else + echo "Warning: libbacktrace path not found" +fi + +echo "Native dependencies built successfully!" diff --git a/vendor/db_connector b/vendor/db_connector deleted file mode 160000 index 74aef399e..000000000 --- a/vendor/db_connector +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 74aef399e5c232f95c9fc5c987cebac846f09d62 diff --git a/vendor/dnsclient.nim b/vendor/dnsclient.nim deleted file mode 160000 index 23214235d..000000000 --- a/vendor/dnsclient.nim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 23214235d4784d24aceed99bbfe153379ea557c8 diff --git a/vendor/nim-bearssl b/vendor/nim-bearssl deleted file mode 160000 index 11e798b62..000000000 --- a/vendor/nim-bearssl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 11e798b62b8e6beabe958e048e9e24c7e0f9ee63 diff --git a/vendor/nim-chronicles b/vendor/nim-chronicles deleted file mode 160000 index 54f5b7260..000000000 --- a/vendor/nim-chronicles +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 54f5b726025e8c7385e3a6529d3aa27454c6e6ff diff --git a/vendor/nim-chronos b/vendor/nim-chronos deleted file mode 160000 index 85af4db76..000000000 --- a/vendor/nim-chronos +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 85af4db764ecd3573c4704139560df3943216cf1 diff --git a/vendor/nim-confutils b/vendor/nim-confutils deleted file mode 160000 index e214b3992..000000000 --- a/vendor/nim-confutils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e214b3992a31acece6a9aada7d0a1ad37c928f3b diff --git a/vendor/nim-dnsdisc b/vendor/nim-dnsdisc deleted file mode 160000 index b71d029f4..000000000 --- a/vendor/nim-dnsdisc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b71d029f4da4ec56974d54c04518bada00e1b623 diff --git a/vendor/nim-eth b/vendor/nim-eth deleted file mode 160000 index d9135e6c3..000000000 --- a/vendor/nim-eth +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d9135e6c3c5d6d819afdfb566aa8d958756b73a8 diff --git a/vendor/nim-faststreams b/vendor/nim-faststreams deleted file mode 160000 index c3ac3f639..000000000 --- a/vendor/nim-faststreams +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c3ac3f639ed1d62f59d3077d376a29c63ac9750c diff --git a/vendor/nim-ffi b/vendor/nim-ffi deleted file mode 160000 index 06111de15..000000000 --- a/vendor/nim-ffi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 06111de155253b34e47ed2aaed1d61d08d62cc1b diff --git a/vendor/nim-http-utils b/vendor/nim-http-utils deleted file mode 160000 index 79cbab146..000000000 --- a/vendor/nim-http-utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 79cbab1460f4c0cdde2084589d017c43a3d7b4f1 diff --git a/vendor/nim-json-rpc b/vendor/nim-json-rpc deleted file mode 160000 index 9665c2650..000000000 --- a/vendor/nim-json-rpc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9665c265035f49f5ff94bbffdeadde68e19d6221 diff --git a/vendor/nim-json-serialization b/vendor/nim-json-serialization deleted file mode 160000 index b65fd6a7e..000000000 --- a/vendor/nim-json-serialization +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b65fd6a7e64c864dabe40e7dfd6c7d07db0014ac diff --git a/vendor/nim-jwt b/vendor/nim-jwt deleted file mode 160000 index 18f8378de..000000000 --- a/vendor/nim-jwt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 18f8378de52b241f321c1f9ea905456e89b95c6f diff --git a/vendor/nim-libbacktrace b/vendor/nim-libbacktrace deleted file mode 160000 index d8bd4ce5c..000000000 --- a/vendor/nim-libbacktrace +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p deleted file mode 160000 index eb7e6ff89..000000000 --- a/vendor/nim-libp2p +++ /dev/null @@ -1 +0,0 @@ -Subproject commit eb7e6ff89889e41b57515f891ba82986c54809fb diff --git a/vendor/nim-lsquic b/vendor/nim-lsquic deleted file mode 160000 index f3fe33462..000000000 --- a/vendor/nim-lsquic +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f3fe33462601ea34eb2e8e9c357c92e61f8d121b diff --git a/vendor/nim-metrics b/vendor/nim-metrics deleted file mode 160000 index ecf64c607..000000000 --- a/vendor/nim-metrics +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ecf64c6078d1276d3b7d9b3d931fbdb70004db11 diff --git a/vendor/nim-minilru b/vendor/nim-minilru deleted file mode 160000 index 0c4b2bce9..000000000 --- a/vendor/nim-minilru +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0c4b2bce959591f0a862e9b541ba43c6d0cf3476 diff --git a/vendor/nim-nat-traversal b/vendor/nim-nat-traversal deleted file mode 160000 index 860e18c37..000000000 --- a/vendor/nim-nat-traversal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 860e18c37667b5dd005b94c63264560c35d88004 diff --git a/vendor/nim-presto b/vendor/nim-presto deleted file mode 160000 index 92b1c7ff1..000000000 --- a/vendor/nim-presto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 92b1c7ff141e6920e1f8a98a14c35c1fa098e3be diff --git a/vendor/nim-regex b/vendor/nim-regex deleted file mode 160000 index 4593305ed..000000000 --- a/vendor/nim-regex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4593305ed1e49731fc75af1dc572dd2559aad19c diff --git a/vendor/nim-results b/vendor/nim-results deleted file mode 160000 index df8113dda..000000000 --- a/vendor/nim-results +++ /dev/null @@ -1 +0,0 @@ -Subproject commit df8113dda4c2d74d460a8fa98252b0b771bf1f27 diff --git a/vendor/nim-secp256k1 b/vendor/nim-secp256k1 deleted file mode 160000 index 9dd3df621..000000000 --- a/vendor/nim-secp256k1 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9dd3df62124aae79d564da636bb22627c53c7676 diff --git a/vendor/nim-serialization b/vendor/nim-serialization deleted file mode 160000 index 6f525d544..000000000 --- a/vendor/nim-serialization +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f525d5447d97256750ca7856faead03e562ed20 diff --git a/vendor/nim-sqlite3-abi b/vendor/nim-sqlite3-abi deleted file mode 160000 index bdf01cf42..000000000 --- a/vendor/nim-sqlite3-abi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bdf01cf4236fb40788f0733466cdf6708783cbac diff --git a/vendor/nim-stew b/vendor/nim-stew deleted file mode 160000 index e57400149..000000000 --- a/vendor/nim-stew +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e5740014961438610d336cd81706582dbf2c96f0 diff --git a/vendor/nim-stint b/vendor/nim-stint deleted file mode 160000 index 470b78925..000000000 --- a/vendor/nim-stint +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 470b7892561b5179ab20bd389a69217d6213fe58 diff --git a/vendor/nim-taskpools b/vendor/nim-taskpools deleted file mode 160000 index 9e8ccc754..000000000 --- a/vendor/nim-taskpools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9e8ccc754631ac55ac2fd495e167e74e86293edb diff --git a/vendor/nim-testutils b/vendor/nim-testutils deleted file mode 160000 index 94d68e796..000000000 --- a/vendor/nim-testutils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 94d68e796c045d5b37cabc6be32d7bfa168f8857 diff --git a/vendor/nim-toml-serialization b/vendor/nim-toml-serialization deleted file mode 160000 index fea85b27f..000000000 --- a/vendor/nim-toml-serialization +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fea85b27f0badcf617033ca1bc05444b5fd8aa7a diff --git a/vendor/nim-unicodedb b/vendor/nim-unicodedb deleted file mode 160000 index 66f245871..000000000 --- a/vendor/nim-unicodedb +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 66f2458710dc641dd4640368f9483c8a0ec70561 diff --git a/vendor/nim-unittest2 b/vendor/nim-unittest2 deleted file mode 160000 index 8b51e99b4..000000000 --- a/vendor/nim-unittest2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8b51e99b4a57fcfb31689230e75595f024543024 diff --git a/vendor/nim-web3 b/vendor/nim-web3 deleted file mode 160000 index 81ee8ce47..000000000 --- a/vendor/nim-web3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 81ee8ce479d86acb73be7c4f365328e238d9b4a3 diff --git a/vendor/nim-websock b/vendor/nim-websock deleted file mode 160000 index ebe308a79..000000000 --- a/vendor/nim-websock +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ebe308a79a7b440a11dfbe74f352be86a3883508 diff --git a/vendor/nim-zlib b/vendor/nim-zlib deleted file mode 160000 index daa8723fd..000000000 --- a/vendor/nim-zlib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit daa8723fd32299d4ca621c837430c29a5a11e19a diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system deleted file mode 160000 index e6c2c9da3..000000000 --- a/vendor/nimbus-build-system +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e6c2c9da39c2d368d9cf420ac22692e99715d22c diff --git a/vendor/nimcrypto b/vendor/nimcrypto deleted file mode 160000 index 721fb99ee..000000000 --- a/vendor/nimcrypto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 721fb99ee099b632eb86dfad1f0d96ee87583774 diff --git a/vendor/nph b/vendor/nph deleted file mode 160000 index c6e03162d..000000000 --- a/vendor/nph +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c6e03162dc2820d3088660f644818d7040e95791 diff --git a/waku.nimble b/waku.nimble index 3ff41c5bd..58daa87f5 100644 --- a/waku.nimble +++ b/waku.nimble @@ -33,9 +33,40 @@ requires "nim >= 2.2.4", "minilru", "lsquic", "jwt", - "ffi" + "ffi", + # Transitive dependencies + "bearssl", + "secp256k1", + "nat_traversal", + "faststreams", + "json_serialization", + "http_utils", + "websock", + "dnsclient", + "toml_serialization", + "sqlite3_abi", + "taskpools", + "unittest2", + "testutils", + "zlib", + "unicodedb" + +# Custom fork URLs (for nimble lock) +# These are automatically used by nimble when resolving dependencies +# libp2p: https://github.com/vacp2p/nim-libp2p.git +# lsquic: https://github.com/vacp2p/nim-lsquic.git +# jwt: https://github.com/vacp2p/nim-jwt.git +# ffi: https://github.com/logos-messaging/nim-ffi.git ### Helper functions + +# Get the path to a nimble package +proc getNimblePath(pkgName: string): string = + let (output, exitCode) = gorgeEx("nimble path " & pkgName) + if exitCode != 0: + quit "Failed to get nimble path for " & pkgName + result = output.strip() + proc buildModule(filePath, params = "", lang = "c"): bool = if not dirExists "build": mkDir "build" @@ -260,6 +291,15 @@ proc buildMobileIOS(srcDir = ".", params = "") = let clangBase = "clang -arch " & iosArch & " -isysroot " & sdkPath & " -mios-version-min=18.0 -fembed-bitcode -fPIC -O2" + # Get nimble package paths for native dependencies + let bearSslPkgDir = getNimblePath("bearssl") + let secp256k1PkgDir = getNimblePath("secp256k1") + let natTraversalPkgDir = getNimblePath("nat_traversal") + + # Get Nim lib path + let (nimPath, _) = gorgeEx("nim --verbosity:0 --eval:'echo getCurrentCompilerExe().parentDir.parentDir / \"lib\"'") + let nimLibDir = nimPath.strip() + # Generate C sources from Nim (no linking) exec "nim c" & " --nimcache:" & nimcacheDir & @@ -277,8 +317,8 @@ proc buildMobileIOS(srcDir = ".", params = "") = # --- 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("/", "_") @@ -289,7 +329,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 & @@ -314,9 +354,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", @@ -337,7 +377,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): @@ -371,13 +411,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