-
Notifications
You must be signed in to change notification settings - Fork 284
/
retroarch-build.sh
executable file
·129 lines (111 loc) · 2.61 KB
/
retroarch-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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#! /usr/bin/env bash
# vim: set ts=3 sw=3 noet ft=sh : bash
SCRIPT="${0#./}"
BASE_DIR="${SCRIPT%/*}"
WORKDIR="$PWD"
if [ "$BASE_DIR" = "$SCRIPT" ]; then
BASE_DIR="$WORKDIR"
else
if [[ "$0" != /* ]]; then
# Make the path absolute
BASE_DIR="$WORKDIR/$BASE_DIR"
fi
fi
. "$BASE_DIR/libretro-config.sh"
if [ -z "$RARCH_DIST_DIR" ]; then
RARCH_DIR="$BASE_DIR/dist"
RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR"
fi
die()
{
echo $1
#exit 1
}
if [ "$HOST_CC" ]; then
CC="${HOST_CC}-gcc"
CXX="${HOST_CC}-g++"
STRIP="${HOST_CC}-strip"
fi
if [ -z "$MAKE" ]; then
if [ "$(expr substr $(uname -s) 1 7)" = "MINGW32" ]; then
MAKE=mingw32-make
else
MAKE=make
fi
fi
if [ -z "$CC" ]; then
if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
CC=clang
elif [ "$(expr substr $(uname -s) 1 7)" = "MINGW32" ]; then
CC=mingw32-gcc
else
CC=gcc
fi
fi
if [ -z "$CXX" ]; then
if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
CXX=clang++
elif [ "$(expr substr $(uname -s) 1 7)" = "MINGW32" ]; then
CXX=mingw32-g++
else
CXX=g++
fi
fi
echo "CC = $CC"
echo "CXX = $CXX"
echo "STRIP = $STRIP"
mkdir -p "$RARCH_DIST_DIR"
export RARCHCFLAGS=""
check_deps()
{
if [ $ENABLE_GLES ]; then
echo "=== Enabling OpenGL ES ==="
export ENABLE_GLES="--enable-gles"
fi
if [ $ARM_NEON ]; then
echo "=== Enabling ARM NEON support ==="
export ENABLE_NEON="--enable-neon"
fi
if [ $ARM_HARDFLOAT ]; then
echo "=== Enabling ARM Hard float ABI support ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mfloat-abi=hard"
fi
if [ $ARM_SOFTFLOAT ]; then
echo "=== Enabling ARM Soft float ABI support ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mfloat-abi=softfp"
fi
if [ "$CORTEX_A8" ]; then
echo "=== Enabling Cortex A8 CFLAGS ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mcpu=cortex-a8 -mtune=cortex-a8"
fi
if [ "$CORTEX_A9" ]; then
echo "=== Enabling Cortex A9 CFLAGS ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mcpu=cortex-a9 -mtune=cortex-a9"
fi
if [ $ARM_NEON ]; then
echo "=== Enabling ARM NEON support (CFLAGS) ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mfpu=neon"
fi
}
build_retroarch()
{
cd "$BASE_DIR"
pwd
if [ -d "retroarch" ]; then
echo "=== Building RetroArch ==="
cd retroarch
check_deps
if [ -z "${NOCLEAN}" ]; then
./configure $ENABLE_GLES $ENABLE_NEON
${MAKE} -f Makefile platform=${FORMAT_COMPILER_TARGET} CC="gcc ${RARCHCFLAGS}" $COMPILER -j$JOBS clean || die "Failed to clean RetroArch"
fi
${MAKE} -f Makefile platform=${FORMAT_COMPILER_TARGET} CC="gcc ${RARCHCFLAGS}" $COMPILER -j$JOBS || die "Failed to build RetroArch"
else
echo "RetroArch not fetched, skipping ..."
fi
}
if [ $1 ]; then
$1
else
build_retroarch
fi