This patch combine three patch which is related to "--gcov" flag.
[platform/framework/web/chromium-efl.git] / tizen_src / build / common.sh
index 22686e8..8248d7e 100755 (executable)
@@ -3,6 +3,46 @@
 export SCRIPTDIR=$(readlink -e $(dirname $0))
 export TOPDIR=$(readlink -f "${SCRIPTDIR}/../..")
 export CHROME_SRC="${TOPDIR}"
+export LATEST_TIZEN_VERSION=8.0
+export DEFAULT_TIZEN_VERSION=$LATEST_TIZEN_VERSION
+
+if [ "$(echo "$@" | grep -e "--tizen")" != "" ]; then
+  tizen_version=$(echo $@ | sed -e 's#.*--tizen_\([0-9.]*\).*#\1#')
+  DEFAULT_TIZEN_VERSION=$tizen_version
+fi
+
+# Generate gbs.conf
+export PUBLIC_REPO_VERSION=
+if [ "$DEFAULT_TIZEN_VERSION" != "${LATEST_TIZEN_VERSION}" ]; then
+  PUBLIC_REPO_VERSION=-$DEFAULT_TIZEN_VERSION
+fi
+sed -e "s/@PUBLIC_REPO_VERSION@/$PUBLIC_REPO_VERSION/g" \
+    -e "s/@TIZEN_VERSION@/$DEFAULT_TIZEN_VERSION/g" \
+    tizen_src/build/gbs.conf.in > tizen_src/build/gbs.conf
+
+function getSystemDeps() {
+  local host_arch=$(getHostArch)
+  local platform=$1
+  local system_deps="--system-libraries
+                     libpng
+                     libxslt
+                     zlib
+                    "
+  # Tizen profile
+  if [ "$platform" != "desktop" ]; then
+    # Emulator profile
+    if [ "$host_arch" == "x86" -o "$host_arch" == "x64" ]; then
+      system_deps+="libjpeg
+                   "
+    fi
+    # Non product tv profiles on tizen 6.0
+    if [ "$platform" != "tv" -a "$DEFAULT_TIZEN_VERSION" == "6.0" ]; then
+      system_deps+="icu
+                   "
+    fi
+  fi
+  echo $system_deps
+}
 
 function getHostOs() {
   echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
@@ -10,11 +50,15 @@ function getHostOs() {
 
 function getHostArch() {
   echo $(uname -m | sed -e \
-        's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/;s/aarch64/arm64/')
+        's/i.86/x86/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/x86/;s/aarch64/arm64/;s/riscv.*/riscv64/')
+}
+
+function getGccVersion() {
+  echo $(gcc -dumpversion)
 }
 
 function getPythonVersion() {
-  echo $(python --version  2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
+  echo $(python3 --version  2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
 }
 
 function setIfUndef() {
@@ -27,7 +71,6 @@ function setIfUndef() {
     fi
 }
 
-
 function hostBuldScriptUsage() {
 cat << EOF
 usage: $1 [OPTIONS]
@@ -37,36 +80,40 @@ Build non gbs version of chromium-efl
 OPTIONS:
    -h, --help            Show this message
    --build-ewk-unittests Build ewk unittests
+   --enable-pepper-extensions    Enable Tizen Pepper Extensions
    --ccache              Configure ccache installed in your system
    --clang               Use chromium's clang compiler to build the sources
-   --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
-   --xwalk               Build crosswalk and friends
 
 examples:
-$0 --skip-gyp
-$0 --skip-gyp --ccache
+$0 --ccache
 $0 --skip-ninja
 EOF
   exit
 }
 
-function parseHostBuildScriptParams() {
+function undoReplacedGn() {
+  local system_deps=$(getSystemDeps $1)
+  if [ "$system_deps" != "" ]; then
+    echo "** use system lib : undo **"
+    # Restore gn files to their original states not to mess up the tree permanently.
+    $TOPDIR/build/linux/unbundle/replace_gn_files.py --undo $system_deps icu
+  fi
+}
 
-  export SKIP_GYP=0
+function parseHostBuildScriptParams() {
+  trap 'undoReplacedGn $1' SIGINT
   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
-  export BUILD_CONTENT_SHELL=1
-  export BUILD_XWALK=0
-  export BUILD_CHROMEDRIVER=0
+  export BUILD_CHROME=0
   export BUILD_SUBDIRECTORY=Release
   export COMPONENT_BUILD=0
+  export ENABLE_PEPPER_EXTENSIONS=0
 
   local platform="$1"
   shift
@@ -76,19 +123,19 @@ function parseHostBuildScriptParams() {
       -h|--help)
         hostBuldScriptUsage ${0}
         ;;
-      --skip-gyp)
-        export SKIP_GYP=1
+      --skip-gn)
+        export SKIP_GN=1
         ;;
       --ccache)
         echo using ccache
         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
+      --build-chrome)
+        export BUILD_CHROME=1
         ;;
       --force-jhbuild)
         export FORCE_JHBUILD=1
@@ -102,15 +149,12 @@ function parseHostBuildScriptParams() {
       --debug)
         export BUILD_SUBDIRECTORY="Debug"
         ;;
-      --xwalk)
-        export BUILD_XWALK=1
-        ;;
-      --chromedriver)
-        export BUILD_CHROMEDRIVER=1
-        ;;
       --component-build)
         export COMPONENT_BUILD=1
         ;;
