Files
barecopper/build.sh
jcfb 26f068bc09 support native windows binary compilation
* add winsock2 to globals.c

* add winsocket2 compatibility to main function

* add winsocket2 to packets.c

* and winsocket2 to procedures.c

* add winsocket 2 compatibility to tools.c

* add winsocket2 to varnum.c

* add mingw64 linker options to build.sh

* fix build

* style nitpicks

* remove old_fd

* update compilation instructions for windows

---------

Co-authored-by: p2r3 <41925384+p2r3@users.noreply.github.com>
2025-09-14 17:11:56 +03:00

28 lines
676 B
Bash
Executable File

#!/usr/bin/env bash
# Check for registries before attempting to compile, prevents confusion
if [ ! -f "include/registries.h" ]; then
echo "Error: 'include/registries.h' is missing."
echo "Please follow the 'Compilation' section of the README to generate it."
exit 1
fi
# Figure out executable suffix (for MSYS compilation)
case "$OSTYPE" in
msys*|cygwin*|win32*) exe=".exe" ;;
*) exe="" ;;
esac
# mingw64-specific linker options
windows_linker=""
unameOut="$(uname -s)"
case "$unameOut" in
MINGW64_NT*)
windows_linker="-static -lws2_32 -pthread"
;;
esac
rm -f "bareiron$exe"
gcc src/*.c -O3 -Iinclude -o "bareiron$exe" $windows_linker
"./bareiron$exe"