3 tizen_build_conf="/etc/tizen-build.conf"
6 # TV has something different.
7 if [ ! -f "$tizen_build_conf" ]; then
9 elif [ "$(grep "TZ_BUILD_PROJECT" "$tizen_build_conf" | grep "Unified")" != "" ]; then
11 elif [ "$(grep "TZ_BUILD_RELEASE_NAME" "$tizen_build_conf" | grep "TV")" != "" ]; then
13 elif [ "$(grep "TZ_BUILD_PROJECT" "$tizen_build_conf" | grep "Wearable")" != "" ]; then
15 elif [ "$(grep "TZ_BUILD_PROJECT" "$tizen_build_conf" | grep "DA")" != "" ]; then
18 echo "There isn't proper profile."
25 echo $(grep "TZ_BUILD_VERSION" "$tizen_build_conf" | sed -e "s/TZ_BUILD_VERSION=//g")
28 source $(dirname $0)/common.sh --tizen_$(get_tizen_version)
29 trap 'error_report $0 $LINENO' ERR SIGINT SIGTERM SIGQUIT
30 host_arch=$(getHostArch)
31 system_deps=$(getSystemDeps $(get_profile))
32 export HOST_ARCH=$host_arch
34 supported_targets=("tizen" "desktop")
36 if [ -z "$GN_GENERATOR_OUTPUT" ]; then
37 GN_GENERATOR_OUTPUT="out.${host_arch}"
41 echo $GN_GENERATOR_OUTPUT
43 if [ -z "$GN_GENERATOR_FLAG" ]; then
44 export GN_GENERATOR_FLAG=$GN_GENERATOR_OUTPUT
49 # __GN_CHROMIUMEFL_TARGET is defined when we are called from build_desktop.sh.
50 # Otherwise we are called by gbs which already passes the is_tizen flag.
51 if [ "$__GN_CHROMIUMEFL_TARGET" == "desktop" ]; then
55 while [[ $# > 0 ]]; do
62 tizen_version=$(echo $1 | sed -e 's#tizen_version\=\([0-9.]*\)#\1#')
64 tizen_emulator_support=true)
65 tizen_emulator_support=true
67 tizen_product_tv=true)
70 tizen_product_da=true)
74 system_deps=("${system_deps[@]/icu/}")
78 system_deps=("${system_deps[@]/icu/}")
87 findElementInArray "$target" "${supported_targets[@]}"
88 if [[ $? == 1 ]]; then
89 echo "Unsupported target: $target"
93 if [ "$__GN_CHROMIUMEFL_TARGET" == "crosscompile" ]; then
94 buildType=crosscompile
95 EXTRA_GN_ARGS+=" edje_compiler=${TOPDIR}/out.${host_arch}/Dependencies/Root/bin/edje_cc"
98 ORIGINAL_GN_DEFINES="$GN_DEFINES"
99 export GN_DEFINES=$(echo "$GN_DEFINES" | sed -e 's/component\s*=\s*shared_library//g')
100 if [ "$ORIGINAL_GN_DEFINES" != "$GN_DEFINES" ]; then
101 echo "WARNING: component build is not supported."
102 echo "Removing component=shared_library from GN_DEFINES."
105 COMMON_GN_PARAMETERS="use_libjpeg_turbo=true
106 rtc_enable_sctp=false
115 enable_extensions=true
117 use_allocator=\"none\"
122 add_desktop_flags() {
124 if [ $USE_CLANG == 1 ]; then
127 ADDITIONAL_GN_PARAMETERS+="use_system_libjpeg=true
131 local build_chrome=false
132 if [ $BUILD_CHROME == 1 ]; then
136 ADDITIONAL_GN_PARAMETERS+="gcc_ver=\"$(getGccVersion)\"
139 target_cpu=\"${host_arch}\"
140 target_os="\"linux\""
143 use_plugin_placeholder_hole=true
145 dcheck_always_on=false
147 build_chrome=${build_chrome}
152 ADDITIONAL_GN_PARAMETERS+="arm_use_neon=true
154 if [ "$host_arch" == "arm64" ]; then
155 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
156 deps_lib_path=\"/usr/lib64\"
157 v8_control_flow_integrity=false
162 add_emulator_flags() {
163 if [ "$host_arch" == "x64" ]; then
164 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
165 deps_lib_path=\"/usr/lib64\"
171 ADDITIONAL_GN_PARAMETERS+="is_tizen=true
172 use_zygote_handle=true
173 gcc_ver=\"$(getGccVersion)\"
175 python_ver=\"$(getPythonVersion)\"
176 is_official_build=true
179 target_os="\"tizen\""
181 current_cpu=\"${host_arch}\"
182 host_cpu=\"${host_arch}\"
183 target_cpu=\"${host_arch}\"
184 use_real_dbus_clients=false
186 use_system_libwayland=true
187 v8_use_external_startup_data=true
190 # FIXME : Note that the v8_snapshot_toolchain has been set to wrong
191 # toolchain clang in x64 build even is_clang is false.
192 # This sets it to toolchain gcc forcibly as workaround.
193 # It needs to be set to the toolchain gcc under is_clang is false.
194 if [ "$host_arch" == "x64" ]; then
195 ADDITIONAL_GN_PARAMETERS+="v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_x64\"
199 if [ "$is_clang" == "true" ]; then
200 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
201 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
206 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
207 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
208 use_system_libjpeg=true
212 if [[ "${system_deps[@]}" =~ "icu" ]]; then
213 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=false
216 processICU replace_icu
218 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=true
223 if [ "$tizen_product_tv" == "true" ]; then
224 ADDITIONAL_GN_PARAMETERS+="enable_plugins=true
225 use_plugin_placeholder_hole=true
228 ADDITIONAL_GN_PARAMETERS+="tizen_multimedia=true
229 proprietary_codecs=true
231 tizen_web_speech_recognition=true
232 tizen_tbm_support=true
235 if [ "$tizen_product_tv" == "true" ]; then
236 ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=true
240 # Enable video hole only for standard and TV profile
241 if [ \( "$tizen_product_tv" == "true" \) -o \( "$tizen_product_da" != "true" -a "$tizen_emulator_support" != "true" \) ]; then
242 ADDITIONAL_GN_PARAMETERS+="tizen_video_hole=true
245 ADDITIONAL_GN_PARAMETERS+="tizen_video_hole=false
250 add_wayland_flags() {
251 if [ "$use_wayland" == "true" ]; then
252 ADDITIONAL_GN_PARAMETERS+="use_wayland=true
256 ADDITIONAL_GN_PARAMETERS+="use_wayland=false
257 wayland_bringup=false
263 # To reduce binary size, O2 is only applied to major components
264 # and Os is applied to the others.
267 if [ "$is_clang" == "true" ]; then
271 ADDITIONAL_GN_PARAMETERS+="lto_level=\"$lto_level\"
275 # Due to large file size issue of libchromium-ewk.so,
276 # The symbol level is set to 1 by default.
277 # Once the issue is fixed, set it to the level from platform.
278 local symbol_level=$(echo " $CFLAGS" | sed -e 's#.* -g\([0-9]\).*#\1#')
279 if [ "$host_arch" == "x86" ]; then
281 elif [ "$symbol_level" != "0" ]; then
285 if [[ $symbol_level =~ ^[0-9]$ ]]; then
286 ADDITIONAL_GN_PARAMETERS+="symbol_level=$symbol_level
289 ADDITIONAL_GN_PARAMETERS+="symbol_level=1
292 # target_arch changed to target_cpu but not changed because it seems that
293 # it is used for gbs and added target_cpu also.
294 ADDITIONAL_GN_PARAMETERS+="target_cpu=\"${host_arch}\"
299 # target_arch changed to target_cpu but not changed because it seems that
300 # it is used for gbs and added target_cpu also.
301 ADDITIONAL_GN_PARAMETERS+="target_cpu=\"arm\"
302 sysroot=\"$SYSROOTDIR\"
306 # Compiling yasm with crosscompile + icecc leads to some strange errors (one file is built for target instead of host).
307 # Yasm is an assembler used only by the build (not at runtime) and it is generally available in Linux distros so let's just
308 # use it from the system.
309 ADDITIONAL_GN_PARAMETERS+="use_system_yasm=true"
312 if [ "$target" == "desktop" ]; then
316 if [ "$host_arch" == "arm" -o "$host_arch" == "arm64" ]; then
318 elif [ "$host_arch" == "x86" -o "$host_arch" == "x64" ]; then
321 if [ "$buildType" == "gbs" ]; then
323 elif [ "$buildType" == "crosscompile" ]; then
328 if [ "$system_deps" != "" ]; then
329 echo "** use system lib : replace **"
330 #replacing original files with correct ones according to $system_deps
331 $TOPDIR/build/linux/unbundle/replace_gn_files.py $system_deps
338 --dotfile=${TOPDIR}/tizen_src/.gn
340 $COMMON_GN_PARAMETERS
341 $ADDITIONAL_GN_PARAMETERS
345 if [ "$target" == "tizen" ]; then
346 echo $BUILD_ARCH > host_arch.txt
349 echo $target > target.txt
350 echo $target > third_party/node/target.txt
352 printf "GN_ARGUMENTS:\n"
353 for arg in $_GN_ARGS; do
354 printf " * ${arg##-D}\n"
356 for arg in $system_deps; do
357 printf " * ${arg##-D}\n"
360 ${TOPDIR}/tizen_src/build/gn_chromiumefl \