summaryrefslogtreecommitdiff
path: root/jenkins-ci-build.sh
blob: 83b4687054dc8a9da296f9a6795ead3c9c577913 (plain)
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
#!/bin/bash

UNAME=`uname`
MASTER_DIR=`dirname $0`
BUILD_DEFAULT="release"

cd ${MASTER_DIR}

if [ "$OPTIONS" = "all_options" ];
then
	export USE_CODEC_VORBIS=1
	export USE_FREETYPE=1
fi

if [ "$UNAME" == "Darwin" ]; then
	CORES=`sysctl -n hw.ncpu`
elif [ "$UNAME" == "Linux" ]; then
	CORES=`awk '/^processor/ { N++} END { print N }' /proc/cpuinfo`
fi

echo "platform      : ${UNAME}"
echo "cores         : ${CORES}"
if [ "${BUILD_TYPE}" == "" ]; then
	BUILD_TYPE="${BUILD_DEFAULT}"
	echo "build type    : defaulting to ${BUILD_TYPE}"
else
	echo "build type    : ${BUILD_TYPE}"
fi

echo "environment   :"
export

if [ -n "${CPPCHECK}" ]; then
	if [ ! -f "${CPPCHECK}" ]; then
		command -v cppcheck >/dev/null
		if [ "$?" != "0" ]; then
			echo "cppcheck not installed"
			exit 1
		fi

		cppcheck --enable=all --max-configs=1 --xml --xml-version=2 code 2> ${CPPCHECK}
	fi

	ln -s ${CPPCHECK} cppcheck.xml
fi

make -j${CORES} distclean ${BUILD_TYPE}

exit $?