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\""
144 dcheck_always_on=false
146 build_chrome=${build_chrome}
151 ADDITIONAL_GN_PARAMETERS+="arm_use_neon=false
153 if [ "$host_arch" == "arm64" ]; then
154 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
155 deps_lib_path=\"/usr/lib64\"
160 add_emulator_flags() {
161 if [ "$host_arch" == "x64" ]; then
162 ADDITIONAL_GN_PARAMETERS+="system_libdir=\"lib64\"
163 deps_lib_path=\"/usr/lib64\"
169 ADDITIONAL_GN_PARAMETERS+="is_tizen=true
170 use_zygote_handle=true
171 gcc_ver=\"$(getGccVersion)\"
172 python_ver=\"$(getPythonVersion)\"
173 is_official_build=true
175 enable_basic_printing=true
176 enable_print_preview=true
178 target_os="\"tizen\""
180 current_cpu=\"${host_arch}\"
181 host_cpu=\"${host_arch}\"
182 target_cpu=\"${host_arch}\"
183 use_real_dbus_clients=false
185 use_system_libwayland=true
188 # FIXME : Note that the v8_snapshot_toolchain has been set to wrong
189 # toolchain clang in x64 build even is_clang is false.
190 # This sets it to toolchain gcc forcibly as workaround.
191 # It needs to be set to the toolchain gcc under is_clang is false.
192 if [ "$host_arch" == "x64" ]; then
193 ADDITIONAL_GN_PARAMETERS+="v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_x64\"
197 if [ "$is_clang" == "true" ]; then
198 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
199 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_clang_$host_arch\"
204 ADDITIONAL_GN_PARAMETERS+="host_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
205 v8_snapshot_toolchain=\"//tizen_src/build/toolchain/tizen:tizen_$host_arch\"
206 use_system_libjpeg=true
210 if [[ "${system_deps[@]}" =~ "icu" ]]; then
211 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=false
214 processICU replace_icu
216 ADDITIONAL_GN_PARAMETERS+="icu_use_data_file=true
220 # [M49_2623] Temporary disabling the flag.
221 # FIXME: http://165.213.149.170/jira/browse/TWF-610
222 ADDITIONAL_GN_PARAMETERS+="tizen_multimedia=true
223 proprietary_codecs=true
224 tizen_web_speech_recognition=true
225 tizen_tbm_support=true
229 add_wayland_flags() {
230 if [ "$use_wayland" == "true" ]; then
231 ADDITIONAL_GN_PARAMETERS+="use_wayland=true
235 ADDITIONAL_GN_PARAMETERS+="use_wayland=false
236 wayland_bringup=false
242 # To reduce binary size, O2 is only applied to major components
243 # and Os is applied to the others.
246 if [ "$is_clang" == "true" ]; then
250 ADDITIONAL_GN_PARAMETERS+="lto_level=\"$lto_level\"
254 # Due to large file size issue of libchromium-ewk.so,
255 # The symbol level is set to 1 by default.
256 # Once the issue is fixed, set it to the level from platform.
257 local symbol_level=$(echo " $CFLAGS" | sed -e 's#.* -g\([0-9]\).*#\1#')
258 if [ "$host_arch" == "x86" ]; then
260 elif [ "$symbol_level" != "0" ]; then
264 if [[ $symbol_level =~ ^[0-9]$ ]]; then
265 ADDITIONAL_GN_PARAMETERS+="symbol_level=$symbol_level
268 ADDITIONAL_GN_PARAMETERS+="symbol_level=1
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=\"${host_arch}\"
278 # target_arch changed to target_cpu but not changed because it seems that
279 # it is used for gbs and added target_cpu also.
280 ADDITIONAL_GN_PARAMETERS+="target_cpu=\"arm\"
281 sysroot=\"$SYSROOTDIR\"
285 # Compiling yasm with crosscompile + icecc leads to some strange errors (one file is built for target instead of host).
286 # Yasm is an assembler used only by the build (not at runtime) and it is generally available in Linux distros so let's just
287 # use it from the system.
288 ADDITIONAL_GN_PARAMETERS+="use_system_yasm=true"
291 if [ "$target" == "desktop" ]; then
295 if [ "$host_arch" == "arm" -o "$host_arch" == "arm64" ]; then
297 elif [ "$host_arch" == "x86" -o "$host_arch" == "x64" ]; then
300 if [ "$buildType" == "gbs" ]; then
302 elif [ "$buildType" == "crosscompile" ]; then
307 if [ "$system_deps" != "" ]; then
308 echo "** use system lib : replace **"
309 #replacing original files with correct ones according to $system_deps
310 $TOPDIR/build/linux/unbundle/replace_gn_files.py $system_deps
317 --dotfile=${TOPDIR}/tizen_src/.gn
319 $COMMON_GN_PARAMETERS
320 $ADDITIONAL_GN_PARAMETERS
324 echo $target > target.txt
325 echo $target > third_party/node/target.txt
327 printf "GN_ARGUMENTS:\n"
328 for arg in $_GN_ARGS; do
329 printf " * ${arg##-D}\n"
331 for arg in $system_deps; do
332 printf " * ${arg##-D}\n"
335 ${TOPDIR}/tizen_src/build/gn_chromiumefl \