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
33 if [ "$platform" != "desktop" ]; then
35 if [ "$host_arch" == "x86" -o "$host_arch" == "x64" ]; then
39 # Non product tv profiles on tizen 6.0
40 if [ "$platform" != "tv" -a "$DEFAULT_TIZEN_VERSION" == "6.0" ]; then
48 function getHostOs() {
49 echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
52 function getHostArch() {
53 echo $(uname -m | sed -e \
54 's/i.86/x86/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/x86/;s/aarch64/arm64/')
57 function getGccVersion() {
58 echo $(gcc -dumpversion)
61 function getPythonVersion() {
62 echo $(python3 --version 2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
65 function setIfUndef() {
68 if [ -n "$original" ]; then
75 function hostBuldScriptUsage() {
79 Build non gbs version of chromium-efl
82 -h, --help Show this message
83 --build-ewk-unittests Build ewk unittests
84 --enable-pepper-extensions Enable Tizen Pepper Extensions
85 --ccache Configure ccache installed in your system
86 --clang Use chromium's clang compiler to build the sources
87 --debug Build debug version of chromium-efl (out.${host_arch}/Debug instead of out.${host_arch}/Release)
88 -jN Set number of jobs, just like with make or ninja
89 --skip-ninja Skip ninja step
98 function undoReplacedGn() {
99 local system_deps=$(getSystemDeps $1)
100 if [ "$system_deps" != "" ]; then
101 echo "** use system lib : undo **"
102 # Restore gn files to their original states not to mess up the tree permanently.
103 $TOPDIR/build/linux/unbundle/replace_gn_files.py --undo $system_deps icu
107 function parseHostBuildScriptParams() {
108 trap 'undoReplacedGn $1' SIGINT
111 export FORCE_JHBUILD=0
113 export BUILD_EWK_UNITTESTS=0
114 export BUILD_CHROME=0
115 export BUILD_SUBDIRECTORY=Release
116 export COMPONENT_BUILD=0
117 export ENABLE_PEPPER_EXTENSIONS=0
122 while [[ $# > 0 ]]; do
125 hostBuldScriptUsage ${0}
133 source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
139 export BUILD_CHROME=1
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
156 --enable-pepper-extensions)
157 export ENABLE_PEPPER_EXTENSIONS=1
163 echo "Unknown argument: $1"
171 function hostGnChromiumEfl() {
172 if [[ $SKIP_GN != 1 ]]; then
174 local COMPONENT_ARG=""
175 local PEPPER_EXTENSIONS_ARG=""
176 if [[ $COMPONENT_BUILD == 1 ]]; then
177 COMPONENT_ARG="component=shared_library"
179 if [[ $ENABLE_PEPPER_EXTENSIONS == 1 ]]; then
180 PEPPER_EXTENSIONS_ARG="tizen_pepper_extensions=true"
182 ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
185 $PEPPER_EXTENSIONS_ARG \
190 function hostNinja() {
191 if [[ $SKIP_NINJA == 0 ]]; then
192 if [[ $BUILD_CHROME == 1 ]]; then
193 TARGETS="content_shell chrome"
195 TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser"
197 if [[ $BUILD_EWK_UNITTESTS == 1 ]]; then
198 TARGETS="$TARGETS ewk_unittests"
200 if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
201 TARGETS="$TARGETS chromedriver"
203 export BUILD_SUBDIRECTORY=""
204 BUILDDIR=${GN_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
205 ninja -C $BUILDDIR ${JOBS} ${TARGETS}
210 function error_report() {
211 echo "Error: File:$1 Line:$2"
215 function findElementInArray() {
217 for elm in "${@:2}"; do
218 [[ "$elm" = "$1" ]] && return 0;
223 function setupAndExecuteTargetBuild() {
232 local exclusive_options=0
237 local RELEASE_BUILD=0
238 local MAKE_SQUASHFS_RPM=0
240 # "|| :" means "or always succeeding built-in command"
241 PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" | head -1 || :)
242 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | head -1 || :)
243 GBS_ROOT=$(echo "$@" | grep -Po "(?<=\-B\s)[^\s]*" | head -1 || :)
245 while [[ $# > 0 ]]; do
248 ARGS+=(--define "_debug_mode 1")
251 ARGS+=(--define "_skip_ninja 1")
254 ARGS+=(--define "_skip_gn 1")
257 ARGS[$count]=--define
258 count=$(( $count + 1 ))
259 ARGS[$count]="_ttrace 1"
262 ARGS+=(--define "component_build 1")
265 ARGS+=(--define "_disable_wrt_js 1")
271 ARGS+=(--define "_use_system_icu $(echo $1 | sed -e 's/--icu=//g')")
277 ARGS+=(--define "_nodebug 1")
295 ARGS+=(--define "_clang 0")
299 ARGS+=(--define "_clang 1")
302 PROFILE=tz_$(echo $1 | sed 's/--//g')
305 PROFILE=tz_$(echo $1 | sed 's/--//g')
310 ARGS+=(--define "_build_chrome 1")
319 ARGS+=(--define "_make_squashfs_rpm $MAKE_SQUASHFS_RPM")
321 if [ "$LOCAL_BUILD" == "1" ]; then
322 ARGS+=(--define "_local_build 1")
323 local _jobs=$((`/usr/bin/getconf _NPROCESSORS_ONLN` / 2 - `ps -ef | grep " ninja " | wc -l` -1))
324 local _smp_mflags=-j$(if ((${_jobs} > 10)); then echo ${_jobs}; else echo 10; fi)
325 ARGS+=(--define "_costomized_smp_mflags $_smp_mflags")
327 ARGS+=(--define "_clang 1")
330 if [ "$RELEASE_BUILD" == "1" ]; then
331 ARGS+=(--define "_local_build 0")
332 if [[ $platform == "tv" ]]; then
333 ARGS+=(--define "_clang 1")
335 ARGS+=(--define "_clang 0")
336 ARGS+=(--define "_no_lto 0")
340 if [ "$PROFILE" == "" ]; then
341 if [[ $platform == "tv" ]]; then
342 PROFILE=tztv_${DEFAULT_TIZEN_VERSION}_arm-pontusm
343 elif [[ $platform == "da" ]]; then
344 PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
345 elif [[ $platform == "wearable" ]]; then
346 PROFILE=tzwr_5.5_arm-spin
348 echo "Cannot set default PROFILE for platform=${platform}"
353 if [ "$MIRROR" == "1" ]; then
354 PROFILE=${PROFILE}_mirror
357 echo "Set the profile : $PROFILE"
359 if [ "$ARCHITECTURE" == "" ]; then
362 echo "Set the architecture : $ARCHITECTURE"
364 if [ "$(echo "${PROFILE}" | grep -P "tz_standard")" != "" -a "$NOINIT" == 0 ]; then
365 processRpmlintOption $PROFILE $RPMLINT
367 local BRANCH=$(echo $(basename $(git symbolic-ref HEAD)))
368 if [ "$(echo $BRANCH | grep dev)" != "" ]; then
370 elif [ "$(echo $BRANCH | grep beta)" != "" ]; then
375 local CHROMIUM_VERSION=$(echo $(head -n 1 chrome/VERSION) | sed -e 's/MAJOR=//g')
378 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
379 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
380 if [ "$GBS_ROOT" == "" ]; then
381 GBS_ROOT_OPT="-B ~/GBS-ROOT-M${CHROMIUM_VERSION}-${PROFILE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-${BRANCH^^}"
383 GBS_ROOT_OPT="-B $GBS_ROOT"
387 processICU initialize_icu
388 gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental $GBS_ROOT_OPT
390 undoReplacedGn $platform
391 processICU restore_icu
394 function processICU() {
395 local ICU_PATH="$TOPDIR/third_party/icu/source"
396 local ICU_REPLACE_PATH="$TOPDIR/third_party/icu/source_replace"
398 if [ "$1" == "replace_icu" ]; then
399 if [ ! -e $ICU_REPLACE_PATH ] && [ -e $ICU_PATH ]; then
400 echo "** third_party/icu/source is replaced to use system icu."
401 mv $ICU_PATH $ICU_REPLACE_PATH
403 elif [ "$1" == "restore_icu" ]; then
404 if [ -e $ICU_REPLACE_PATH ] && [ ! -e $ICU_PATH ]; then
405 echo "** third_party/icu/source is restored."
406 mv $ICU_REPLACE_PATH $ICU_PATH
408 elif [ "$1" == "initialize_icu" ]; then
409 if [ -e $ICU_REPLACE_PATH ]; then
410 echo "** third_party/icu/source is initialized."
412 mv $ICU_REPLACE_PATH $ICU_PATH
417 function processRpmlintOption() {
421 export BUILD_CONF_OPTS=
423 echo "** Process rpmlint option"
425 local PREVIOUS_RPMLINT="!rpmlint"
426 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
429 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
430 # Once built with rpmlint
431 PREVIOUS_RPMLINT="rpmlint"
435 if [ "$RPMLINT" == 0 ]; then
436 echo "** Disable rpmlint"
437 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
438 rm -rf $BUILD_CONF_DIR
439 mkdir $BUILD_CONF_DIR
440 URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
441 # The latest version doesn't have tizen version in snapshot repository url.
442 if [ "$DEFAULT_TIZEN_VERSION" == "${LATEST_TIZEN_VERSION}" ]; then
445 URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
447 REPO=http://download.tizen.org/snapshots/tizen/$URL_TIZEN_VERSION$platform/latest/repos/$URL_TARGET/packages/repodata/
448 echo "** Repo : $REPO"
449 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
450 BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
451 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
452 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
453 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
454 echo "It's failed to donwload build.conf. Please contact system administrator."
457 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
458 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
459 if [ "$DEFAULT_TIZEN_VERSION" == "6.0" ]; then
460 sed -i 's/tizen_version_major 5/tizen_version_major 6/g' $BUILD_CONF_DIR/$BUILD_CONF
461 sed -i 's/tizen_version_minor 5/tizen_version_minor 0/g' $BUILD_CONF_DIR/$BUILD_CONF
463 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
464 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
465 echo "** Once built with rpmlint"
466 BUILD_CONF_OPTS+=" --clean"
468 else # Enable rpmlint
469 echo "** Enable rpmlint"
471 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
472 BUILD_CONF_OPTS="--clean"