-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
42 lines (33 loc) · 1.04 KB
/
build.sh
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
#!/usr/bin/env bash
# Parameters
VERSION_BUILD="4111"
OUTPUT_PATH="bin"
SOURCE_PATH="engine"
VERSION_FILE="version.h"
ELF_FILE="OpenBOR.elf"
BIN_FILE="OpenBOR.bin"
# Set the working directory
cd "$SOURCE_PATH"
# Check for version.h file
# As the original "version.sh" script is executed from SVN, the VERSION_BUILD is
# always empty and we don't want to update this script for now...
if [ ! -f "version.h" ]; then
./version.sh
# Avoid the -i switch as this causes problems under MinGW.
# See https://stackoverflow.com/a/14410957/3726096
sed "s/\VERSION_BUILD \"\"/VERSION_BUILD \"$VERSION_BUILD\"/g" "$VERSION_FILE" > "$VERSION_FILE".tmp
mv "$VERSION_FILE".tmp "$VERSION_FILE"
fi
# Building the Sega Dreamcast binary
make clean BUILD_DC=1
make BUILD_DC=1
# Back to our original location
cd ..
# Moving binaries in the "bin/" directory if possible
if [ -f "$SOURCE_PATH/$ELF_FILE" ]; then
if [ ! -d "$OUTPUT_PATH" ]; then
mkdir "$OUTPUT_PATH"
fi
mv "$SOURCE_PATH/$ELF_FILE" "$OUTPUT_PATH"
mv "$SOURCE_PATH/$BIN_FILE" "$OUTPUT_PATH"
fi