initial changes for deprect vendor

This commit is contained in:
darshankabariya 2026-01-12 13:32:10 +05:30
parent 284a0816cc
commit 8368a5ec48
No known key found for this signature in database
GPG Key ID: 9A92CCD9899F0D22
43 changed files with 159 additions and 442 deletions

187
.gitmodules vendored
View File

@ -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

279
Makefile
View File

@ -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)
@ -33,27 +15,28 @@ ifneq (,$(findstring MINGW,$(detected_OS)))
detected_OS := Windows
endif
# NIM binary location
NIM_BINARY := $(shell which nim)
NPH := $(shell dirname $(NIM_BINARY))/nph
# Compilation parameters
NIM_PARAMS ?=
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"
LIBS = -lws2_32 -lbcrypt -liphlpapi -luserenv -lntdll -lminiupnpc -lnatpmp -lpq
LIBS = -lws2_32 -lbcrypt -liphlpapi -luserenv -lntdll -lpq
NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)")
export PATH := /c/msys64/usr/bin:/c/msys64/mingw64/bin:/c/msys64/usr/lib:/c/msys64/mingw64/lib:$(PATH)
endif
##########
## Main ##
##########
.PHONY: all test update clean
.PHONY: all test update clean deps
# default target, because it's the first one that doesn't start with '.'
# default target
all: | wakunode2 example2 chat2 chat2bridge libwaku
test_file := $(word 2,$(MAKECMDGOALS))
@ -68,78 +51,46 @@ ifeq ($(strip $(test_file)),)
else
$(MAKE) compile-test TEST_FILE="$(test_file)" TEST_NAME="$(call test_name)"
endif
# this prevents make from erroring on unknown targets like "Index"
# this prevents make from erroring on unknown targets
%:
@true
waku.nims:
ln -s waku.nimble $@
update: | update-common
rm -rf waku.nims && \
$(MAKE) waku.nims $(HANDLE_OUTPUT)
update: | waku.nims
nimble refresh
$(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
## Git version
GIT_VERSION ?= $(shell git describe --abbrev=6 --always --tags)
## Compilation parameters. If defined in the CLI the assignments won't be executed
NIM_PARAMS := $(NIM_PARAMS) -d:git_version=\"$(GIT_VERSION)\"
## Heaptracker options
HEAPTRACKER ?= 0
HEAPTRACKER_INJECT ?= 0
ifeq ($(HEAPTRACKER), 1)
# Assumes Nim's lib/system/alloc.nim is patched!
TARGET := debug-with-heaptrack
ifeq ($(HEAPTRACKER_INJECT), 1)
# the Nim compiler will load 'libheaptrack_inject.so'
HEAPTRACK_PARAMS := -d:heaptracker -d:heaptracker_inject
NIM_PARAMS := $(NIM_PARAMS) -d:heaptracker -d:heaptracker_inject
else
# the Nim compiler will load 'libheaptrack_preload.so'
HEAPTRACK_PARAMS := -d:heaptracker
NIM_PARAMS := $(NIM_PARAMS) -d:heaptracker
endif
endif
## end of Heaptracker options
##################
## Dependencies ##
##################
.PHONY: deps libbacktrace
FOUNDRY_VERSION := 1.5.0
PNPM_VERSION := 10.23.0
rustup:
ifeq (, $(shell which cargo))
# Install Rustup if it's not installed
# -y: Assume "yes" for all prompts
# --default-toolchain stable: Install the stable toolchain
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
endif
rln-deps: rustup
./scripts/install_rln_tests_dependencies.sh $(FOUNDRY_VERSION) $(PNPM_VERSION)
deps: | deps-common nat-libs waku.nims
### nim-libbacktrace
# "-d:release" implies "--stacktrace:off" and it cannot be added to config.nims
# Debug/Release mode
ifeq ($(DEBUG), 0)
NIM_PARAMS := $(NIM_PARAMS) -d:release
else
@ -151,18 +102,7 @@ NIM_PARAMS := $(NIM_PARAMS) -d:disable_libbacktrace
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
clean-libbacktrace:
+ $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT)
# Extend deps and clean targets
ifneq ($(USE_LIBBACKTRACE), 0)
deps: | libbacktrace
endif
NIM_PARAMS := $(NIM_PARAMS) -d:libp2p_mix_experimental_exit_is_dest
ifeq ($(POSTGRES), 1)
NIM_PARAMS := $(NIM_PARAMS) -d:postgres -d:nimDebugDlOpen
@ -172,14 +112,25 @@ ifeq ($(DEBUG_DISCV5), 1)
NIM_PARAMS := $(NIM_PARAMS) -d:debugDiscv5
endif
clean: | clean-libbacktrace
##################
## Dependencies ##
##################
.PHONY: deps
### Create nimble links (used when building with Nix)
FOUNDRY_VERSION := 1.5.0
PNPM_VERSION := 10.23.0
nimbus-build-system-nimble-dir:
NIMBLE_DIR="$(CURDIR)/$(NIMBLE_DIR)" \
PWD_CMD="$(PWD)" \
$(CURDIR)/scripts/generate_nimble_links.sh
rustup:
ifeq (, $(shell which cargo))
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
endif
rln-deps: rustup
./scripts/install_rln_tests_dependencies.sh $(FOUNDRY_VERSION) $(PNPM_VERSION)
# Install nimble dependencies
deps: | build waku.nims
nimble install -d -y
##################
## RLN ##
@ -206,7 +157,6 @@ clean-librln:
cargo clean --manifest-path vendor/zerokit/rln/Cargo.toml
rm -f $(LIBRLN_FILE)
# Extend clean target
clean: | clean-librln
#################
@ -216,68 +166,65 @@ clean: | clean-librln
testcommon: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testcommon $(NIM_PARAMS) waku.nims
nimble testcommon
##########
## Waku ##
##########
.PHONY: testwaku wakunode2 testwakunode2 example2 chat2 chat2bridge liteprotocoltester
# 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
wakunode2: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
\
$(ENV_SCRIPT) nim wakunode2 $(NIM_PARAMS) waku.nims
nimble wakunode2
benchmarks: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim benchmarks $(NIM_PARAMS) waku.nims
nimble benchmarks
testwakunode2: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testwakunode2 $(NIM_PARAMS) waku.nims
nimble testwakunode2
example2: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims
nimble example2
chat2: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim chat2 $(NIM_PARAMS) waku.nims
nimble chat2
chat2mix: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim chat2mix $(NIM_PARAMS) waku.nims
nimble chat2mix
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
chat2bridge: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim chat2bridge $(NIM_PARAMS) waku.nims
nimble chat2bridge
liteprotocoltester: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim liteprotocoltester $(NIM_PARAMS) waku.nims
nimble liteprotocoltester
lightpushwithmix: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim lightpushwithmix $(NIM_PARAMS) waku.nims
nimble lightpushwithmix
build/%: | build deps librln
echo -e $(BUILD_MSG) "build/$*" && \
$(ENV_SCRIPT) nim buildone $(NIM_PARAMS) waku.nims $*
nimble buildone $*
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 $(TEST_FILE) && \
nimble execTest $(TEST_FILE) "\"$(TEST_NAME)\""
################
## Waku tools ##
@ -288,27 +235,23 @@ tools: networkmonitor wakucanary
wakucanary: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim wakucanary $(NIM_PARAMS) waku.nims
nimble wakucanary
networkmonitor: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim networkmonitor $(NIM_PARAMS) waku.nims
nimble networkmonitor
############
## 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
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)
nimble install nph -y
echo "nph utility is available"
else
echo "nph utility already exists at " $(NPH)
echo "nph utility already exists at " $(NPH)
endif
GIT_PRE_COMMIT_HOOK := .git/hooks/pre-commit
@ -328,7 +271,6 @@ nph/%: | build-nph
clean-nph:
rm -f $(NPH)
# To avoid hardcoding nph binary location in several places
print-nph-path:
echo "$(NPH)"
@ -339,25 +281,20 @@ clean: | clean-nph
###################
.PHONY: docs coverage
# 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
nimble 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
#####################
## Container image ##
#####################
# -d:insecure - Necessary to enable Prometheus HTTP endpoint for metrics
# -d:chronicles_colors:none - Necessary to disable colors in logs for Docker
DOCKER_IMAGE_NIMFLAGS ?= -d:chronicles_colors:none -d:insecure -d:postgres
DOCKER_IMAGE_NIMFLAGS := $(DOCKER_IMAGE_NIMFLAGS) $(HEAPTRACK_PARAMS)
# build a docker image for the fleet
docker-image: MAKE_TARGET ?= wakunode2
docker-image: DOCKER_IMAGE_TAG ?= $(MAKE_TARGET)-$(GIT_VERSION)
docker-image: DOCKER_IMAGE_NAME ?= wakuorg/nwaku:$(DOCKER_IMAGE_TAG)
@ -365,7 +302,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)" \
@ -391,19 +327,14 @@ docker-push:
####################################
## Container lite-protocol-tester ##
####################################
# -d:insecure - Necessary to enable Prometheus HTTP endpoint for metrics
# -d:chronicles_colors:none - Necessary to disable colors in logs for Docker
DOCKER_LPT_NIMFLAGS ?= -d:chronicles_colors:none -d:insecure
# build a docker image for the fleet
docker-liteprotocoltester: DOCKER_LPT_TAG ?= latest
docker-liteprotocoltester: DOCKER_LPT_NAME ?= wakuorg/liteprotocoltester:$(DOCKER_LPT_TAG)
# --no-cache
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)" \
@ -423,7 +354,6 @@ docker-quick-liteprotocoltester: | liteprotocoltester
docker-liteprotocoltester-push:
docker push $(DOCKER_LPT_NAME)
################
## C Bindings ##
################
@ -450,19 +380,37 @@ 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) $@.$(LIB_EXT)
cwaku_example: | build libwaku
echo -e $(BUILD_MSG) "build/$@" && \
cc -o "build/$@" \
./examples/cbindings/waku_example.c \
./examples/cbindings/base64.c \
-lwaku -Lbuild/ \
-pthread -ldl -lm
cppwaku_example: | build libwaku
echo -e $(BUILD_MSG) "build/$@" && \
g++ -o "build/$@" \
./examples/cpp/waku.cpp \
./examples/cpp/base64.cpp \
-lwaku -Lbuild/ \
-pthread -ldl -lm
nodejswaku: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
node-gyp build --directory=examples/nodejs/
#####################
## Mobile Bindings ##
#####################
.PHONY: libwaku-android \
libwaku-android-precheck \
libwaku-android-arm64 \
libwaku-android-amd64 \
libwaku-android-x86 \
libwaku-android-arm \
rebuild-nat-libs \
build-libwaku-for-android-arch
libwaku-android-precheck \
libwaku-android-arm64 \
libwaku-android-amd64 \
libwaku-android-x86 \
libwaku-android-arm
ANDROID_TARGET ?= 30
ifeq ($(detected_OS),Darwin)
@ -471,17 +419,14 @@ else
ANDROID_TOOLCHAIN_DIR := $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/linux-x86_64
endif
rebuild-nat-libs: | clean-cross nat-libs
libwaku-android-precheck:
ifndef ANDROID_NDK_HOME
$(error ANDROID_NDK_HOME is not set)
$(error ANDROID_NDK_HOME is not set)
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) nimble libWakuAndroid
libwaku-android-arm64: ANDROID_ARCH=aarch64-linux-android
libwaku-android-arm64: CPU=arm64
@ -505,29 +450,23 @@ libwaku-android-arm: ANDROID_ARCH=armv7a-linux-androideabi
libwaku-android-arm: CPU=arm
libwaku-android-arm: ABIDIR=armeabi-v7a
libwaku-android-arm: | libwaku-android-precheck build deps
# cross-rs target architecture name does not match the one used in android
$(MAKE) build-libwaku-for-android-arch ANDROID_ARCH=$(ANDROID_ARCH) CROSS_TARGET=armv7-linux-androideabi CPU=$(CPU) ABIDIR=$(ABIDIR) ANDROID_COMPILER=$(ANDROID_ARCH)$(ANDROID_TARGET)-clang
libwaku-android:
$(MAKE) libwaku-android-amd64
$(MAKE) libwaku-android-arm64
$(MAKE) libwaku-android-x86
# This target is disabled because on recent versions of cross-rs complain with the following error
# relocation R_ARM_THM_ALU_PREL_11_0 cannot be used against symbol 'stack_init_trampoline_return'; recompile with -fPIC
# It's likely this architecture is not used so we might just not support it.
# $(MAKE) libwaku-android-arm
#################
## iOS Bindings #
#################
.PHONY: libwaku-ios-precheck \
libwaku-ios-device \
libwaku-ios-simulator \
libwaku-ios
libwaku-ios-device \
libwaku-ios-simulator \
libwaku-ios
IOS_DEPLOYMENT_TARGET ?= 18.0
# Get SDK paths dynamically using xcrun
define get_ios_sdk_path
$(shell xcrun --sdk $(1) --show-sdk-path 2>/dev/null)
endef
@ -539,59 +478,25 @@ else
$(error iOS builds are only supported on macOS)
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
# iOS device (arm64)
libwaku-ios-device: IOS_ARCH=arm64
libwaku-ios-device: IOS_SDK=iphoneos
libwaku-ios-device: IOS_SDK_PATH=$(call get_ios_sdk_path,iphoneos)
libwaku-ios-device: | libwaku-ios-precheck build deps
$(MAKE) build-libwaku-for-ios-arch IOS_ARCH=$(IOS_ARCH) IOS_SDK=$(IOS_SDK) IOS_SDK_PATH=$(IOS_SDK_PATH)
# iOS simulator (arm64 - Apple Silicon Macs)
libwaku-ios-simulator: IOS_ARCH=arm64
libwaku-ios-simulator: IOS_SDK=iphonesimulator
libwaku-ios-simulator: IOS_SDK_PATH=$(call get_ios_sdk_path,iphonesimulator)
libwaku-ios-simulator: | libwaku-ios-precheck build deps
$(MAKE) build-libwaku-for-ios-arch IOS_ARCH=$(IOS_ARCH) IOS_SDK=$(IOS_SDK) IOS_SDK_PATH=$(IOS_SDK_PATH)
# Build all iOS targets
libwaku-ios:
$(MAKE) libwaku-ios-device
$(MAKE) libwaku-ios-simulator
cwaku_example: | build libwaku
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
cppwaku_example: | build libwaku
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
nodejswaku: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
node-gyp build --directory=examples/nodejs/
endif # "variables.mk" was not included
###################
# Release Targets #
###################
@ -605,5 +510,3 @@ release-notes:
docker.io/wakuorg/sv4git:latest \
release-notes |\
sed -E 's@#([0-9]+)@[#\1](https://github.com/waku-org/nwaku/issues/\1)@g'
# I could not get the tool to replace issue ids with links, so using sed for now,
# asked here: https://github.com/bvieira/sv4git/discussions/101

