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_arm-kantm2
278 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
279 PROFILE=tztv_4.0_arm-kantm
281 elif [[ $platform == "da" ]]; then
282 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
283 PROFILE=tzda_arm-kantm
285 PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
288 echo "Cannot set default PROFILE for platform=${platform}"
293 if [ "$MIRROR" == "1" ]; then
294 PROFILE=${PROFILE}_mirror
297 echo "Set the profile : $PROFILE"
299 if [ "$ARCHITECTURE" == "" ]; then
300 if [[ $platform == "mobile" ]]; then
302 elif [[ $platform == "mobile_emulator" ]]; then
304 elif [[ $platform == "tv" ]]; then
306 elif [[ $platform == "tv_emulator" ]]; then
309 echo "Cannot set default ARCHITECTURE for platform=${platform}"
313 echo "Set the architecture : $ARCHITECTURE"
315 if [ "$(echo "${PROFILE}" | grep -P "kant|jazz|hawk|product")" == "" -a "$NOINIT" == 0 ]; then
316 processRpmlintOption $PROFILE $RPMLINT
318 local BRANCH=$(echo $(basename $(git symbolic-ref HEAD)))
319 if [ "$(echo $BRANCH | grep dev)" != "" ]; then
321 elif [ "$(echo $BRANCH | grep beta)" != "" ]; then
326 local CHROMIUM_VERSION=$(echo $(head -n 1 chrome/VERSION) | sed -e 's/MAJOR=//g')
329 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
330 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
331 if [ "$GBS_ROOT" == "" ]; then
332 GBS_ROOT_OPT="-B ~/GBS-ROOT-M${CHROMIUM_VERSION}-${PROFILE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-${BRANCH^^}"
334 GBS_ROOT_OPT="-B $GBS_ROOT"
338 gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental $GBS_ROOT_OPT
341 function processRpmlintOption() {
345 export BUILD_CONF_OPTS=
347 echo "** Process rpmlint option"
349 local PREVIOUS_RPMLINT="!rpmlint"
350 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
353 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
354 # Once built with rpmlint
355 PREVIOUS_RPMLINT="rpmlint"
359 if [ "$RPMLINT" == 0 ]; then
360 echo "** Disable rpmlint"
361 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
362 rm -rf $BUILD_CONF_DIR
363 mkdir $BUILD_CONF_DIR
364 URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
365 # The latest version doesn't have tizen version in snapshot repository url.
366 if [ "$(echo $DEFAULT_TIZEN_VERSION)" == "latest" ]; then
369 URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
371 REPO=http://download.tizen.org/snapshots/tizen/$URL_TIZEN_VERSION$platform/latest/repos/$URL_TARGET/packages/repodata/
372 echo "** Repo : $REPO"
373 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
374 BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
375 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
376 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
377 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
378 echo "It's failed to donwload build.conf. Please contact system administrator."
381 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
382 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
383 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
384 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
385 echo "** Once built with rpmlint"
386 BUILD_CONF_OPTS+=" --clean"
388 else # Enable rpmlint
389 echo "** Enable rpmlint"
391 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
392 BUILD_CONF_OPTS="--clean"