+      --enable-pepper-extensions)
+        export ENABLE_PEPPER_EXTENSIONS=1
+        ;;
       -j*)
         export JOBS="$1"
         ;;
@@ -123,41 +167,48 @@ function parseHostBuildScriptParams() {
   done
 }
 
-function hostGypChromiumEfl() {
-  if [[ $SKIP_GYP == 0 ]]; then
+function hostGnChromiumEfl() {
+  if [[ $SKIP_GN != 1 ]]; then
     local XWALK_ARG=""
     local COMPONENT_ARG=""
-    if [[ $BUILD_XWALK == 1 ]]; then
-      XWALK_ARG="--xwalk"
-    fi
+    local PEPPER_EXTENSIONS_ARG=""
     if [[ $COMPONENT_BUILD == 1 ]]; then
-      COMPONENT_ARG="-Dcomponent=shared_library"
+      COMPONENT_ARG="component=shared_library"
     fi
-    ${TOPDIR}/tizen_src/build/gyp_chromiumefl.sh \
+    if [[ $ENABLE_PEPPER_EXTENSIONS == 1 ]]; then
+      PEPPER_EXTENSIONS_ARG="tizen_pepper_extensions=true"
+    fi
+    ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
       $XWALK_ARG \
       $COMPONENT_ARG \
-      -Doutdir="$TOPDIR/out.$(getHostArch)" \
+      $PEPPER_EXTENSIONS_ARG \
       $@
   fi
 }
 
 function hostNinja() {
+  local RESULT=0
   if [[ $SKIP_NINJA == 0 ]]; then
-    TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser"
+    if [[ $BUILD_CHROME == 1 ]]; then
+      TARGETS="content_shell chrome"
+    else
+      TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser"
+    fi
     if [[ $BUILD_EWK_UNITTESTS == 1 ]]; then
       TARGETS="$TARGETS ewk_unittests"
     fi
-    if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
-      TARGETS="$TARGETS content_shell dump_syms minidump_stackwalk"
-    fi
-    if [[ $BUILD_XWALK == 1 ]]; then
-      TARGETS="$TARGETS xwalk"
-    fi
     if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
       TARGETS="$TARGETS chromedriver"
     fi
-    BUILDDIR=${GYP_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
+    export BUILD_SUBDIRECTORY=""
+    BUILDDIR=${GN_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
     ninja -C $BUILDDIR ${JOBS} ${TARGETS}
+    RESULT=$?
+  fi
+  undoReplacedGn $1
+
+  if [[ $RESULT != 0 ]]; then
+    exit $RESULT
   fi
 }
 
@@ -175,172 +226,274 @@ function findElementInArray() {
 }
 
 function setupAndExecuteTargetBuild() {
-
   local platform="$1"
   shift
 
   local PROFILE
   local ARCHITECTURE
   local CONF_FLAG
-  local SPEC_FILE="chromium-efl.spec"
   local -a ARGS
 
-  # "|| :" means "or always succeeding built-in command"
-  PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" || :)
-  ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" || :)
-
-  if [ "$PROFILE" == "" ]; then
-    if [[ $platform == "mobile" ]]; then
-      PROFILE=tzmb_v3.0_arm64-wayland
-    elif [[ $platform == "mobile_emulator" ]]; then
-      PROFILE=tzmb_v3.0_emulator-wayland
-    elif [[ $platform == "tv" ]]; then
-      PROFILE=tztv_v3.0_arm-wayland
-    elif [[ $platform == "tv_emulator" ]]; then
-      PROFILE=tztv_v3.0_emulator-wayland
-    else
-      echo "Cannot set default PROFILE for platform=${platform}"
-      exit 1
-    fi
-  fi
-  echo "Set the profile : $PROFILE"
-
-  if [ "$ARCHITECTURE" == "" ]; then
-    if [[ $platform == "mobile" ]]; then
-      ARCHITECTURE=aarch64
-    elif [[ $platform == "mobile_emulator" ]]; then
-      ARCHITECTURE=i586
-    elif [[ $platform == "tv" ]]; then
-      ARCHITECTURE=armv7l
-    elif [[ $platform == "tv_emulator" ]]; then
-      ARCHITECTURE=i586
-    else
-      echo "Cannot set default ARCHITECTURE for platform=${platform}"
-      exit 1
-    fi
-  fi
-  echo "Set the architecture : $ARCHITECTURE"
-
-  if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
-    CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
-  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"
-  fi
+  local exclusive_options=0
+  local RPMLINT=0
+  local NOINIT=0
+  local MIRROR=0
+  local LOCAL_BUILD=1
+  local RELEASE_BUILD=0
+  local MAKE_SQUASHFS_RPM=0
+  local BUILD_CHROME=0
 
-  if [ "$(echo "${PROFILE}" | grep -Po "v3.0")" != "" ]; then
-    prepareTizen3Build $PROFILE
-  fi
+  # "|| :" means "or always succeeding built-in command"
+  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 || :)
 
-  local count=0
-  local exclusive_options=0
   while [[ $# > 0 ]]; do
-    count=$(( $count + 1 ))
     case "$1" in
     --debug)
-        ARGS[$count]=--define
-        count=$(( $count + 1 ))
-        ARGS[$count]="_debug_mode 1"
+        ARGS+=(--define "_debug_mode 1")
+    ;;
+    --gcov)
+        LOCAL_BUILD=0
+        ARGS+=(--define "_local_build 0")
+        ARGS+=(--define "_clang 0")
+        ARGS+=(--define "_no_lto 0")
+        ARGS+=(--define "gcov 1")
     ;;
     --skip-ninja)
-        ARGS[$count]=--define
-        count=$(( $count + 1 ))
-        ARGS[$count]="_skip_ninja 1"
+        ARGS+=(--define "_skip_ninja 1")
     ;;
-    --skip-gyp)
-        ARGS[$count]=--define
-        count=$(( $count + 1 ))
-        ARGS[$count]="_skip_gyp 1"
+    --skip-gn)
+        ARGS+=(--define "_skip_gn 1")
     ;;
