[M73 Migration][Product TV] Enable tizen 5.5 musem build by default
[platform/framework/web/chromium-efl.git] / tizen_src / build / common.sh
index 983c005..b1cf646 100755 (executable)
@@ -3,21 +3,19 @@
 export SCRIPTDIR=$(readlink -e $(dirname $0))
 export TOPDIR=$(readlink -f "${SCRIPTDIR}/../..")
 export CHROME_SRC="${TOPDIR}"
-# Please set DEFAULT_TIZEN_VERSION to empty value for the latest tizen version
+# Please set DEFAULT_TIZEN_VERSION to 'latest' for the latest tizen version
 # or set DEFAULT_TIZEN_VERSION to current tizen version for the others.
-export DEFAULT_TIZEN_VERSION=
+export DEFAULT_TIZEN_VERSION=latest
 
 if [ "$(echo "$@" | grep -e "--tizen")" != "" ]; then
   tizen_version=$(echo $@ | sed -e 's#.*--tizen_\([0-9.]*\).*#\1#')
   if $(echo $tizen_version | grep -qe "^[-\?[0-9]\+\.\?[0-9]*$" && echo true || echo false); then
     DEFAULT_TIZEN_VERSION=$tizen_version
   else
-    DEFAULT_TIZEN_VERSION=
+    DEFAULT_TIZEN_VERSION=latest
   fi
 fi
 
-supported_targets=("tizen" "desktop")
-
 function getHostOs() {
   echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
 }
@@ -56,12 +54,10 @@ OPTIONS:
    --no-content-shell    Don't build content_shell application
    --debug               Build debug version of chromium-efl (out.${host_arch}/Debug instead of out.${host_arch}/Release)
    -jN                   Set number of jobs, just like with make or ninja
-   --skip-gyp            Skip restore_gyp, jhbuild and gyp_chromium steps
    --skip-ninja          Skip ninja step
 
 examples:
-$0 --skip-gyp
-$0 --skip-gyp --ccache
+$0 --ccache
 $0 --skip-ninja
 EOF
   exit
@@ -69,9 +65,8 @@ EOF
 
 function parseHostBuildScriptParams() {
 
-  export SKIP_GYP=0
   export USE_CCACHE=0
-  export USE_CLANG=0
+  export USE_CLANG=1
   export FORCE_JHBUILD=0
   export SKIP_NINJA=0
   export BUILD_EWK_UNITTESTS=0
@@ -87,9 +82,6 @@ function parseHostBuildScriptParams() {
       -h|--help)
         hostBuldScriptUsage ${0}
         ;;
-      --skip-gyp)
-        export SKIP_GYP=1
-        ;;
       --skip-gn)
         export SKIP_GN=1
         ;;
@@ -98,8 +90,8 @@ function parseHostBuildScriptParams() {
         export USE_CCACHE=1
         source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
         ;;
-      --clang)
-        export USE_CLANG=1
+      --gcc)
+        export USE_CLANG=0
         ;;
       --no-content-shell)
         export BUILD_CONTENT_SHELL=0
@@ -131,24 +123,6 @@ function parseHostBuildScriptParams() {
   done
 }
 
-function hostGypChromiumEfl() {
-  if [[ $SKIP_GYP == 0 ]]; then
-    local XWALK_ARG=""
-    local COMPONENT_ARG=""
-    if [[ $BUILD_XWALK == 1 ]]; then
-      XWALK_ARG="--xwalk"
-    fi
-    if [[ $COMPONENT_BUILD == 1 ]]; then
-      COMPONENT_ARG="-Dcomponent=shared_library"
-    fi
-    ${TOPDIR}/tizen_src/build/gyp_chromiumefl.sh \
-      $XWALK_ARG \
-      $COMPONENT_ARG \
-      -Doutdir="$TOPDIR/out.$(getHostArch)" \
-      $@
-  fi
-}
-
 function hostGnChromiumEfl() {
   if [[ $SKIP_GN != 1 ]]; then
     local XWALK_ARG=""
@@ -159,8 +133,6 @@ function hostGnChromiumEfl() {
     ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
       $XWALK_ARG \
       $COMPONENT_ARG \
-      "outdir=\"$TOPDIR/out.$(getHostArch)\"" \
-      "chromium_efl_tizen_version=30" \
       $@
   fi
 }
@@ -212,8 +184,9 @@ function setupAndExecuteTargetBuild() {
   local MIRROR=0
 
   # "|| :" means "or always succeeding built-in command"
-  PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" | uniq || :)
-  ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | uniq || :)
+  PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" | head -1 || :)
+  ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | head -1 || :)
+  GBS_ROOT=$(echo "$@" | grep -Po "(?<=\-B\s)[^\s]*" | head -1 || :)
 
   while [[ $# > 0 ]]; do
     count=$(( $count + 1 ))
@@ -228,11 +201,6 @@ function setupAndExecuteTargetBuild() {
         count=$(( $count + 1 ))
         ARGS[$count]="_skip_ninja 1"
     ;;
-    --skip-gyp)
-        ARGS[$count]=--define
-        count=$(( $count + 1 ))
-        ARGS[$count]="_skip_gyp 1"
-    ;;
     --skip-gn)
         ARGS[$count]=--define
         count=$(( $count + 1 ))
@@ -250,6 +218,11 @@ function setupAndExecuteTargetBuild() {
         RPMLINT=1
         count=$(( $count + 1 ))
     ;;
+    --nodebug)
+        ARGS[$count]=--define
+        count=$(( $count + 1 ))
+        ARGS[$count]="_nodebug 1"
+    ;;
     --noinit)
         NOINIT=1
         ARGS[$count]="$1"
