diff --git a/Makefile b/Makefile index 33a5ac019..e6d95cf34 100644 --- a/Makefile +++ b/Makefile @@ -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)") diff --git a/config.nims b/config.nims index fd9a62888..37a8d9a0d 100644 --- a/config.nims +++ b/config.nims @@ -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") diff --git a/scripts/build_rln.sh b/scripts/build_rln.sh index b5e4da0b6..992c1f434 100755 --- a/scripts/build_rln.sh +++ b/scripts/build_rln.sh @@ -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')