diff --git a/.gitmodules b/.gitmodules index d05c751dd..431d96653 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,14 +13,3 @@ ignore = untracked branch = master -[submodule "vendor/nph"] - ignore = untracked - branch = master - path = vendor/nph - url = https://github.com/arnetheduck/nph.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 f331b110b..3e23effa8 100644 --- a/Makefile +++ b/Makefile @@ -113,8 +113,7 @@ 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)\" -# Add vendor/nim-ffi to path (kept as submodule due to broken .nimble file) -NIM_PARAMS := $(NIM_PARAMS) --path:vendor/nim-ffi +# nim-ffi is now installed via Nimble as 'ffi' package ## Heaptracker options HEAPTRACKER ?= 0 @@ -330,13 +329,27 @@ networkmonitor: | build deps librln # 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, find it in nimble bin directory +NIMBLE_BIN_DIR := $(shell nimble path 2>/dev/null | head -1 | xargs dirname 2>/dev/null)/../bin +NPH_NIMBLE := $(NIMBLE_BIN_DIR)/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 -e $(INFO_MSG) "Building nph from nimble package..." + nimble build nph -y + @if [ -f "$(NPH_NIMBLE)" ]; then \ + cp "$(NPH_NIMBLE)" "$(NPH)"; \ + echo "nph utility is available at $(NPH)"; \ + else \ + echo "nph binary not found at $(NPH_NIMBLE), trying alternate location..."; \ + NPH_PKG=$$(ls -d $(NIMBLE_PKGS_DIR)/nph-* 2>/dev/null | head -1); \ + if [ -n "$$NPH_PKG" ]; then \ + nim c --skipParentCfg:on -o:$(NPH) $$NPH_PKG/src/nph.nim; \ + echo "nph utility is available at $(NPH)"; \ + fi; \ + fi else - echo "nph utility already exists at " $(NPH) + @echo "nph utility already exists at $(NPH)" endif GIT_PRE_COMMIT_HOOK := .git/hooks/pre-commit diff --git a/README.md b/README.md index c64479738..015aa343a 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ Refer to [js-waku repo](https://github.com/waku-org/js-waku/tree/master/packages ## Formatting -Nim files are expected to be formatted using the [`nph`](https://github.com/arnetheduck/nph) version present in `vendor/nph`. +Nim files are expected to be formatted using [`nph`](https://github.com/arnetheduck/nph), which is installed via Nimble. You can easily format file with the `make nph/ file` command. For example: diff --git a/waku.nimble b/waku.nimble index 26c306fea..f812e5e1a 100644 --- a/waku.nimble +++ b/waku.nimble @@ -41,6 +41,10 @@ requires "results" requires "nimcrypto" requires "db_connector" requires "dnsclient" +requires "nph" + +# FFI framework - from logos-messaging fork +requires "https://github.com/logos-messaging/nim-ffi.git >= 0.1.0" # Packages with native dependencies requires "eth"