3 export SCRIPTDIR=$(readlink -e $(dirname $0))
4 export TOPDIR=$(readlink -f "${SCRIPTDIR}/../..")
5 export CHROME_SRC="${TOPDIR}"
6 export LATEST_TIZEN_VERSION=7.0
7 export DEFAULT_TIZEN_VERSION=$LATEST_TIZEN_VERSION
9 if [ "$(echo "$@" | grep -e "--tizen")" != "" ]; then
10 tizen_version=$(echo $@ | sed -e 's#.*--tizen_\([0-9.]*\).*#\1#')
11 DEFAULT_TIZEN_VERSION=$tizen_version
15 export PUBLIC_REPO_VERSION=
16 if [ "$DEFAULT_TIZEN_VERSION" != "${LATEST_TIZEN_VERSION}" ]; then
17 PUBLIC_REPO_VERSION=$DEFAULT_TIZEN_VERSION-
19 sed -e "s/@PUBLIC_REPO_VERSION@/$PUBLIC_REPO_VERSION/g" \
20 -e "s/@TIZEN_VERSION@/$DEFAULT_TIZEN_VERSION/g" \
21 tizen_src/build/gbs.conf.in > tizen_src/build/gbs.conf
23 function getSystemDeps() {
24 local host_arch=$(getHostArch)
26 local system_deps="--system-libraries
34 if [ "$platform" != "desktop" ]; then
36 if [ "$host_arch" == "x86" -o "$host_arch" == "x64" ]; then
40 # Non product tv profiles on tizen 6.0
41 if [ "$platform" != "tv" -a "$DEFAULT_TIZEN_VERSION" == "6.0" ]; then
49 function getHostOs() {
50 echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
53 function getHostArch() {
54 echo $(uname -m | sed -e \
55 's/i.86/x86/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/x86/;s/aarch64/arm64/')
58 function getGccVersion() {
59 echo $(gcc -dumpversion)
62 function getPythonVersion() {
63 echo $(python3 --version 2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
66 function setIfUndef() {
69 if [ -n "$original" ]; then
76 function hostBuldScriptUsage() {
80 Build non gbs version of chromium-efl
83 -h, --help Show this message
84 --build-ewk-unittests Build ewk unittests
85 --ccache Configure ccache installed in your system
86 --clang Use chromium's clang compiler to build the sources
87 --no-content-shell Don't build content_shell application
88 --debug Build debug version of chromium-efl (out.${host_arch}/Debug instead of out.${host_arch}/Release)
89 -jN Set number of jobs, just like with make or ninja
90 --skip-ninja Skip ninja step
99 function undoReplacedGn() {
100 local system_deps=$(getSystemDeps $1)
101 if [ "$system_deps" != "" ]; then
102 echo "** use system lib : undo **"
103 # Restore gn files to their original states not to mess up the tree permanently.
104 $TOPDIR/build/linux/unbundle/replace_gn_files.py --undo $system_deps icu
108 function parseHostBuildScriptParams() {
109 trap 'undoReplacedGn $1' SIGINT
112 export FORCE_JHBUILD=0
114 export BUILD_EWK_UNITTESTS=0
115 export BUILD_CONTENT_SHELL=1
116 export BUILD_SUBDIRECTORY=Release
117 export COMPONENT_BUILD=0
122 while [[ $# > 0 ]]; do
125 hostBuldScriptUsage ${0}
133 source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
139 export BUILD_CONTENT_SHELL=0
142 export FORCE_JHBUILD=1
147 --build-ewk-unittests)
148 export BUILD_EWK_UNITTESTS=1
151 export BUILD_SUBDIRECTORY="Debug"
154 export COMPONENT_BUILD=1
160 echo "Unknown argument: $1"
168 function hostGnChromiumEfl() {
169 if [[ $SKIP_GN != 1 ]]; then
171 local COMPONENT_ARG=""
172 if [[ $COMPONENT_BUILD == 1 ]]; then
173 COMPONENT_ARG="component=shared_library"
175 ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
182 function hostNinja() {
183 if [[ $SKIP_NINJA == 0 ]]; then
184 TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser content_shell chrome"
185 if [[ $BUILD_EWK_UNITTESTS == 1 ]]; then
186 TARGETS="$TARGETS ewk_unittests"
188 if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
189 TARGETS="$TARGETS content_shell dump_syms minidump_stackwalk"
191 if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
192 TARGETS="$TARGETS chromedriver"
194 export BUILD_SUBDIRECTORY=""
195 BUILDDIR=${GN_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
196 ninja -C $BUILDDIR ${JOBS} ${TARGETS}
201 function error_report() {
202 echo "Error: File:$1 Line:$2"
206 function findElementInArray() {
208 for elm in "${@:2}"; do
209 [[ "$elm" = "$1" ]] && return 0;
214 function setupAndExecuteTargetBuild() {
223 local exclusive_options=0
228 local RELEASE_BUILD=0
230 # "|| :" means "or always succeeding built-in command"
231 PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" | head -1 || :)
232 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | head -1 || :)
233 GBS_ROOT=$(echo "$@" | grep -Po "(?<=\-B\s)[^\s]*" | head -1 || :)
235 while [[ $# > 0 ]]; do
238 ARGS+=(--define "_debug_mode 1")
241 ARGS+=(--define "_skip_ninja 1")
244 ARGS+=(--define "_skip_gn 1")
247 ARGS+=(--define "component_build 1")
250 ARGS+=(--define "_disable_wrt_js 1")
256 ARGS+=(--define "_use_system_icu $(echo $1 | sed -e 's/--icu=//g')")
262 ARGS+=(--define "_nodebug 1")
277 ARGS+=(--define "_clang 0")
281 ARGS+=(--define "_clang 1")
284 PROFILE=tz_$(echo $1 | sed 's/--//g')
287 PROFILE=tz_$(echo $1 | sed 's/--//g')
297 if [ "$LOCAL_BUILD" == "1" ]; then
298 ARGS+=(--define "_local_build 1")
299 local _jobs=$((`/usr/bin/getconf _NPROCESSORS_ONLN` / 2 - `ps -ef | grep " ninja " | wc -l` -1))
300 local _smp_mflags=-j$(if ((${_jobs} > 10)); then echo ${_jobs}; else echo 10; fi)
301 ARGS+=(--define "_costomized_smp_mflags $_smp_mflags")
303 ARGS+=(--define "_clang 1")
306 if [ "$RELEASE_BUILD" == "1" ]; then
307 ARGS+=(--define "_local_build 0")
308 if [[ $platform == "tv" ]]; then
309 ARGS+=(--define "_clang 1")
311 ARGS+=(--define "_clang 0")
312 ARGS+=(--define "_no_lto 0")
316 if [ "$PROFILE" == "" ]; then
317 if [[ $platform == "tv" ]]; then
318 PROFILE=tztv_${DEFAULT_TIZEN_VERSION}_arm-pontusm
319 elif [[ $platform == "da" ]]; then
320 PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
321 elif [[ $platform == "wearable" ]]; then
322 PROFILE=tzwr_5.5_arm-spin
324 echo "Cannot set default PROFILE for platform=${platform}"
329 if [ "$MIRROR" == "1" ]; then
330 PROFILE=${PROFILE}_mirror
333 echo "Set the profile : $PROFILE"
335 if [ "$ARCHITECTURE" == "" ]; then
338 echo "Set the architecture : $ARCHITECTURE"
340 if [ "$(echo "${PROFILE}" | grep -P "tz_standard")" != "" -a "$NOINIT" == 0 ]; then
341 processRpmlintOption $PROFILE $RPMLINT
343 local BRANCH=$(echo $(basename $(git symbolic-ref HEAD)))
344 if [ "$(echo $BRANCH | grep dev)" != "" ]; then
346 elif [ "$(echo $BRANCH | grep beta)" != "" ]; then
351 local CHROMIUM_VERSION=$(echo $(head -n 1 chrome/VERSION) | sed -e 's/MAJOR=//g')
354 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
355 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
356 if [ "$GBS_ROOT" == "" ]; then
357 GBS_ROOT_OPT="-B ~/GBS-ROOT-M${CHROMIUM_VERSION}-${PROFILE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-${BRANCH^^}"
359 GBS_ROOT_OPT="-B $GBS_ROOT"
363 processICU initialize_icu
364 gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental $GBS_ROOT_OPT
366 undoReplacedGn $platform
367 processICU restore_icu
370 function processICU() {
371 local ICU_PATH="$TOPDIR/third_party/icu/source"
372 local ICU_REPLACE_PATH="$TOPDIR/third_party/icu/source_replace"
374 if [ "$1" == "replace_icu" ]; then
375 if [ ! -e $ICU_REPLACE_PATH ] && [ -e $ICU_PATH ]; then
376 echo "** third_party/icu/source is replaced to use system icu."
377 mv $ICU_PATH $ICU_REPLACE_PATH
379 elif [ "$1" == "restore_icu" ]; then
380 if [ -e $ICU_REPLACE_PATH ] && [ ! -e $ICU_PATH ]; then
381 echo "** third_party/icu/source is restored."
382 mv $ICU_REPLACE_PATH $ICU_PATH
384 elif [ "$1" == "initialize_icu" ]; then
385 if [ -e $ICU_REPLACE_PATH ]; then
386 echo "** third_party/icu/source is initialized."
388 mv $ICU_REPLACE_PATH $ICU_PATH
393 function processRpmlintOption() {
397 export BUILD_CONF_OPTS=
399 echo "** Process rpmlint option"
401 local PREVIOUS_RPMLINT="!rpmlint"
402 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
405 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
406 # Once built with rpmlint
407 PREVIOUS_RPMLINT="rpmlint"
411 if [ "$RPMLINT" == 0 ]; then
412 echo "** Disable rpmlint"
413 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
414 rm -rf $BUILD_CONF_DIR
415 mkdir $BUILD_CONF_DIR
416 URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
417 # The latest version doesn't have tizen version in snapshot repository url.
418 if [ "$DEFAULT_TIZEN_VERSION" == "${LATEST_TIZEN_VERSION}" ]; then
421 URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
423 REPO=http://download.tizen.org/snapshots/tizen/$URL_TIZEN_VERSION$platform/latest/repos/$URL_TARGET/packages/repodata/
424 echo "** Repo : $REPO"
425 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
426 BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
427 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
428 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
429 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
430 echo "It's failed to donwload build.conf. Please contact system administrator."
433 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
434 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
435 if [ "$DEFAULT_TIZEN_VERSION" == "6.0" ]; then
436 sed -i 's/tizen_version_major 5/tizen_version_major 6/g' $BUILD_CONF_DIR/$BUILD_CONF
437 sed -i 's/tizen_version_minor 5/tizen_version_minor 0/g' $BUILD_CONF_DIR/$BUILD_CONF
439 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
440 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
441 echo "** Once built with rpmlint"
442 BUILD_CONF_OPTS+=" --clean"
444 else # Enable rpmlint
445 echo "** Enable rpmlint"
447 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
448 BUILD_CONF_OPTS="--clean"