From 354d36c885c8b63fe780c04c84394d6551a67f27 Mon Sep 17 00:00:00 2001 From: Darshan K Date: Wed, 11 Sep 2024 14:48:53 +0530 Subject: [PATCH 1/3] feat: update rln.lib and makefiles --- Makefile | 5 +++++ scripts/build_rln.sh | 30 ++++++++++++++++++++++-------- vendor/negentropy | 2 +- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index df4cba206b..7db88b820b 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,12 @@ clean: | clean-librln .PHONY: negentropy LIBNEGENTROPY_BUILDDIR := $(CURDIR)/vendor/negentropy/cpp +ifeq ($(OS),Windows_NT) +LIBNEGENTROPY_FILE := libnegentropy.dll +else LIBNEGENTROPY_FILE := libnegentropy.so +endif + deps: | negentropy diff --git a/scripts/build_rln.sh b/scripts/build_rln.sh index d4843ca5ed..2788afd5dc 100755 --- a/scripts/build_rln.sh +++ b/scripts/build_rln.sh @@ -14,8 +14,21 @@ output_filename=$3 [[ -z "${rln_version}" ]] && { echo "No rln version specified"; exit 1; } [[ -z "${output_filename}" ]] && { echo "No output filename specified"; exit 1; } +# Detect OS +case "$(uname -s)" in + Linux*) os=linux; + Darwin*) os=darwin; + MINGW*) os=windows; + MSYS*) os=windows; + *) os=unknown; +esac + # Get the host triplet -host_triplet=$(rustc --version --verbose | awk '/host:/{print $2}') +if [ "$os" = "windows" ]; then + host_triplet=$(rustc -vV | sed -n 's/host: //p') +else + host_triplet=$(rustc --version --verbose | awk '/host:/{print $2}') +fi tarball="${host_triplet}" @@ -27,7 +40,6 @@ else tarball+="-rln.tar.gz" fi - # Download the prebuilt rln library if it is available if curl --silent --fail-with-body -L \ "https://github.com/vacp2p/zerokit/releases/download/$rln_version/$tarball" \ @@ -40,12 +52,14 @@ then else echo "Failed to download ${tarball}" # Build rln instead - # first, check if submodule version = version in Makefile - cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" - submodule_version=$( - cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" \ - | jq -r '.packages[] | select(.name == "rln") | .version' - ) + cargo_metadata=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml") + + if [ "$os" = "windows" ]; then + submodule_version=$(echo "$cargo_metadata" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p') + else + submodule_version=$(echo "$cargo_metadata" | jq -r '.packages[] | select(.name == "rln") | .version') + fi + if [[ "v${submodule_version}" != "${rln_version}" ]]; then echo "Submodule version (v${submodule_version}) does not match version in Makefile (${rln_version})" echo "Please update the submodule to ${rln_version}" diff --git a/vendor/negentropy b/vendor/negentropy index f152076994..a8fb7e7d74 160000 --- a/vendor/negentropy +++ b/vendor/negentropy @@ -1 +1 @@ -Subproject commit f15207699493a129ac94448f930aa3d3fa748886 +Subproject commit a8fb7e7d741762a16e4b19a95ac22b08b4de17a8 From a3fc2c16080fbaafcf1d13fddfd00d5f9bbba678 Mon Sep 17 00:00:00 2001 From: Darshan K Date: Thu, 12 Sep 2024 01:17:25 +0530 Subject: [PATCH 2/3] chore: resolve error --- scripts/build_rln.sh | 10 +++++----- vendor/negentropy | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/build_rln.sh b/scripts/build_rln.sh index 2788afd5dc..0a1fc6165f 100755 --- a/scripts/build_rln.sh +++ b/scripts/build_rln.sh @@ -16,11 +16,11 @@ output_filename=$3 # Detect OS case "$(uname -s)" in - Linux*) os=linux; - Darwin*) os=darwin; - MINGW*) os=windows; - MSYS*) os=windows; - *) os=unknown; + Linux*) os=linux;; + Darwin*) os=darwin;; + MINGW*) os=windows;; + MSYS*) os=windows;; + *) os=unknown;; esac # Get the host triplet diff --git a/vendor/negentropy b/vendor/negentropy index a8fb7e7d74..34799b80de 160000 --- a/vendor/negentropy +++ b/vendor/negentropy @@ -1 +1 @@ -Subproject commit a8fb7e7d741762a16e4b19a95ac22b08b4de17a8 +Subproject commit 34799b80de1c70fef1ea353cb38c14ef1fe6c636 From f627eecf39978321b872b9aa076675511c66864f Mon Sep 17 00:00:00 2001 From: Darshan K <35736874+darshankabariya@users.noreply.github.com> Date: Fri, 20 Sep 2024 13:53:16 +0530 Subject: [PATCH 3/3] feat: update dll and set TEMP --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Makefile b/Makefile index 7db88b820b..dfc930cb26 100644 --- a/Makefile +++ b/Makefile @@ -29,12 +29,42 @@ GIT_SUBMODULE_UPDATE := git submodule update --init --recursive else # "variables.mk" was included. Business as usual until the end of this file. +OS := Windows_NT + ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10... detected_OS := Windows else detected_OS := $(strip $(shell uname)) endif +$(info Debug: OS check in Main from environment is $(OS)) +$(info "-----------------------------------------------") + +ifeq ($(OS),Windows_NT) + # Define a new temporary directory for Windows + TMP_DIR := $(HOME)/status-work/nwaku/tmp + # Ensure the temporary directory exists + $(shell mkdir -p $(TMP_DIR)) + # Add environment variable to use this temporary directory + export TMP := $(TMP_DIR) + export TEMP := $(TMP_DIR) +endif + +ifeq ($(OS),Windows_NT) + TMP_PARAMS := $(TMP_PARAMS) \ + --passL:"C:/msys64/mingw64/lib/libws2_32.a" \ + --passL:"C:/msys64/mingw64/lib/libbcrypt.a" \ + --passL:"C:/msys64/mingw64/lib/libcrypt32.a" \ + --passL:"C:/msys64/mingw64/lib/libuser32.a" \ + --passL:"C:/msys64/mingw64/lib/libadvapi32.a" \ + --passL:"C:/msys64/mingw64/lib/libkernel32.a" \ + --passL:"C:/msys64/mingw64/lib/libuuid.a" \ + --passL:"C:/msys64/mingw64/lib/libshlwapi.a" \ + --passL:"C:/msys64/mingw64/lib/libole32.a" + + NIM_PARAMS := $(TMP_PARAMS) $(NIM_PARAMS) # Update this path as necessary +endif + ########## ## Main ## ##########