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]*" | uniq || :)
188 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | uniq || :)
190 while [[ $# > 0 ]]; do
191 count=$(( $count + 1 ))
194 ARGS[$count]=--define
195 count=$(( $count + 1 ))
196 ARGS[$count]="_debug_mode 1"
199 ARGS[$count]=--define
200 count=$(( $count + 1 ))
201 ARGS[$count]="_skip_ninja 1"
204 ARGS[$count]=--define
205 count=$(( $count + 1 ))
206 ARGS[$count]="_skip_gn 1"
209 ARGS[$count]=--define
210 count=$(( $count + 1 ))
211 ARGS[$count]="component_build 1"
218 count=$(( $count + 1 ))
221 ARGS[$count]=--define
222 count=$(( $count + 1 ))
223 ARGS[$count]="_nodebug 1"
228 count=$(( $count + 1 ))
234 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
236 PROFILE=tz_$(echo $1 | sed 's/--//g')
237 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
238 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
240 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
244 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
245 PROFILE=tz_$(echo $1 | sed 's/--//g')
246 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
247 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
249 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
261 if [ "$PROFILE" == "" ]; then
262 if [[ $platform == "mobile" ]]; then
263 PROFILE=tzmb_3.0_target-TM1
264 elif [[ $platform == "tv" ]]; then
265 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
266 PROFILE=tztv_arm-kantm2
267 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
268 PROFILE=tztv_4.0_arm-kantm
270 elif [[ $platform == "da" ]]; then
271 if [ "$DEFAULT_TIZEN_VERSION" == "latest" ]; then
272 PROFILE=tzda_arm-kantm
274 PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
277 echo "Cannot set default PROFILE for platform=${platform}"
282 if [ "$MIRROR" == "1" ]; then
283 PROFILE=${PROFILE}_mirror
286 echo "Set the profile : $PROFILE"
288 if [ "$ARCHITECTURE" == "" ]; then
289 if [[ $platform == "mobile" ]]; then
291 elif [[ $platform == "mobile_emulator" ]]; then
293 elif [[ $platform == "tv" ]]; then
295 elif [[ $platform == "tv_emulator" ]]; then
298 echo "Cannot set default ARCHITECTURE for platform=${platform}"
302 echo "Set the architecture : $ARCHITECTURE"
304 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
305 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
308 if [ "$(echo "${PROFILE}" | grep -P "kant|jazz|hawk|product")" == "" -a "$NOINIT" == 0 ]; then
309 processRpmlintOption $PROFILE $RPMLINT
311 local BRANCH=$(echo $(basename $(git symbolic-ref HEAD)))
312 if [ "$(echo $BRANCH | grep dev)" != "" ]; then
314 elif [ "$(echo $BRANCH | grep beta)" != "" ]; then
319 local CHROMIUM_VERSION=$(echo $(head -n 1 chrome/VERSION) | sed -e 's/MAJOR=//g')
321 gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental \
322 -B ~/GBS-ROOT-${PROFILE^^}-${ARCHITECTURE^^}-TIZEN_${DEFAULT_TIZEN_VERSION^^}-${BRANCH^^}-M${CHROMIUM_VERSION}
325 function processRpmlintOption() {
329 export BUILD_CONF_OPTS=
331 echo "** Process rpmlint option"
333 local PREVIOUS_RPMLINT="!rpmlint"
334 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
337 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
338 # Once built with rpmlint
339 PREVIOUS_RPMLINT="rpmlint"
343 if [ "$RPMLINT" == 0 ]; then
344 echo "** Disable rpmlint"
345 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
346 rm -rf $BUILD_CONF_DIR
347 mkdir $BUILD_CONF_DIR
348 URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
349 # The latest version doesn't have tizen version in snapshot repository url.
350 if [ "$(echo $DEFAULT_TIZEN_VERSION)" == "latest" ]; then
353 URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
355 REPO=http://download.tizen.org/snapshots/tizen/$URL_TIZEN_VERSION$platform/latest/repos/$URL_TARGET/packages/repodata/
356 echo "** Repo : $REPO"
357 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
358 BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
359 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
360 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
361 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
362 echo "It's failed to donwload build.conf. Please contact system administrator."
365 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
366 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
367 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
368 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
369 echo "** Once built with rpmlint"
370 BUILD_CONF_OPTS+=" --clean"
372 else # Enable rpmlint
373 echo "** Enable rpmlint"
375 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
376 BUILD_CONF_OPTS="--clean"