File: libretro-build.sh

package info (click to toggle)
libretro-core-info 1.3.6%2Bgit20160816-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 1,292 kB
  • ctags: 129
  • sloc: sh: 5,078; makefile: 15
file content (307 lines) | stat: -rwxr-xr-x 7,639 bytes parent folder | download
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
#! /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="$WORKDIR/dist"
	RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR"
fi

if [ -z "$JOBS" ]; then
	JOBS=7
fi

if [ "$HOST_CC" ]; then
	CC="${HOST_CC}-gcc"
	CXX="${HOST_CC}-g++"
	CXX11="${HOST_CC}-g++"
	STRIP="${HOST_CC}-strip"
fi

if [ -z "$MAKE" ]; then
	if uname -s | grep -i MINGW > /dev/null 2>&1; then
		MAKE=mingw32-make
	else
		if type gmake > /dev/null 2>&1; then
			MAKE=gmake
		else
			MAKE=make
		fi
	fi
fi

if [ -z "$CC" ]; then
	if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
		CC=cc
	elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then
		CC=mingw32-gcc
	else
		CC=gcc
	fi
fi

if [ -z "$CXX" ]; then
	if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
		CXX=c++
		CXX11="clang++ -std=c++11 -stdlib=libc++"
		# FIXME: Do this right later.
		if [ "$ARCH" = "i386" ]; then
			CC="cc -arch i386"
			CXX="c++ -arch i386"
			CXX11="clang++ -arch i386 -std=c++11 -stdlib=libc++"
		fi
	elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then
		CXX=mingw32-g++
		CXX11=mingw32-g++
	else
		CXX=g++
		CXX11=g++
	fi
fi

FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET


echo "CC = $CC"
echo "CXX = $CXX"
echo "CXX11 = $CXX11"
echo "STRIP = $STRIP"


. "$BASE_DIR/libretro-build-common.sh"

# These are cores which only work properly right
# now on little-endian architecture systems

build_default_cores_little_endian_only() {
	libretro_build_core tgbdual
	if [ $platform != "psp1" ]; then
		libretro_build_core gpsp
		libretro_build_core o2em
	fi
	libretro_build_core 4do

	if [ $platform != "qnx" ]; then
		if [ $platform != "psp1" ]; then
			libretro_build_core desmume
		fi
		libretro_build_core picodrive
	fi

	# TODO - Verify endianness compatibility - for now exclude
	libretro_build_core virtualjaguar
}

# These are C++11 cores

build_default_cores_cpp11() {
	libretro_build_core dinothawr
	libretro_build_core stonesoup
	libretro_build_core bsnes_accuracy
	libretro_build_core bsnes_balanced
	libretro_build_core bsnes_performance
	libretro_build_core bsnes_mercury_accuracy
	libretro_build_core bsnes_mercury_balanced
	libretro_build_core bsnes_mercury_performance
	libretro_build_core mame2014
	libretro_build_core mame
}

# These are cores intended for platforms with a limited
# amount of RAM, where the full version would not fit
# into memory

build_default_cores_small_memory_footprint() {
	libretro_build_core fb_alpha_cps1
	libretro_build_core fb_alpha_cps2
	libretro_build_core fb_alpha_neo
}

build_default_cores_libretro_gl() {
	# Reasons for not compiling this yet on these targets (other than endianness issues)
	# 1) Wii/NGC - no PPC dynarec, no usable graphics plugins that work with GX
	# 2) PS3     - no PPC dynarec, PSGL is GLES 1.0 while graphics plugins right now require GL 2.0+/GLES2
	# 3) QNX     - Compilation issues, ARM NEON compiler issues
	if [ $platform != "qnx" ]; then
		libretro_build_core mupen64plus
	fi

	# Graphics require GLES 2/GL 2.0
	if [ $platform != "psp1" ]; then
		libretro_build_core 3dengine
	fi
}

# These build everywhere libretro-build.sh works
# (They also use rules builds, which will help later)