View File

@ -125,3 +125,8 @@ if defined(android):
switch("passC", "--sysroot=" & sysRoot)
switch("passL", "--sysroot=" & sysRoot)
switch("cincludes", sysRoot & "/usr/include/")
# begin Nimble config (version 2)
--noNimblePath
when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths"
# end Nimble config

1
vendor/db_connector vendored

@ -1 +0,0 @@
Subproject commit 74aef399e5c232f95c9fc5c987cebac846f09d62

@ -1 +0,0 @@
Subproject commit 23214235d4784d24aceed99bbfe153379ea557c8

1
vendor/nim-bearssl vendored

@ -1 +0,0 @@
Subproject commit 11e798b62b8e6beabe958e048e9e24c7e0f9ee63

@ -1 +0,0 @@
Subproject commit 54f5b726025e8c7385e3a6529d3aa27454c6e6ff

1
vendor/nim-chronos vendored

@ -1 +0,0 @@
Subproject commit 85af4db764ecd3573c4704139560df3943216cf1

@ -1 +0,0 @@
Subproject commit e214b3992a31acece6a9aada7d0a1ad37c928f3b

1
vendor/nim-dnsdisc vendored

@ -1 +0,0 @@
Subproject commit b71d029f4da4ec56974d54c04518bada00e1b623

