#!/bin/bash
-pushd `dirname $0` > /dev/null
-export SCRIPTDIR=`pwd -L`
-popd > /dev/null
-
+export SCRIPTDIR=$(readlink -e $(dirname $0))
export TOPDIR=$(readlink -f "${SCRIPTDIR}/../..")
export CHROME_SRC="${TOPDIR}"
+# 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=latest
-function applyPatch {
- directory=$1
- shift
- patchfile=$1
- shift
- echo Applying $patchfile in $directory
- pushd "$directory" > /dev/null
- patch -p1 $@ < "$patchfile"
- popd > /dev/null
-}
+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=latest
+ fi
+fi
function getHostOs() {
echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
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/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/;s/aarch64/arm64/')
}
function getPythonVersion() {
--build-ewk-unittests Build ewk unittests
--ccache Configure ccache installed in your system
--clang Use chromium's clang compiler to build the sources
- --content-shell Build content_shell application
+ --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() {
- 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
- export BUILD_CONTENT_SHELL=0
- export BUILD_XWALK=0
+ export BUILD_CONTENT_SHELL=1
export BUILD_SUBDIRECTORY=Release
+ export COMPONENT_BUILD=0
local platform="$1"
shift
-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/build/ccache_env.sh ${platform}
+ source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
;;
- --clang)
- export USE_CLANG=1
+ --gcc)
+ export USE_CLANG=0
;;
- --content-shell)
- export BUILD_CONTENT_SHELL=1
+ --no-content-shell)
+ export BUILD_CONTENT_SHELL=0
;;
--force-jhbuild)
export FORCE_JHBUILD=1
--debug)
export BUILD_SUBDIRECTORY="Debug"
;;
- --xwalk)
- export BUILD_XWALK=1
+ --component-build)
+ export COMPONENT_BUILD=1
;;
-j*)
export JOBS="$1"
done
}
-function hostGypChromiumEfl() {
- if [[ $SKIP_GYP == 0 ]]; then
+function hostGnChromiumEfl() {
+ if [[ $SKIP_GN != 1 ]]; then
local XWALK_ARG=""
- if [[ $BUILD_XWALK == 1 ]]; then
- XWALK_ARG="--xwalk"
+ local COMPONENT_ARG=""
+ if [[ $COMPONENT_BUILD == 1 ]]; then
+ COMPONENT_ARG="component=shared_library"
fi
- ${TOPDIR}/tizen_src/build/gyp_chromiumefl.sh $XWALK_ARG $@
+ ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
+ $XWALK_ARG \
+ $COMPONENT_ARG \
+ $@
fi
}
if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
TARGETS="$TARGETS content_shell dump_syms minidump_stackwalk"
fi
- if [[ $BUILD_XWALK == 1 ]]; then
- TARGETS="$TARGETS xwalk"
+ 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}
fi
}
}
function setupAndExecuteTargetBuild() {
-
local platform="$1"
shift
- local PROFILE_NAME
- local DEFAULT_PROFILE_NAME
+ local PROFILE
local ARCHITECTURE
local CONF_FLAG
local -a ARGS
+ local count=0
+ local exclusive_options=0
+ local RPMLINT=0
+ local NOINIT=0
+ local MIRROR=0
+
# "|| :" means "or always succeeding built-in command"
- PROFILE_NAME=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" || :)
-
- if [[ $platform == "mobile" ]]; then
- DEFAULT_PROFILE_NAME=tizenmb_v2.4
- ARCHITECTURE=armv7l
- elif [[ $platform == "tv" ]]; then
- DEFAULT_PROFILE_NAME=tztv_v3.0
- ARCHITECTURE=armv7l
- elif [[ $platform == "emulator" ]]; then
- DEFAULT_PROFILE_NAME=tizen_emulator_v2.4
- ARCHITECTURE=i586
+ 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 ))
+ case "$1" in
+ --debug)
+ ARGS[$count]=--define
+ count=$(( $count + 1 ))
+ ARGS[$count]="_debug_mode 1"
+ ;;
+ --skip-ninja)
+ ARGS[$count]=--define
+ count=$(( $count + 1 ))
+ ARGS[$count]="_skip_ninja 1"
+ ;;
+ --skip-gn)
+ ARGS[$count]=--define
+ count=$(( $count + 1 ))
+ ARGS[$count]="_skip_gn 1"
+ ;;
+ --component-build)
+ ARGS[$count]=--define
+ count=$(( $count + 1 ))
+ ARGS[$count]="component_build 1"
+ ;;
+ --gbs-debug)
+ ARGS[$count]=--debug
+ ;;
+ --rpmlint)
+ RPMLINT=1
+ count=$(( $count + 1 ))
+ ;;
+ --nodebug)
+ ARGS[$count]=--define
+ count=$(( $count + 1 ))
+ ARGS[$count]="_nodebug 1"
+ ;;
+ --noinit)
+ NOINIT=1
+ ARGS[$count]="$1"
+ count=$(( $count + 1 ))
+ ;;
+ --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" == "latest" ]; then
+ echo $1
+ 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)
+ else
+ PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
+ fi
+ ;;
+ --emulator*)
+ 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)
+ else
+ PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
+ fi
+ ;;
+ --tizen*)
+ ;;
+ *)
+ ARGS[$count]="$1"
+ ;;
+ esac
+ shift;
+ done
+
+ if [ "$PROFILE" == "" ]; then
+ if [[ $platform == "mobile" ]]; then
+ PROFILE=tzmb_3.0_target-TM1
+ elif [[ $platform == "tv" ]]; then
+ 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_arm-musem
+ fi
+ elif [[ $platform == "da" ]]; then
+ if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
+ PROFILE=tzda_arm-kantm
+ else
+ PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
+ fi
+ else
+ echo "Cannot set default PROFILE for platform=${platform}"
+ exit 1
+ fi
fi
- if [ "$PROFILE_NAME" == "" ]; then
- PROFILE_NAME=$DEFAULT_PROFILE_NAME
+ if [ "$MIRROR" == "1" ]; then
+ PROFILE=${PROFILE}_mirror
fi
- PROFILE_FLAG="-P $PROFILE_NAME"
+ echo "Set the profile : $PROFILE"
+ if [ "$ARCHITECTURE" == "" ]; then
+ if [[ $platform == "mobile" ]]; then
+ ARCHITECTURE=armv7l
+ 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 [ "$(echo "${PROFILE}" | grep -P "muse|kant|jazz|hawk|product")" == "" -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')
+
+ 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 --incremental $GBS_ROOT_OPT
+}
+
+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
- cd $TOPDIR
- rm -f packaging
- ln -sf tizen_src/packaging packaging
- gbs $CONF_FLAG build $PROFILE_FLAG -A $ARCHITECTURE --incremental "${@}"
+ # 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 [ "$(echo $DEFAULT_TIZEN_VERSION)" == "latest" ]; then
+ URL_TIZEN_VERSION=
+ else
+ URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
+ fi
+ REPO=http://download.tizen.org/snapshots/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
+ 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 # Enable rpmlint
+ echo "** Enable rpmlint"
+ BUILD_CONF_OPTS=""
+ if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
+ BUILD_CONF_OPTS="--clean"
+ fi
+ fi
}