3 source $(dirname $0)/common.sh
4 trap 'error_report $0 $LINENO' ERR SIGINT SIGTERM SIGQUIT
5 host_arch=$(getHostArch)
7 supported_targets=("mobile" "tv" "desktop")
9 if [ -z "$GYP_GENERATOR_OUTPUT" ]; then
10 GYP_GENERATOR_OUTPUT=${TOPDIR}/"out.${host_arch}"
13 if [ -z "$GYP_GENERATOR_FLAGS" ]; then
14 export GYP_GENERATOR_FLAGS="output_dir=${GYP_GENERATOR_OUTPUT}"
19 # __GYP_CHROMIUMEFL_TARGET is defined when we are called from build_desktop.sh.
20 # Otherwise we are called by gbs whch already passes the correct building_for_* flag.
21 if [ "$__GYP_CHROMIUMEFL_TARGET" == "desktop" ]; then
25 while [[ $# > 0 ]]; do
27 -Dbuilding_for_tizen_*=1)
29 target=$(echo $1 | sed -e 's#-Dbuilding_for_tizen_\([a-z]*\)\=1#\1#')
31 -Dchromium_efl_tizen_version=*)
32 tizen_version=$(echo $1 | sed -e 's#-Dchromium_efl_tizen_version\=\([0-9.]*\)#\1#')
34 -Dtizen_emulator_support=1)
35 tizen_emulator_support=1
43 -Dbuilding_crosswalk_bin=*)
44 building_xwalk_for_development=1
50 findElementInArray "$target" "${supported_targets[@]}"
51 if [[ $? == 1 ]]; then
52 echo "Unsupported target: $target"
56 if [ "$__GYP_CHROMIUMEFL_TARGET" == "crosscompile" ]; then
57 buildType=crosscompile
58 EXTRA_GYP_ARGS+=" -Dedje_compiler=${TOPDIR}/out.${host_arch}/Dependencies/Root/bin/edje_cc"
61 ORIGINAL_GYP_DEFINES="$GYP_DEFINES"
62 export GYP_DEFINES=$(echo "$GYP_DEFINES" | sed -e 's/component\s*=\s*shared_library//g')
63 if [ "$ORIGINAL_GYP_DEFINES" != "$GYP_DEFINES" ]; then
64 echo "WARNING: component build is not supported."
65 echo "Removing component=shared_library from GYP_DEFINES."
68 COMMON_GYP_PARAMETERS="
70 -Dproprietary_codecs=1
77 -Dozone_auto_platforms=0
78 -Dozone_platform_wayland=0
86 -Ddisable_fatal_linker_warnings=
90 if [ "$building_xwalk" == "1" ] && [ "$building_xwalk_for_development" != "1" ]; then
91 COMMON_GYP_PARAMETERS+="
92 -Dxwalk_link_against_chromium_ewk=1
97 ADDITIONAL_GYP_PARAMETERS+="-Dbuilding_for_tizen=0
98 -Dbuilding_for_tizen_mobile=0
99 -Dbuilding_for_tizen_tv=0
107 ADDITIONAL_GYP_PARAMETERS+="-Darmv7=1
114 ADDITIONAL_GYP_PARAMETERS+="-Dbuilding_for_tizen=1
117 -Dpython_ver=$(getPythonVersion)
118 -Denable_basic_printing=1
119 -Denable_print_preview=1
121 -Dlinux_use_bundled_gold=0
122 -Dlinux_use_bundled_binutils=0
124 -Dtizen_multimedia_eme_support=0
127 # TODO(youngsoo): Once binutils-gold issue on tizen v3.0 ARM 64bit is fixed,
128 # make the latest tizen version unconditional.
129 if [ "$tizen_version" == "3.0" ] && [ "$host_arch" == "arm" ]; then
130 # [M48_2564] Temporary disabling the flag for switching to new chromium
131 # FIXME: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=15383
132 ADDITIONAL_GYP_PARAMETERS+="-Dlinux_use_gold_flags=0
133 -Dprebuilt_ld_gold_dir=${TOPDIR}/tizen_src/build/prebuild
135 elif [ "$tizen_version" == "2.4" -a "$target" == "tv" ]; then
136 ADDITIONAL_GYP_PARAMETERS+="-Dlinux_use_gold_flags=0
137 -Dprebuilt_ld_gold_dir=${TOPDIR}/tizen_src/build/prebuild/tizen_v2.4_tv
140 ADDITIONAL_GYP_PARAMETERS+="-Dlinux_use_gold_flags=0
141 -Dprebuilt_ld_gold_dir=${TOPDIR}/tizen_src/build/prebuild
145 if [ "$tizen_version" == "3.0" ]; then
146 ADDITIONAL_GYP_PARAMETERS+="-Dtizen_multimedia_support=1
149 ADDITIONAL_GYP_PARAMETERS+="-Dtizen_multimedia_support=0
156 add_wayland_flags() {
157 if [ "$use_wayland" == "1" ]; then
158 ADDITIONAL_GYP_PARAMETERS+="-Duse_wayland=1
162 ADDITIONAL_GYP_PARAMETERS+="-Duse_wayland=0
169 ADDITIONAL_GYP_PARAMETERS+="-Dtarget_arch=$host_arch
170 -Dhost_arch=$host_arch
174 # TODO(b.kelemen): ideally crosscompile should also support system libs.
175 # Unfortunately the gbs root doesn't contain everything chromium needs.
176 SYSTEM_DEPS="-Duse_system_expat=1
178 -Duse_system_libjpeg=0
179 -Duse_system_libpng=1
180 -Duse_system_libxml=1
181 -Duse_system_libxslt=1
186 if [ "$target" == "mobile" ]; then
187 SYSTEM_DEPS+="-Duse_system_bzip2=1
188 -Duse_system_libexif=1
195 ADDITIONAL_GYP_PARAMETERS+="-Dtarget_arch=arm
196 -Dhost_arch=$host_arch
197 -Dsysroot=$SYSROOTDIR
202 # Compiling yasm with crosscompile + icecc leads to some strange errors (one file is built for target instead of host).
203 # Yasm is an assembler used only by the build (not at runtime) and it is generally available in Linux distros so let's just
204 # use it from the system.
205 ADDITIONAL_GYP_PARAMETERS+="-Duse_system_yasm=1"
208 if [ "$target" == "desktop" ]; then
212 if [ "$target" == "mobile" -o "$target" == "tv" ]; then
213 if [ "$target_arch" == "arm" ]; then
216 if [ "$buildType" == "gbs" ]; then
218 elif [ "$buildType" == "crosscompile" ]; then
222 if [ "$SYSTEM_DEPS" != "" ]; then
223 #replacing original files with correct ones according to $SYSTEM_DEPS
224 $TOPDIR/build/linux/unbundle/replace_gyp_files.py $SYSTEM_DEPS
229 $COMMON_GYP_PARAMETERS
231 $ADDITIONAL_GYP_PARAMETERS
234 printf "GYP_ARGUMENTS:\n"
235 for arg in $_GYP_ARGS; do
236 printf " * ${arg##-D}\n"
239 ${TOPDIR}/tizen_src/build/gyp_chromiumefl \
241 ${TOPDIR}/tizen_src/ewk/chromium-ewk.gyp
245 if [ "$SYSTEM_DEPS" != "" ]; then
246 # Restore gyp files to their original states not to mess up the tree permanently.
247 $TOPDIR/build/linux/unbundle/replace_gyp_files.py --undo $SYSTEM_DEPS