[MM] Remove unused gstreamer port.
[platform/framework/web/chromium-efl.git] / tizen_src / build / gyp_chromiumefl.sh
1 #!/bin/bash
2
3 source $(dirname $0)/common.sh
4 trap 'error_report $0 $LINENO' ERR SIGINT SIGTERM SIGQUIT
5 host_arch=$(getHostArch)
6
7 supported_targets=("mobile" "tv" "desktop")
8
9 if [ -z "$GYP_GENERATOR_OUTPUT" ]; then
10   GYP_GENERATOR_OUTPUT=${TOPDIR}/"out.${host_arch}"
11 fi
12
13 if [ -z "$GYP_GENERATOR_FLAGS" ]; then
14   export GYP_GENERATOR_FLAGS="output_dir=${GYP_GENERATOR_OUTPUT}"
15 fi
16
17 EXTRA_GYP_ARGS="$@"
18
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
22   target=desktop
23 fi
24
25 while [[ $# > 0 ]]; do
26   case "$1" in
27     -Dbuilding_for_tizen_*=1)
28       buildType="gbs"
29       target=$(echo $1 | sed -e 's#-Dbuilding_for_tizen_\([a-z]*\)\=1#\1#')
30       ;;
31     -Dchromium_efl_tizen_version=*)
32       tizen_version=$(echo $1 | sed -e 's#-Dchromium_efl_tizen_version\=\([0-9.]*\)#\1#')
33       ;;
34     -Dtizen_emulator_support=1)
35       tizen_emulator_support=1
36       ;;
37     -Duse_wayland=1)
38       use_wayland=1
39       ;;
40     --xwalk)
41       building_xwalk=1
42       ;;
43     -Dbuilding_crosswalk_bin=*)
44       building_xwalk_for_development=1
45       ;;
46   esac
47   shift;
48 done
49
50 findElementInArray "$target" "${supported_targets[@]}"
51 if [[ $? == 1 ]]; then
52   echo "Unsupported target: $target"
53   exit 1
54 fi
55
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"
59 fi
60
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."
66 fi
67
68 COMMON_GYP_PARAMETERS="
69                       -Duse_libjpeg_turbo=1
70                       -Dproprietary_codecs=1
71                       -Duse_alsa=0
72                       -Duse_aura=0
73                       -Duse_efl=1
74                       -Duse_gconf=0
75                       -Duse_kerberos=0
76                       -Duse_ozone=1
77                       -Dozone_auto_platforms=0
78                       -Dozone_platform_wayland=0
79                       -Duse_gnome_keyring=0
80                       -Duse_pango=0
81                       -Duse_cairo=0
82                       -Denable_plugins=1
83                       -Denable_extensions=1
84                       -Duse_cups=0
85                       -Duse_allocator=none
86                       -Ddisable_fatal_linker_warnings=
87                       --depth=${TOPDIR}
88                       "
89
90 if [ "$building_xwalk" == "1" ] && [ "$building_xwalk_for_development" != "1" ]; then
91   COMMON_GYP_PARAMETERS+="
92                          -Dxwalk_link_against_chromium_ewk=1
93                          "
94 fi
95
96 add_desktop_flags() {
97   ADDITIONAL_GYP_PARAMETERS+="-Dbuilding_for_tizen=0
98                               -Dbuilding_for_tizen_mobile=0
99                               -Dbuilding_for_tizen_tv=0
100                               -Dclang=${USE_CLANG}
101                               -Dwerror=
102                               -Duse_wayland=0
103                              "
104 }
105
106 add_arm_flags() {
107   ADDITIONAL_GYP_PARAMETERS+="-Darmv7=1
108                               -Darm_thumb=1
109                               -Darm_neon=1
110                              "
111 }
112
113 add_tizen_flags() {
114   ADDITIONAL_GYP_PARAMETERS+="-Dbuilding_for_tizen=1
115                               -Dtizen=1
116                               -Dwerror=
117                               -Dpython_ver=$(getPythonVersion)
118                               -Denable_basic_printing=1
119                               -Denable_print_preview=1
120                               -Dclang=0
121                               -Dlinux_use_bundled_gold=0
122                               -Dlinux_use_bundled_binutils=0
123                               -Ddisable_nacl=1
124                               -Dtizen_multimedia_eme_support=0
125                              "
126
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
134                                "
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
138                                "
139   else
140     ADDITIONAL_GYP_PARAMETERS+="-Dlinux_use_gold_flags=0
141                                 -Dprebuilt_ld_gold_dir=${TOPDIR}/tizen_src/build/prebuild
142                                "
143   fi
144
145   if [ "$tizen_version" == "3.0" ]; then
146     ADDITIONAL_GYP_PARAMETERS+="-Dtizen_multimedia_support=1
147                            "
148   else
149     ADDITIONAL_GYP_PARAMETERS+="-Dtizen_multimedia_support=0
150                            "
151   fi
152
153   add_wayland_flags
154 }
155
156 add_wayland_flags() {
157   if [ "$use_wayland" == "1" ]; then
158     ADDITIONAL_GYP_PARAMETERS+="-Duse_wayland=1
159                                 -Dwayland_bringup=1
160                                "
161   else
162     ADDITIONAL_GYP_PARAMETERS+="-Duse_wayland=0
163                                 -Dwayland_bringup=0
164                                "
165   fi
166 }
167
168 add_gbs_flags() {
169   ADDITIONAL_GYP_PARAMETERS+="-Dtarget_arch=$host_arch
170                               -Dhost_arch=$host_arch
171                               -Dsysroot=
172                               --no-parallel
173                              "
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
177                -Duse_system_flac=1
178                -Duse_system_libjpeg=0
179                -Duse_system_libpng=1
180                -Duse_system_libxml=1
181                -Duse_system_libxslt=1
182                -Duse_system_zlib=1
183                -Duse_system_icu=1
184               "
185
186   if [ "$target" == "mobile" ]; then
187     SYSTEM_DEPS+="-Duse_system_bzip2=1
188                   -Duse_system_libexif=1
189                   -Duse_system_nspr=1
190                  "
191   fi
192 }
193
194 add_cross_flags() {
195   ADDITIONAL_GYP_PARAMETERS+="-Dtarget_arch=arm
196                               -Dhost_arch=$host_arch
197                               -Dsysroot=$SYSROOTDIR
198                               -Darm_tune=arm7
199                               -Dhost_clang=0
200                              "
201
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"
206 }
207
208 if [ "$target" == "desktop" ]; then
209   add_desktop_flags
210 else
211   add_tizen_flags
212   if [ "$target" == "mobile" -o "$target" == "tv" ]; then
213     if [ "$target_arch" == "arm" ]; then
214       add_arm_flags
215     fi
216     if [ "$buildType" == "gbs" ]; then
217       add_gbs_flags
218     elif [ "$buildType" == "crosscompile" ]; then
219       add_cross_flags
220     fi
221   fi
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
225   fi
226 fi
227
228 _GYP_ARGS="
229     $COMMON_GYP_PARAMETERS
230     $SYSTEM_DEPS
231     $ADDITIONAL_GYP_PARAMETERS
232     $EXTRA_GYP_ARGS
233     "
234 printf "GYP_ARGUMENTS:\n"
235 for arg in $_GYP_ARGS; do
236   printf "    * ${arg##-D}\n"
237 done
238
239 ${TOPDIR}/tizen_src/build/gyp_chromiumefl \
240     ${_GYP_ARGS} \
241     ${TOPDIR}/tizen_src/ewk/chromium-ewk.gyp
242
243 ret=$?
244
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
248 fi
249
250 exit $ret