Chromium Code Reviews| Index: generate_gypi.sh |
| diff --git a/generate_gypi.sh b/generate_gypi.sh |
| index 08c16d7a844ab3f0af4c070d1d61de371b527ee2..756488bb8798d7cc22718c0632228b21f37ca592 100755 |
| --- a/generate_gypi.sh |
| +++ b/generate_gypi.sh |
| @@ -8,10 +8,13 @@ |
| # config/platform directories needed to build libvpx. |
| # Every time libvpx source code is updated just run this script. |
| # |
| -# For example: |
| -# $ ./generate_gypi.sh |
| +# Usage: |
| +# $ ./generate_gypi.sh [--disable-avx] [--only-configs] |
| # |
| -# And this will update all the .gypi, .gni and config files needed. |
| +# The following optional flags are supported: |
| +# --disable-avx : AVX+AVX2 support is disabled. |
| +# --only-configs: Excludes generation of GN and GYP files (i.e. only |
| +# configuration headers are generated). |
| # |
| # !!! It's highly recommended to install yasm before running this script. |
| @@ -20,6 +23,23 @@ BASE_DIR=$(pwd) |
| LIBVPX_SRC_DIR="source/libvpx" |
| LIBVPX_CONFIG_DIR="source/config" |
|
Johann
2015/09/14 17:24:04
maybe unset DISABLE_AVX?
kjellander_chromium
2015/09/14 18:38:21
Done.
|
| +for i in "$@" |
| +do |
| +case $i in |
| + --disable-avx) |
| + DISABLE_AVX=true |
|
Johann
2015/09/14 17:24:04
DISABLE_AVX="--disable-avx --disable-avx2"
kjellander_chromium
2015/09/14 18:38:21
Done.
|
| + shift |
| + ;; |
| + --only-configs) |
| + ONLY_CONFIGS=true |
| + shift |
| + ;; |
| + *) |
| + # Unknown option. |
|
Johann
2015/09/14 17:24:04
fail/error on unknown option
kjellander_chromium
2015/09/14 18:38:21
Good idea, done.
|
| + ;; |
| +esac |
| +done |
| + |
| # Print license header. |
| # $1 - Output base name |
| function write_license { |
| @@ -118,7 +138,7 @@ function write_target_definition { |
| fi |
| echo " 'cflags': [ '-m$4', ]," >> "$2" |
| echo " 'xcode_settings': { 'OTHER_CFLAGS': [ '-m$4' ] }," >> "$2" |
| - if [[ $4 == avx2 ]]; then |
| +if [[ ! $DISABLE_AVX && $4 == avx2 ]]; then |
|
Johann
2015/09/14 17:24:03
-nz or -ne or whatever "not set"
kjellander_chromium
2015/09/14 18:38:21
Done.
|
| echo " 'msvs_settings': {" >> "$2" |
| echo " 'VCCLCompilerTool': {" >> "$2" |
| echo " 'EnableEnhancedInstructionSet': '5', # /arch:AVX2" >> "$2" |
| @@ -183,12 +203,12 @@ function write_intrinsics_gypi { |
| if [ 0 -ne ${#sse4_1_sources} ]; then |
| write_target_definition sse4_1_sources[@] "$2" libvpx_intrinsics_sse4_1 sse4.1 |
| fi |
| - if [ 0 -ne ${#avx_sources} ]; then |
| + if [[ ! $DISABLE_AVX && 0 -ne ${#avx_sources} ]]; then |
| #write_target_definition avx_sources[@] "$2" libvpx_intrinsics_avx avx |
| echo "ERROR: Uncomment avx sections in libvpx.gyp" |
| exit 1 |
| fi |
| - if [ 0 -ne ${#avx2_sources} ]; then |
| + if [[ ! $DISABLE_AVX && 0 -ne ${#avx2_sources} ]]; then |
| write_target_definition avx2_sources[@] "$2" libvpx_intrinsics_avx2 avx2 |
| fi |
| @@ -267,8 +287,10 @@ function convert_srcs_to_project_files { |
| write_gni sse3_sources $2_sse3 "$BASE_DIR/libvpx_srcs.gni" |
| write_gni ssse3_sources $2_ssse3 "$BASE_DIR/libvpx_srcs.gni" |
| write_gni sse4_1_sources $2_sse4_1 "$BASE_DIR/libvpx_srcs.gni" |
| - write_gni avx_sources $2_avx "$BASE_DIR/libvpx_srcs.gni" |
| - write_gni avx2_sources $2_avx2 "$BASE_DIR/libvpx_srcs.gni" |
| + if [[ ! $DISABLE_AVX ]]; then |
| + write_gni avx_sources $2_avx "$BASE_DIR/libvpx_srcs.gni" |
| + write_gni avx2_sources $2_avx2 "$BASE_DIR/libvpx_srcs.gni" |
| + fi |
| else |
| local c_sources=$(echo "$source_list" | egrep '.(c|h)$') |
| local assembly_sources=$(echo -e "$source_list\n$intrinsic_list" | \ |
| @@ -377,7 +399,7 @@ function gen_rtcd_header { |
| function gen_config_files { |
| ./configure $2 > /dev/null |
| - # Disable HAVE_UNISTD_H as it causes vp8 to try to detect how many cpus |
| + # Disable HAVE_UNISTD_H as it causes vp8 to try to detect how many cpus |
| # available, which doesn't work from iniside a sandbox on linux. |
| ( echo '/HAVE_UNISTD_H/s/[01]/0/' ; echo 'w' ; echo 'q' ) | ed -s vpx_config.h |
| @@ -403,6 +425,9 @@ cd $TEMP_DIR |
| echo "Generate config files." |
| all_platforms="--enable-external-build --enable-postproc --disable-install-srcs --enable-multi-res-encoding --enable-temporal-denoising --disable-unit-tests --disable-install-docs --disable-examples --enable-vp9-temporal-denoising --enable-vp9-postproc --size-limit=16384x16384" |
|
Johann
2015/09/14 17:24:04
add DISABLE_AVX to this line
kjellander_chromium
2015/09/14 18:38:20
Done.
|
| +if [[ $DISABLE_AVX ]]; then |
| + all_platforms="${all_platforms} --disable-avx --disable-avx2" |
| +fi |
| gen_config_files linux/ia32 "--target=x86-linux-gcc --disable-ccache --enable-pic --enable-realtime-only ${all_platforms}" |
| gen_config_files linux/x64 "--target=x86_64-linux-gcc --disable-ccache --enable-pic --enable-realtime-only ${all_platforms}" |
| gen_config_files linux/arm "--target=armv6-linux-gcc --enable-pic --enable-realtime-only --disable-install-bins --disable-install-libs --disable-edsp ${all_platforms}" |
| @@ -463,68 +488,70 @@ echo "Prepare Makefile." |
| ./configure --target=generic-gnu > /dev/null |
| make_clean |
| -# Remove existing .gni file. |
| -rm -rf $BASE_DIR/libvpx_srcs.gni |
| -write_license $BASE_DIR/libvpx_srcs.gni |
| +if [[ ! $ONLY_CONFIGS ]]; then |
| + # Remove existing .gni file. |
| + rm -rf $BASE_DIR/libvpx_srcs.gni |
| + write_license $BASE_DIR/libvpx_srcs.gni |
| -echo "Generate X86 source list." |
| -config=$(print_config linux/ia32) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86 |
| + echo "Generate X86 source list." |
| + config=$(print_config linux/ia32) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86 |
| -# Copy vpx_version.h. The file should be the same for all platforms. |
| -cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR |
| + # Copy vpx_version.h. The file should be the same for all platforms. |
| + cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR |
| -echo "Generate X86_64 source list." |
| -config=$(print_config linux/x64) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86_64 |
| + echo "Generate X86_64 source list." |
| + config=$(print_config linux/x64) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86_64 |
| -echo "Generate ARM source list." |
| -config=$(print_config linux/arm) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm |
| + echo "Generate ARM source list." |
| + config=$(print_config linux/arm) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm |
| -echo "Generate ARM NEON source list." |
| -config=$(print_config linux/arm-neon) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon |
| + echo "Generate ARM NEON source list." |
| + config=$(print_config linux/arm-neon) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon |
| -echo "Generate ARM NEON CPU DETECT source list." |
| -config=$(print_config linux/arm-neon-cpu-detect) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon_cpu_detect |
| + echo "Generate ARM NEON CPU DETECT source list." |
| + config=$(print_config linux/arm-neon-cpu-detect) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon_cpu_detect |
| -echo "Generate ARM64 source list." |
| -config=$(print_config linux/arm64) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm64 |
| + echo "Generate ARM64 source list." |
| + config=$(print_config linux/arm64) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm64 |
| -echo "Generate MIPS source list." |
| -config=$(print_config_basic linux/mipsel) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_mips |
| + echo "Generate MIPS source list." |
| + config=$(print_config_basic linux/mipsel) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_mips |
| -echo "MIPS64 source list is identical to MIPS source list. No need to generate it." |
| + echo "MIPS64 source list is identical to MIPS source list. No need to generate it." |
| -echo "Generate NaCl source list." |
| -config=$(print_config_basic nacl) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_nacl |
| + echo "Generate NaCl source list." |
| + config=$(print_config_basic nacl) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_nacl |
| -echo "Generate GENERIC source list." |
| -config=$(print_config_basic linux/generic) |
| -make_clean |
| -make libvpx_srcs.txt target=libs $config > /dev/null |
| -convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic |
| + echo "Generate GENERIC source list." |
| + config=$(print_config_basic linux/generic) |
| + make_clean |
| + make libvpx_srcs.txt target=libs $config > /dev/null |
| + convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic |
| +fi |
| echo "Remove temporary directory." |
| cd $BASE_DIR |