Skip to content

Commit

Permalink
chore: give cross plateform support
Browse files Browse the repository at this point in the history
  • Loading branch information
darshankabariya committed Oct 17, 2024
1 parent f2f313f commit 553c728
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ 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

ifeq ($(OS),Windows_NT)
# Determine the OS
detected_OS := $(shell uname -s)
ifeq ($(detected_OS),Darwin)
detected_OS := Darwin
else ifeq ($(detected_OS),Linux)
detected_OS := Linux
else ifneq (,$(findstring MINGW,$(detected_OS)))
detected_OS := Windows
else
detected_OS := Unknown
endif

ifeq ($(detected_OS),Windows)
# Add the necessary libraries to the linker flags
LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll
NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)")
Expand Down
4 changes: 3 additions & 1 deletion config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ if defined(windows):
for dir in walkDir("./vendor"):
if dir.kind == pcDir:
switch("path", dir.path)
# disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries
switch("path", dir.path / "src")

# disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries
switch("passL", "-Wl,--no-insert-timestamp")
# increase stack size
switch("passL", "-Wl,--stack,8388608")
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_rln.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ else
# first, check if submodule version = version in Makefile
cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml"

if [ "$os" = "windows" ]; then
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p')
else
submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | jq -r '.packages[] | select(.name == "rln") | .version')
Expand Down

0 comments on commit 553c728

Please sign in to comment.