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 empty value for the latest tizen version
7 # or set DEFAULT_TIZEN_VERSION to current tizen version for the others.
8 export DEFAULT_TIZEN_VERSION=
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=
19 supported_targets=("tizen" "desktop")
21 function getHostOs() {
22 echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
25 function getHostArch() {
26 echo $(uname -m | sed -e \
27 's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/;s/aarch64/arm64/')
30 function getPythonVersion() {
31 echo $(python --version 2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
34 function setIfUndef() {
37 if [ -n "$original" ]; then
45 function hostBuldScriptUsage() {
49 Build non gbs version of chromium-efl
52 -h, --help Show this message
53 --build-ewk-unittests Build ewk unittests
54 --ccache Configure ccache installed in your system
55 --clang Use chromium's clang compiler to build the sources
56 --no-content-shell Don't build content_shell application
57 --debug Build debug version of chromium-efl (out.${host_arch}/Debug instead of out.${host_arch}/Release)
58 -jN Set number of jobs, just like with make or ninja
59 --skip-gyp Skip restore_gyp, jhbuild and gyp_chromium steps
60 --skip-ninja Skip ninja step
64 $0 --skip-gyp --ccache
70 function parseHostBuildScriptParams() {
75 export FORCE_JHBUILD=0
77 export BUILD_EWK_UNITTESTS=0
78 export BUILD_CONTENT_SHELL=1
79 export BUILD_SUBDIRECTORY=Release
80 export COMPONENT_BUILD=0
85 while [[ $# > 0 ]]; do
88 hostBuldScriptUsage ${0}
99 source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
105 export BUILD_CONTENT_SHELL=0
108 export FORCE_JHBUILD=1
113 --build-ewk-unittests)
114 export BUILD_EWK_UNITTESTS=1
117 export BUILD_SUBDIRECTORY="Debug"
120 export COMPONENT_BUILD=1
126 echo "Unknown argument: $1"
134 function hostGypChromiumEfl() {
135 if [[ $SKIP_GYP == 0 ]]; then
137 local COMPONENT_ARG=""
138 if [[ $BUILD_XWALK == 1 ]]; then
141 if [[ $COMPONENT_BUILD == 1 ]]; then
142 COMPONENT_ARG="-Dcomponent=shared_library"
144 ${TOPDIR}/tizen_src/build/gyp_chromiumefl.sh \
147 -Doutdir="$TOPDIR/out.$(getHostArch)" \
152 function hostGnChromiumEfl() {
153 if [[ $SKIP_GN != 1 ]]; then
155 local COMPONENT_ARG=""
156 if [[ $COMPONENT_BUILD == 1 ]]; then
157 COMPONENT_ARG="component=shared_library"
159 ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
162 "outdir=\"$TOPDIR/out.$(getHostArch)\"" \
163 "chromium_efl_tizen_version=30" \
168 function hostNinja() {
169 if [[ $SKIP_NINJA == 0 ]]; then
170 TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser"
171 if [[ $BUILD_EWK_UNITTESTS == 1 ]]; then
172 TARGETS="$TARGETS ewk_unittests"
174 if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
175 TARGETS="$TARGETS content_shell dump_syms minidump_stackwalk"
177 if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
178 TARGETS="$TARGETS chromedriver"
180 export BUILD_SUBDIRECTORY=""
181 BUILDDIR=${GN_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
182 ninja -C $BUILDDIR ${JOBS} ${TARGETS}
186 function error_report() {
187 echo "Error: File:$1 Line:$2"
191 function findElementInArray() {
193 for elm in "${@:2}"; do
194 [[ "$elm" = "$1" ]] && return 0;
199 function setupAndExecuteTargetBuild() {
209 local exclusive_options=0
214 # "|| :" means "or always succeeding built-in command"
215 PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" | uniq || :)
216 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | uniq || :)
218 while [[ $# > 0 ]]; do
219 count=$(( $count + 1 ))
222 ARGS[$count]=--define
223 count=$(( $count + 1 ))
224 ARGS[$count]="_debug_mode 1"
227 ARGS[$count]=--define
228 count=$(( $count + 1 ))
229 ARGS[$count]="_skip_ninja 1"
232 ARGS[$count]=--define
233 count=$(( $count + 1 ))
234 ARGS[$count]="_skip_gyp 1"
237 ARGS[$count]=--define
238 count=$(( $count + 1 ))
239 ARGS[$count]="_skip_gn 1"
242 ARGS[$count]=--define
243 count=$(( $count + 1 ))
244 ARGS[$count]="component_build 1"
251 count=$(( $count + 1 ))
256 count=$(( $count + 1 ))
262 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
264 PROFILE=tz_$(echo $1 | sed 's/--//g')
265 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
266 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
268 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
272 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
273 PROFILE=tz_$(echo $1 | sed 's/--//g')
274 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
275 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
277 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
289 if [ "$exclusive_options" -gt 1 ]; then
290 echo "ERROR: --libs and --crosswalk-bin are mutually exclusive parameters."
294 if [ "$target" == "libs" ]; then
295 SPEC_FILE="chromium-efl-libs.spec"
296 elif [ "$target" == "crosswalk-bin" ]; then
297 SPEC_FILE="crosswalk-bin.spec"
300 if [ "$PROFILE" == "" ]; then
301 if [[ $platform == "mobile" ]]; then
302 PROFILE=tzmb_3.0_target-TM1
303 elif [[ $platform == "tv" ]]; then
304 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
305 PROFILE=tztv_arm-kantm
307 PROFILE=tztv_${DEFAULT_TIZEN_VERSION}_arm-kantm
309 elif [[ $platform == "da" ]]; then
310 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
311 PROFILE=tzda_arm-kantm
313 PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
316 echo "Cannot set default PROFILE for platform=${platform}"
321 if [ "$MIRROR" == "1" ]; then
322 PROFILE=${PROFILE}_mirror
325 echo "Set the profile : $PROFILE"
327 if [ "$ARCHITECTURE" == "" ]; then
328 if [[ $platform == "mobile" ]]; then
330 elif [[ $platform == "mobile_emulator" ]]; then
332 elif [[ $platform == "tv" ]]; then
334 elif [[ $platform == "tv_emulator" ]]; then
337 echo "Cannot set default ARCHITECTURE for platform=${platform}"
341 echo "Set the architecture : $ARCHITECTURE"
343 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
344 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
348 if [ "$PROFILE" == "tztv_v2.4_product" ]; then
349 EXTRA_PACK_OPTS="--extra-packs python-base-x86-arm,python-x86-arm,python-xml-x86-arm"
352 if [ "$(echo "${PROFILE}" | grep -P "kant|jazz|hawk|product")" == "" -a "$NOINIT" == 0 ]; then
353 processRpmlintOption $PROFILE $RPMLINT
356 gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS $EXTRA_PACK_OPTS --incremental
359 function processRpmlintOption() {
363 export BUILD_CONF_OPTS=
365 echo "** Process rpmlint option"
367 local PREVIOUS_RPMLINT="!rpmlint"
368 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
371 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
372 # Once built with rpmlint
373 PREVIOUS_RPMLINT="rpmlint"
377 if [ "$RPMLINT" == 0 ]; then
378 echo "** Disable rpmlint"
379 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
380 rm -rf $BUILD_CONF_DIR
381 mkdir $BUILD_CONF_DIR
382 URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
383 # The latest version doesn't have tizen version in snapshot repository url.
384 if [ "$(echo $DEFAULT_TIZEN_VERSION)" == "" ]; then
387 URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
389 REPO=http://download.tizen.org/snapshots/tizen/$URL_TIZEN_VERSION$platform/latest/repos/$URL_TARGET/packages/repodata/
390 echo "** Repo : $REPO"
391 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
392 BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
393 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
394 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
395 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
396 echo "It's failed to donwload build.conf. Please contact system administrator."
399 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
400 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
401 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
402 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
403 echo "** Once built with rpmlint"
404 BUILD_CONF_OPTS+=" --clean"
406 else # Enable rpmlint
407 echo "** Enable rpmlint"
409 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
410 BUILD_CONF_OPTS="--clean"