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 EXCLUDED_NIM_PACKAGES := vendor/nim-dnsdisc/vendor
LINK_PCRE := 0 LINK_PCRE := 0
LOG_LEVEL := TRACE LOG_LEVEL := TRACE
NPH := vendor/nph/src/nph
FORMAT_MSG := "\\x1B[95mFormatting:\\x1B[39m" FORMAT_MSG := "\\x1B[95mFormatting:\\x1B[39m"
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target # we don't want an error here, so we can handle things later, in the ".DEFAULT" target
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk -include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
@ -35,13 +34,13 @@ ifneq (,$(findstring MINGW,$(detected_OS)))
detected_OS := Windows detected_OS := Windows
endif endif
ifeq ($(detected_OS),Windows) ifeq ($(detected_OS),Windows)
# Define a new temporary directory for Windows # Define a new temporary directory for Windows
TMP_DIR := $(CURDIR)/tmp TMP_DIR := $(CURDIR)/tmp
$(shell mkdir -p $(TMP_DIR)) $(shell mkdir -p $(TMP_DIR))
export TMP := $(TMP_DIR) export TMP := $(TMP_DIR)
export TEMP := $(TMP_DIR) export TEMP := $(TMP_DIR)
# Add the necessary libraries to the linker flags # Add the necessary libraries to the linker flags
LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll -lminiupnpc LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll -lminiupnpc
NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)") NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)")
@ -63,6 +62,7 @@ waku.nims:
update: | update-common update: | update-common
rm -rf waku.nims && \ rm -rf waku.nims && \
$(MAKE) waku.nims $(HANDLE_OUTPUT) $(MAKE) waku.nims $(HANDLE_OUTPUT)
$(MAKE) build-nph
clean: clean:
rm -rf build rm -rf build
@ -287,8 +287,17 @@ networkmonitor: | build deps librln
############ ############
.PHONY: build-nph install-nph clean-nph print-nph-path .PHONY: build-nph install-nph clean-nph print-nph-path
build-nph: # Default location for nph binary shall be next to nim binary to make it available on the path.
$(ENV_SCRIPT) nim c vendor/nph/src/nph.nim 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 GIT_PRE_COMMIT_HOOK := .git/hooks/pre-commit
@ -300,7 +309,7 @@ else
exit 1 exit 1
endif endif
nph/%: build-nph nph/%: | build-nph
echo -e $(FORMAT_MSG) "nph/$*" && \ echo -e $(FORMAT_MSG) "nph/$*" && \
$(NPH) $* $(NPH) $*