OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script is used to generate .gypi, .gni files and files in the | 7 # This script is used to generate .gypi, .gni files and files in the |
8 # config/platform directories needed to build libvpx. | 8 # config/platform directories needed to build libvpx. |
9 # Every time libvpx source code is updated just run this script. | 9 # Every time libvpx source code is updated just run this script. |
10 # | 10 # |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 echo " 'source/config/<(OS_CATEGORY)/<(target_arch_full)'," >> "$2" | 96 echo " 'source/config/<(OS_CATEGORY)/<(target_arch_full)'," >> "$2" |
97 echo " '<(libvpx_source)'," >> "$2" | 97 echo " '<(libvpx_source)'," >> "$2" |
98 echo " ]," >> "$2" | 98 echo " ]," >> "$2" |
99 echo " 'sources': [" >> "$2" | 99 echo " 'sources': [" >> "$2" |
100 for f in $sources_list | 100 for f in $sources_list |
101 do | 101 do |
102 echo " '<(libvpx_source)/$f'," >> $2 | 102 echo " '<(libvpx_source)/$f'," >> $2 |
103 done | 103 done |
104 echo " ]," >> "$2" | 104 echo " ]," >> "$2" |
105 if [[ $4 == fpu=neon ]]; then | 105 if [[ $4 == fpu=neon ]]; then |
| 106 echo " 'includes': [ 'ads2gas.gypi' ]," >> "$2" |
106 echo " 'cflags!': [ '-mfpu=vfpv3-d16' ]," >> "$2" | 107 echo " 'cflags!': [ '-mfpu=vfpv3-d16' ]," >> "$2" |
107 echo " 'conditions': [" >> $2 | 108 echo " 'conditions': [" >> $2 |
108 echo " # Disable LTO in neon targets due to compiler bug" >> "$2" | 109 echo " # Disable LTO in neon targets due to compiler bug" >> "$2" |
109 echo " # crbug.com/408997" >> "$2" | 110 echo " # crbug.com/408997" >> "$2" |
110 echo " ['use_lto==1', {" >> "$2" | 111 echo " ['use_lto==1', {" >> "$2" |
111 echo " 'cflags!': [" >> "$2" | 112 echo " 'cflags!': [" >> "$2" |
112 echo " '-flto'," >> "$2" | 113 echo " '-flto'," >> "$2" |
113 echo " '-ffat-lto-objects'," >> "$2" | 114 echo " '-ffat-lto-objects'," >> "$2" |
114 echo " ]," >> "$2" | 115 echo " ]," >> "$2" |
115 echo " }]," >> "$2" | 116 echo " }]," >> "$2" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 function write_intrinsics_gypi { | 149 function write_intrinsics_gypi { |
149 declare -a file_list=("${!1}") | 150 declare -a file_list=("${!1}") |
150 | 151 |
151 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') | 152 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') |
152 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') | 153 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') |
153 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') | 154 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') |
154 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') | 155 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') |
155 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') | 156 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') |
156 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') | 157 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') |
157 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') | 158 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') |
158 local neon_sources=$(echo "$file_list" | grep '_neon\.c$') | 159 local neon_sources=$(echo "$file_list" | grep '_neon\.c$\|\.asm$') |
159 | 160 |
160 # Intrinsic functions and files are in flux. We can selectively generate them | 161 # Intrinsic functions and files are in flux. We can selectively generate them |
161 # but we can not selectively include them in libvpx.gyp. Throw some errors | 162 # but we can not selectively include them in libvpx.gyp. Throw some errors |
162 # when new targets are needed. | 163 # when new targets are needed. |
163 | 164 |
164 rm -rf "$2" | 165 rm -rf "$2" |
165 write_license "$2" | 166 write_license "$2" |
166 write_gypi_header "$2" | 167 write_gypi_header "$2" |
167 | 168 |
168 echo " 'targets': [" >> "$2" | 169 echo " 'targets': [" >> "$2" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 # The actual ARM files end in .asm. We have rules to translate them to .S | 224 # The actual ARM files end in .asm. We have rules to translate them to .S |
224 source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/) | 225 source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/) |
225 | 226 |
226 # Select all x86 files ending with .c | 227 # Select all x86 files ending with .c |
227 local intrinsic_list=$(echo "$source_list" | \ | 228 local intrinsic_list=$(echo "$source_list" | \ |
228 egrep 'vp[89]/(encoder|decoder|common)/x86/' | \ | 229 egrep 'vp[89]/(encoder|decoder|common)/x86/' | \ |
229 egrep '(mmx|sse2|sse3|ssse3|sse4|avx|avx2).c$') | 230 egrep '(mmx|sse2|sse3|ssse3|sse4|avx|avx2).c$') |
230 | 231 |
231 # Select all neon files ending in C but only when building in RTCD mode | 232 # Select all neon files ending in C but only when building in RTCD mode |
232 if [ "libvpx_srcs_arm_neon_cpu_detect" == "$2" ]; then | 233 if [ "libvpx_srcs_arm_neon_cpu_detect" == "$2" ]; then |
233 # Select all arm neon files ending in _neon.c | 234 # Select all arm neon files ending in _neon.c and all asm files. |
| 235 # The asm files need to be included in the intrinsics target because |
| 236 # they need the -mfpu=neon flag. |
234 # the pattern may need to be updated if vpx_scale gets intrinics | 237 # the pattern may need to be updated if vpx_scale gets intrinics |
235 local intrinsic_list=$(echo "$source_list" | \ | 238 local intrinsic_list=$(echo "$source_list" | \ |
236 egrep 'vp[89]/(encoder|decoder|common)/arm/neon/' | \ | 239 egrep 'vp[89]/(encoder|decoder|common)/arm/neon/.*(_neon\.c|\.asm)$') |
237 egrep '_neon.c$') | |
238 fi | 240 fi |
239 | 241 |
240 # Remove these files from the main list. | 242 # Remove these files from the main list. |
241 source_list=$(comm -23 <(echo "$source_list") <(echo "$intrinsic_list")) | 243 source_list=$(comm -23 <(echo "$source_list") <(echo "$intrinsic_list")) |
242 | 244 |
243 local x86_list=$(echo "$source_list" | egrep '/x86/') | 245 local x86_list=$(echo "$source_list" | egrep '/x86/') |
244 | 246 |
245 write_gypi source_list "$BASE_DIR/$2.gypi" | 247 write_gypi source_list "$BASE_DIR/$2.gypi" |
246 | 248 |
247 # All the files are in a single "element." Check if the first element has | 249 # All the files are in a single "element." Check if the first element has |
(...skipping 18 matching lines...) Expand all Loading... |
266 write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni" | 268 write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni" |
267 write_gni mmx_sources $2_mmx "$BASE_DIR/libvpx_srcs.gni" | 269 write_gni mmx_sources $2_mmx "$BASE_DIR/libvpx_srcs.gni" |
268 write_gni sse2_sources $2_sse2 "$BASE_DIR/libvpx_srcs.gni" | 270 write_gni sse2_sources $2_sse2 "$BASE_DIR/libvpx_srcs.gni" |
269 write_gni sse3_sources $2_sse3 "$BASE_DIR/libvpx_srcs.gni" | 271 write_gni sse3_sources $2_sse3 "$BASE_DIR/libvpx_srcs.gni" |
270 write_gni ssse3_sources $2_ssse3 "$BASE_DIR/libvpx_srcs.gni" | 272 write_gni ssse3_sources $2_ssse3 "$BASE_DIR/libvpx_srcs.gni" |
271 write_gni sse4_1_sources $2_sse4_1 "$BASE_DIR/libvpx_srcs.gni" | 273 write_gni sse4_1_sources $2_sse4_1 "$BASE_DIR/libvpx_srcs.gni" |
272 write_gni avx_sources $2_avx "$BASE_DIR/libvpx_srcs.gni" | 274 write_gni avx_sources $2_avx "$BASE_DIR/libvpx_srcs.gni" |
273 write_gni avx2_sources $2_avx2 "$BASE_DIR/libvpx_srcs.gni" | 275 write_gni avx2_sources $2_avx2 "$BASE_DIR/libvpx_srcs.gni" |
274 else | 276 else |
275 local c_sources=$(echo "$source_list" | egrep '.(c|h)$') | 277 local c_sources=$(echo "$source_list" | egrep '.(c|h)$') |
276 local assembly_sources=$(echo "$source_list" | egrep '.asm$') | 278 local assembly_sources=$(echo -e "$source_list\n$intrinsic_list" | \ |
| 279 egrep '.asm$') |
277 local neon_sources=$(echo "$intrinsic_list" | grep '_neon\.c$') | 280 local neon_sources=$(echo "$intrinsic_list" | grep '_neon\.c$') |
278 write_gni c_sources $2 "$BASE_DIR/libvpx_srcs.gni" | 281 write_gni c_sources $2 "$BASE_DIR/libvpx_srcs.gni" |
279 write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni" | 282 write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni" |
280 if [ 0 -ne ${#neon_sources} ]; then | 283 if [ 0 -ne ${#neon_sources} ]; then |
281 write_gni neon_sources $2_neon "$BASE_DIR/libvpx_srcs.gni" | 284 write_gni neon_sources $2_neon "$BASE_DIR/libvpx_srcs.gni" |
282 fi | 285 fi |
283 fi | 286 fi |
284 } | 287 } |
285 | 288 |
286 # Clean files from previous make. | 289 # Clean files from previous make. |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 make_clean | 518 make_clean |
516 make libvpx_srcs.txt target=libs $config > /dev/null | 519 make libvpx_srcs.txt target=libs $config > /dev/null |
517 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic | 520 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic |
518 | 521 |
519 echo "Remove temporary directory." | 522 echo "Remove temporary directory." |
520 cd $BASE_DIR | 523 cd $BASE_DIR |
521 rm -rf $TEMP_DIR | 524 rm -rf $TEMP_DIR |
522 | 525 |
523 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? | 526 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? |
524 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? | 527 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? |
OLD | NEW |