3 export SCRIPTDIR=$(readlink -e $(dirname $0))
4 export TOPDIR=$(readlink -f "${SCRIPTDIR}/../..")
5 export CHROME_SRC="${TOPDIR}"
8 echo $(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
11 function getHostArch() {
12 echo $(uname -m | sed -e \
13 's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/;s/aarch64/arm64/')
16 function getPythonVersion() {
17 echo $(python --version 2>&1 | sed -e 's/Python \([0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/')
20 function setIfUndef() {
23 if [ -n "$original" ]; then
31 function hostBuldScriptUsage() {
35 Build non gbs version of chromium-efl
38 -h, --help Show this message
39 --build-ewk-unittests Build ewk unittests
40 --ccache Configure ccache installed in your system
41 --clang Use chromium's clang compiler to build the sources
42 --no-content-shell Don't build content_shell application
43 --debug Build debug version of chromium-efl (out.${host_arch}/Debug instead of out.${host_arch}/Release)
44 -jN Set number of jobs, just like with make or ninja
45 --skip-gyp Skip restore_gyp, jhbuild and gyp_chromium steps
46 --skip-ninja Skip ninja step
47 --xwalk Build crosswalk and friends
51 $0 --skip-gyp --ccache
57 function parseHostBuildScriptParams() {
62 export FORCE_JHBUILD=0
64 export BUILD_EWK_UNITTESTS=0
65 export BUILD_CONTENT_SHELL=1
67 export BUILD_SUBDIRECTORY=Release
68 export COMPONENT_BUILD=0
73 while [[ $# > 0 ]]; do
76 hostBuldScriptUsage ${0}
90 source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
96 export BUILD_CONTENT_SHELL=0
99 export FORCE_JHBUILD=1
104 --build-ewk-unittests)
105 export BUILD_EWK_UNITTESTS=1
108 export BUILD_SUBDIRECTORY="Debug"
114 export COMPONENT_BUILD=1
120 echo "Unknown argument: $1"
128 function hostGypChromiumEfl() {
129 if [[ $SKIP_GYP == 0 ]]; then
131 local COMPONENT_ARG=""
132 if [[ $BUILD_XWALK == 1 ]]; then
135 if [[ $COMPONENT_BUILD == 1 ]]; then
136 COMPONENT_ARG="-Dcomponent=shared_library"
138 ${TOPDIR}/tizen_src/build/gyp_chromiumefl.sh \
141 -Doutdir="$TOPDIR/out.$(getHostArch)" \
146 function hostGnChromiumEfl() {
147 if [[ $SKIP_GN != 1 ]]; then
149 local COMPONENT_ARG=""
150 if [[ $BUILD_XWALK == 1 ]]; then
151 XWALK_ARG="xwalk=true"
153 if [[ $COMPONENT_BUILD == 1 ]]; then
154 COMPONENT_ARG="component=shared_library"
156 ${TOPDIR}/tizen_src/build/gn_chromiumefl.sh \
159 "outdir=\"$TOPDIR/out.$(getHostArch)\"" \
160 "chromium_efl_tizen_version=30" \
165 function hostNinja() {
166 if [[ $SKIP_NINJA == 0 ]]; then
167 TARGETS="chromium-ewk efl_webprocess efl_webview_app ubrowser"
168 if [[ $BUILD_EWK_UNITTESTS == 1 ]]; then
169 TARGETS="$TARGETS ewk_unittests"
171 if [[ $BUILD_CONTENT_SHELL == 1 ]]; then
172 TARGETS="$TARGETS content_shell dump_syms minidump_stackwalk"
174 if [[ $BUILD_XWALK == 1 ]]; then
175 TARGETS="$TARGETS xwalk"
177 if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
178 TARGETS="$TARGETS chromedriver"
180 if [ "$USE_GN" ]; then
181 export BUILD_SUBDIRECTORY=""
182 BUILDDIR=${GN_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
184 BUILDDIR=${GYP_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
186 ninja -C $BUILDDIR ${JOBS} ${TARGETS}
190 function error_report() {
191 echo "Error: File:$1 Line:$2"
195 function findElementInArray() {
197 for elm in "${@:2}"; do
198 [[ "$elm" = "$1" ]] && return 0;
203 function setupAndExecuteTargetBuild() {
211 local SPEC_FILE="chromium-efl.spec"
214 # "|| :" means "or always succeeding built-in command"
215 PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" || :)
216 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" || :)
218 if [ "$PROFILE" == "" ]; then
219 if [[ $platform == "mobile" ]]; then
220 PROFILE=tzmb_v3.0_arm64-wayland
221 elif [[ $platform == "mobile_emulator" ]]; then
222 PROFILE=tzmb_v3.0_emulator-wayland
223 elif [[ $platform == "tv" ]]; then
224 PROFILE=tztv_v3.0_arm-wayland
225 elif [[ $platform == "tv_emulator" ]]; then
226 PROFILE=tztv_v3.0_emulator-wayland
228 echo "Cannot set default PROFILE for platform=${platform}"
232 echo "Set the profile : $PROFILE"
234 if [ "$ARCHITECTURE" == "" ]; then
235 if [[ $platform == "mobile" ]]; then
237 elif [[ $platform == "mobile_emulator" ]]; then
239 elif [[ $platform == "tv" ]]; then
241 elif [[ $platform == "tv_emulator" ]]; then
244 echo "Cannot set default ARCHITECTURE for platform=${platform}"
248 echo "Set the architecture : $ARCHITECTURE"
250 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
251 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
255 if [ "$PROFILE" == "tztv_v2.4_product" ]; then
256 EXTRA_PACK_OPTS="--extra-packs python-base-x86-arm,python-x86-arm,python-xml-x86-arm"
260 local exclusive_options=0
263 while [[ $# > 0 ]]; do
264 count=$(( $count + 1 ))
267 ARGS[$count]=--define
268 count=$(( $count + 1 ))
269 ARGS[$count]="_debug_mode 1"
272 ARGS[$count]=--define
273 count=$(( $count + 1 ))
274 ARGS[$count]="_skip_ninja 1"
277 ARGS[$count]=--define
278 count=$(( $count + 1 ))
279 ARGS[$count]="_skip_gyp 1"
282 ARGS[$count]=--define
283 count=$(( $count + 1 ))
284 ARGS[$count]="_use_gn 1"
287 ARGS[$count]=--define
288 count=$(( $count + 1 ))
289 ARGS[$count]="_skip_gn 1"
292 ARGS[$count]=--define
293 count=$(( $count + 1 ))
294 ARGS[$count]="build_xwalk 1"
297 ARGS[$count]=--define
298 count=$(( $count + 1 ))
299 ARGS[$count]="component_build 1"
303 exclusive_options=$(( $exclusive_options + 1 ))
306 target="crosswalk-bin"
307 exclusive_options=$(( $exclusive_options + 1 ))
314 count=$(( $count + 1 ))
319 count=$(( $count + 1 ))
328 if [ "$exclusive_options" -gt 1 ]; then
329 echo "ERROR: --libs and --crosswalk-bin are mutually exclusive parameters."
335 ln -sf tizen_src/packaging packaging
337 if [ "$target" == "libs" ]; then
338 SPEC_FILE="chromium-efl-libs.spec"
339 elif [ "$target" == "crosswalk-bin" ]; then
340 SPEC_FILE="crosswalk-bin.spec"
343 if [ "$(echo "${PROFILE}" | grep -Po "v3.0")" != "" -a "$NOINIT" == 0 ]; then
344 prepareTizen3Build $PROFILE $RPMLINT
347 gbs $CONF_FLAG build -P $PROFILE --spec $SPEC_FILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS $EXTRA_PACK_OPTS --incremental
350 function prepareTizen3Build() {
355 # In case of '_rpmlint 1', build.conf of gbs repo will be used, enabling rpmlint.
356 # Otherwise, locally prepared build.conf will be used, disabling rpmlint.
357 local PREVIOUS_BUILD_CONF_PATH=""
359 if [ "$PROFILE" == "tztv_v3.0_arm-wayland" ]; then
360 PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tztv_v3.0_arm_wayland.conf"
361 elif [ "$PROFILE" == "tzmb_v3.0_arm-wayland" ]; then
362 PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tzmb_v3.0_arm_wayland.conf"
363 elif [ "$PROFILE" == "tzmb_v3.0_arm64-wayland" ]; then
364 PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tzmb_v3.0_arm64_wayland.conf"
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 REPO=http://download.tizen.org/snapshots/tizen/$platform/latest/repos/$(echo $ARCHITECTURE | sed -e "s/armv7l/arm/;s/aarch64/arm64/")-wayland/packages/repodata/
383 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
384 BUILD_CONF_GZ=$(awk -F\" '{ print $6 }' $BUILD_CONF_DIR/index.html | grep "build.conf.gz")
385 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
386 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
387 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
388 echo "It's failed to donwload build.conf. Please contact system administrator."
391 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
392 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
393 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
394 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
395 echo "** Once built with rpmlint"
396 BUILD_CONF_OPTS+=" --clean"
398 else # Enable rpmlint
399 echo "** Enable rpmlint"
401 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
402 BUILD_CONF_OPTS="--clean"