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 if [ $BUILD_CHROME == 1 ]; then
38 GN_GENERATOR_OUTPUT="out.chrome.${host_arch}"
40 GN_GENERATOR_OUTPUT="out.${host_arch}"
45 echo $GN_GENERATOR_OUTPUT
47 if [ -z "$GN_GENERATOR_FLAG" ]; then
48 export GN_GENERATOR_FLAG=$GN_GENERATOR_OUTPUT
53 # __GN_CHROMIUMEFL_TARGET is defined when we are called from build_desktop.sh.
54 # Otherwise we are called by gbs which already passes the is_tizen flag.
55 if [ "$__GN_CHROMIUMEFL_TARGET" == "desktop" ]; then
59 while [[ $# > 0 ]]; do
66 tizen_version=$(echo $1 | sed -e 's#tizen_version\=\([0-9.]*\)#\1#')
68 tizen_emulator_support=true)
69 tizen_emulator_support=true
71 tizen_product_tv=true)
74 tizen_product_da=true)
78 system_deps=("${system_deps[@]/icu/}")
82 system_deps=("${system_deps[@]/icu/}")
91 findElementInArray "$target" "${supported_targets[@]}"
92 if [[ $? == 1 ]]; then
93 echo "Unsupported target: $target"
97 if [ "$__GN_CHROMIUMEFL_TARGET" == "crosscompile" ]; then
98 buildType=crosscompile
99 EXTRA_GN_ARGS+=" edje_compiler=${TOPDIR}/out.${host_arch}/Dependencies/Root/bin/edje_cc"
102 ORIGINAL_GN_DEFINES="$GN_DEFINES"
103 export GN_DEFINES=$(echo "$GN_DEFINES" | sed -e 's/component\s*=\s*shared_library//g')
104 if [ "$ORIGINAL_GN_DEFINES" != "$GN_DEFINES" ]; then
105 echo "WARNING: component build is not supported."
106 echo "Removing component=shared_library from GN_DEFINES."
109 COMMON_GN_PARAMETERS="use_libjpeg_turbo=true
110 rtc_enable_sctp=false
119 enable_extensions=true
120 enable_print_preview=false
121 enable_oop_printing=false
128 add_desktop_flags() {
130 if [ $USE_CLANG == 1 ]; then
133 ADDITIONAL_GN_PARAMETERS+="use_system_libjpeg=true
137 local build_chrome=false
138 if [ $BUILD_CHROME == 1 ]; then
142 ADDITIONAL_GN_PARAMETERS+="gcc_ver=\"$(getGccVersion)\"
145 target_cpu=\"${host_arch}\"
146 target_os="\"linux\""
149 use_plugin_placeholder_hole=true
151 dcheck_always_on=false
153 build_chrome=${build_chrome}
160 ADDITIONAL_GN_PARAMETERS+="arm_use_neon=true
162 if [ "$host_arch" == "arm64" ]; then
163 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
164 deps_lib_path=\"/usr/lib64\"
165 v8_control_flow_integrity=false
170 add_emulator_flags() {
171 if [ "$host_arch" == "x64" ]; then
172 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
173 deps_lib_path=\"/usr/lib64\"
179 ADDITIONAL_GN_PARAMETERS+="
181 if [ "$host_arch" == "riscv64" ]; then
182 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
183 deps_lib_path=\"/usr/lib64\"
184 v8_control_flow_integrity=false
185 v8_enable_webassembly=true
191 ADDITIONAL_GN_PARAMETERS+="is_tizen=true
192 use_zygote_handle=true
193 gcc_ver=\"$(getGccVersion)\"
195 python_ver=\"$(getPythonVersion)\"
196 is_official_build=true
199 target_os="\"tizen\""
201 current_cpu=\"${host_arch}\"
202 host_cpu=\"${host_arch}\"
203 target_cpu=\"${host_arch}\"
204 use_real_dbus_clients=false
206 use_system_libwayland=true
207 v8_use_external_startup_data=true
210 # FIXME : Note that the v8_snapshot_toolchain has been set to wrong
211 # toolchain clang in x64 build even is_clang is false.
212 # This sets it to toolchain gcc forcibly as workaround.
213 # It needs to be set to the toolchain gcc under is_clang is false.
214 if [ "$host_arch" == "x64" ]; then
215 ADDITIONAL_GN_PARAMETERS+="v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_x64\"
219 if [ "$is_clang" == "true" ]; then
220 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
221 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
226 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
227 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
228 use_system_libjpeg=true
232 if [[ "${system_deps[@]}" =~ "icu" ]]; then
233 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=false
236 processICU replace_icu
238 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=true
243 if [ "$tizen_product_tv" == "true" ]; then
244 ADDITIONAL_GN_PARAMETERS+="enable_plugins=true
245 use_plugin_placeholder_hole=true
249 ADDITIONAL_GN_PARAMETERS+="tizen_multimedia=true
250 proprietary_codecs=true
252 tizen_web_speech_recognition=true
253 tizen_tbm_support=false
254 ffmpeg_branding=\"Chrome\"
257 if [ "$tizen_product_tv" == "true" ]; then
258 ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=false
262 # Enable video hole only for standard and TV profile
263 if [ \( "$tizen_product_tv" == "true" \) -o \( "$tizen_product_da" != "true" -a "$tizen_emulator_support" != "true" \) ]; then
264 ADDITIONAL_GN_PARAMETERS+="tizen_video_hole=true
267 ADDITIONAL_GN_PARAMETERS+="tizen_video_hole=false
272 add_wayland_flags() {
273 if [ "$use_wayland" == "true" ]; then
274 ADDITIONAL_GN_PARAMETERS+="use_wayland=true
278 ADDITIONAL_GN_PARAMETERS+="use_wayland=false
279 wayland_bringup=false
285 # To reduce binary size, O2 is only applied to major components
286 # and Os is applied to the others.
289 if [ "$is_clang" == "true" ]; then
293 ADDITIONAL_GN_PARAMETERS+="lto_level=\"$lto_level\"
297 # Due to large file size issue of libchromium-ewk.so,
298 # The symbol level is set to 1 by default.
299 # Once the issue is fixed, set it to the level from platform.
300 local symbol_level=$(echo " $CFLAGS" | sed -e 's#.* -g\([0-9]\).*#\1#')
301 if [ "$host_arch" == "x86" ]; then
303 elif [ "$symbol_level" != "0" ]; then
307 if [[ $symbol_level =~ ^[0-9]$ ]]; then
308 ADDITIONAL_GN_PARAMETERS+="symbol_level=$symbol_level
311 ADDITIONAL_GN_PARAMETERS+="symbol_level=1
314 # target_arch changed to target_cpu but not changed because it seems that
315 # it is used for gbs and added target_cpu also.
316 ADDITIONAL_GN_PARAMETERS+="target_cpu=\"${host_arch}\"
321 # target_arch changed to target_cpu but not changed because it seems that
322 # it is used for gbs and added target_cpu also.
323 ADDITIONAL_GN_PARAMETERS+="target_cpu=\"arm\"
324 sysroot=\"$SYSROOTDIR\"
328 # Compiling yasm with crosscompile + icecc leads to some strange errors (one file is built for target instead of host).
329 # Yasm is an assembler used only by the build (not at runtime) and it is generally available in Linux distros so let's just
330 # use it from the system.
331 ADDITIONAL_GN_PARAMETERS+="use_system_yasm=true"
334 if [ "$target" == "desktop" ]; then
338 if [ "$host_arch" == "arm" -o "$host_arch" == "arm64" ]; then
340 elif [ "$host_arch" == "x86" -o "$host_arch" == "x64" ]; then
342 elif [ "$host_arch" == "riscv64" -o "$host_arch" == "riscv64" ]; then
345 if [ "$buildType" == "gbs" ]; then
347 elif [ "$buildType" == "crosscompile" ]; then
352 if [ "$system_deps" != "" ]; then
353 echo "** use system lib : replace **"
354 #replacing original files with correct ones according to $system_deps
355 $TOPDIR/build/linux/unbundle/replace_gn_files.py $system_deps
362 --dotfile=${TOPDIR}/tizen_src/.gn
364 $COMMON_GN_PARAMETERS
365 $ADDITIONAL_GN_PARAMETERS
369 if [ "$target" == "tizen" ]; then
370 echo $BUILD_ARCH > host_arch.txt
373 echo $target > target.txt
374 echo $target > third_party/node/target.txt
376 printf "GN_ARGUMENTS:\n"
377 for arg in $_GN_ARGS; do
378 printf " * ${arg##-D}\n"
380 for arg in $system_deps; do
381 printf " * ${arg##-D}\n"
384 ${TOPDIR}/tizen_src/build/gn_chromiumefl \