Refactoring of build scripts
[platform/framework/web/chromium-efl.git] / tizen_src / build / common.sh
1 #!/bin/bash
2
3 pushd `dirname ${BASH_SOURCE[0]}` > /dev/null
4 SCRIPT_PATH=`pwd -L`
5 popd > /dev/null
6
7 PROJECT_ROOT_PATH="${SCRIPT_PATH}/.."
8 if [[ -z "${CHROME_SRC}" ]]; then
9   # If $CHROME_SRC was not set, assume src subfolder in project directory is CHROME_SRC.
10   export CHROME_SRC="${PROJECT_ROOT_PATH}/src"
11 fi
12
13 function applyPatch {
14   directory=$1
15   shift
16   patchfile=$1
17   shift
18   echo Applying $patchfile in $directory
19   pushd "$directory" > /dev/null
20   patch -p1 $@ < "$patchfile"
21   popd > /dev/null
22 }
23
24 function getHostOs() {
25   echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
26 }
27
28 function getHostArch() {
29   echo $(uname -m | sed -e \
30         's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/')
31 }
32
33 function getPythonVersion() {
34   echo $(python --version  2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
35 }