-    --xwalk)
+    --ttrace)
         ARGS[$count]=--define
         count=$(( $count + 1 ))
-        ARGS[$count]="build_xwalk 1"
+        ARGS[$count]="_ttrace 1"
     ;;
     --component-build)
-        ARGS[$count]=--define
-        count=$(( $count + 1 ))
-        ARGS[$count]="component_build 1"
-    ;;
-    --libs)
-        target="libs"
-        exclusive_options=$(( $exclusive_options + 1 ))
+        ARGS+=(--define "component_build 1")
     ;;
-    --crosswalk-bin)
-        target="crosswalk-bin"
-        exclusive_options=$(( $exclusive_options + 1 ))
+    --disable-wrtjs)
+        ARGS+=(--define "_disable_wrt_js 1")
     ;;
     --gbs-debug)
-        ARGS[$count]=--debug
+        ARGS+=(--debug)
     ;;
-    --chromedriver)
-        ARGS[$count]=--define
-        count=$(( $count + 1 ))
-        ARGS[$count]="build_chromedriver 1"
+    --icu=*)
+        ARGS+=(--define "_use_system_icu $(echo $1 | sed -e 's/--icu=//g')")
+    ;;
+    --rpmlint)
+        RPMLINT=1
+    ;;
+    --nodebug)
+        ARGS+=(--define "_nodebug 1")
+    ;;
+    --noinit)
+        NOINIT=1
+        ARGS+=("$1")
+    ;;
+    --mirror)
+        MIRROR=1
+    ;;
+    --release)
+        LOCAL_BUILD=0
+        RELEASE_BUILD=1
+    ;;
+    --squashfs)
+        MAKE_SQUASHFS_RPM=1
+    ;;
+    --gcc)
+        LOCAL_BUILD=0
+        ARGS+=(--define "_clang 0")
+    ;;
+    --clang)
+        LOCAL_BUILD=0
+        ARGS+=(--define "_clang 1")
+    ;;
+    --standard*)
+        PROFILE=tz_$(echo $1 | sed 's/--//g')
+    ;;
+    --emulator*)
+        PROFILE=tz_$(echo $1 | sed 's/--//g')
+    ;;
+    --tizen*)
+    ;;
+    --build-chrome)
+        BUILD_CHROME=1
+        ARGS+=(--define "_build_chrome 1")
     ;;
     *)
