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 files and files in the config/platform | 7 # This script is used to generate .gypi files and files in the config/platform |
8 # directories needed to build libvpx. | 8 # 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 # $1 - Array name for file list. | 96 # $1 - Array name for file list. |
97 # $2 - Output file | 97 # $2 - Output file |
98 function write_special_flags { | 98 function write_special_flags { |
99 declare -a file_list=("${!1}") | 99 declare -a file_list=("${!1}") |
100 | 100 |
101 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') | 101 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') |
102 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') | 102 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') |
103 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') | 103 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') |
104 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') | 104 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') |
105 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') | 105 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') |
| 106 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') |
| 107 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') |
106 | 108 |
107 # Intrinsic functions and files are in flux. We can selectively generate them | 109 # Intrinsic functions and files are in flux. We can selectively generate them |
108 # but we can not selectively include them in libvpx.gyp. Throw some warnings | 110 # but we can not selectively include them in libvpx.gyp. Throw some warnings |
109 # when the expected output changes. | 111 # when the expected output changes. |
110 | 112 |
111 # Expect output for these: | 113 # Expect output for these: |
112 if [ 0 -eq ${#mmx_sources} ]; then | 114 if [ 0 -eq ${#mmx_sources} ]; then |
113 echo "WARNING: Comment mmx sections in libvpx.gyp" | 115 echo "ERROR: Comment mmx sections in libvpx.gyp" |
114 exit 1 | 116 exit 1 |
115 fi | 117 fi |
116 if [ 0 -eq ${#sse2_sources} ]; then | 118 if [ 0 -eq ${#sse2_sources} ]; then |
117 echo "WARNING: Comment sse2 sections in libvpx.gyp" | 119 echo "ERROR: Comment sse2 sections in libvpx.gyp" |
118 exit 1 | 120 exit 1 |
119 fi | 121 fi |
120 if [ 0 -eq ${#ssse3_sources} ]; then | 122 if [ 0 -eq ${#ssse3_sources} ]; then |
121 echo "WARNING: Comment ssse3 sections in libvpx.gyp" | 123 echo "ERROR: Comment ssse3 sections in libvpx.gyp" |
| 124 exit 1 |
| 125 fi |
| 126 if [ 0 -eq ${#avx2_sources} ]; then |
| 127 echo "ERROR: Comment avx2 sections in libvpx.gyp" |
122 exit 1 | 128 exit 1 |
123 fi | 129 fi |
124 | 130 |
125 # Do not expect output for these: | 131 # Do not expect output for these: |
126 if [ 0 -ne ${#sse3_sources} ]; then | 132 if [ 0 -ne ${#sse3_sources} ]; then |
127 echo "WARNING: Uncomment sse3 sections in libvpx.gyp" | 133 echo "ERROR: Uncomment sse3 sections in libvpx.gyp" |
128 exit 1 | 134 exit 1 |
129 fi | 135 fi |
130 if [ 0 -ne ${#sse4_1_sources} ]; then | 136 if [ 0 -ne ${#sse4_1_sources} ]; then |
131 echo "WARNING: Uncomment sse4_1 sections in libvpx.gyp" | 137 echo "ERROR: Uncomment sse4_1 sections in libvpx.gyp" |
| 138 exit 1 |
| 139 fi |
| 140 if [ 0 -ne ${#avx_sources} ]; then |
| 141 echo "ERROR: Uncomment avx sections in libvpx.gyp" |
132 exit 1 | 142 exit 1 |
133 fi | 143 fi |
134 | 144 |
135 write_gypi_header $2 | 145 write_gypi_header $2 |
136 | 146 |
137 echo " 'targets': [" >> $2 | 147 echo " 'targets': [" >> $2 |
138 | 148 |
139 write_target_definition mmx_sources[@] $2 libvpx_intrinsics_mmx mmx | 149 write_target_definition mmx_sources[@] $2 libvpx_intrinsics_mmx mmx |
140 write_target_definition sse2_sources[@] $2 libvpx_intrinsics_sse2 sse2 | 150 write_target_definition sse2_sources[@] $2 libvpx_intrinsics_sse2 sse2 |
141 #write_target_definition sse3_sources[@] $2 libvpx_intrinsics_sse3 sse3 | 151 #write_target_definition sse3_sources[@] $2 libvpx_intrinsics_sse3 sse3 |
142 write_target_definition ssse3_sources[@] $2 libvpx_intrinsics_ssse3 ssse3 | 152 write_target_definition ssse3_sources[@] $2 libvpx_intrinsics_ssse3 ssse3 |
143 #write_target_definition sse4_1_sources[@] $2 libvpx_intrinsics_sse4_1 sse4.1 | 153 #write_target_definition sse4_1_sources[@] $2 libvpx_intrinsics_sse4_1 sse4.1 |
| 154 #write_target_definition avx_sources[@] $2 libvpx_intrinsics_avx avx |
| 155 write_target_definition avx2_sources[@] $2 libvpx_intrinsics_avx2 avx2 |
144 | 156 |
145 echo " ]," >> $2 | 157 echo " ]," >> $2 |
146 | 158 |
147 write_gypi_footer $2 | 159 write_gypi_footer $2 |
148 } | 160 } |
149 | 161 |
150 # Convert a list of source files into gypi file. | 162 # Convert a list of source files into gypi file. |
151 # $1 - Input file. | 163 # $1 - Input file. |
152 # $2 - Output gypi file base. Will generate additional .gypi files when | 164 # $2 - Output gypi file base. Will generate additional .gypi files when |
153 # different compilation flags are required. | 165 # different compilation flags are required. |
(...skipping 12 matching lines...) Expand all Loading... |
166 | 178 |
167 # Not sure why vpx_config is not included. | 179 # Not sure why vpx_config is not included. |
168 source_list=$(echo "$source_list" | grep -v 'vpx_config\.c') | 180 source_list=$(echo "$source_list" | grep -v 'vpx_config\.c') |
169 | 181 |
170 # The actual ARM files end in .asm. We have rules to translate them to .S | 182 # The actual ARM files end in .asm. We have rules to translate them to .S |
171 source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/) | 183 source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/) |
172 | 184 |
173 # Select all x86 files ending with .c | 185 # Select all x86 files ending with .c |
174 local x86_intrinsic_list=$(echo "$source_list" | \ | 186 local x86_intrinsic_list=$(echo "$source_list" | \ |
175 egrep 'vp[89]/(encoder|decoder|common)/x86/' | \ | 187 egrep 'vp[89]/(encoder|decoder|common)/x86/' | \ |
176 egrep '(mmx|sse2|sse3|ssse3|sse4).c$') | 188 egrep '(mmx|sse2|sse3|ssse3|sse4|avx|avx2).c$') |
177 | 189 |
178 # Remove these files from the main list. | 190 # Remove these files from the main list. |
179 source_list=$(comm -23 <(echo "$source_list") <(echo "$x86_intrinsic_list")) | 191 source_list=$(comm -23 <(echo "$source_list") <(echo "$x86_intrinsic_list")) |
180 | 192 |
181 write_file_list source_list $BASE_DIR/$2.gypi | 193 write_file_list source_list $BASE_DIR/$2.gypi |
182 | 194 |
183 # All the files are in a single "element." Check if the first element has | 195 # All the files are in a single "element." Check if the first element has |
184 # length 0. | 196 # length 0. |
185 if [ 0 -ne ${#x86_intrinsic_list} ]; then | 197 if [ 0 -ne ${#x86_intrinsic_list} ]; then |
186 write_special_flags x86_intrinsic_list[@] $BASE_DIR/$2_intrinsics.gypi | 198 write_special_flags x86_intrinsic_list[@] $BASE_DIR/$2_intrinsics.gypi |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 make_clean | 400 make_clean |
389 make libvpx_srcs.txt target=libs $config > /dev/null | 401 make libvpx_srcs.txt target=libs $config > /dev/null |
390 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_nacl | 402 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_nacl |
391 | 403 |
392 echo "Remove temporary directory." | 404 echo "Remove temporary directory." |
393 cd $BASE_DIR | 405 cd $BASE_DIR |
394 rm -rf $TEMP_DIR | 406 rm -rf $TEMP_DIR |
395 | 407 |
396 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? | 408 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? |
397 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? | 409 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? |
OLD | NEW |