blob: 97a1e9ed641dd41a098d00182db7b28b3c4e166d (
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
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
|
#!/bin/bash
function exportVar {
NAME=$1
VALUE=$2
echo export $NAME=\"$VALUE\"
export $NAME="$VALUE"
}
function setenv {
if [ -z "$1" ]; then
echo "ERROR: setenv() requires one argument."
exit 1
fi
if [ -z "${NACL_SDK_ROOT}" ]; then
echo "ERROR: This script requires NACL_SDK_ROOT to be set."
exit 1
fi
ARCH_WIDTH=$1
if [ ${ARCH_WIDTH} = "32" ]; then
CROSS_ID=i686
elif [ ${ARCH_WIDTH} = "64" ]; then
CROSS_ID=x86_64
else
echo "ERROR: Unknown arch width: ${ARCH_WIDTH}"
exit 1
fi
OS_NAME=$(uname -s)
if [ $OS_NAME = "Darwin" ]; then
OS_SUBDIR="mac"
OS_SUBDIR_SHORT="mac"
OS_JOBS=4
elif [ $OS_NAME = "Linux" ]; then
OS_SUBDIR="linux"
OS_SUBDIR_SHORT="linux"
OS_JOBS=4
else
OS_SUBDIR="windows"
OS_SUBDIR_SHORT="win"
OS_JOBS=1
fi
NACL_TOOLCHAIN_ROOT=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86_newlib
NACL_BIN_PATH=${NACL_TOOLCHAIN_ROOT}/bin
export NACL_CROSS_PREFIX=${CROSS_ID}-nacl
if [[ -z "$NACL_MAKE_CCACHE" ]]; then
exportVar NACLCC ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-gcc
exportVar NACLCXX ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-g++
else
exportVar NACLCC "${NACL_MAKE_CCACHE} ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-gcc"
exportVar NACLCXX "${NACL_MAKE_CCACHE} ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-g++"
fi
exportVar NACLAR ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ar
exportVar NACLRANLIB ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ranlib
exportVar NACLLD ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ld
exportVar NACLSTRINGS ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strings
exportVar NACLSTRIP ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strip
exportVar CC "${NACLCC}"
exportVar CXX "${NACLCXX}"
exportVar AR "${NACLAR}"
exportVar RANLIB "${NACLRANLIB}"
exportVar PATH ${NACL_BIN_PATH}:${PATH};
exportVar C_INCLUDE_PATH "${NACL_SDK_ROOT}/include:${NACL_SDK_ROOT}/ports/include:${C_INCLUDE_PATH}"
exportVar CPLUS_INCLUDE_PATH "${NACL_SDK_ROOT}/include:${NACL_SDK_ROOT}/ports/include:${CPLUS_INCLUDE_PATH}"
exportVar GYP_DEFINES "skia_os=nacl skia_gpu=0 skia_arch_width=${ARCH_WIDTH}"
}
function build {
if [ -z "$1" ]; then
echo "ERROR: build() requires one argument."
exit 1
fi
setenv $1
export SKIA_OUT=out/nacl$1
make ${MAKE_ARGS}
}
MAKE_ARGS=""
while (( "$#" )); do
if [[ "$1" == "--use-ccache" ]];
then
if [[ -z "$NACL_MAKE_CCACHE" ]];
then
NACL_MAKE_CCACHE=$(which ccache)
fi
elif [ -z "${MAKE_ARGS}" ]; then
MAKE_ARGS="$1"
else
MAKE_ARGS="${MAKE_ARGS} $1"
fi
shift
done
if [[ -n "$NACL_MAKE_CCACHE" ]]; then
$NACL_MAKE_CCACHE --version &> /dev/null
if [[ "$?" != "0" ]]; then
echo "Unable to find ccache!"
exit 1
fi
fi
build 32 && \
build 64 && \
if ! [ -L platform_tools/nacl/out ]; then
ln -s ../../out platform_tools/nacl
fi
|