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 proprietary_codecs=false
107 rtc_enable_sctp=false
116 enable_extensions=true
118 use_allocator=\"none\"
123 add_desktop_flags() {
125 if [ $USE_CLANG == 1 ]; then
128 ADDITIONAL_GN_PARAMETERS+="use_system_libjpeg=true
131 ADDITIONAL_GN_PARAMETERS+="gcc_ver=\"$(getGccVersion)\"
134 target_cpu=\"${host_arch}\"
135 target_os="\"linux\""
139 dcheck_always_on=false
145 ADDITIONAL_GN_PARAMETERS+="arm_use_neon=false
147 if [ "$host_arch" == "arm64" ]; then
148 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
149 deps_lib_path=\"/usr/lib64\"
154 add_emulator_flags() {
155 if [ "$host_arch" == "x64" ]; then
156 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
157 deps_lib_path=\"/usr/lib64\"
163 ADDITIONAL_GN_PARAMETERS+="is_tizen=true
164 use_zygote_handle=true
165 gcc_ver=\"$(getGccVersion)\"
166 python_ver=\"$(getPythonVersion)\"
167 is_official_build=true
169 enable_basic_printing=true
170 enable_print_preview=true
171 tizen_multimedia_eme_support=false
173 target_os="\"tizen\""
175 current_cpu=\"${host_arch}\"
176 host_cpu=\"${host_arch}\"
177 target_cpu=\"${host_arch}\"
178 use_real_dbus_clients=false
180 use_system_libwayland=true
183 # FIXME : Note that the v8_snapshot_toolchain has been set to wrong
184 # toolchain clang in x64 build even is_clang is false.
185 # This sets it to toolchain gcc forcibly as workaround.
186 # It needs to be set to the toolchain gcc under is_clang is false.
187 if [ "$host_arch" == "x64" ]; then
188 ADDITIONAL_GN_PARAMETERS+="v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_x64\"
192 if [ "$is_clang" == "true" ]; then
193 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
194 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
199 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
200 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
201 use_system_libjpeg=true
205 if [[ "${system_deps[@]}" =~ "icu" ]]; then
206 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=false
209 processICU replace_icu
211 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=true
215 # [M49_2623] Temporary disabling the flag.
216 # FIXME: http://165.213.149.170/jira/browse/TWF-610
217 ADDITIONAL_GN_PARAMETERS+="tizen_multimedia_support=false
218 tizen_tbm_support=false
222 add_wayland_flags() {
223 if [ "$use_wayland" == "true" ]; then
224 ADDITIONAL_GN_PARAMETERS+="use_wayland=true
228 ADDITIONAL_GN_PARAMETERS+="use_wayland=false
229 wayland_bringup=false
235 # To reduce binary size, O2 is only applied to major components
236 # and Os is applied to the others.
239 if [ "$is_clang" == "true" ]; then
243 ADDITIONAL_GN_PARAMETERS+="lto_level=\"$lto_level\"
247 # Due to large file size issue of libchromium-ewk.so,
248 # The symbol level is set to 1 by default.
249 # Once the issue is fixed, set it to the level from platform.
250 local symbol_level=$(echo " $CFLAGS" | sed -e 's#.* -g\([0-9]\).*#\1#')
251 if [ "$host_arch" == "x86" ]; then
253 elif [ "$symbol_level" != "0" ]; then
257 if [[ $symbol_level =~ ^[0-9]$ ]]; then
258 ADDITIONAL_GN_PARAMETERS+="symbol_level=$symbol_level
261 ADDITIONAL_GN_PARAMETERS+="symbol_level=1
264 # target_arch changed to target_cpu but not changed because it seems that
265 # it is used for gbs and added target_cpu also.
266 ADDITIONAL_GN_PARAMETERS+="target_cpu=\"${host_arch}\"
271 # target_arch changed to target_cpu but not changed because it seems that
272 # it is used for gbs and added target_cpu also.
273 ADDITIONAL_GN_PARAMETERS+="target_cpu=\"arm\"
274 sysroot=\"$SYSROOTDIR\"
278 # Compiling yasm with crosscompile + icecc leads to some strange errors (one file is built for target instead of host).
279 # Yasm is an assembler used only by the build (not at runtime) and it is generally available in Linux distros so let's just
280 # use it from the system.
281 ADDITIONAL_GN_PARAMETERS+="use_system_yasm=true"
284 if [ "$target" == "desktop" ]; then
288 if [ "$host_arch" == "arm" -o "$host_arch" == "arm64" ]; then
290 elif [ "$host_arch" == "x86" -o "$host_arch" == "x64" ]; then
293 if [ "$buildType" == "gbs" ]; then
295 elif [ "$buildType" == "crosscompile" ]; then
300 if [ "$system_deps" != "" ]; then
301 echo "** use system lib : replace **"
302 #replacing original files with correct ones according to $system_deps
303 $TOPDIR/build/linux/unbundle/replace_gn_files.py $system_deps
310 --dotfile=${TOPDIR}/tizen_src/.gn
312 $COMMON_GN_PARAMETERS
313 $ADDITIONAL_GN_PARAMETERS
317 echo $target > target.txt
318 echo $target > third_party/node/target.txt
320 printf "GN_ARGUMENTS:\n"
321 for arg in $_GN_ARGS; do
322 printf " * ${arg##-D}\n"
324 for arg in $system_deps; do
325 printf " * ${arg##-D}\n"
328 ${TOPDIR}/tizen_src/build/gn_chromiumefl \