-      ARGS[$count]="$1"
+      ARGS+=("$1")
     ;;
     esac
     shift;
   done
 
-  if [[ $exclusive_options -gt 1 ]]; then
-    echo "ERROR: --libs and --crosswalk-bin are mutually exclusive parameters."
-    exit 1
+  ARGS+=(--define "_make_squashfs_rpm $MAKE_SQUASHFS_RPM")
+
+  if [ "$LOCAL_BUILD" == "1" ]; then
+    ARGS+=(--define "_local_build 1")
+    local _jobs=$((`/usr/bin/getconf _NPROCESSORS_ONLN` / 2 - `ps -ef | grep " ninja " | wc -l` -1))
+    local _smp_mflags=-j$(if ((${_jobs} > 10)); then echo ${_jobs}; else echo 10; fi)
+    ARGS+=(--define "_costomized_smp_mflags $_smp_mflags")
+    # Default values
+    ARGS+=(--define "_clang 1")
+  fi
+
+  if [ "$RELEASE_BUILD" == "1" ]; then
+    ARGS+=(--define "_local_build 0")
+    if [[ $platform == "tv" ]]; then
+      ARGS+=(--define "_clang 1")
+    else
+      ARGS+=(--define "_clang 0")
+      ARGS+=(--define "_no_lto 0")
+    fi
+  fi
+
+  if [ "$PROFILE" == "" ]; then
+    if [[ $platform == "tv" ]]; then
+      PROFILE=tztv_${DEFAULT_TIZEN_VERSION}_arm-pontusm
+    elif [[ $platform == "da" ]]; then
+      PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
+    elif [[ $platform == "riscv" ]]; then
+      PROFILE=tz_${DEFAULT_TIZEN_VERSION}_riscv
+    elif [[ $platform == "wearable" ]]; then
+      PROFILE=tzwr_5.5_arm-spin
+    elif [[ $platform == "Base-X" ]]; then
+      PROFILE=tz_X
+    else
+      echo "Cannot set default PROFILE for platform=${platform}"
+      exit 1
+    fi
+  fi
+
+  if [ "$MIRROR" == "1" ]; then
+    PROFILE=${PROFILE}_mirror
+  fi
+
+  echo "Set the profile : $PROFILE"
+
+  if [ "$ARCHITECTURE" == "" ]; then
+    ARCHITECTURE=armv7l
   fi
+  echo "Set the architecture : $ARCHITECTURE"
 
-  cd $TOPDIR
-  rm -f packaging
-  ln -sf tizen_src/packaging packaging
+  if [ "$(echo "${PROFILE}" | grep -P "tz_standard")" != "" -a "$NOINIT" == 0 ]; then
+    processRpmlintOption $PROFILE $RPMLINT
+  fi
+  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 [ "$target" == "libs" ]; then
-    SPEC_FILE="chromium-efl-libs.spec"
-  elif [ "$target" == "crosswalk-bin" ]; then
-    SPEC_FILE="crosswalk-bin.spec"
+  local GBS_ROOT_OPT=
+  if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
+    CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
+    if [ "$GBS_ROOT" == "" ]; then
+      if [ "$BUILD_CHROME" == "1" ]; then
+        GBS_ROOT_OPT="-B ~/GBS-ROOT-M${CHROMIUM_VERSION}-${PROFILE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-CHROME-${BRANCH^^}"
+      else
+        GBS_ROOT_OPT="-B ~/GBS-ROOT-M${CHROMIUM_VERSION}-${PROFILE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-${BRANCH^^}"
+      fi
+    else
+      GBS_ROOT_OPT="-B $GBS_ROOT"
+    fi
   fi
 
-  gbs $CONF_FLAG build -P $PROFILE --spec $SPEC_FILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS $EXTRA_PACK_OPTS --incremental
+  processICU initialize_icu
+  gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental $GBS_ROOT_OPT
+  local RESULT=$?
+
+  undoReplacedGn $platform
+  processICU restore_icu
+
+  if [[ $RESULT != 0 ]]; then
+    exit $RESULT
+  fi
 }
 