1
vendor/nim-eth vendored

@ -1 +0,0 @@
Subproject commit d9135e6c3c5d6d819afdfb566aa8d958756b73a8

@ -1 +0,0 @@
Subproject commit c3ac3f639ed1d62f59d3077d376a29c63ac9750c

1
vendor/nim-ffi vendored

@ -1 +0,0 @@
Subproject commit d7a5492121aad190cf549436836e2fa42e34ff9b

@ -1 +0,0 @@
Subproject commit 79cbab1460f4c0cdde2084589d017c43a3d7b4f1

1
vendor/nim-json-rpc vendored

@ -1 +0,0 @@
Subproject commit 9665c265035f49f5ff94bbffdeadde68e19d6221

@ -1 +0,0 @@
Subproject commit b65fd6a7e64c864dabe40e7dfd6c7d07db0014ac

1
vendor/nim-jwt vendored

@ -1 +0,0 @@
Subproject commit 18f8378de52b241f321c1f9ea905456e89b95c6f

@ -1 +0,0 @@
Subproject commit d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb

1
vendor/nim-libp2p vendored

@ -1 +0,0 @@
Subproject commit eb7e6ff89889e41b57515f891ba82986c54809fb

1
vendor/nim-lsquic vendored

@ -1 +0,0 @@
Subproject commit f3fe33462601ea34eb2e8e9c357c92e61f8d121b

