| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 echo " '<(libvpx_source)'," >> $2 | 72 echo " '<(libvpx_source)'," >> $2 |
| 73 echo " ]," >> $2 | 73 echo " ]," >> $2 |
| 74 echo " 'sources': [" >> $2 | 74 echo " 'sources': [" >> $2 |
| 75 for f in $sources_list | 75 for f in $sources_list |
| 76 do | 76 do |
| 77 echo " '<(libvpx_source)/$f'," >> $2 | 77 echo " '<(libvpx_source)/$f'," >> $2 |
| 78 done | 78 done |
| 79 echo " ]," >> $2 | 79 echo " ]," >> $2 |
| 80 echo " 'conditions': [" >> $2 | 80 echo " 'conditions': [" >> $2 |
| 81 echo " ['os_posix==1 and OS!=\"mac\"', {" >> $2 | 81 echo " ['os_posix==1 and OS!=\"mac\"', {" >> $2 |
| 82 echo " 'cflags!': [ '-mfpu=vfpv3-d16' ]," >> $2 |
| 82 echo " 'cflags': [ '-m$4', ]," >> $2 | 83 echo " 'cflags': [ '-m$4', ]," >> $2 |
| 83 echo " }]," >> $2 | 84 echo " }]," >> $2 |
| 84 echo " ['OS==\"mac\"', {" >> $2 | 85 echo " ['OS==\"mac\"', {" >> $2 |
| 85 echo " 'xcode_settings': {" >> $2 | 86 echo " 'xcode_settings': {" >> $2 |
| 86 echo " 'OTHER_CFLAGS': [ '-m$4', ]," >> $2 | 87 echo " 'OTHER_CFLAGS': [ '-m$4', ]," >> $2 |
| 87 echo " }," >> $2 | 88 echo " }," >> $2 |
| 88 echo " }]," >> $2 | 89 echo " }]," >> $2 |
| 89 echo " ]," >> $2 | 90 echo " ]," >> $2 |
| 90 echo " }," >> $2 | 91 echo " }," >> $2 |
| 91 } | 92 } |
| 92 | 93 |
| 93 | 94 |
| 94 # Generate a gypi which applies additional compiler flags based on the file | 95 # Generate a gypi which applies additional compiler flags based on the file |
| 95 # name. | 96 # name. |
| 96 # $1 - Array name for file list. | 97 # $1 - Array name for file list. |
| 97 # $2 - Output file | 98 # $2 - Output file |
| 98 function write_special_flags { | 99 function write_special_flags { |
| 99 declare -a file_list=("${!1}") | 100 declare -a file_list=("${!1}") |
| 100 | 101 |
| 101 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') | 102 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') |
| 102 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') | 103 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') |
| 103 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') | 104 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') |
| 104 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') | 105 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') |
| 105 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') | 106 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') |
| 106 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') | 107 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') |
| 107 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') | 108 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') |
| 108 | 109 |
| 110 local neon_sources=$(echo "$file_list" | grep '_neon\.c$') |
| 111 |
| 109 # Intrinsic functions and files are in flux. We can selectively generate them | 112 # Intrinsic functions and files are in flux. We can selectively generate them |
| 110 # but we can not selectively include them in libvpx.gyp. Throw some warnings | 113 # but we can not selectively include them in libvpx.gyp. Throw some errors |
| 111 # when the expected output changes. | 114 # when new targets are needed. |
| 112 | |
| 113 # Expect output for these: | |
| 114 if [ 0 -eq ${#mmx_sources} ]; then | |
| 115 echo "ERROR: Comment mmx sections in libvpx.gyp" | |
| 116 exit 1 | |
| 117 fi | |
| 118 if [ 0 -eq ${#sse2_sources} ]; then | |
| 119 echo "ERROR: Comment sse2 sections in libvpx.gyp" | |
| 120 exit 1 | |
| 121 fi | |
| 122 if [ 0 -eq ${#ssse3_sources} ]; then | |
| 123 echo "ERROR: Comment ssse3 sections in libvpx.gyp" | |
| 124 exit 1 | |
| 125 fi | |
| 126 | |
| 127 # Do not expect output for these: | |
| 128 if [ 0 -ne ${#sse3_sources} ]; then | |
| 129 echo "ERROR: Uncomment sse3 sections in libvpx.gyp" | |
| 130 exit 1 | |
| 131 fi | |
| 132 if [ 0 -ne ${#sse4_1_sources} ]; then | |
| 133 echo "ERROR: Uncomment sse4_1 sections in libvpx.gyp" | |
| 134 exit 1 | |
| 135 fi | |
| 136 if [ 0 -ne ${#avx_sources} ]; then | |
| 137 echo "ERROR: Uncomment avx sections in libvpx.gyp" | |
| 138 exit 1 | |
| 139 fi | |
| 140 if [ 0 -ne ${#avx2_sources} ]; then | |
| 141 echo "ERROR: Uncomment avx2 sections in libvpx.gyp" | |
| 142 exit 1 | |
| 143 fi | |
| 144 | 115 |
| 145 write_gypi_header $2 | 116 write_gypi_header $2 |
| 146 | 117 |
| 147 echo " 'targets': [" >> $2 | 118 echo " 'targets': [" >> $2 |
| 148 | 119 |
| 149 write_target_definition mmx_sources[@] $2 libvpx_intrinsics_mmx mmx | 120 # x86[_64] |
| 150 write_target_definition sse2_sources[@] $2 libvpx_intrinsics_sse2 sse2 | 121 if [ 0 -ne ${#mmx_sources} ]; then |
| 151 #write_target_definition sse3_sources[@] $2 libvpx_intrinsics_sse3 sse3 | 122 write_target_definition mmx_sources[@] $2 libvpx_intrinsics_mmx mmx |
| 152 write_target_definition ssse3_sources[@] $2 libvpx_intrinsics_ssse3 ssse3 | 123 fi |
| 153 #write_target_definition sse4_1_sources[@] $2 libvpx_intrinsics_sse4_1 sse4.1 | 124 if [ 0 -ne ${#sse2_sources} ]; then |
| 154 #write_target_definition avx_sources[@] $2 libvpx_intrinsics_avx avx | 125 write_target_definition sse2_sources[@] $2 libvpx_intrinsics_sse2 sse2 |
| 155 #write_target_definition avx2_sources[@] $2 libvpx_intrinsics_avx2 avx2 | 126 fi |
| 127 if [ 0 -ne ${#sse3_sources} ]; then |
| 128 #write_target_definition sse3_sources[@] $2 libvpx_intrinsics_sse3 sse3 |
| 129 echo "ERROR: Uncomment sse3 sections in libvpx.gyp" |
| 130 exit 1 |
| 131 fi |
| 132 if [ 0 -ne ${#ssse3_sources} ]; then |
| 133 write_target_definition ssse3_sources[@] $2 libvpx_intrinsics_ssse3 ssse3 |
| 134 fi |
| 135 if [ 0 -ne ${#sse4_1_sources} ]; then |
| 136 #write_target_definition sse4_1_sources[@] $2 libvpx_intrinsics_sse4_1 sse4.
1 |
| 137 echo "ERROR: Uncomment sse4_1 sections in libvpx.gyp" |
| 138 exit 1 |
| 139 fi |
| 140 if [ 0 -ne ${#avx_sources} ]; then |
| 141 #write_target_definition avx_sources[@] $2 libvpx_intrinsics_avx avx |
| 142 echo "ERROR: Uncomment avx sections in libvpx.gyp" |
| 143 exit 1 |
| 144 fi |
| 145 if [ 0 -ne ${#avx2_sources} ]; then |
| 146 #write_target_definition avx2_sources[@] $2 libvpx_intrinsics_avx2 avx2 |
| 147 echo "ERROR: Uncomment avx2 sections in libvpx.gyp" |
| 148 exit 1 |
| 149 fi |
| 150 |
| 151 # arm neon |
| 152 if [ 0 -ne ${#neon_sources} ]; then |
| 153 write_target_definition neon_sources[@] $2 libvpx_intrinsics_neon fpu=neon |
| 154 fi |
| 156 | 155 |
| 157 echo " ]," >> $2 | 156 echo " ]," >> $2 |
| 158 | 157 |
| 159 write_gypi_footer $2 | 158 write_gypi_footer $2 |
| 160 } | 159 } |
| 161 | 160 |
| 162 # Convert a list of source files into gypi file. | 161 # Convert a list of source files into gypi file. |
| 163 # $1 - Input file. | 162 # $1 - Input file. |
| 164 # $2 - Output gypi file base. Will generate additional .gypi files when | 163 # $2 - Output gypi file base. Will generate additional .gypi files when |
| 165 # different compilation flags are required. | 164 # different compilation flags are required. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 176 # not part of the compiled library. | 175 # not part of the compiled library. |
| 177 source_list=$(echo "$source_list" | grep -v '_offsets\.c') | 176 source_list=$(echo "$source_list" | grep -v '_offsets\.c') |
| 178 | 177 |
| 179 # Not sure why vpx_config is not included. | 178 # Not sure why vpx_config is not included. |
| 180 source_list=$(echo "$source_list" | grep -v 'vpx_config\.c') | 179 source_list=$(echo "$source_list" | grep -v 'vpx_config\.c') |
| 181 | 180 |
| 182 # The actual ARM files end in .asm. We have rules to translate them to .S | 181 # The actual ARM files end in .asm. We have rules to translate them to .S |
| 183 source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/) | 182 source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/) |
| 184 | 183 |
| 185 # Select all x86 files ending with .c | 184 # Select all x86 files ending with .c |
| 186 local x86_intrinsic_list=$(echo "$source_list" | \ | 185 local intrinsic_list=$(echo "$source_list" | \ |
| 187 egrep 'vp[89]/(encoder|decoder|common)/x86/' | \ | 186 egrep 'vp[89]/(encoder|decoder|common)/x86/' | \ |
| 188 egrep '(mmx|sse2|sse3|ssse3|sse4|avx|avx2).c$') | 187 egrep '(mmx|sse2|sse3|ssse3|sse4|avx|avx2).c$') |
| 189 | 188 |
| 189 # Select all neon files ending in C but only when building in RTCD mode |
| 190 if [ "libvpx_srcs_arm_neon_cpu_detect" == "$2" ]; then |
| 191 # Select all arm neon files ending in _neon.c |
| 192 # the pattern may need to be updated if vpx_scale gets intrinics |
| 193 local intrinsic_list=$(echo "$source_list" | \ |
| 194 egrep 'vp[89]/(encoder|decoder|common)/arm/neon/' | \ |
| 195 egrep '_neon.c$') |
| 196 fi |
| 197 |
| 190 # Remove these files from the main list. | 198 # Remove these files from the main list. |
| 191 source_list=$(comm -23 <(echo "$source_list") <(echo "$x86_intrinsic_list")) | 199 source_list=$(comm -23 <(echo "$source_list") <(echo "$intrinsic_list")) |
| 192 | 200 |
| 193 write_file_list source_list $BASE_DIR/$2.gypi | 201 write_file_list source_list $BASE_DIR/$2.gypi |
| 194 | 202 |
| 195 # All the files are in a single "element." Check if the first element has | 203 # All the files are in a single "element." Check if the first element has |
| 196 # length 0. | 204 # length 0. |
| 197 if [ 0 -ne ${#x86_intrinsic_list} ]; then | 205 if [ 0 -ne ${#intrinsic_list} ]; then |
| 198 write_special_flags x86_intrinsic_list[@] $BASE_DIR/$2_intrinsics.gypi | 206 write_special_flags intrinsic_list[@] $BASE_DIR/$2_intrinsics.gypi |
| 199 fi | 207 fi |
| 200 | 208 |
| 201 } | 209 } |
| 202 | 210 |
| 203 # Clean files from previous make. | 211 # Clean files from previous make. |
| 204 function make_clean { | 212 function make_clean { |
| 205 make clean > /dev/null | 213 make clean > /dev/null |
| 206 rm -f libvpx_srcs.txt | 214 rm -f libvpx_srcs.txt |
| 207 } | 215 } |
| 208 | 216 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 make_clean | 411 make_clean |
| 404 make libvpx_srcs.txt target=libs $config > /dev/null | 412 make libvpx_srcs.txt target=libs $config > /dev/null |
| 405 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_nacl | 413 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_nacl |
| 406 | 414 |
| 407 echo "Remove temporary directory." | 415 echo "Remove temporary directory." |
| 408 cd $BASE_DIR | 416 cd $BASE_DIR |
| 409 rm -rf $TEMP_DIR | 417 rm -rf $TEMP_DIR |
| 410 | 418 |
| 411 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? | 419 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? |
| 412 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? | 420 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? |
| OLD | NEW |