generate_sources_mozbuild.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. # Modified from chromium/src/third_party/libaom/generate_gni.sh
  7. # This script is used to generate sources.mozbuild and files in the
  8. # config/platform directories needed to build libaom.
  9. # Every time libaom source code is updated just run this script.
  10. #
  11. # Usage:
  12. # $ ./generate_sources_mozbuild.sh
  13. export LC_ALL=C
  14. BASE_DIR=$(pwd)
  15. LIBAOM_SRC_DIR="/media/libaom/src"
  16. LIBAOM_CONFIG_DIR="config"
  17. # Print license header.
  18. # $1 - Output base name
  19. function write_license {
  20. echo "# This file is generated. Do not edit." >> $1
  21. echo "" >> $1
  22. }
  23. # Generate *_rtcd.h files.
  24. # $1 - Header file directory.
  25. # $2 - Architecture.
  26. # $3 - Optional - any additional arguments to pass through.
  27. function gen_rtcd_header {
  28. echo "Generate $LIBAOM_CONFIG_DIR/$1/*_rtcd.h files."
  29. AOM_CONFIG=$BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_config.h
  30. $BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/rtcd.pl \
  31. --arch=$2 \
  32. --sym=av1_rtcd $3 \
  33. --config=$AOM_CONFIG \
  34. $BASE_DIR/$LIBAOM_SRC_DIR/av1/common/av1_rtcd_defs.pl \
  35. > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/av1_rtcd.h
  36. $BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/rtcd.pl \
  37. --arch=$2 \
  38. --sym=aom_scale_rtcd $3 \
  39. --config=$AOM_CONFIG \
  40. $BASE_DIR/$LIBAOM_SRC_DIR/aom_scale/aom_scale_rtcd.pl \
  41. > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_scale_rtcd.h
  42. $BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/rtcd.pl \
  43. --arch=$2 \
  44. --sym=aom_dsp_rtcd $3 \
  45. --config=$AOM_CONFIG \
  46. $BASE_DIR/$LIBAOM_SRC_DIR/aom_dsp/aom_dsp_rtcd_defs.pl \
  47. > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_dsp_rtcd.h
  48. }
  49. echo "Generating config files."
  50. cd $BASE_DIR
  51. python generate_sources_mozbuild.py
  52. # Copy aom_version.h once. The file is the same for all platforms.
  53. cp aom_version.h $BASE_DIR/$LIBAOM_CONFIG_DIR
  54. gen_rtcd_header linux/x64 x86_64
  55. gen_rtcd_header linux/ia32 x86
  56. gen_rtcd_header mac/x64 x86_64
  57. gen_rtcd_header win/x64 x86_64
  58. gen_rtcd_header win/ia32 x86
  59. gen_rtcd_header win/mingw32 x86
  60. gen_rtcd_header win/mingw64 x86_64
  61. gen_rtcd_header linux/arm armv7
  62. gen_rtcd_header generic generic
  63. cd $BASE_DIR/$LIBAOM_SRC_DIR
  64. cd $BASE_DIR