Enhancement on building nph and made it available naturaly on the path as being copied next to nim. (#3152)

This commit is contained in:
NagyZoltanPeter 2024-10-28 16:43:00 +01:00 committed by GitHub
parent cfde7eea82
commit b42f4c7a89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 6 deletions

View File

@ -8,7 +8,6 @@ BUILD_SYSTEM_DIR := vendor/nimbus-build-system
EXCLUDED_NIM_PACKAGES := vendor/nim-dnsdisc/vendor
LINK_PCRE := 0
LOG_LEVEL := TRACE
NPH := vendor/nph/src/nph
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
@ -63,6 +62,7 @@ waku.nims:
update: | update-common
rm -rf waku.nims && \
$(MAKE) waku.nims $(HANDLE_OUTPUT)
$(MAKE) build-nph
clean:
rm -rf build
@ -287,8 +287,17 @@ networkmonitor: | build deps librln
############
.PHONY: build-nph install-nph clean-nph print-nph-path
build-nph:
$(ENV_SCRIPT) nim c vendor/nph/src/nph.nim
# 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 vendor/nph/src/nph.nim && \
mv vendor/nph/src/nph $(shell dirname $(NPH))
echo "nph utility is available at " $(NPH)
else
echo "nph utility already exists at " $(NPH)
endif
GIT_PRE_COMMIT_HOOK := .git/hooks/pre-commit
@ -300,7 +309,7 @@ else
exit 1
endif
nph/%: build-nph
nph/%: | build-nph
echo -e $(FORMAT_MSG) "nph/$*" && \
$(NPH) $*