2025-03-05 21:21:59 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
echo "- - - - - - - - - - Windows Setup Script - - - - - - - - - -"
|
|
|
|
|
|
2026-05-26 10:51:43 +02:00
|
|
|
# Mirrors the steps in .github/workflows/windows-build.yml so a local MSYS2
|
|
|
|
|
# build matches CI. Builds go through the nimble build system: Nim/Nimble are
|
|
|
|
|
# installed via scripts/install_nim.sh + install_nimble.sh, dependencies are
|
|
|
|
|
# fetched into nimbledeps/ by `nimble setup --localdeps`, and the nat-libs and
|
|
|
|
|
# bearssl C sources are rebuilt from there.
|
|
|
|
|
|
2025-03-05 21:21:59 +05:30
|
|
|
success_count=0
|
|
|
|
|
failure_count=0
|
|
|
|
|
|
|
|
|
|
# Function to execute a command and check its status
|
|
|
|
|
execute_command() {
|
|
|
|
|
echo "Executing: $1"
|
|
|
|
|
if eval "$1"; then
|
|
|
|
|
echo -e "✓ Command succeeded \n"
|
|
|
|
|
((success_count++))
|
|
|
|
|
else
|
|
|
|
|
echo -e "✗ Command failed \n"
|
|
|
|
|
((failure_count++))
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "1. -.-.-.-- Set PATH -.-.-.-"
|
2026-05-26 10:51:43 +02:00
|
|
|
export PATH="$HOME/.nimble/bin:/c/msys64/usr/bin:/c/msys64/mingw64/bin:/c/msys64/usr/lib:/c/msys64/mingw64/lib:$PATH"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
|
|
|
|
echo "2. -.-.-.- Verify dependencies -.-.-.-"
|
2026-05-26 10:51:43 +02:00
|
|
|
execute_command "which gcc g++ make cmake cargo upx rustc python nasm"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
|
|
|
|
echo "3. -.-.-.- Updating submodules -.-.-.-"
|
|
|
|
|
execute_command "git submodule update --init --recursive"
|
|
|
|
|
|
2026-05-26 10:51:43 +02:00
|
|
|
echo "4. -.-.-.- Installing nasm -.-.-.-"
|
|
|
|
|
execute_command "bash scripts/install_nasm_in_windows.sh"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
2026-05-26 10:51:43 +02:00
|
|
|
echo "5. -.-.-.- Installing Nim and Nimble -.-.-.-"
|
|
|
|
|
execute_command "make install-nimble"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
2026-05-26 10:51:43 +02:00
|
|
|
echo "6. -.-.-.- Patch nimble.lock for Windows nim checksum -.-.-.-"
|
|
|
|
|
# nimble.exe uses Windows Git (core.autocrlf=true by default), which converts
|
|
|
|
|
# LF->CRLF on checkout. This changes the SHA1 of the nim package source tree
|
|
|
|
|
# relative to the Linux-computed checksum stored in nimble.lock. Patch the lock
|
|
|
|
|
# file with the Windows-computed checksum before nimble reads it.
|
|
|
|
|
execute_command "sed -i 's/68bb85cbfb1832ce4db43943911b046c3af3caab/a092a045d3a427d127a5334a6e59c76faff54686/g' nimble.lock"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
2026-05-26 10:51:43 +02:00
|
|
|
echo "7. -.-.-.- Installing nimble deps -.-.-.-"
|
|
|
|
|
execute_command "nimble setup --localdeps -y"
|
|
|
|
|
execute_command "make rebuild-nat-libs-nimbledeps CC=gcc"
|
|
|
|
|
execute_command "make rebuild-bearssl-nimbledeps CC=gcc"
|
|
|
|
|
execute_command "touch nimbledeps/.nimble-setup"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
2026-05-26 10:51:43 +02:00
|
|
|
echo "8. -.-.-.- Creating tmp directory -.-.-.-"
|
|
|
|
|
execute_command "mkdir -p tmp"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
|
|
|
|
echo "9. -.-.-.- Building wakunode2 -.-.-.- "
|
2026-05-26 10:51:43 +02:00
|
|
|
execute_command "make wakunode2 LOG_LEVEL=DEBUG V=3 -j8"
|
2025-03-05 21:21:59 +05:30
|
|
|
|
2025-06-26 01:03:40 +05:30
|
|
|
echo "10. -.-.-.- Building libwaku -.-.-.- "
|
|
|
|
|
execute_command "make libwaku STATIC=0 LOG_LEVEL=DEBUG V=1 -j8"
|
|
|
|
|
|
2025-03-05 21:21:59 +05:30
|
|
|
echo "Windows setup completed successfully!"
|
|
|
|
|
echo "✓ Successful commands: $success_count"
|
|
|
|
|
echo "✗ Failed commands: $failure_count"
|