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_CHROMEDRIVER=0
68 export BUILD_SUBDIRECTORY=Release
69 export COMPONENT_BUILD=0
74 while [[ $# > 0 ]]; do
77 hostBuldScriptUsage ${0}
85 source $TOPDIR/tizen_src/build/ccache_env.sh ${platform}
91 export BUILD_CONTENT_SHELL=0
94 export FORCE_JHBUILD=1
99 --build-ewk-unittests)
100 export BUILD_EWK_UNITTESTS=1
103 export BUILD_SUBDIRECTORY="Debug"
109 export BUILD_CHROMEDRIVER=1
112 export COMPONENT_BUILD=1
118 echo "Unknown argument: $1"
126 function hostGypChromiumEfl() {
127 if [[ $SKIP_GYP == 0 ]]; then
129 local COMPONENT_ARG=""
130 if [[ $BUILD_XWALK == 1 ]]; then
133 if [[ $COMPONENT_BUILD == 1 ]]; then
134 COMPONENT_ARG="-Dcomponent=shared_library"
136 ${TOPDIR}/tizen_src/build/gyp_chromiumefl.sh \
139 -Doutdir="$TOPDIR/out.$(getHostArch)" \
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_XWALK == 1 ]]; then
154 TARGETS="$TARGETS xwalk"
156 if [[ $BUILD_CHROMEDRIVER == 1 ]]; then
157 TARGETS="$TARGETS chromedriver"
159 BUILDDIR=${GYP_GENERATOR_OUTPUT}/${BUILD_SUBDIRECTORY}
160 ninja -C $BUILDDIR ${JOBS} ${TARGETS}
164 function error_report() {
165 echo "Error: File:$1 Line:$2"
169 function findElementInArray() {
171 for elm in "${@:2}"; do
172 [[ "$elm" = "$1" ]] && return 0;
177 function setupAndExecuteTargetBuild() {
185 local SPEC_FILE="chromium-efl.spec"
188 # "|| :" means "or always succeeding built-in command"
189 PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" || :)
190 ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" || :)
192 if [ "$PROFILE" == "" ]; then
193 if [[ $platform == "mobile" ]]; then
194 PROFILE=tzmb_v3.0_arm64-wayland
195 elif [[ $platform == "mobile_emulator" ]]; then
196 PROFILE=tzmb_v3.0_emulator-wayland
197 elif [[ $platform == "tv" ]]; then
198 PROFILE=tztv_v3.0_arm-wayland
199 elif [[ $platform == "tv_emulator" ]]; then
200 PROFILE=tztv_v3.0_emulator-wayland
202 echo "Cannot set default PROFILE for platform=${platform}"
206 echo "Set the profile : $PROFILE"
208 if [ "$ARCHITECTURE" == "" ]; then
209 if [[ $platform == "mobile" ]]; then
211 elif [[ $platform == "mobile_emulator" ]]; then
213 elif [[ $platform == "tv" ]]; then
215 elif [[ $platform == "tv_emulator" ]]; then
218 echo "Cannot set default ARCHITECTURE for platform=${platform}"
222 echo "Set the architecture : $ARCHITECTURE"
224 if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
225 CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
229 if [ "$PROFILE" == "tztv_v2.4_product" ]; then
230 EXTRA_PACK_OPTS="--extra-packs python-base-x86-arm,python-x86-arm,python-xml-x86-arm"
234 local exclusive_options=0
237 while [[ $# > 0 ]]; do
238 count=$(( $count + 1 ))
241 ARGS[$count]=--define
242 count=$(( $count + 1 ))
243 ARGS[$count]="_debug_mode 1"
246 ARGS[$count]=--define
247 count=$(( $count + 1 ))
248 ARGS[$count]="_skip_ninja 1"
251 ARGS[$count]=--define
252 count=$(( $count + 1 ))
253 ARGS[$count]="_skip_gyp 1"
256 ARGS[$count]=--define
257 count=$(( $count + 1 ))
258 ARGS[$count]="build_xwalk 1"
261 ARGS[$count]=--define
262 count=$(( $count + 1 ))
263 ARGS[$count]="component_build 1"
267 exclusive_options=$(( $exclusive_options + 1 ))
270 target="crosswalk-bin"
271 exclusive_options=$(( $exclusive_options + 1 ))
277 ARGS[$count]=--define
278 count=$(( $count + 1 ))
279 ARGS[$count]="build_chromedriver 1"
283 count=$(( $count + 1 ))
288 count=$(( $count + 1 ))
297 if [ "$exclusive_options" -gt 1 ]; then
298 echo "ERROR: --libs and --crosswalk-bin are mutually exclusive parameters."
304 ln -sf tizen_src/packaging packaging
306 if [ "$target" == "libs" ]; then
307 SPEC_FILE="chromium-efl-libs.spec"
308 elif [ "$target" == "crosswalk-bin" ]; then
309 SPEC_FILE="crosswalk-bin.spec"
312 if [ "$(echo "${PROFILE}" | grep -Po "v3.0")" != "" -a "$NOINIT" == 0 ]; then
313 prepareTizen3Build $PROFILE $RPMLINT
316 gbs $CONF_FLAG build -P $PROFILE --spec $SPEC_FILE --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS $EXTRA_PACK_OPTS --incremental
319 function prepareTizen3Build() {
324 # In case of '_rpmlint 1', build.conf of gbs repo will be used, enabling rpmlint.
325 # Otherwise, locally prepared build.conf will be used, disabling rpmlint.
326 local PREVIOUS_BUILD_CONF_PATH=""
328 if [ "$PROFILE" == "tztv_v3.0_arm-wayland" ]; then
329 PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tztv_v3.0_arm_wayland.conf"
330 elif [ "$PROFILE" == "tzmb_v3.0_arm-wayland" ]; then
331 PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tzmb_v3.0_arm_wayland.conf"
332 elif [ "$PROFILE" == "tzmb_v3.0_arm64-wayland" ]; then
333 PREVIOUS_BUILD_CONF_PATH="/var/tmp/$USER-gbs/tzmb_v3.0_arm64_wayland.conf"
336 local PREVIOUS_RPMLINT="!rpmlint"
337 if [ ! -f "$PREVIOUS_BUILD_CONF_PATH" ]; then
340 elif [ "$(grep -Po "\!rpmlint" "$PREVIOUS_BUILD_CONF_PATH" | uniq -d)" != "!rpmlint" ]; then
341 # Once built with rpmlint
342 PREVIOUS_RPMLINT="rpmlint"
346 if [ "$RPMLINT" == 0 ]; then
347 echo "** Disable rpmlint"
348 BUILD_CONF_DIR=$SCRIPTDIR/build_conf
349 rm -rf $BUILD_CONF_DIR
350 mkdir $BUILD_CONF_DIR
351 REPO=http://download.tizen.org/snapshots/tizen/$platform/latest/repos/$(echo $ARCHITECTURE | sed -e "s/armv7l/arm/;s/aarch64/arm64/")-wayland/packages/repodata/
352 wget $REPO -O $BUILD_CONF_DIR/index.html > /dev/null 2>&1
353 BUILD_CONF_GZ=$(awk -F\" '{ print $6 }' $BUILD_CONF_DIR/index.html | grep "build.conf.gz")
354 BUILD_CONF=$(basename $BUILD_CONF_GZ .gz)
355 wget $REPO$BUILD_CONF_GZ -P $BUILD_CONF_DIR > /dev/null 2>&1
356 if [ ! -f "$BUILD_CONF_DIR/$BUILD_CONF_GZ" ]; then
357 echo "It's failed to donwload build.conf. Please contact system administrator."
360 gunzip $BUILD_CONF_DIR/$BUILD_CONF_GZ
361 sed -i 's/rpmlint-mini\ rpmlint-tizen/!rpmlint-mini\ !rpmlint-tizen/g' $BUILD_CONF_DIR/$BUILD_CONF
362 BUILD_CONF_OPTS="-D $BUILD_CONF_DIR/$BUILD_CONF"
363 if [ "$PREVIOUS_RPMLINT" == "rpmlint" ]; then
364 echo "** Once built with rpmlint"
365 BUILD_CONF_OPTS+=" --clean"
367 else # Enable rpmlint
368 echo "** Enable rpmlint"
370 if [ "$PREVIOUS_RPMLINT" == "!rpmlint" ]; then
371 BUILD_CONF_OPTS="--clean"