[TIZEN] Port build system from beta/forct/m34_1847
[platform/framework/web/chromium-efl.git] / tizen_src / build / build_desktop.sh
1 #!/bin/bash
2
3 SCRIPTDIR=$( cd $(dirname $0) ; pwd -P )
4 TOPDIR=$( cd ${SCRIPTDIR}/.. ; pwd -P )
5
6 source ${SCRIPTDIR}/common.sh
7
8 host_arch=$(getHostArch)
9
10 GYP_GENERATOR_OUTPUT=${TOPDIR}/"out.${host_arch}"
11
12 JHBUILD_DEPS="${GYP_GENERATOR_OUTPUT}/Dependencies/Root"
13
14 if [ "${host_arch}" == "x64" ]; then
15   _LIBDIR=lib64
16 elif [ "${host_arch}" == "ia32" ]; then
17   _LIBDIR=lib
18 fi
19
20 usage() {
21 cat << EOF
22 usage: $0 [OPTIONS]
23
24 Build desktop version of chromium-efl
25
26 OPTIONS:
27    -h, --help    Show this message
28    --skip-gyp    Skip restore_gyp, jhbuild and gyp_chromium steps
29    --ccache      configure ccache installed in your system
30    --skip-ninja  Skip ninja step
31    --debug       build debug version of chromium-efl (in $GYP_GENERATOR_OUTPUT/Debug instead of default $GYP_GENERATOR_OUTPUT/Release)
32
33 examples:
34 $0 --skip-gyp
35 $0 --skip-gyp --ccache
36 $0 --skip-ninja
37 EOF
38   exit
39 }
40
41 SKIP_GYP=0
42 USE_CCACHE=0
43 SKIP_NINJA=0
44
45 BUILD_SUBDIRECTORY=Release
46
47 if echo "$@" | grep -cq '\(\(\-\-help\)\|\(\-h\)\)'; then
48   usage
49 fi
50
51 if echo "$@" | grep -cq '\-\-skip-gyp'; then
52   SKIP_GYP=1
53 fi
54
55 if echo "$@" | grep -cq '\-\-skip-ninja'; then
56   SKIP_NINJA=1
57 fi
58
59 if echo "$@" | grep -cq '\-\-ccache'; then
60   USE_CCACHE=1
61 fi
62
63 if echo "$@" | grep -cq '\-\-debug'; then
64   BUILD_SUBDIRECTORY=Debug
65 fi
66
67 set -e
68
69 if [ "$SKIP_GYP" == "0" ]; then
70   ${TOPDIR}/build/gyp_chromiumefl.sh
71 fi
72
73 if [ "$SKIP_NINJA" == "0" ]; then
74   if [ "$USE_CCACHE" == "1" ]; then
75     echo using ccache
76     set +e
77     source $TOPDIR/build/ccache_env.sh desktop
78     set -e
79   fi
80   export LD_LIBRARY_PATH="${JHBUILD_DEPS}/${_LIBDIR}:$LD_LIBRARY_PATH"
81   ninja -C ${GYP_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
82 fi