1
vendor/nim-metrics vendored

@ -1 +0,0 @@
Subproject commit ecf64c6078d1276d3b7d9b3d931fbdb70004db11

1
vendor/nim-minilru vendored

@ -1 +0,0 @@
Subproject commit 0c4b2bce959591f0a862e9b541ba43c6d0cf3476

@ -1 +0,0 @@
Subproject commit 860e18c37667b5dd005b94c63264560c35d88004

1
vendor/nim-presto vendored

@ -1 +0,0 @@
Subproject commit 92b1c7ff141e6920e1f8a98a14c35c1fa098e3be

1
vendor/nim-regex vendored

@ -1 +0,0 @@
Subproject commit 4593305ed1e49731fc75af1dc572dd2559aad19c

1
vendor/nim-results vendored

@ -1 +0,0 @@
Subproject commit df8113dda4c2d74d460a8fa98252b0b771bf1f27

@ -1 +0,0 @@
Subproject commit 9dd3df62124aae79d564da636bb22627c53c7676

@ -1 +0,0 @@
Subproject commit 6f525d5447d97256750ca7856faead03e562ed20

@ -1 +0,0 @@
Subproject commit bdf01cf4236fb40788f0733466cdf6708783cbac

1
vendor/nim-stew vendored

@ -1 +0,0 @@
Subproject commit e5740014961438610d336cd81706582dbf2c96f0