-function prepareTizen3Build() {
-  local PROFILE=$1
-  BUILD_CONF_OPTS=""
-
-  # In case of '_rpmlint 1', build.conf of gbs repo will be used, enabling rpmlint.
-  # Otherwise, locally prepared build.conf will be used, disabling rpmlint.
-  local PREVIOUS_BUILD_CONF_PATH=""
-  local LOCAL_BUILD_CONF_PATH=""
-
-  if [ "$PROFILE" == "tztv_v3.0_arm-wayland" ]; then
-    PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tztv_v3.0_arm-walynad.conf"
-    LOCAL_BUILD_CONF_PATH="$TOPDIR/tizen_src/build/tztv_v3.0_arm-wayland.conf"
-  elif [ "$PROFILE" == "tzmb_v3.0_arm-wayland" ]; then
-    PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tzmb_v3.0_arm-walynad.conf"
-    LOCAL_BUILD_CONF_PATH="$TOPDIR/tizen_src/build/tzmb_v3.0_arm-wayland.conf"
-  elif [ "$PROFILE" == "tzmb_v3.0_arm64-wayland" ]; then
-    PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tzmb_v3.0_arm64-walynad.conf"
-    LOCAL_BUILD_CONF_PATH="$TOPDIR/tizen_src/build/tzmb_v3.0_arm64-wayland.conf"
+function processICU() {
+  local ICU_PATH="$TOPDIR/third_party/icu/source"
+  local ICU_REPLACE_PATH="$TOPDIR/third_party/icu/source_replace"
+
+  if [ "$1" == "replace_icu" ]; then
+    if [ ! -e $ICU_REPLACE_PATH ] && [ -e $ICU_PATH ]; then
+      echo "** third_party/icu/source is replaced to use system icu."
+      mv $ICU_PATH $ICU_REPLACE_PATH
+    fi
+  elif [ "$1" == "restore_icu" ]; then
+    if [ -e $ICU_REPLACE_PATH ] && [ ! -e $ICU_PATH ]; then
+      echo "** third_party/icu/source is restored."
+      mv $ICU_REPLACE_PATH $ICU_PATH
+    fi
+  elif [ "$1" == "initialize_icu" ]; then
+    if [ -e $ICU_REPLACE_PATH ]; then
+      echo "** third_party/icu/source is initialized."
+      rm -rf $ICU_PATH
+      mv $ICU_REPLACE_PATH $ICU_PATH
+    fi
   fi
+}
+
+function processRpmlintOption() {
+  local PROFILE=$1
+  local RPMLINT=$2
+  local URL_TARGET=
+  export BUILD_CONF_OPTS=
+
+  echo "** Process rpmlint option"
 
   local PREVIOUS_RPMLINT="!rpmlint"
   if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
+    # Never built before
     PREVIOUS_RPMLINT=""
   elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
+    # Once built with rpmlint
     PREVIOUS_RPMLINT="rpmlint"
   fi
 
-  if [ "$LOCAL_BUILD_CONF_PATH" != "" ]; then
-    BUILD_CONF_OPTS="-D $LOCAL_BUILD_CONF_PATH"
-  fi
-
-  if [ "$(echo "$@" | grep -Po "_rpmlint\ 1")" == "" ]; then
+  # Disable rpmlint
+  if [ "$RPMLINT" == 0 ]; then
+    echo "** Disable rpmlint"
+    BUILD_CONF_DIR=$SCRIPTDIR/build_conf
+    rm -rf $BUILD_CONF_DIR
+    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 [ "$DEFAULT_TIZEN_VERSION" == "${LATEST_TIZEN_VERSION}" ]; then
+      URL_TIZEN_VERSION=
+    else
+      URL_TIZEN_VERSION=-$DEFAULT_TIZEN_VERSION
+    fi
+    REPO=http://download.tizen.org/snapshots/TIZEN/Tizen$URL_TIZEN_VERSION/Tizen$URL_TIZEN_VERSION-$platform/latest/repos/$URL_TARGET/packages/repodata/
+    echo "** Repo : $REPO"
+    wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
+    BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
+    BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
+    wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
+    if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
+      echo "It's failed to donwload build.conf. Please contact system administrator."
+      exit 1
+    fi
+    gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
+    sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
+    if [ "$DEFAULT_TIZEN_VERSION" == "6.0" ]; then
+      sed -i 's/tizen_version_major 5/tizen_version_major 6/g' $BUILD_CONF_DIR/$BUILD_CONF
+      sed -i 's/tizen_version_minor 5/tizen_version_minor 0/g' $BUILD_CONF_DIR/$BUILD_CONF
+    fi
+    BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
     if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
+      echo "** Once built with rpmlint"
       BUILD_CONF_OPTS+=" --clean"
     fi
-  else
+  else # Enable rpmlint
+    echo "** Enable rpmlint"
     BUILD_CONF_OPTS=""
     if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
       BUILD_CONF_OPTS="--clean"