Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: windows support #3033

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##
##########
Expand Down Expand Up @@ -172,7 +202,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

Expand Down
30 changes: 22 additions & 8 deletions scripts/build_rln.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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" \
Expand All @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion vendor/negentropy
Submodule negentropy updated 1 files
+11 −5 cpp/Makefile
Loading