1
vendor/nim-stint vendored

@ -1 +0,0 @@
Subproject commit 470b7892561b5179ab20bd389a69217d6213fe58

@ -1 +0,0 @@
Subproject commit 9e8ccc754631ac55ac2fd495e167e74e86293edb

@ -1 +0,0 @@
Subproject commit 94d68e796c045d5b37cabc6be32d7bfa168f8857

@ -1 +0,0 @@
Subproject commit fea85b27f0badcf617033ca1bc05444b5fd8aa7a

@ -1 +0,0 @@
Subproject commit 66f2458710dc641dd4640368f9483c8a0ec70561

@ -1 +0,0 @@
Subproject commit 8b51e99b4a57fcfb31689230e75595f024543024

1
vendor/nim-web3 vendored

@ -1 +0,0 @@
Subproject commit 81ee8ce479d86acb73be7c4f365328e238d9b4a3

1
vendor/nim-websock vendored

@ -1 +0,0 @@
Subproject commit ebe308a79a7b440a11dfbe74f352be86a3883508

1
vendor/nim-zlib vendored

@ -1 +0,0 @@
Subproject commit daa8723fd32299d4ca621c837430c29a5a11e19a

@ -1 +0,0 @@
Subproject commit e6c2c9da39c2d368d9cf420ac22692e99715d22c

1
vendor/nimcrypto vendored

@ -1 +0,0 @@
Subproject commit 721fb99ee099b632eb86dfad1f0d96ee87583774

1
vendor/nph vendored

@ -1 +0,0 @@
Subproject commit c6e03162dc2820d3088660f644818d7040e95791

View File

