| 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, .gni files and files in the |
| 8 # 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 # |
| 11 # For example: | 11 # For example: |
| 12 # $ ./generate_gypi.sh | 12 # $ ./generate_gypi.sh |
| 13 # | 13 # |
| 14 # And this will update all the .gypi and config files needed. | 14 # And this will update all the .gypi, .gni and config files needed. |
| 15 # | 15 # |
| 16 # !!! It's highly recommended to install yasm before running this script. | 16 # !!! It's highly recommended to install yasm before running this script. |
| 17 | 17 |
| 18 export LC_ALL=C | 18 export LC_ALL=C |
| 19 BASE_DIR=`pwd` | 19 BASE_DIR=$(pwd) |
| 20 LIBVPX_SRC_DIR="source/libvpx" | 20 LIBVPX_SRC_DIR="source/libvpx" |
| 21 LIBVPX_CONFIG_DIR="source/config" | 21 LIBVPX_CONFIG_DIR="source/config" |
| 22 | 22 |
| 23 # Print gypi boilerplate header | 23 # Print license header. |
| 24 # $1 - Output base name | 24 # $1 - Output base name |
| 25 function write_gypi_header { | 25 function write_license { |
| 26 echo "# This file is generated. Do not edit." > $1 | 26 echo "# This file is generated. Do not edit." >> $1 |
| 27 echo "# Copyright (c) 2013 The Chromium Authors. All rights reserved." >> $1 | 27 echo "# Copyright (c) 2014 The Chromium Authors. All rights reserved." >> $1 |
| 28 echo "# Use of this source code is governed by a BSD-style license that can be
" >> $1 | 28 echo "# Use of this source code is governed by a BSD-style license that can be
" >> $1 |
| 29 echo "# found in the LICENSE file." >> $1 | 29 echo "# found in the LICENSE file." >> $1 |
| 30 echo "" >> $1 | 30 echo "" >> $1 |
| 31 } |
| 32 |
| 33 # Print gypi boilerplate header. |
| 34 # $1 - Output base name |
| 35 function write_gypi_header { |
| 31 echo "{" >> $1 | 36 echo "{" >> $1 |
| 32 } | 37 } |
| 33 | 38 |
| 34 # Print gypi boilerplate footer | 39 # Print gypi boilerplate footer. |
| 35 # $1 - Output base name | 40 # $1 - Output base name |
| 36 function write_gypi_footer { | 41 function write_gypi_footer { |
| 37 echo "}" >> $1 | 42 echo "}" >> $1 |
| 38 } | 43 } |
| 39 | 44 |
| 40 # Generate a gypi with a list of source files. | 45 # Generate a gypi with a list of source files. |
| 41 # $1 - Array name for file list. This is processed with 'declare' below to | 46 # $1 - Array name for file list. This is processed with 'declare' below to |
| 42 # regenerate the array locally. | 47 # regenerate the array locally. |
| 43 # $2 - Output file | 48 # $2 - Output file |
| 44 function write_file_list { | 49 function write_gypi { |
| 50 # Convert the first argument back in to an array. |
| 51 local readonly file_list=(${!1}) |
| 52 |
| 53 rm -rf "$2" |
| 54 write_license "$2" |
| 55 write_gypi_header "$2" |
| 56 |
| 57 echo " 'sources': [" >> "$2" |
| 58 for f in ${file_list[@]} |
| 59 do |
| 60 echo " '<(libvpx_source)/$f'," >> "$2" |
| 61 done |
| 62 echo " ]," >> "$2" |
| 63 |
| 64 write_gypi_footer "$2" |
| 65 } |
| 66 |
| 67 # Generate a gni with a list of source files. |
| 68 # $1 - Array name for file list. This is processed with 'declare' below to |
| 69 # regenerate the array locally. |
| 70 # $2 - GN variable name. |
| 71 # $3 - Output file. |
| 72 function write_gni { |
| 45 # Convert the first argument back in to an array. | 73 # Convert the first argument back in to an array. |
| 46 declare -a file_list=("${!1}") | 74 declare -a file_list=("${!1}") |
| 47 | 75 |
| 48 write_gypi_header $2 | 76 echo "$2 = [" >> "$3" |
| 49 | |
| 50 echo " 'sources': [" >> $2 | |
| 51 for f in $file_list | 77 for f in $file_list |
| 52 do | 78 do |
| 53 echo " '<(libvpx_source)/$f'," >> $2 | 79 echo " \"//third_party/libvpx/source/libvpx/$f\"," >> "$3" |
| 54 done | 80 done |
| 55 echo " ]," >> $2 | 81 echo "]" >> "$3" |
| 56 | |
| 57 write_gypi_footer $2 | |
| 58 } | 82 } |
| 59 | 83 |
| 60 # Target template function | 84 # Target template function |
| 61 # $1 - Array name for file list. | 85 # $1 - Array name for file list. |
| 62 # $2 - Output file | 86 # $2 - Output file |
| 63 # $3 - Target name | 87 # $3 - Target name |
| 64 # $4 - Compiler flag | 88 # $4 - Compiler flag |
| 65 function write_target_definition { | 89 function write_target_definition { |
| 66 declare -a sources_list=("${!1}") | 90 declare -a sources_list=("${!1}") |
| 67 | 91 |
| 68 echo " {" >> $2 | 92 echo " {" >> "$2" |
| 69 echo " 'target_name': '$3'," >> $2 | 93 echo " 'target_name': '$3'," >> "$2" |
| 70 echo " 'type': 'static_library'," >> $2 | 94 echo " 'type': 'static_library'," >> "$2" |
| 71 echo " 'include_dirs': [" >> $2 | 95 echo " 'include_dirs': [" >> "$2" |
| 72 echo " 'source/config/<(OS_CATEGORY)/<(target_arch_full)'," >> $2 | 96 echo " 'source/config/<(OS_CATEGORY)/<(target_arch_full)'," >> "$2" |
| 73 echo " '<(libvpx_source)'," >> $2 | 97 echo " '<(libvpx_source)'," >> "$2" |
| 74 echo " ]," >> $2 | 98 echo " ]," >> "$2" |
| 75 echo " 'sources': [" >> $2 | 99 echo " 'sources': [" >> "$2" |
| 76 for f in $sources_list | 100 for f in $sources_list |
| 77 do | 101 do |
| 78 echo " '<(libvpx_source)/$f'," >> $2 | 102 echo " '<(libvpx_source)/$f'," >> $2 |
| 79 done | 103 done |
| 80 echo " ]," >> $2 | 104 echo " ]," >> "$2" |
| 81 if [[ $4 == fpu=neon ]]; then | 105 if [[ $4 == fpu=neon ]]; then |
| 82 echo " 'cflags!': [ '-mfpu=vfpv3-d16' ]," >> $2 | 106 echo " 'cflags!': [ '-mfpu=vfpv3-d16' ]," >> "$2" |
| 83 echo " 'conditions': [" >> $2 | 107 echo " 'conditions': [" >> $2 |
| 84 echo " # Disable LTO in neon targets due to compiler bug" >> $2 | 108 echo " # Disable LTO in neon targets due to compiler bug" >> "$2" |
| 85 echo " # crbug.com/408997" >> $2 | 109 echo " # crbug.com/408997" >> "$2" |
| 86 echo " ['use_lto==1', {" >> $2 | 110 echo " ['use_lto==1', {" >> "$2" |
| 87 echo " 'cflags!': [" >> $2 | 111 echo " 'cflags!': [" >> "$2" |
| 88 echo " '-flto'," >> $2 | 112 echo " '-flto'," >> "$2" |
| 89 echo " '-ffat-lto-objects'," >> $2 | 113 echo " '-ffat-lto-objects'," >> "$2" |
| 90 echo " ]," >> $2 | 114 echo " ]," >> "$2" |
| 91 echo " }]," >> $2 | 115 echo " }]," >> "$2" |
| 92 echo " ]," >> $2 | 116 echo " ]," >> "$2" |
| 93 fi | 117 fi |
| 94 echo " 'cflags': [ '-m$4', ]," >> $2 | 118 echo " 'cflags': [ '-m$4', ]," >> "$2" |
| 95 echo " 'xcode_settings': { 'OTHER_CFLAGS': [ '-m$4' ] }," >> $2 | 119 echo " 'xcode_settings': { 'OTHER_CFLAGS': [ '-m$4' ] }," >> "$2" |
| 96 if [[ $4 == avx* ]]; then | 120 if [[ $4 == avx* ]]; then |
| 97 echo " 'msvs_settings': {" >> $2 | 121 echo " 'msvs_settings': {" >> "$2" |
| 98 echo " 'VCCLCompilerTool': {" >> $2 | 122 echo " 'VCCLCompilerTool': {" >> "$2" |
| 99 echo " 'EnableEnhancedInstructionSet': '3', # /arch:AVX" >> $2 | 123 echo " 'EnableEnhancedInstructionSet': '3', # /arch:AVX" >> "$2" |
| 100 echo " }," >> $2 | 124 echo " }," >> "$2" |
| 101 echo " }," >> $2 | 125 echo " }," >> "$2" |
| 102 elif [[ $4 == ssse3 || $4 == sse4.1 ]]; then | 126 elif [[ $4 == ssse3 || $4 == sse4.1 ]]; then |
| 103 echo " 'conditions': [" >> $2 | 127 echo " 'conditions': [" >> "$2" |
| 104 echo " ['OS==\"win\" and clang==1', {" >> $2 | 128 echo " ['OS==\"win\" and clang==1', {" >> "$2" |
| 105 echo " # cl.exe's /arch flag doesn't have a setting for SSSE3/4, and
cl.exe" >> $2 | 129 echo " # cl.exe's /arch flag doesn't have a setting for SSSE3/4, and
cl.exe" >> "$2" |
| 106 echo " # doesn't need it for intrinsics. clang-cl does need it, thoug
h." >> $2 | 130 echo " # doesn't need it for intrinsics. clang-cl does need it, thoug
h." >> "$2" |
| 107 echo " 'msvs_settings': {" >> $2 | 131 echo " 'msvs_settings': {" >> "$2" |
| 108 echo " 'VCCLCompilerTool': { 'AdditionalOptions': [ '-m$4' ] }," >>
$2 | 132 echo " 'VCCLCompilerTool': { 'AdditionalOptions': [ '-m$4' ] }," >>
"$2" |
| 109 echo " }," >> $2 | 133 echo " }," >> "$2" |
| 110 echo " }]," >> $2 | 134 echo " }]," >> "$2" |
| 111 echo " ]," >> $2 | 135 echo " ]," >> "$2" |
| 112 fi | 136 fi |
| 113 echo " }," >> $2 | 137 echo " }," >> "$2" |
| 114 } | 138 } |
| 115 | 139 |
| 116 | 140 |
| 117 # Generate a gypi which applies additional compiler flags based on the file | 141 # Generate a gypi which applies additional compiler flags based on the file |
| 118 # name. | 142 # name. |
| 119 # $1 - Array name for file list. | 143 # $1 - Array name for file list. |
| 120 # $2 - Output file | 144 # $2 - Output file |
| 121 function write_special_flags { | 145 function write_intrinsics_gypi { |
| 122 declare -a file_list=("${!1}") | 146 declare -a file_list=("${!1}") |
| 123 | 147 |
| 124 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') | 148 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') |
| 125 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') | 149 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') |
| 126 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') | 150 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') |
| 127 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') | 151 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') |
| 128 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') | 152 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') |
| 129 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') | 153 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') |
| 130 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') | 154 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') |
| 131 | |
| 132 local neon_sources=$(echo "$file_list" | grep '_neon\.c$') | 155 local neon_sources=$(echo "$file_list" | grep '_neon\.c$') |
| 133 | 156 |
| 134 # Intrinsic functions and files are in flux. We can selectively generate them | 157 # Intrinsic functions and files are in flux. We can selectively generate them |
| 135 # but we can not selectively include them in libvpx.gyp. Throw some errors | 158 # but we can not selectively include them in libvpx.gyp. Throw some errors |
| 136 # when new targets are needed. | 159 # when new targets are needed. |
| 137 | 160 |
| 138 write_gypi_header $2 | 161 rm -rf "$2" |
| 162 write_license "$2" |
| 163 write_gypi_header "$2" |
| 139 | 164 |
| 140 echo " 'targets': [" >> $2 | 165 echo " 'targets': [" >> "$2" |
| 141 | 166 |
| 142 # x86[_64] | 167 # x86[_64] |
| 143 if [ 0 -ne ${#mmx_sources} ]; then | 168 if [ 0 -ne ${#mmx_sources} ]; then |
| 144 write_target_definition mmx_sources[@] $2 libvpx_intrinsics_mmx mmx | 169 write_target_definition mmx_sources[@] "$2" libvpx_intrinsics_mmx mmx |
| 145 fi | 170 fi |
| 146 if [ 0 -ne ${#sse2_sources} ]; then | 171 if [ 0 -ne ${#sse2_sources} ]; then |
| 147 write_target_definition sse2_sources[@] $2 libvpx_intrinsics_sse2 sse2 | 172 write_target_definition sse2_sources[@] "$2" libvpx_intrinsics_sse2 sse2 |
| 148 fi | 173 fi |
| 149 if [ 0 -ne ${#sse3_sources} ]; then | 174 if [ 0 -ne ${#sse3_sources} ]; then |
| 150 #write_target_definition sse3_sources[@] $2 libvpx_intrinsics_sse3 sse3 | 175 #write_target_definition sse3_sources[@] "$2" libvpx_intrinsics_sse3 sse3 |
| 151 echo "ERROR: Uncomment sse3 sections in libvpx.gyp" | 176 echo "ERROR: Uncomment sse3 sections in libvpx.gyp" |
| 152 exit 1 | 177 exit 1 |
| 153 fi | 178 fi |
| 154 if [ 0 -ne ${#ssse3_sources} ]; then | 179 if [ 0 -ne ${#ssse3_sources} ]; then |
| 155 write_target_definition ssse3_sources[@] $2 libvpx_intrinsics_ssse3 ssse3 | 180 write_target_definition ssse3_sources[@] "$2" libvpx_intrinsics_ssse3 ssse3 |
| 156 fi | 181 fi |
| 157 if [ 0 -ne ${#sse4_1_sources} ]; then | 182 if [ 0 -ne ${#sse4_1_sources} ]; then |
| 158 write_target_definition sse4_1_sources[@] $2 libvpx_intrinsics_sse4_1 sse4.1 | 183 write_target_definition sse4_1_sources[@] "$2" libvpx_intrinsics_sse4_1 sse4
.1 |
| 159 fi | 184 fi |
| 160 if [ 0 -ne ${#avx_sources} ]; then | 185 if [ 0 -ne ${#avx_sources} ]; then |
| 161 #write_target_definition avx_sources[@] $2 libvpx_intrinsics_avx avx | 186 #write_target_definition avx_sources[@] "$2" libvpx_intrinsics_avx avx |
| 162 echo "ERROR: Uncomment avx sections in libvpx.gyp" | 187 echo "ERROR: Uncomment avx sections in libvpx.gyp" |
| 163 exit 1 | 188 exit 1 |
| 164 fi | 189 fi |
| 165 if [ 0 -ne ${#avx2_sources} ]; then | 190 if [ 0 -ne ${#avx2_sources} ]; then |
| 166 #write_target_definition avx2_sources[@] $2 libvpx_intrinsics_avx2 avx2 | 191 #write_target_definition avx2_sources[@] "$2" libvpx_intrinsics_avx2 avx2 |
| 167 echo "ERROR: Uncomment avx2 sections in libvpx.gyp" | 192 echo "ERROR: Uncomment avx2 sections in libvpx.gyp" |
| 168 exit 1 | 193 exit 1 |
| 169 fi | 194 fi |
| 170 | 195 |
| 171 # arm neon | 196 # arm neon |
| 172 if [ 0 -ne ${#neon_sources} ]; then | 197 if [ 0 -ne ${#neon_sources} ]; then |
| 173 write_target_definition neon_sources[@] $2 libvpx_intrinsics_neon fpu=neon | 198 write_target_definition neon_sources[@] "$2" libvpx_intrinsics_neon fpu=neon |
| 174 fi | 199 fi |
| 175 | 200 |
| 176 echo " ]," >> $2 | 201 echo " ]," >> "$2" |
| 177 | 202 |
| 178 write_gypi_footer $2 | 203 write_gypi_footer "$2" |
| 179 } | 204 } |
| 180 | 205 |
| 181 # Convert a list of source files into gypi file. | 206 # Convert a list of source files into gypi and gni files. |
| 182 # $1 - Input file. | 207 # $1 - Input file. |
| 183 # $2 - Output gypi file base. Will generate additional .gypi files when | 208 # $2 - Output gypi file base. Will generate additional .gypi files when |
| 184 # different compilation flags are required. | 209 # different compilation flags are required. |
| 185 function convert_srcs_to_gypi { | 210 function convert_srcs_to_project_files { |
| 186 # Do the following here: | 211 # Do the following here: |
| 187 # 1. Filter .c, .h, .s, .S and .asm files. | 212 # 1. Filter .c, .h, .s, .S and .asm files. |
| 188 # 2. Move certain files to a separate include to allow applying different | 213 # 2. Move certain files to a separate include to allow applying different |
| 189 # compiler options. | 214 # compiler options. |
| 190 # 3. Replace .asm.s to .asm because gyp will do the conversion. | 215 # 3. Replace .asm.s to .asm because gyp will do the conversion. |
| 191 | 216 |
| 192 local source_list=$(grep -E '(\.c|\.h|\.S|\.s|\.asm)$' $1) | 217 local source_list=$(grep -E '(\.c|\.h|\.S|\.s|\.asm)$' $1) |
| 193 | 218 |
| 194 # _offsets are used in pre-processing to generate files for assembly. They are | 219 # _offsets are used in pre-processing to generate files for assembly. They are |
| 195 # not part of the compiled library. | 220 # not part of the compiled library. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 211 # Select all arm neon files ending in _neon.c | 236 # Select all arm neon files ending in _neon.c |
| 212 # 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 |
| 213 local intrinsic_list=$(echo "$source_list" | \ | 238 local intrinsic_list=$(echo "$source_list" | \ |
| 214 egrep 'vp[89]/(encoder|decoder|common)/arm/neon/' | \ | 239 egrep 'vp[89]/(encoder|decoder|common)/arm/neon/' | \ |
| 215 egrep '_neon.c$') | 240 egrep '_neon.c$') |
| 216 fi | 241 fi |
| 217 | 242 |
| 218 # Remove these files from the main list. | 243 # Remove these files from the main list. |
| 219 source_list=$(comm -23 <(echo "$source_list") <(echo "$intrinsic_list")) | 244 source_list=$(comm -23 <(echo "$source_list") <(echo "$intrinsic_list")) |
| 220 | 245 |
| 221 write_file_list source_list $BASE_DIR/$2.gypi | 246 local x86_list=$(echo "$source_list" | egrep '/x86/') |
| 247 |
| 248 write_gypi source_list "$BASE_DIR/$2.gypi" |
| 222 | 249 |
| 223 # All the files are in a single "element." Check if the first element has | 250 # All the files are in a single "element." Check if the first element has |
| 224 # length 0. | 251 # length 0. |
| 225 if [ 0 -ne ${#intrinsic_list} ]; then | 252 if [ 0 -ne ${#intrinsic_list} ]; then |
| 226 write_special_flags intrinsic_list[@] $BASE_DIR/$2_intrinsics.gypi | 253 write_intrinsics_gypi intrinsic_list[@] "$BASE_DIR/$2_intrinsics.gypi" |
| 227 fi | 254 fi |
| 228 | 255 |
| 256 # Write a single .gni file that includes all source files for all archs. |
| 257 if [ 0 -ne ${#x86_list} ]; then |
| 258 # X86 systems need to separate C and assembly files for GN. |
| 259 local c_sources=$(echo "$source_list" | egrep '.(c|h)$') |
| 260 local assembly_sources=$(echo "$source_list" | egrep '.asm$') |
| 261 local mmx_sources=$(echo "$intrinsic_list" | grep '_mmx\.c$') |
| 262 local sse2_sources=$(echo "$intrinsic_list" | grep '_sse2\.c$') |
| 263 local sse3_sources=$(echo "$intrinsic_list" | grep '_sse3\.c$') |
| 264 local ssse3_sources=$(echo "$intrinsic_list" | grep '_ssse3\.c$') |
| 265 local sse4_1_sources=$(echo "$intrinsic_list" | grep '_sse4\.c$') |
| 266 local avx_sources=$(echo "$intrinsic_list" | grep '_avx\.c$') |
| 267 local avx2_sources=$(echo "$intrinsic_list" | grep '_avx2\.c$') |
| 268 |
| 269 write_gni c_sources $2 "$BASE_DIR/libvpx_srcs.gni" |
| 270 write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni" |
| 271 write_gni mmx_sources $2_mmx "$BASE_DIR/libvpx_srcs.gni" |
| 272 write_gni sse2_sources $2_sse2 "$BASE_DIR/libvpx_srcs.gni" |
| 273 write_gni sse3_sources $2_sse3 "$BASE_DIR/libvpx_srcs.gni" |
| 274 write_gni ssse3_sources $2_ssse3 "$BASE_DIR/libvpx_srcs.gni" |
| 275 write_gni sse4_1_sources $2_sse4_1 "$BASE_DIR/libvpx_srcs.gni" |
| 276 write_gni avx_sources $2_avx "$BASE_DIR/libvpx_srcs.gni" |
| 277 write_gni avx2_sources $2_avx2 "$BASE_DIR/libvpx_srcs.gni" |
| 278 else |
| 279 local neon_sources=$(echo "$intrinsic_list" | grep '_neon\.c$') |
| 280 write_gni source_list $2 "$BASE_DIR/libvpx_srcs.gni" |
| 281 if [ 0 -ne ${#neon_sources} ]; then |
| 282 write_gni neon_sources $2_neon "$BASE_DIR/libvpx_srcs.gni" |
| 283 fi |
| 284 fi |
| 229 } | 285 } |
| 230 | 286 |
| 231 # Clean files from previous make. | 287 # Clean files from previous make. |
| 232 function make_clean { | 288 function make_clean { |
| 233 make clean > /dev/null | 289 make clean > /dev/null |
| 234 rm -f libvpx_srcs.txt | 290 rm -f libvpx_srcs.txt |
| 235 } | 291 } |
| 236 | 292 |
| 237 # Lint a pair of vpx_config.h and vpx_config.asm to make sure they match. | 293 # Lint a pair of vpx_config.h and vpx_config.asm to make sure they match. |
| 238 # $1 - Header file directory. | 294 # $1 - Header file directory. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 # Generate Config files. "--enable-external-build" must be set to skip | 371 # Generate Config files. "--enable-external-build" must be set to skip |
| 316 # detection of capabilities on specific targets. | 372 # detection of capabilities on specific targets. |
| 317 # $1 - Header file directory. | 373 # $1 - Header file directory. |
| 318 # $2 - Config command line. | 374 # $2 - Config command line. |
| 319 function gen_config_files { | 375 function gen_config_files { |
| 320 ./configure $2 > /dev/null | 376 ./configure $2 > /dev/null |
| 321 | 377 |
| 322 # Generate vpx_config.asm. Do not create one for mips. | 378 # Generate vpx_config.asm. Do not create one for mips. |
| 323 if [[ "$1" != *mipsel && "$1" != *mips64el ]]; then | 379 if [[ "$1" != *mipsel && "$1" != *mips64el ]]; then |
| 324 if [[ "$1" == *x64* ]] || [[ "$1" == *ia32* ]]; then | 380 if [[ "$1" == *x64* ]] || [[ "$1" == *ia32* ]]; then |
| 325 egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print $2 " equ " $3}'
> vpx_config.asm | 381 egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print "%define " $2 "
" $3}' > vpx_config.asm |
| 326 else | 382 else |
| 327 egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print $2 " EQU " $3}'
| perl $BASE_DIR/$LIBVPX_SRC_DIR/build/make/ads2gas.pl > vpx_config.asm | 383 egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print $2 " EQU " $3}'
| perl $BASE_DIR/$LIBVPX_SRC_DIR/build/make/ads2gas.pl > vpx_config.asm |
| 328 fi | 384 fi |
| 329 fi | 385 fi |
| 330 | 386 |
| 331 cp vpx_config.* $BASE_DIR/$LIBVPX_CONFIG_DIR/$1 | 387 cp vpx_config.* $BASE_DIR/$LIBVPX_CONFIG_DIR/$1 |
| 332 make_clean | 388 make_clean |
| 333 rm -rf vpx_config.* | 389 rm -rf vpx_config.* |
| 334 } | 390 } |
| 335 | 391 |
| 336 echo "Create temporary directory." | 392 echo "Create temporary directory." |
| 337 TEMP_DIR="$LIBVPX_SRC_DIR.temp" | 393 TEMP_DIR="$LIBVPX_SRC_DIR.temp" |
| 338 rm -rf $TEMP_DIR | 394 rm -rf $TEMP_DIR |
| 339 cp -R $LIBVPX_SRC_DIR $TEMP_DIR | 395 cp -R $LIBVPX_SRC_DIR $TEMP_DIR |
| 340 cd $TEMP_DIR | 396 cd $TEMP_DIR |
| 341 | 397 |
| 342 echo "Generate Config Files" | 398 echo "Generate config files." |
| 343 # TODO(joeyparrish) Enable AVX2 when broader VS2013 support is available | 399 # TODO(joeyparrish) Enable AVX2 when broader VS2013 support is available |
| 344 all_platforms="--enable-external-build --enable-postproc --disable-install-srcs
--enable-multi-res-encoding --enable-temporal-denoising --disable-unit-tests --d
isable-install-docs --disable-examples --disable-avx2" | 400 all_platforms="--enable-external-build --enable-postproc --disable-install-srcs
--enable-multi-res-encoding --enable-temporal-denoising --disable-unit-tests --d
isable-install-docs --disable-examples --disable-avx2" |
| 345 gen_config_files linux/ia32 "--target=x86-linux-gcc --disable-ccache --enable-pi
c --enable-realtime-only ${all_platforms}" | 401 gen_config_files linux/ia32 "--target=x86-linux-gcc --disable-ccache --enable-pi
c --enable-realtime-only ${all_platforms}" |
| 346 gen_config_files linux/x64 "--target=x86_64-linux-gcc --disable-ccache --enable-
pic --enable-realtime-only ${all_platforms}" | 402 gen_config_files linux/x64 "--target=x86_64-linux-gcc --disable-ccache --enable-
pic --enable-realtime-only ${all_platforms}" |
| 347 gen_config_files linux/arm "--target=armv6-linux-gcc --enable-pic --enable-realt
ime-only --disable-install-bins --disable-install-libs --disable-edsp ${all_plat
forms}" | 403 gen_config_files linux/arm "--target=armv6-linux-gcc --enable-pic --enable-realt
ime-only --disable-install-bins --disable-install-libs --disable-edsp ${all_plat
forms}" |
| 348 gen_config_files linux/arm-neon "--target=armv7-linux-gcc --enable-pic --enable-
realtime-only --disable-edsp ${all_platforms}" | 404 gen_config_files linux/arm-neon "--target=armv7-linux-gcc --enable-pic --enable-
realtime-only --disable-edsp ${all_platforms}" |
| 349 gen_config_files linux/arm-neon-cpu-detect "--target=armv7-linux-gcc --enable-pi
c --enable-realtime-only --enable-runtime-cpu-detect --disable-edsp ${all_platfo
rms}" | 405 gen_config_files linux/arm-neon-cpu-detect "--target=armv7-linux-gcc --enable-pi
c --enable-realtime-only --enable-runtime-cpu-detect --disable-edsp ${all_platfo
rms}" |
| 350 gen_config_files linux/arm64 "--force-target=armv8-linux-gcc --enable-pic --enab
le-realtime-only --disable-edsp ${all_platforms}" | 406 gen_config_files linux/arm64 "--force-target=armv8-linux-gcc --enable-pic --enab
le-realtime-only --disable-edsp ${all_platforms}" |
| 351 gen_config_files linux/mipsel "--target=mips32-linux-gcc --disable-fast-unaligne
d ${all_platforms}" | 407 gen_config_files linux/mipsel "--target=mips32-linux-gcc --disable-fast-unaligne
d ${all_platforms}" |
| 352 gen_config_files linux/mips64el "--target=mips64-linux-gcc --disable-fast-unalig
ned ${all_platforms}" | 408 gen_config_files linux/mips64el "--target=mips64-linux-gcc --disable-fast-unalig
ned ${all_platforms}" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 gen_rtcd_header win/ia32 x86 | 451 gen_rtcd_header win/ia32 x86 |
| 396 gen_rtcd_header win/x64 x86_64 | 452 gen_rtcd_header win/x64 x86_64 |
| 397 gen_rtcd_header mac/ia32 x86 | 453 gen_rtcd_header mac/ia32 x86 |
| 398 gen_rtcd_header mac/x64 x86_64 | 454 gen_rtcd_header mac/x64 x86_64 |
| 399 gen_rtcd_header nacl nacl | 455 gen_rtcd_header nacl nacl |
| 400 | 456 |
| 401 echo "Prepare Makefile." | 457 echo "Prepare Makefile." |
| 402 ./configure --target=generic-gnu > /dev/null | 458 ./configure --target=generic-gnu > /dev/null |
| 403 make_clean | 459 make_clean |
| 404 | 460 |
| 461 # Remove existing .gni file. |
| 462 rm -rf $BASE_DIR/libvpx_srcs.gni |
| 463 write_license $BASE_DIR/libvpx_srcs.gni |
| 464 |
| 405 echo "Generate X86 source list." | 465 echo "Generate X86 source list." |
| 406 config=$(print_config linux/ia32) | 466 config=$(print_config linux/ia32) |
| 407 make_clean | 467 make_clean |
| 408 make libvpx_srcs.txt target=libs $config > /dev/null | 468 make libvpx_srcs.txt target=libs $config > /dev/null |
| 409 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_x86 | 469 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86 |
| 410 | 470 |
| 411 # Copy vpx_version.h. The file should be the same for all platforms. | 471 # Copy vpx_version.h. The file should be the same for all platforms. |
| 412 cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR | 472 cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR |
| 413 | 473 |
| 414 echo "Generate X86_64 source list." | 474 echo "Generate X86_64 source list." |
| 415 config=$(print_config linux/x64) | 475 config=$(print_config linux/x64) |
| 416 make_clean | 476 make_clean |
| 417 make libvpx_srcs.txt target=libs $config > /dev/null | 477 make libvpx_srcs.txt target=libs $config > /dev/null |
| 418 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_x86_64 | 478 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86_64 |
| 419 | 479 |
| 420 echo "Generate ARM source list." | 480 echo "Generate ARM source list." |
| 421 config=$(print_config linux/arm) | 481 config=$(print_config linux/arm) |
| 422 make_clean | 482 make_clean |
| 423 make libvpx_srcs.txt target=libs $config > /dev/null | 483 make libvpx_srcs.txt target=libs $config > /dev/null |
| 424 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_arm | 484 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm |
| 425 | 485 |
| 426 echo "Generate ARM NEON source list." | 486 echo "Generate ARM NEON source list." |
| 427 config=$(print_config linux/arm-neon) | 487 config=$(print_config linux/arm-neon) |
| 428 make_clean | 488 make_clean |
| 429 make libvpx_srcs.txt target=libs $config > /dev/null | 489 make libvpx_srcs.txt target=libs $config > /dev/null |
| 430 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_arm_neon | 490 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon |
| 431 | 491 |
| 432 echo "Generate ARM NEON CPU DETECT source list." | 492 echo "Generate ARM NEON CPU DETECT source list." |
| 433 config=$(print_config linux/arm-neon-cpu-detect) | 493 config=$(print_config linux/arm-neon-cpu-detect) |
| 434 make_clean | 494 make_clean |
| 435 make libvpx_srcs.txt target=libs $config > /dev/null | 495 make libvpx_srcs.txt target=libs $config > /dev/null |
| 436 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_arm_neon_cpu_detect | 496 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon_cpu_detect |
| 437 | 497 |
| 438 echo "Generate ARM64 source list." | 498 echo "Generate ARM64 source list." |
| 439 config=$(print_config linux/arm64) | 499 config=$(print_config linux/arm64) |
| 440 make_clean | 500 make_clean |
| 441 make libvpx_srcs.txt target=libs $config > /dev/null | 501 make libvpx_srcs.txt target=libs $config > /dev/null |
| 442 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_arm64 | 502 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm64 |
| 443 | 503 |
| 444 echo "Generate MIPS source list." | 504 echo "Generate MIPS source list." |
| 445 config=$(print_config_basic linux/mipsel) | 505 config=$(print_config_basic linux/mipsel) |
| 446 make_clean | 506 make_clean |
| 447 make libvpx_srcs.txt target=libs $config > /dev/null | 507 make libvpx_srcs.txt target=libs $config > /dev/null |
| 448 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_mips | 508 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_mips |
| 449 | 509 |
| 450 echo "MIPS64 source list is identical to MIPS source list. No need to generate i
t." | 510 echo "MIPS64 source list is identical to MIPS source list. No need to generate i
t." |
| 451 | 511 |
| 452 echo "Generate NaCl source list." | 512 echo "Generate NaCl source list." |
| 453 config=$(print_config_basic nacl) | 513 config=$(print_config_basic nacl) |
| 454 make_clean | 514 make_clean |
| 455 make libvpx_srcs.txt target=libs $config > /dev/null | 515 make libvpx_srcs.txt target=libs $config > /dev/null |
| 456 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_nacl | 516 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_nacl |
| 457 | 517 |
| 458 echo "Generate GENERIC source list." | 518 echo "Generate GENERIC source list." |
| 459 config=$(print_config_basic linux/generic) | 519 config=$(print_config_basic linux/generic) |
| 460 make_clean | 520 make_clean |
| 461 make libvpx_srcs.txt target=libs $config > /dev/null | 521 make libvpx_srcs.txt target=libs $config > /dev/null |
| 462 convert_srcs_to_gypi libvpx_srcs.txt libvpx_srcs_generic | 522 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic |
| 463 | 523 |
| 464 echo "Remove temporary directory." | 524 echo "Remove temporary directory." |
| 465 cd $BASE_DIR | 525 cd $BASE_DIR |
| 466 rm -rf $TEMP_DIR | 526 rm -rf $TEMP_DIR |
| 467 | 527 |
| 468 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? | 528 # TODO(fgalligan): Is "--disable-fast-unaligned" needed on mipsel? |
| 469 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? | 529 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? |
| OLD | NEW |