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-ninja Skip ninja step
68 function parseHostBuildScriptParams() {
72 export FORCE_JHBUILD=0
74 export BUILD_EWK_UNITTESTS=0
75 export BUILD_CONTENT_SHELL=1
76 export BUILD_SUBDIRECTORY=Release
77 export COMPONENT_BUILD=0
82 while [[ $# > 0 ]]; do
85 hostBuldScriptUsage ${0}
93 source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
99 export BUILD_CONTENT_SHELL=0
102 export FORCE_JHBUILD=1
107 --build-ewk-unittests)
108 export BUILD_EWK_UNITTESTS=1
111 export BUILD_SUBDIRECTORY="Debug"
114 export COMPONENT_BUILD=1
120 echo "Unknown argument: $1"
128 function hostGnChromiumEfl() {
129 if [[ $SKIP_GN != 1 ]]; then
131 local COMPONENT_ARG=""
132 if [[ $COMPONENT_BUILD == 1 ]]; then
133 COMPONENT_ARG="component=shared_library"
135 ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
138 "outdir=\"$TOPDIR/out.$(getHostArch)\"" \
139 "chromium_efl_tizen_version=30" \
144 function hostNinja() {
145 if [[ $SKIP_NINJA == 0 ]]; then
146 TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser"
147 if [[ $BUILD_EWK_UNITTESTS == 1 ]]; then
148 TARGETS="$TARGETS ewk_unittests"
150 if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
151 TARGETS="$TARGETS content_shell dump_syms minidump_stackwalk"
153 if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
154 TARGETS="$TARGETS chromedriver"
156 export BUILD_SUBDIRECTORY=""
157 BUILDDIR=${GN_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
158 ninja -C $BUILDDIR ${JOBS} ${TARGETS}
162 function error_report() {
163 echo "Error: File:$1 Line:$2"
167 function findElementInArray() {
169 for elm in "${@:2}"; do
170 [[ "$elm" = "$1" ]] && return 0;
175 function setupAndExecuteTargetBuild() {
185 local exclusive_options=0
190 # "|| :" means "or always succeeding built-in command"
191 PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" | uniq || :)
192 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" | uniq || :)
194 while [[ $# > 0 ]]; do
195 count=$(( $count + 1 ))
198 ARGS[$count]=--define
199 count=$(( $count + 1 ))
200 ARGS[$count]="_debug_mode 1"
203 ARGS[$count]=--define
204 count=$(( $count + 1 ))
205 ARGS[$count]="_skip_ninja 1"
208 ARGS[$count]=--define
209 count=$(( $count + 1 ))
210 ARGS[$count]="_skip_gn 1"
213 ARGS[$count]=--define
214 count=$(( $count + 1 ))
215 ARGS[$count]="component_build 1"
222 count=$(( $count + 1 ))
227 count=$(( $count + 1 ))
233 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
235 PROFILE=tz_$(echo $1 | sed 's/--//g')
236 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
237 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
239 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
243 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
244 PROFILE=tz_$(echo $1 | sed 's/--//g')
245 elif [ "$DEFAULT_TIZEN_VERSION" == "4.0" ]; then
246 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')_$(echo $ARCHITECTURE | grep "i586" -q && echo "ia32" || echo $ARCHITECTURE)
248 PROFILE=tz_${DEFAULT_TIZEN_VERSION}_$(echo $1 | sed 's/--//g')
260 if [ "$exclusive_options" -gt 1 ]; then
261 echo "ERROR: --libs and --crosswalk-bin are mutually exclusive parameters."
265 if [ "$target" == "libs" ]; then
266 SPEC_FILE="chromium-efl-libs.spec"
267 elif [ "$target" == "crosswalk-bin" ]; then
268 SPEC_FILE="crosswalk-bin.spec"
271 if [ "$PROFILE" == "" ]; then
272 if [[ $platform == "mobile" ]]; then
273 PROFILE=tzmb_3.0_target-TM1
274 elif [[ $platform == "tv" ]]; then
275 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
276 PROFILE=tztv_arm-kantm
278 PROFILE=tztv_${DEFAULT_TIZEN_VERSION}_arm-kantm
280 elif [[ $platform == "da" ]]; then
281 if [ "$DEFAULT_TIZEN_VERSION" == "" ]; then
282 PROFILE=tzda_arm-kantm
284 PROFILE=tzda_${DEFAULT_TIZEN_VERSION}_arm-kantm
287 echo "Cannot set default PROFILE for platform=${platform}"
292 if [ "$MIRROR" == "1" ]; then
293 PROFILE=${PROFILE}_mirror
296 echo "Set the profile : $PROFILE"
298 if [ "$ARCHITECTURE" == "" ]; then
299 if [[ $platform == "mobile" ]]; then
301 elif [[ $platform == "mobile_emulator" ]]; then
303 elif [[ $platform == "tv" ]]; then
305 elif [[ $platform == "tv_emulator" ]]; then
308 echo "Cannot set default ARCHITECTURE for platform=${platform}"
312 echo "Set the architecture : $ARCHITECTURE"
314 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
315 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
319 if [ "$PROFILE" == "tztv_v2.4_product" ]; then
320 EXTRA_PACK_OPTS="--extra-packs python-base-x86-arm,python-x86-arm,python-xml-x86-arm"
323 if [ "$(echo "${PROFILE}" | grep -P "kant|jazz|hawk|product")" == "" -a "$NOINIT" == 0 ]; then
324 processRpmlintOption $PROFILE $RPMLINT
327 gbs $CONF_FLAG build -P $PROFILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS $EXTRA_PACK_OPTS --incremental
330 function processRpmlintOption() {
334 export BUILD_CONF_OPTS=
336 echo "** Process rpmlint option"
338 local PREVIOUS_RPMLINT="!rpmlint"
339 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
342 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
343 # Once built with rpmlint
344 PREVIOUS_RPMLINT="rpmlint"
348 if [ "$RPMLINT" == 0 ]; then
349 echo "** Disable rpmlint"
350 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
351 rm -rf $BUILD_CONF_DIR
352 mkdir $BUILD_CONF_DIR
353 URL_TARGET=$(echo $PROFILE | sed -e 's#.*\.[0-9]*_\([-a-zA-Z0-9]*\).*#\1#;s/tz_//g')
354 # The latest version doesn't have tizen version in snapshot repository url.
355 if [ "$(echo $DEFAULT_TIZEN_VERSION)" == "" ]; then
358 URL_TIZEN_VERSION=$DEFAULT_TIZEN_VERSION-
360 REPO=http://download.tizen.org/snapshots/tizen/$URL_TIZEN_VERSION$platform/latest/repos/$URL_TARGET/packages/repodata/
361 echo "** Repo : $REPO"
362 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
363 BUILD_CONF_GZ=$(grep "build.conf.gz" $BUILD_CONF_DIR/index.html | sed -e 's#.*\=\"\(.*\)\".*#\1#')
364 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
365 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
366 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
367 echo "It's failed to donwload build.conf. Please contact system administrator."
370 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
371 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
372 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
373 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
374 echo "** Once built with rpmlint"
375 BUILD_CONF_OPTS+=" --clean"
377 else # Enable rpmlint
378 echo "** Enable rpmlint"
380 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
381 BUILD_CONF_OPTS="--clean"