3 export SCRIPTDIR=$(readlink -e $(dirname $0))
4 export TOPDIR=$(readlink -f "${SCRIPTDIR}/../..")
5 export CHROME_SRC="${TOPDIR}"
6 # Please set DEFAULT_TIZEN_VERSION to 'latest' for the latest tizen version
7 # or set DEFAULT_TIZEN_VERSION to current tizen version for the others.
8 export DEFAULT_TIZEN_VERSION=latest
10 if [ "$(echo "$@" | grep -e "--tizen")" != "" ]; then
11 tizen_version=$(echo $@ | sed -e 's#.*--tizen_\([0-9.]*\).*#\1#')
12 if $(echo $tizen_version | grep -qe "^[-\?[0-9]\+\.\?[0-9]*$" && echo true || echo false); then
13 DEFAULT_TIZEN_VERSION=$tizen_version
15 DEFAULT_TIZEN_VERSION=latest
19 function getHostOs() {
20 echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
23 function getHostArch() {
24 echo $(uname -m | sed -e \
25 's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/;s/aarch64/arm64/')
28 function getPythonVersion() {
29 echo $(python --version 2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
32 function setIfUndef() {
35 if [ -n "$original" ]; then
43 function hostBuldScriptUsage() {
47 Build non gbs version of chromium-efl
50 -h, --help Show this message
51 --build-ewk-unittests Build ewk unittests
52 --ccache Configure ccache installed in your system
53 --clang Use chromium's clang compiler to build the sources
54 --no-content-shell Don't build content_shell application
55 --debug Build debug version of chromium-efl (out.${host_arch}/Debug instead of out.${host_arch}/Release)
56 -jN Set number of jobs, just like with make or ninja
57 --skip-ninja Skip ninja step
66 function parseHostBuildScriptParams() {
70 export FORCE_JHBUILD=0
72 export BUILD_EWK_UNITTESTS=0
73 export BUILD_CONTENT_SHELL=1
74 export BUILD_SUBDIRECTORY=Release
75 export COMPONENT_BUILD=0
80 while [[ $# > 0 ]]; do
83 hostBuldScriptUsage ${0}
91 source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
97 export BUILD_CONTENT_SHELL=0
100 export FORCE_JHBUILD=1
105 --build-ewk-unittests)
106 export BUILD_EWK_UNITTESTS=1
109 export BUILD_SUBDIRECTORY="Debug"
112 export COMPONENT_BUILD=1
118 echo "Unknown argument: $1"
126 function hostGnChromiumEfl() {
127 if [[ $SKIP_GN != 1 ]]; then
129 local COMPONENT_ARG=""
130 if [[ $COMPONENT_BUILD == 1 ]]; then
131 COMPONENT_ARG="component=shared_library"
133 ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
140 function hostNinja() {
141 if [[ $SKIP_NINJA == 0 ]]; then
142 TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser"
143 if [[ $BUILD_EWK_UNITTESTS == 1 ]]; then
144 TARGETS="$TARGETS ewk_unittests"
146 if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
147 TARGETS="$TARGETS content_shell dump_syms minidump_stackwalk"
149 if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
150 TARGETS="$TARGETS chromedriver"
152 export BUILD_SUBDIRECTORY=""
153 BUILDDIR=${GN_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
154 ninja -C $BUILDDIR ${JOBS} ${TARGETS}
158 function error_report() {
159 echo "Error: File:$1 Line:$2"
163 function findElementInArray() {
165 for elm in "${@:2}"; do
166 [[ "$elm" = "$1" ]] && return 0;
171 function setupAndExecuteTargetBuild() {
181 local exclusive_options=0
186 # "|| :" means "or always succeeding built-in command"
187 PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" | head -1 || :)
188 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | head -1 || :)
189 GBS_ROOT=$(echo "$@" | grep -Po "(?<=\-B\s)[^\s]*" | head -1 || :)
191 while [[ $# > 0 ]]; do
192 count=$(( $count + 1 ))
195 ARGS[$count]=--define
196 count=$(( $count + 1 ))
197 ARGS[$count]="_debug_mode 1"
200 ARGS[$count]=--define
201 count=$(( $count + 1 ))
202 ARGS[$count]="_skip_ninja 1"
205 ARGS[$count]=--define
206 count=$(( $count + 1 ))
207 ARGS[$count]="_skip_gn 1"
210 ARGS[$count]=--define
211 count=$(( $count + 1 ))
212 ARGS[$count]="component_build 1"
219 count=$(( $count + 1 ))
222 ARGS[$count]=--define
223 count=$(( $count + 1 ))
224 ARGS[$count]="_nodebug 1"
229 count=$(( $count + 1 ))
235 ARGS[$count]=--define
236 count=$(( $count + 1 ))
237 ARGS[$count]="_gcc 1"
240 ARGS[$count]=--define
241 count=$(( $count + 1 ))
242 ARGS[$count]="_clang 1"
245 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
247 PROFILE=tz_$(echo $1 | sed 's/--//g')
248 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
249 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
251 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
255 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
256 PROFILE=tz_$(echo $1 | sed 's/--//g')
257 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
258 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
260 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
272 if [ "$PROFILE" == "" ]; then
273 if [[ $platform == "mobile" ]]; then
274 PROFILE=tzmb_3.0_target-TM1
275 elif [[ $platform == "tv" ]]; then
276 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
277 PROFILE=tztv_5.5_arm-musem
278 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
279 PROFILE=tztv_4.0_arm-kantm
281 PROFILE=tztv_arm-musem
283 elif [[ $platform == "da" ]]; then
284 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
285 PROFILE=tzda_arm-kantm
287 PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
290 echo "Cannot set default PROFILE for platform=${platform}"
295 if [ "$MIRROR" == "1" ]; then
296 PROFILE=${PROFILE}_mirror
299 echo "Set the profile : $PROFILE"
301 if [ "$ARCHITECTURE" == "" ]; then
302 if [[ $platform == "mobile" ]]; then
304 elif [[ $platform == "mobile_emulator" ]]; then
306 elif [[ $platform == "tv" ]]; then
308 elif [[ $platform == "tv_emulator" ]]; then
311 echo "Cannot set default ARCHITECTURE for platform=${platform}"
315 echo "Set the architecture : $ARCHITECTURE"
317 if [ "$(echo "${PROFILE}" | grep -P "muse|kant|jazz|hawk|product")" == "" -a "$NOINIT" == 0 ]; then
318 processRpmlintOption $PROFILE $RPMLINT
320 local BRANCH=$(echo $(basename $(git symbolic-ref HEAD)))
321 if [ "$(echo $BRANCH | grep dev)" != "" ]; then
323 elif [ "$(echo $BRANCH | grep beta)" != "" ]; then
328 local CHROMIUM_VERSION=$(echo $(head -n 1 chrome/VERSION) | sed -e 's/MAJOR=//g')
331 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
332 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
333 if [ "$GBS_ROOT" == "" ]; then
334 GBS_ROOT_OPT="-B ~/GBS-ROOT-M${CHROMIUM_VERSION}-${PROFILE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-${BRANCH^^}"
336 GBS_ROOT_OPT="-B $GBS_ROOT"
340 gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental $GBS_ROOT_OPT
343 function processRpmlintOption() {
347 export BUILD_CONF_OPTS=
349 echo "** Process rpmlint option"
351 local PREVIOUS_RPMLINT="!rpmlint"
352 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
355 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
356 # Once built with rpmlint
357 PREVIOUS_RPMLINT="rpmlint"
361 if [ "$RPMLINT" == 0 ]; then
362 echo "** Disable rpmlint"
363 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
364 rm -rf $BUILD_CONF_DIR
365 mkdir $BUILD_CONF_DIR
366 URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
367 # The latest version doesn't have tizen version in snapshot repository url.
368 if [ "$(echo $DEFAULT_TIZEN_VERSION)" == "latest" ]; then
371 URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
373 REPO=http://download.tizen.org/snapshots/tizen/$URL_TIZEN_VERSION$platform/latest/repos/$URL_TARGET/packages/repodata/
374 echo "** Repo : $REPO"
375 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
376 BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
377 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
378 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
379 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
380 echo "It's failed to donwload build.conf. Please contact system administrator."
383 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
384 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
385 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
386 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
387 echo "** Once built with rpmlint"
388 BUILD_CONF_OPTS+=" --clean"
390 else # Enable rpmlint
391 echo "** Enable rpmlint"
393 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
394 BUILD_CONF_OPTS="--clean"