Skip to content

Commit

Permalink
feat: everuthing in one comments
Browse files Browse the repository at this point in the history
  • Loading branch information
darshankabariya committed Jan 28, 2025
1 parent b406b7b commit d6048bd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ ifeq ($(detected_OS),Windows)
export TMP := $(TMP_DIR)
export TEMP := $(TMP_DIR)

# Add the necessary libraries to the linker flags
LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll -lminiupnpc
MINGW_PATH = /c/msys64/mingw64
NIM_PARAMS += --passL:"-L$(MINGW_PATH)/lib"
LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll -lminiupnpc -lnatpmp -lpq
NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)")
NIM_PARAMS += --passC:"-I$(MINGW_PATH)/include"
endif

##########
Expand Down
6 changes: 6 additions & 0 deletions config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ else:

if defined(windows):
switch("passL", "rln.lib")
switch("define", "postgres=false")
# Exclude postgres-related files from compilation

# Automatically add all vendor subdirectories
for dir in walkDir("./vendor"):
if dir.kind == pcDir:
switch("path", dir.path)
switch("path", dir.path / "src")

switch("path", "./vendor/nim-nat-traversal")
switch("path", "./vendor/nim-nat-traversal/vendor/libnatpmp-upstream")
switch("path", "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc")

# disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries
switch("passL", "-Wl,--no-insert-timestamp")
# increase stack size
Expand Down
27 changes: 19 additions & 8 deletions scripts/windows_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ build_component() {
local dir="$1"
local command="$2"
local name="$3"

echo "Building $name"
if [ -d "$dir" ]; then
change_directory "$dir"
Expand All @@ -53,16 +53,27 @@ execute_command "mkdir -p tmp"
echo "3. Building Nim"
build_component "vendor/nimbus-build-system/vendor/Nim" "./build_all.bat" "Nim"

echo "4. Building miniupnpc"
echo "4. changing branch"
cd "vendor/nim-nat-traversal/vendor/miniupnp"
git checkout little_chore_windows_support
cd ../../../..

echo "5. Building miniupnpc"
build_component "vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc" "./mingw32make.bat" "miniupnpc"

echo "5. Building libnatpmp"
build_component "vendor/nim-nat-traversal/vendor/libnatpmp-upstream" "./build.bat" "libnatpmp"
echo "6. Building libnatpmp"
cd ./vendor/nim-nat-traversal/vendor/libnatpmp-upstream
./build.bat
mv natpmp.a libnatpmp.a
cd ../../../../

echo "6. Building libunwind"
build_component "vendor/nim-libbacktrace" "make install/usr/lib/libunwind.a" "libunwind"
echo "7. Building libunwind"
cd vendor/nim-libbacktrace
make all
make install/usr/lib/libunwind.a
cd ../../

echo "7. Building wakunode2"
execute_command "make wakunode2 V=1 NIMFLAGS="-d:disableMarchNative -d:postgres -d:chronicles_colors:none" "
echo "8. Building wakunode2"
make wakunode2 V=1

echo "Windows setup completed successfully!"

0 comments on commit d6048bd

Please sign in to comment.