@@ -258,8 +231,18 @@ function setupAndExecuteTargetBuild() {
     --mirror)
         MIRROR=1
     ;;
+    --gcc)
+        ARGS[$count]=--define
+        count=$(( $count + 1 ))
+        ARGS[$count]="_gcc 1"
+    ;;
+    --clang)
+        ARGS[$count]=--define
+        count=$(( $count + 1 ))
+        ARGS[$count]="_clang 1"
+    ;;
     --standard*)
-        if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
+        if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
           echo $1
           PROFILE=tz_$(echo $1 | sed 's/--//g')
         elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
@@ -269,7 +252,7 @@ function setupAndExecuteTargetBuild() {
         fi
     ;;
     --emulator*)
-        if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
+        if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
           PROFILE=tz_$(echo $1 | sed 's/--//g')
         elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
           PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
@@ -286,28 +269,19 @@ function setupAndExecuteTargetBuild() {
     shift;
   done
 
-  if [ "$exclusive_options" -gt 1 ]; then
-    echo "ERROR: --libs and --crosswalk-bin are mutually exclusive parameters."
-    exit 1
-  fi
-
-  if [ "$target" == "libs" ]; then
-    SPEC_FILE="chromium-efl-libs.spec"
-  elif [ "$target" == "crosswalk-bin" ]; then
-    SPEC_FILE="crosswalk-bin.spec"
-  fi
-
   if [ "$PROFILE" == "" ]; then
     if [[ $platform == "mobile" ]]; then
       PROFILE=tzmb_3.0_target-TM1
     elif [[ $platform == "tv" ]]; then
-      if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
-        PROFILE=tztv_arm-kantm
+      if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
+        PROFILE=tztv_5.5_arm-musem
+      elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
+        PROFILE=tztv_4.0_arm-kantm
       else
-        PROFILE=tztv_${DEFAULT_TIZEN_VERSION}_arm-kantm
+        PROFILE=tztv_arm-musem
       fi
     elif [[ $platform == "da" ]]; then
-      if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
+      if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
         PROFILE=tzda_arm-kantm
       else
         PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
@@ -340,20 +314,30 @@ function setupAndExecuteTargetBuild() {
   fi
   echo "Set the architecture : $ARCHITECTURE"
 
-  if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
-    CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
+  if [ "$(echo "${PROFILE}" | grep -P "muse|kant|jazz|hawk|product")" == "" -a "$NOINIT" == 0 ]; then
+    processRpmlintOption $PROFILE $RPMLINT
   fi
-
-  EXTRA_PACK_OPTS=""
-  if [ "$PROFILE" == "tztv_v2.4_product" ]; then
-    EXTRA_PACK_OPTS="--extra-packs python-base-x86-arm,python-x86-arm,python-xml-x86-arm"
+  local BRANCH=$(echo $(basename $(git symbolic-ref HEAD)))
+  if [ "$(echo $BRANCH | grep dev)" != "" ]; then
+    BRANCH=dev
+  elif [ "$(echo $BRANCH | grep beta)" != "" ]; then
+    BRANCH=beta
+  else
+    BRANCH=release
   fi
+  local CHROMIUM_VERSION=$(echo $(head -n 1 chrome/VERSION) | sed -e 's/MAJOR=//g')
 
-  if [ "$(echo "${PROFILE}" | grep -P "kant|jazz|hawk|product")" == "" -a "$NOINIT" == 0 ]; then
-    processRpmlintOption $PROFILE $RPMLINT
+  local GBS_ROOT_OPT=
+  if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
+    CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
+    if [ "$GBS_ROOT" == "" ]; then
+      GBS_ROOT_OPT="-B ~/GBS-ROOT-M${CHROMIUM_VERSION}-${PROFILE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-${BRANCH^^}"
+    else
+      GBS_ROOT_OPT="-B $GBS_ROOT"
+    fi
   fi
 
-  gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS $EXTRA_PACK_OPTS --incremental
+  gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental $GBS_ROOT_OPT
 }
 
 function processRpmlintOption() {
@@ -381,7 +365,7 @@ function processRpmlintOption() {
     mkdir $BUILD_CONF_DIR
     URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
     # The latest version doesn't have tizen version in snapshot repository url.
-    if [ "$(echo $DEFAULT_TIZEN_VERSION)" == "" ]; then
+    if [ "$(echo $DEFAULT_TIZEN_VERSION)" == "latest" ]; then
       URL_TIZEN_VERSION=
     else
       URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-