@ -12,28 +12,54 @@ license = "MIT or Apache License 2.0"
### Dependencies
requires "nim >= 2.2.4",
# Async & Concurrency
"chronos",
"taskpools",
# Logging & Configuration
"chronicles",
"confutils",
"chronos",
"dnsdisc",
"eth",
"json_rpc",
"libbacktrace",
"nimcrypto",
# Serialization
"serialization",
"json_serialization",
"toml_serialization",
"faststreams",
# Networking & P2P
"libp2p >= 1.14.3",
"eth",
"nat_traversal",
"websock",
"dnsdisc",
"dnsclient",
"httputils",
# Cryptography
"nimcrypto",
"secp256k1",
"bearssl",
# RPC & APIs
"json_rpc",
"presto",
"web3",
"jwt",
# Database
"db_connector",
"sqlite3_abi",
# Utilities
"stew",
"stint",
"metrics",
"libp2p >= 1.14.3",
"web3",
"presto",
"regex",
"unicodedb",
"results",
"db_connector",
"minilru",
"lsquic",
"jwt",
"ffi"
"zlib",
# Debug & Testing
"libbacktrace",
"testutils",
"unittest2"
# Packages not on nimble (use git URLs)
requires "https://github.com/vacp2p/nim-lsquic"
requires "https://github.com/logos-messaging/nim-ffi"
### Helper functions
proc buildModule(filePath, params = "", lang = "c"): bool =
@ -231,6 +257,15 @@ proc buildMobileIOS(srcDir = ".", params = "") =
if sdkPath.len == 0:
quit "Error: IOS_SDK_PATH not set. Set it to the path of the iOS SDK"
# Get nimble package paths
let bearsslPath = gorge("nimble path bearssl").strip()
let secp256k1Path = gorge("nimble path secp256k1").strip()
let natTraversalPath = gorge("nimble path nat_traversal").strip()
# Get Nim standard library path
let nimPath = gorge("nim --fullhelp 2>&1 | head -1 | sed 's/.*\\[//' | sed 's/\\].*//'").strip()
let nimLibPath = nimPath.parentDir.parentDir / "lib"
# Use SDK name in path to differentiate device vs simulator
let outDir = "build/ios/" & iosSdk & "-" & iosArch
if not dirExists outDir:
@ -273,8 +308,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 = bearsslPath / "bearssl/csources/src"
let bearSslIncDir = bearsslPath / "bearssl/csources/inc"
for path in walkDirRec(bearSslSrcDir):
if path.endsWith(".c"):
let relPath = path.replace(bearSslSrcDir & "/", "").replace("/", "_")
@ -285,7 +320,7 @@ proc buildMobileIOS(srcDir = ".", params = "") =
# --- secp256k1 ---
echo "Compiling secp256k1 for iOS..."
let secp256k1Dir = "./vendor/nim-secp256k1/vendor/secp256k1"
let secp256k1Dir = secp256k1Path / "vendor/secp256k1"
let secp256k1Flags = " -I" & secp256k1Dir & "/include" &
" -I" & secp256k1Dir & "/src" &
" -I" & secp256k1Dir &
@ -310,9 +345,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 = natTraversalPath / "vendor/miniupnp/miniupnpc/src"
let miniupnpcIncDir = natTraversalPath / "vendor/miniupnp/miniupnpc/include"
let miniupnpcBuildDir = natTraversalPath / "vendor/miniupnp/miniupnpc/build"
let miniupnpcFiles = @[
"addr_is_reserved.c", "connecthostport.c", "igd_desc_parse.c",
"minisoap.c", "minissdpc.c", "miniupnpc.c", "miniwget.c",
@ -333,7 +368,7 @@ proc buildMobileIOS(srcDir = ".", params = "") =
# --- libnatpmp ---
echo "Compiling libnatpmp for iOS..."
let natpmpSrcDir = "./vendor/nim-nat-traversal/vendor/libnatpmp-upstream"
let natpmpSrcDir = natTraversalPath / "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):
@ -367,13 +402,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" & nimLibPath &
" -I" & bearsslPath & "/bearssl/csources/inc/" &
" -I" & bearsslPath & "/bearssl/csources/tools/" &
" -I" & bearsslPath & "/bearssl/abi/" &
" -I" & secp256k1Path & "/vendor/secp256k1/include/" &
" -I" & natTraversalPath & "/vendor/miniupnp/miniupnpc/include/" &
" -I" & natTraversalPath & "/vendor/libnatpmp-upstream/" &
" -I" & nimcacheDir &
" -c " & cFile &
" -o " & oFile
@ -390,7 +425,7 @@ proc buildMobileIOS(srcDir = ".", params = "") =
exec "libtool -static -o " & aFile & " " & objFiles.join(" ")
echo "iOS library created: " & aFile
echo "iOS library created: " & aFile
task libWakuIOS, "Build the mobile bindings for iOS":
let srcDir = "./library"