-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·45 lines (39 loc) · 1.1 KB
/
build.sh
File metadata and controls
executable file
·45 lines (39 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/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
# Default compiler
compiler="gcc"
# Handle arguments for windows 9x build
for arg in "$@"; do
case $arg in
--9x)
if [[ "$unameOut" == MINGW64_NT* ]]; then
compiler="/opt/bin/i686-w64-mingw32-gcc"
windows_linker="$windows_linker -Wl,--subsystem,console:4"
else
echo "Error: Compiling for Windows 9x is only supported when running under the MinGW64 shell."
exit 1
fi
;;
esac
done
rm -f "bareiron$exe"
$compiler src/*.c -O2 -Iinclude -o "bareiron$exe" $windows_linker
"./bareiron$exe"