| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash -e | |
| 2 # | |
| 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 | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 # This script is used to generate .gypi, .gni files and files in the | |
| 8 # config/platform directories needed to build libvpx. | |
| 9 # Every time libvpx source code is updated just run this script. | |
| 10 # | |
| 11 # Usage: | |
| 12 # $ ./generate_gypi.sh [--disable-avx] [--only-configs] | |
| 13 # | |
| 14 # The following optional flags are supported: | |
| 15 # --disable-avx : AVX+AVX2 support is disabled. | |
| 16 # --only-configs: Excludes generation of GN and GYP files (i.e. only | |
| 17 # configuration headers are generated). | |
| 18 | |
| 19 export LC_ALL=C | |
| 20 BASE_DIR=$(pwd) | |
| 21 LIBVPX_SRC_DIR="source/libvpx" | |
| 22 LIBVPX_CONFIG_DIR="source/config" | |
| 23 unset DISABLE_AVX | |
| 24 | |
| 25 for i in "$@" | |
| 26 do | |
| 27 case $i in | |
| 28 --disable-avx) | |
| 29 DISABLE_AVX="--disable-avx --disable-avx2" | |
| 30 shift | |
| 31 ;; | |
| 32 --only-configs) | |
| 33 ONLY_CONFIGS=true | |
| 34 shift | |
| 35 ;; | |
| 36 *) | |
| 37 echo "Unknown option: $i" | |
| 38 exit 1 | |
| 39 ;; | |
| 40 esac | |
| 41 done | |
| 42 | |
| 43 # Print license header. | |
| 44 # $1 - Output base name | |
| 45 function write_license { | |
| 46 echo "# This file is generated. Do not edit." >> $1 | |
| 47 echo "# Copyright (c) 2014 The Chromium Authors. All rights reserved." >> $1 | |
| 48 echo "# Use of this source code is governed by a BSD-style license that can be
" >> $1 | |
| 49 echo "# found in the LICENSE file." >> $1 | |
| 50 echo "" >> $1 | |
| 51 } | |
| 52 | |
| 53 # Search for source files with the same basename in vp8, vp9, and vpx_dsp. The | |
| 54 # build can support such files but only when they are built into disparate | |
| 55 # modules. Configuring such modules for both gyp and gn are tricky so avoid the | |
| 56 # issue at least until vp10 is added. | |
| 57 function find_duplicates { | |
| 58 local readonly duplicate_file_names=$(find \ | |
| 59 $BASE_DIR/$LIBVPX_SRC_DIR/vp8 \ | |
| 60 $BASE_DIR/$LIBVPX_SRC_DIR/vp9 \ | |
| 61 $BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp \ | |
| 62 -type f -name \*.c | xargs -I {} basename {} | sort | uniq -d \ | |
| 63 ) | |
| 64 | |
| 65 if [ -n "${duplicate_file_names}" ]; then | |
| 66 echo "WARNING: DUPLICATE FILES FOUND" | |
| 67 for file in ${duplicate_file_names}; do | |
| 68 find \ | |
| 69 $BASE_DIR/$LIBVPX_SRC_DIR/vp8 \ | |
| 70 $BASE_DIR/$LIBVPX_SRC_DIR/vp9 \ | |
| 71 $BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp \ | |
| 72 -name $file | |
| 73 done | |
| 74 exit 1 | |
| 75 fi | |
| 76 } | |
| 77 | |
| 78 # Print gypi boilerplate header. | |
| 79 # $1 - Output base name | |
| 80 function write_gypi_header { | |
| 81 echo "{" >> $1 | |
| 82 } | |
| 83 | |
| 84 # Print gypi boilerplate footer. | |
| 85 # $1 - Output base name | |
| 86 function write_gypi_footer { | |
| 87 echo "}" >> $1 | |
| 88 } | |
| 89 | |
| 90 # Generate a gypi with a list of source files. | |
| 91 # $1 - Array name for file list. This is processed with 'declare' below to | |
| 92 # regenerate the array locally. | |
| 93 # $2 - Output file | |
| 94 function write_gypi { | |
| 95 # Convert the first argument back in to an array. | |
| 96 local readonly file_list=(${!1}) | |
| 97 | |
| 98 rm -rf "$2" | |
| 99 write_license "$2" | |
| 100 write_gypi_header "$2" | |
| 101 | |
| 102 echo " 'sources': [" >> "$2" | |
| 103 for f in ${file_list[@]} | |
| 104 do | |
| 105 echo " '<(libvpx_source)/$f'," >> "$2" | |
| 106 done | |
| 107 echo " ]," >> "$2" | |
| 108 | |
| 109 write_gypi_footer "$2" | |
| 110 } | |
| 111 | |
| 112 # Generate a gni with a list of source files. | |
| 113 # $1 - Array name for file list. This is processed with 'declare' below to | |
| 114 # regenerate the array locally. | |
| 115 # $2 - GN variable name. | |
| 116 # $3 - Output file. | |
| 117 function write_gni { | |
| 118 # Convert the first argument back in to an array. | |
| 119 declare -a file_list=("${!1}") | |
| 120 | |
| 121 echo "$2 = [" >> "$3" | |
| 122 for f in $file_list | |
| 123 do | |
| 124 echo " \"//third_party/libvpx_new/source/libvpx/$f\"," >> "$3" | |
| 125 done | |
| 126 echo "]" >> "$3" | |
| 127 } | |
| 128 | |
| 129 # Target template function | |
| 130 # $1 - Array name for file list. | |
| 131 # $2 - Output file | |
| 132 # $3 - Target name | |
| 133 # $4 - Compiler flag | |
| 134 function write_target_definition { | |
| 135 declare -a sources_list=("${!1}") | |
| 136 | |
| 137 echo " {" >> "$2" | |
| 138 echo " 'target_name': '$3'," >> "$2" | |
| 139 echo " 'type': 'static_library'," >> "$2" | |
| 140 echo " 'include_dirs': [" >> "$2" | |
| 141 echo " 'source/config/<(OS_CATEGORY)/<(target_arch_full)'," >> "$2" | |
| 142 echo " '<(libvpx_source)'," >> "$2" | |
| 143 echo " ]," >> "$2" | |
| 144 echo " 'sources': [" >> "$2" | |
| 145 for f in $sources_list | |
| 146 do | |
| 147 echo " '<(libvpx_source)/$f'," >> $2 | |
| 148 done | |
| 149 echo " ]," >> "$2" | |
| 150 if [[ $4 == fpu=neon ]]; then | |
| 151 echo " 'includes': [ 'ads2gas.gypi' ]," >> "$2" | |
| 152 echo " 'cflags!': [ '-mfpu=vfpv3-d16' ]," >> "$2" | |
| 153 echo " 'conditions': [" >> $2 | |
| 154 echo " # Disable GCC LTO in neon targets due to compiler bug" >> "$2" | |
| 155 echo " # crbug.com/408997" >> "$2" | |
| 156 echo " ['clang==0 and use_lto==1', {" >> "$2" | |
| 157 echo " 'cflags!': [" >> "$2" | |
| 158 echo " '-flto'," >> "$2" | |
| 159 echo " '-ffat-lto-objects'," >> "$2" | |
| 160 echo " ]," >> "$2" | |
| 161 echo " }]," >> "$2" | |
| 162 echo " ]," >> "$2" | |
| 163 echo " 'cflags': [ '-m$4', ]," >> "$2" | |
| 164 echo " 'asmflags': [ '-m$4', ]," >> "$2" | |
| 165 else | |
| 166 echo " 'cflags': [ '-m$4', ]," >> "$2" | |
| 167 echo " 'xcode_settings': { 'OTHER_CFLAGS': [ '-m$4' ] }," >> "$2" | |
| 168 fi | |
| 169 if [[ -z $DISABLE_AVX && $4 == avx ]]; then | |
| 170 echo " 'msvs_settings': {" >> "$2" | |
| 171 echo " 'VCCLCompilerTool': {" >> "$2" | |
| 172 echo " 'EnableEnhancedInstructionSet': '3', # /arch:AVX" >> "$2" | |
| 173 echo " }," >> "$2" | |
| 174 echo " }," >> "$2" | |
| 175 fi | |
| 176 if [[ -z $DISABLE_AVX && $4 == avx2 ]]; then | |
| 177 echo " 'msvs_settings': {" >> "$2" | |
| 178 echo " 'VCCLCompilerTool': {" >> "$2" | |
| 179 echo " 'EnableEnhancedInstructionSet': '5', # /arch:AVX2" >> "$2" | |
| 180 echo " }," >> "$2" | |
| 181 echo " }," >> "$2" | |
| 182 fi | |
| 183 if [[ $4 == ssse3 || $4 == sse4.1 ]]; then | |
| 184 echo " 'conditions': [" >> "$2" | |
| 185 echo " ['OS==\"win\" and clang==1', {" >> "$2" | |
| 186 echo " # cl.exe's /arch flag doesn't have a setting for SSSE3/4, and
cl.exe" >> "$2" | |
| 187 echo " # doesn't need it for intrinsics. clang-cl does need it, thoug
h." >> "$2" | |
| 188 echo " 'msvs_settings': {" >> "$2" | |
| 189 echo " 'VCCLCompilerTool': { 'AdditionalOptions': [ '-m$4' ] }," >>
"$2" | |
| 190 echo " }," >> "$2" | |
| 191 echo " }]," >> "$2" | |
| 192 echo " ]," >> "$2" | |
| 193 fi | |
| 194 echo " }," >> "$2" | |
| 195 } | |
| 196 | |
| 197 | |
| 198 # Generate a gypi which applies additional compiler flags based on the file | |
| 199 # name. | |
| 200 # $1 - Array name for file list. | |
| 201 # $2 - Output file | |
| 202 function write_intrinsics_gypi { | |
| 203 declare -a file_list=("${!1}") | |
| 204 | |
| 205 local mmx_sources=$(echo "$file_list" | grep '_mmx\.c$') | |
| 206 local sse2_sources=$(echo "$file_list" | grep '_sse2\.c$') | |
| 207 local sse3_sources=$(echo "$file_list" | grep '_sse3\.c$') | |
| 208 local ssse3_sources=$(echo "$file_list" | grep '_ssse3\.c$') | |
| 209 local sse4_1_sources=$(echo "$file_list" | grep '_sse4\.c$') | |
| 210 local avx_sources=$(echo "$file_list" | grep '_avx\.c$') | |
| 211 local avx2_sources=$(echo "$file_list" | grep '_avx2\.c$') | |
| 212 local neon_sources=$(echo "$file_list" | grep '_neon\.c$\|\.asm$') | |
| 213 | |
| 214 # Intrinsic functions and files are in flux. We can selectively generate them | |
| 215 # but we can not selectively include them in libvpx.gyp. Throw some errors | |
| 216 # when new targets are needed. | |
| 217 | |
| 218 rm -rf "$2" | |
| 219 write_license "$2" | |
| 220 write_gypi_header "$2" | |
| 221 | |
| 222 echo " 'targets': [" >> "$2" | |
| 223 | |
| 224 # x86[_64] | |
| 225 if [ 0 -ne ${#mmx_sources} ]; then | |
| 226 write_target_definition mmx_sources[@] "$2" libvpx_intrinsics_mmx mmx | |
| 227 fi | |
| 228 if [ 0 -ne ${#sse2_sources} ]; then | |
| 229 write_target_definition sse2_sources[@] "$2" libvpx_intrinsics_sse2 sse2 | |
| 230 fi | |
| 231 if [ 0 -ne ${#sse3_sources} ]; then | |
| 232 #write_target_definition sse3_sources[@] "$2" libvpx_intrinsics_sse3 sse3 | |
| 233 echo "ERROR: Uncomment sse3 sections in libvpx.gyp" | |
| 234 exit 1 | |
| 235 fi | |
| 236 if [ 0 -ne ${#ssse3_sources} ]; then | |
| 237 write_target_definition ssse3_sources[@] "$2" libvpx_intrinsics_ssse3 ssse3 | |
| 238 fi | |
| 239 if [ 0 -ne ${#sse4_1_sources} ]; then | |
| 240 write_target_definition sse4_1_sources[@] "$2" libvpx_intrinsics_sse4_1 sse4
.1 | |
| 241 fi | |
| 242 if [[ -z $DISABLE_AVX && 0 -ne ${#avx_sources} ]]; then | |
| 243 write_target_definition avx_sources[@] "$2" libvpx_intrinsics_avx avx | |
| 244 fi | |
| 245 if [[ -z $DISABLE_AVX && 0 -ne ${#avx2_sources} ]]; then | |
| 246 write_target_definition avx2_sources[@] "$2" libvpx_intrinsics_avx2 avx2 | |
| 247 fi | |
| 248 | |
| 249 # arm neon | |
| 250 if [ 0 -ne ${#neon_sources} ]; then | |
| 251 write_target_definition neon_sources[@] "$2" libvpx_intrinsics_neon fpu=neon | |
| 252 fi | |
| 253 | |
| 254 echo " ]," >> "$2" | |
| 255 | |
| 256 write_gypi_footer "$2" | |
| 257 } | |
| 258 | |
| 259 # Convert a list of source files into gypi and gni files. | |
| 260 # $1 - Input file. | |
| 261 # $2 - Output gypi file base. Will generate additional .gypi files when | |
| 262 # different compilation flags are required. | |
| 263 function convert_srcs_to_project_files { | |
| 264 # Do the following here: | |
| 265 # 1. Filter .c, .h, .s, .S and .asm files. | |
| 266 # 2. Move certain files to a separate include to allow applying different | |
| 267 # compiler options. | |
| 268 # 3. Replace .asm.s to .asm because gyp will do the conversion. | |
| 269 | |
| 270 local source_list=$(grep -E '(\.c|\.h|\.S|\.s|\.asm)$' $1) | |
| 271 | |
| 272 # Not sure why vpx_config is not included. | |
| 273 source_list=$(echo "$source_list" | grep -v 'vpx_config\.c') | |
| 274 | |
| 275 # The actual ARM files end in .asm. We have rules to translate them to .S | |
| 276 source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/) | |
| 277 | |
| 278 # Select all x86 files ending with .c | |
| 279 local intrinsic_list=$(echo "$source_list" | \ | |
| 280 egrep '(mmx|sse2|sse3|ssse3|sse4|avx|avx2).c$') | |
| 281 | |
| 282 # Select all neon files ending in C but only when building in RTCD mode | |
| 283 if [ "libvpx_srcs_arm_neon_cpu_detect" == "$2" ]; then | |
| 284 # Select all arm neon files ending in _neon.c and all asm files. | |
| 285 # The asm files need to be included in the intrinsics target because | |
| 286 # they need the -mfpu=neon flag. | |
| 287 # the pattern may need to be updated if vpx_scale gets intrinics | |
| 288 local intrinsic_list=$(echo "$source_list" | \ | |
| 289 egrep 'neon.*(\.c|\.asm)$') | |
| 290 fi | |
| 291 | |
| 292 # Remove these files from the main list. | |
| 293 source_list=$(comm -23 <(echo "$source_list") <(echo "$intrinsic_list")) | |
| 294 | |
| 295 local x86_list=$(echo "$source_list" | egrep '/x86/') | |
| 296 | |
| 297 write_gypi source_list "$BASE_DIR/$2.gypi" | |
| 298 | |
| 299 # All the files are in a single "element." Check if the first element has | |
| 300 # length 0. | |
| 301 if [ 0 -ne ${#intrinsic_list} ]; then | |
| 302 write_intrinsics_gypi intrinsic_list[@] "$BASE_DIR/$2_intrinsics.gypi" | |
| 303 fi | |
| 304 | |
| 305 # Write a single .gni file that includes all source files for all archs. | |
| 306 if [ 0 -ne ${#x86_list} ]; then | |
| 307 local c_sources=$(echo "$source_list" | egrep '.(c|h)$') | |
| 308 local assembly_sources=$(echo "$source_list" | egrep '.asm$') | |
| 309 local mmx_sources=$(echo "$intrinsic_list" | grep '_mmx\.c$') | |
| 310 local sse2_sources=$(echo "$intrinsic_list" | grep '_sse2\.c$') | |
| 311 local sse3_sources=$(echo "$intrinsic_list" | grep '_sse3\.c$') | |
| 312 local ssse3_sources=$(echo "$intrinsic_list" | grep '_ssse3\.c$') | |
| 313 local sse4_1_sources=$(echo "$intrinsic_list" | grep '_sse4\.c$') | |
| 314 local avx_sources=$(echo "$intrinsic_list" | grep '_avx\.c$') | |
| 315 local avx2_sources=$(echo "$intrinsic_list" | grep '_avx2\.c$') | |
| 316 | |
| 317 write_gni c_sources $2 "$BASE_DIR/libvpx_srcs.gni" | |
| 318 write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni" | |
| 319 write_gni mmx_sources $2_mmx "$BASE_DIR/libvpx_srcs.gni" | |
| 320 write_gni sse2_sources $2_sse2 "$BASE_DIR/libvpx_srcs.gni" | |
| 321 write_gni sse3_sources $2_sse3 "$BASE_DIR/libvpx_srcs.gni" | |
| 322 write_gni ssse3_sources $2_ssse3 "$BASE_DIR/libvpx_srcs.gni" | |
| 323 write_gni sse4_1_sources $2_sse4_1 "$BASE_DIR/libvpx_srcs.gni" | |
| 324 if [ -z "$DISABLE_AVX" ]; then | |
| 325 write_gni avx_sources $2_avx "$BASE_DIR/libvpx_srcs.gni" | |
| 326 write_gni avx2_sources $2_avx2 "$BASE_DIR/libvpx_srcs.gni" | |
| 327 fi | |
| 328 else | |
| 329 local c_sources=$(echo "$source_list" | egrep '.(c|h)$') | |
| 330 local assembly_sources=$(echo -e "$source_list\n$intrinsic_list" | \ | |
| 331 egrep '.asm$') | |
| 332 local neon_sources=$(echo "$intrinsic_list" | grep '_neon\.c$') | |
| 333 write_gni c_sources $2 "$BASE_DIR/libvpx_srcs.gni" | |
| 334 write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni" | |
| 335 if [ 0 -ne ${#neon_sources} ]; then | |
| 336 write_gni neon_sources $2_neon "$BASE_DIR/libvpx_srcs.gni" | |
| 337 fi | |
| 338 fi | |
| 339 } | |
| 340 | |
| 341 # Clean files from previous make. | |
| 342 function make_clean { | |
| 343 make clean > /dev/null | |
| 344 rm -f libvpx_srcs.txt | |
| 345 } | |
| 346 | |
| 347 # Lint a pair of vpx_config.h and vpx_config.asm to make sure they match. | |
| 348 # $1 - Header file directory. | |
| 349 function lint_config { | |
| 350 # mips does not contain any assembly so the header does not need to be | |
| 351 # compared to the asm. | |
| 352 if [[ "$1" != *mipsel && "$1" != *mips64el ]]; then | |
| 353 $BASE_DIR/lint_config.sh \ | |
| 354 -h $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \ | |
| 355 -a $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.asm | |
| 356 fi | |
| 357 } | |
| 358 | |
| 359 # Print the configuration. | |
| 360 # $1 - Header file directory. | |
| 361 function print_config { | |
| 362 $BASE_DIR/lint_config.sh -p \ | |
| 363 -h $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \ | |
| 364 -a $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.asm | |
| 365 } | |
| 366 | |
| 367 # Print the configuration from Header file. | |
| 368 # This function is an abridged version of print_config which does not use | |
| 369 # lint_config and it does not require existence of vpx_config.asm. | |
| 370 # $1 - Header file directory. | |
| 371 function print_config_basic { | |
| 372 combined_config="$(cat $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \ | |
| 373 | grep -E ' +[01] *$')" | |
| 374 combined_config="$(echo "$combined_config" | grep -v DO1STROUNDING)" | |
| 375 combined_config="$(echo "$combined_config" | sed 's/[ \t]//g')" | |
| 376 combined_config="$(echo "$combined_config" | sed 's/.*define//')" | |
| 377 combined_config="$(echo "$combined_config" | sed 's/0$/=no/')" | |
| 378 combined_config="$(echo "$combined_config" | sed 's/1$/=yes/')" | |
| 379 echo "$combined_config" | sort | uniq | |
| 380 } | |
| 381 | |
| 382 # Generate *_rtcd.h files. | |
| 383 # $1 - Header file directory. | |
| 384 # $2 - Architecture. | |
| 385 function gen_rtcd_header { | |
| 386 echo "Generate $LIBVPX_CONFIG_DIR/$1/*_rtcd.h files." | |
| 387 | |
| 388 rm -rf $BASE_DIR/$TEMP_DIR/libvpx.config | |
| 389 if [[ "$2" == "mipsel" || "$2" == "mips64el" ]]; then | |
| 390 print_config_basic $1 > $BASE_DIR/$TEMP_DIR/libvpx.config | |
| 391 else | |
| 392 $BASE_DIR/lint_config.sh -p \ | |
| 393 -h $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \ | |
| 394 -a $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.asm \ | |
| 395 -o $BASE_DIR/$TEMP_DIR/libvpx.config | |
| 396 fi | |
| 397 | |
| 398 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \ | |
| 399 --arch=$2 \ | |
| 400 --sym=vp8_rtcd $DISABLE_AVX \ | |
| 401 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \ | |
| 402 $BASE_DIR/$LIBVPX_SRC_DIR/vp8/common/rtcd_defs.pl \ | |
| 403 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp8_rtcd.h | |
| 404 | |
| 405 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \ | |
| 406 --arch=$2 \ | |
| 407 --sym=vp9_rtcd $DISABLE_AVX \ | |
| 408 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \ | |
| 409 $BASE_DIR/$LIBVPX_SRC_DIR/vp9/common/vp9_rtcd_defs.pl \ | |
| 410 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp9_rtcd.h | |
| 411 | |
| 412 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \ | |
| 413 --arch=$2 \ | |
| 414 --sym=vpx_scale_rtcd $DISABLE_AVX \ | |
| 415 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \ | |
| 416 $BASE_DIR/$LIBVPX_SRC_DIR/vpx_scale/vpx_scale_rtcd.pl \ | |
| 417 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_scale_rtcd.h | |
| 418 | |
| 419 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \ | |
| 420 --arch=$2 \ | |
| 421 --sym=vpx_dsp_rtcd $DISABLE_AVX \ | |
| 422 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \ | |
| 423 $BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp/vpx_dsp_rtcd_defs.pl \ | |
| 424 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_dsp_rtcd.h | |
| 425 | |
| 426 rm -rf $BASE_DIR/$TEMP_DIR/libvpx.config | |
| 427 } | |
| 428 | |
| 429 # Generate Config files. "--enable-external-build" must be set to skip | |
| 430 # detection of capabilities on specific targets. | |
| 431 # $1 - Header file directory. | |
| 432 # $2 - Config command line. | |
| 433 function gen_config_files { | |
| 434 ./configure $2 > /dev/null | |
| 435 | |
| 436 # Disable HAVE_UNISTD_H as it causes vp8 to try to detect how many cpus | |
| 437 # available, which doesn't work from iniside a sandbox on linux. | |
| 438 ( echo '/HAVE_UNISTD_H/s/[01]/0/' ; echo 'w' ; echo 'q' ) | ed -s vpx_config.h | |
| 439 | |
| 440 # Generate vpx_config.asm. Do not create one for mips. | |
| 441 if [[ "$1" != *mipsel && "$1" != *mips64el ]]; then | |
| 442 if [[ "$1" == *x64* ]] || [[ "$1" == *ia32* ]]; then | |
| 443 egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print "%define " $2 "
" $3}' > vpx_config.asm | |
| 444 else | |
| 445 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 | |
| 446 fi | |
| 447 fi | |
| 448 | |
| 449 cp vpx_config.* $BASE_DIR/$LIBVPX_CONFIG_DIR/$1 | |
| 450 make_clean | |
| 451 rm -rf vpx_config.* | |
| 452 } | |
| 453 | |
| 454 find_duplicates | |
| 455 | |
| 456 echo "Create temporary directory." | |
| 457 TEMP_DIR="$LIBVPX_SRC_DIR.temp" | |
| 458 rm -rf $TEMP_DIR | |
| 459 cp -R $LIBVPX_SRC_DIR $TEMP_DIR | |
| 460 cd $TEMP_DIR | |
| 461 | |
| 462 echo "Generate config files." | |
| 463 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 --enable-vp9-temporal-denoising --enable-
vp9-postproc --size-limit=16384x16384 $DISABLE_AVX --as=yasm" | |
| 464 gen_config_files linux/ia32 "--target=x86-linux-gcc --disable-ccache --enable-pi
c --enable-realtime-only ${all_platforms}" | |
| 465 gen_config_files linux/x64 "--target=x86_64-linux-gcc --disable-ccache --enable-
pic --enable-realtime-only ${all_platforms}" | |
| 466 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}" | |
| 467 gen_config_files linux/arm-neon "--target=armv7-linux-gcc --enable-pic --enable-
realtime-only --disable-edsp ${all_platforms}" | |
| 468 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}" | |
| 469 gen_config_files linux/arm64 "--force-target=armv8-linux-gcc --enable-pic --enab
le-realtime-only --disable-edsp ${all_platforms}" | |
| 470 gen_config_files linux/mipsel "--target=mips32-linux-gcc ${all_platforms}" | |
| 471 gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}" | |
| 472 gen_config_files linux/generic "--target=generic-gnu --enable-pic --enable-realt
ime-only ${all_platforms}" | |
| 473 gen_config_files win/ia32 "--target=x86-win32-vs12 --enable-realtime-only ${all_
platforms}" | |
| 474 gen_config_files win/x64 "--target=x86_64-win64-vs12 --enable-realtime-only ${al
l_platforms}" | |
| 475 gen_config_files mac/ia32 "--target=x86-darwin9-gcc --enable-pic --enable-realti
me-only ${all_platforms}" | |
| 476 gen_config_files mac/x64 "--target=x86_64-darwin9-gcc --enable-pic --enable-real
time-only ${all_platforms}" | |
| 477 gen_config_files nacl "--target=generic-gnu --enable-pic --enable-realtime-only
${all_platforms}" | |
| 478 | |
| 479 echo "Remove temporary directory." | |
| 480 cd $BASE_DIR | |
| 481 rm -rf $TEMP_DIR | |
| 482 | |
| 483 echo "Lint libvpx configuration." | |
| 484 lint_config linux/ia32 | |
| 485 lint_config linux/x64 | |
| 486 lint_config linux/arm | |
| 487 lint_config linux/arm-neon | |
| 488 lint_config linux/arm-neon-cpu-detect | |
| 489 lint_config linux/arm64 | |
| 490 lint_config linux/mipsel | |
| 491 lint_config linux/mips64el | |
| 492 lint_config linux/generic | |
| 493 lint_config win/ia32 | |
| 494 lint_config win/x64 | |
| 495 lint_config mac/ia32 | |
| 496 lint_config mac/x64 | |
| 497 lint_config nacl | |
| 498 | |
| 499 echo "Create temporary directory." | |
| 500 TEMP_DIR="$LIBVPX_SRC_DIR.temp" | |
| 501 rm -rf $TEMP_DIR | |
| 502 cp -R $LIBVPX_SRC_DIR $TEMP_DIR | |
| 503 cd $TEMP_DIR | |
| 504 | |
| 505 gen_rtcd_header linux/ia32 x86 | |
| 506 gen_rtcd_header linux/x64 x86_64 | |
| 507 gen_rtcd_header linux/arm armv6 | |
| 508 gen_rtcd_header linux/arm-neon armv7 | |
| 509 gen_rtcd_header linux/arm-neon-cpu-detect armv7 | |
| 510 gen_rtcd_header linux/arm64 armv8 | |
| 511 gen_rtcd_header linux/mipsel mipsel | |
| 512 gen_rtcd_header linux/mips64el mips64el | |
| 513 gen_rtcd_header linux/generic generic | |
| 514 gen_rtcd_header win/ia32 x86 | |
| 515 gen_rtcd_header win/x64 x86_64 | |
| 516 gen_rtcd_header mac/ia32 x86 | |
| 517 gen_rtcd_header mac/x64 x86_64 | |
| 518 gen_rtcd_header nacl nacl | |
| 519 | |
| 520 echo "Prepare Makefile." | |
| 521 ./configure --target=generic-gnu > /dev/null | |
| 522 make_clean | |
| 523 | |
| 524 if [ -z $ONLY_CONFIGS ]; then | |
| 525 # Remove existing .gni file. | |
| 526 rm -rf $BASE_DIR/libvpx_srcs.gni | |
| 527 write_license $BASE_DIR/libvpx_srcs.gni | |
| 528 | |
| 529 echo "Generate X86 source list." | |
| 530 config=$(print_config linux/ia32) | |
| 531 make_clean | |
| 532 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 533 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86 | |
| 534 | |
| 535 # Copy vpx_version.h. The file should be the same for all platforms. | |
| 536 cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR | |
| 537 | |
| 538 echo "Generate X86_64 source list." | |
| 539 config=$(print_config linux/x64) | |
| 540 make_clean | |
| 541 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 542 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86_64 | |
| 543 | |
| 544 echo "Generate ARM source list." | |
| 545 config=$(print_config linux/arm) | |
| 546 make_clean | |
| 547 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 548 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm | |
| 549 | |
| 550 echo "Generate ARM NEON source list." | |
| 551 config=$(print_config linux/arm-neon) | |
| 552 make_clean | |
| 553 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 554 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon | |
| 555 | |
| 556 echo "Generate ARM NEON CPU DETECT source list." | |
| 557 config=$(print_config linux/arm-neon-cpu-detect) | |
| 558 make_clean | |
| 559 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 560 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon_cpu_detect | |
| 561 | |
| 562 echo "Generate ARM64 source list." | |
| 563 config=$(print_config linux/arm64) | |
| 564 make_clean | |
| 565 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 566 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm64 | |
| 567 | |
| 568 echo "Generate MIPS source list." | |
| 569 config=$(print_config_basic linux/mipsel) | |
| 570 make_clean | |
| 571 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 572 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_mips | |
| 573 | |
| 574 echo "MIPS64 source list is identical to MIPS source list. No need to generate
it." | |
| 575 | |
| 576 echo "Generate NaCl source list." | |
| 577 config=$(print_config_basic nacl) | |
| 578 make_clean | |
| 579 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 580 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_nacl | |
| 581 | |
| 582 echo "Generate GENERIC source list." | |
| 583 config=$(print_config_basic linux/generic) | |
| 584 make_clean | |
| 585 make libvpx_srcs.txt target=libs $config > /dev/null | |
| 586 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic | |
| 587 fi | |
| 588 | |
| 589 echo "Remove temporary directory." | |
| 590 cd $BASE_DIR | |
| 591 rm -rf $TEMP_DIR | |
| 592 | |
| 593 gn format --in-place $BASE_DIR/BUILD.gn | |
| 594 gn format --in-place $BASE_DIR/libvpx_srcs.gni | |
| 595 | |
| 596 cd $BASE_DIR/$LIBVPX_SRC_DIR | |
| 597 echo | |
| 598 echo "Update README.chromium:" | |
| 599 git log -1 --format="%cd%nCommit: %H" --date=format:"Date: %A %B %d %Y" | |
| 600 | |
| 601 cd $BASE_DIR | |
| 602 | |
| 603 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel? | |
| OLD | NEW |