build_default_cores() {
	if [ $platform == "wii" ] || [ $platform == "ngc" ] || [ $platform == "psp1" ]; then
		build_default_cores_small_memory_footprint
	fi
	libretro_build_core 2048
	libretro_build_core bluemsx
	if [ $platform != "psp1" ] && [ $platform != "ngc" ] && [ $platform != "wii" ] && [ $platform != "ps3" ] && [ $platform != "sncps3" ] && [ $platform != "vita" ]; then
		libretro_build_core dosbox
	fi
	libretro_build_core snes9x2005
	if [ $platform != "psp1" ]; then
		# Excluded for binary size reasons
		libretro_build_core fb_alpha
	fi
	libretro_build_core fceumm
	libretro_build_core fmsx
	libretro_build_core gambatte
	libretro_build_core handy
	libretro_build_core stella
	libretro_build_core nestopia
	libretro_build_core nxengine
	libretro_build_core prboom
	libretro_build_core quicknes
	libretro_build_core snes9x2010
	libretro_build_core tyrquake
	libretro_build_core vba_next
	libretro_build_core vecx

	if [ $platform != "psp1" ]; then
		# (PSP) Compilation issues
		libretro_build_core mgba
		# (PSP) Performance issues
		libretro_build_core genesis_plus_gx
	fi

	if [ $platform != "psp1" ] && [ $platform != "wii" ] && [ $platform != "ngc" ] && [ $platform != "vita" ]; then
		# (PSP/NGC/Wii/Vita) Performance and/or binary size issues
		libretro_build_core bsnes_cplusplus98
		libretro_build_core mame2003
		libretro_build_core mednafen_gba
	fi

	libretro_build_core mednafen_lynx
	libretro_build_core mednafen_ngp
	libretro_build_core mednafen_pce_fast

	libretro_build_core mednafen_supergrafx
	libretro_build_core mednafen_vb
	libretro_build_core mednafen_wswan

	libretro_build_core gw
	libretro_build_core prosystem

	if [ $platform != "ps3" ] && [ $platform != "sncps3" ] && [ $platform != "vita" ]; then
		libretro_build_core 81
		libretro_build_core fuse
		libretro_build_core lutro
	fi

	if [ $platform != "ps3" ] && [ $platform != "sncps3" ] && [ $platform != "wii" ] && [ $platform != "ngc" ] && [ $platform != "vita" ]; then
		build_default_cores_little_endian_only

		build_default_cores_libretro_gl

		if [ $platform != "psp1" ]; then
			# (PS3/NGC/Wii/PSP) Excluded for performance reasons
			libretro_build_core snes9x
			libretro_build_core vbam

			# The only reason ScummVM won't be compiled in yet is
			# 1) Wii/NGC/PSP - too big in binary size
			# 2) PS3 - filesystem API issues
			libretro_build_core scummvm

			# Excluded for performance reasons
			libretro_build_core mednafen_pcfx
			libretro_build_core mednafen_psx
			if [ $platform != "qnx" ]; then
				libretro_build_core mednafen_snes
			fi
		fi

		# Could work on PS3/Wii right now but way too slow right now,
		# and messed up big-endian colors
		libretro_build_core yabause

		# Compilation/port status issues
		libretro_build_core hatari
		libretro_build_core meteor


		if [ $platform != "qnx" ] && [ $platform != "psp1" ] && [ $platform != "vita" ]; then
			libretro_build_core mame2010

			build_default_cores_cpp11

			# Just basic compilation issues right now for these platforms
			libretro_build_core emux

			if [ $platform != "win" ]; then
				# Reasons for not compiling this on Windows yet -
				# (Windows) - Doesn't work properly
				# (QNX)     - Compilation issues
				# (PSP1)    - Performance/compilation issues
				# (Wii)     - Performance/compilation issues
				# (PS3)     - Performance/compilation issues
				libretro_build_core pcsx_rearmed
			fi

			if [ $platform != "ios" ] || [ $platform != "ios9" ]; then
				# Would need ffmpeg libraries baked in
				libretro_build_core ffmpeg
				libretro_build_core ppsspp

				libretro_build_core bnes
			fi
		fi

		build_libretro_test
	fi
}


mkdir -p "$RARCH_DIST_DIR"

if [ -n "$SKIP_UNCHANGED" ]; then
	[ -z "$BUILD_REVISIONS_DIR" ] && BUILD_REVISIONS_DIR="$WORKDIR/build-revisions"
	echo "mkdir -p \"$BUILD_REVISIONS_DIR\""
	mkdir -p "$BUILD_REVISIONS_DIR"
fi

if [ -n "$1" ]; then
	while [ -n "$1" ]; do
		case "$1" in
			--nologs)
				LIBRETRO_LOG_SUPER=""
				LIBRETRO_LOG_CORE=""
				;;
			*)
				# New style (just generic cores for now)
				want_cores="$want_cores $1"
				;;
		esac
		shift
	done
fi

libretro_log_init
if [ -n "$want_cores" ]; then
	for core in $want_cores; do
		libretro_build_core $core
	done
else
	build_default_cores
fi
summary