generate_gni.sh 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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. # This script is used to generate .gni files and files in the
  7. # config/platform directories needed to build libvpx.
  8. # Every time libvpx source code is updated just run this script.
  9. #
  10. # Usage:
  11. # $ ./generate_gni.sh [--enable-avx512] [--only-configs]
  12. #
  13. # The following optional flags are supported:
  14. # --enable-avx512 : Enable AVX512.
  15. # --only-configs : Excludes generation of GN and GYP files (i.e. only
  16. # configuration headers are generated).
  17. # --disable-vp9-highbitdepth : Revert x86[_64] builds to low-bit-depth only.
  18. export LC_ALL=C
  19. BASE_DIR=$(pwd)
  20. LIBVPX_SRC_DIR="source/libvpx"
  21. LIBVPX_CONFIG_DIR="source/config"
  22. DISABLE_AVX512="--disable-avx512"
  23. HIGHBD="--enable-vp9-highbitdepth"
  24. # Only disable avx512 if it is an option.
  25. grep -q avx512 source/libvpx/configure || unset DISABLE_AVX512
  26. for i in "$@"
  27. do
  28. case $i in
  29. --enable-avx512)
  30. unset DISABLE_AVX512
  31. shift
  32. ;;
  33. --only-configs)
  34. ONLY_CONFIGS=true
  35. shift
  36. ;;
  37. --enable-vp9-highbitdepth)
  38. shift
  39. ;;
  40. --disable-vp9-highbitdepth)
  41. unset HIGHBD
  42. shift
  43. ;;
  44. *)
  45. echo "Unknown option: $i"
  46. exit 1
  47. ;;
  48. esac
  49. done
  50. # Print license header.
  51. # $1 - Output base name
  52. function write_license {
  53. echo "# This file is generated. Do not edit." >> $1
  54. echo "" >> $1
  55. }
  56. # Search for source files with the same basename in vp8, vp9, and vpx_dsp. The
  57. # build can support such files but only when they are built into disparate
  58. # modules. Configuring such modules for both gyp and gn are tricky so avoid the
  59. # issue at least until gyp is removed.
  60. function find_duplicates {
  61. local readonly duplicate_file_names=$(find \
  62. $BASE_DIR/$LIBVPX_SRC_DIR/vp8 \
  63. $BASE_DIR/$LIBVPX_SRC_DIR/vp9 \
  64. $BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp \
  65. -type f -name \*.c | xargs -I {} basename {} | sort | uniq -d \
  66. )
  67. if [ -n "${duplicate_file_names}" ]; then
  68. echo "WARNING: DUPLICATE FILES FOUND"
  69. for file in ${duplicate_file_names}; do
  70. find \
  71. $BASE_DIR/$LIBVPX_SRC_DIR/vp8 \
  72. $BASE_DIR/$LIBVPX_SRC_DIR/vp9 \
  73. $BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp \
  74. -name $file
  75. done
  76. exit 1
  77. fi
  78. }
  79. # Generate a gni with a list of source files.
  80. # $1 - Array name for file list. This is processed with 'declare' below to
  81. # regenerate the array locally.
  82. # $2 - GN variable name.
  83. # $3 - Output file.
  84. function write_gni {
  85. # Convert the first argument back in to an array.
  86. declare -a file_list=("${!1}")
  87. echo "$2 = [" >> "$3"
  88. for f in $file_list
  89. do
  90. echo " \"//third_party/libvpx/source/libvpx/$f\"," >> "$3"
  91. done
  92. echo "]" >> "$3"
  93. }
  94. # Convert a list of source files into gni files.
  95. # $1 - Input file.
  96. function convert_srcs_to_project_files {
  97. # Do the following here:
  98. # 1. Filter .c, .h, .s, .S and .asm files.
  99. # 2. Move certain files to a separate lists to allow applying different
  100. # compiler options.
  101. # 3. Replace .asm.s to .asm because gn will do the conversion.
  102. local source_list=$(grep -E '(\.c|\.h|\.S|\.s|\.asm)$' $1)
  103. # Not sure why vpx_config.c is not included.
  104. source_list=$(echo "$source_list" | grep -v 'vpx_config\.c')
  105. # Ignore include files.
  106. source_list=$(echo "$source_list" | grep -v 'x86_abi_support\.asm')
  107. # These headers are #included conditionally with #if VPX_ARCH_ARM and
  108. # similar. However, only the header(s) relevant for the current architecture
  109. # are present in $1, hence "gn check" will detect them as invalid includes
  110. # unless explicitly added.
  111. source_list=$(echo -e "$source_list\\nvpx_ports/arm.h")
  112. source_list=$(echo -e "$source_list\\nvpx_ports/x86.h")
  113. source_list=$(echo -e "$source_list\\nvpx_ports/mips.h")
  114. source_list=$(echo "$source_list" | sort -u)
  115. # The actual ARM files end in .asm. We have rules to translate them to .S
  116. source_list=$(echo "$source_list" | sed s/\.asm\.s$/.asm/)
  117. # Select all x86 files ending with .c
  118. local intrinsic_list=$(echo "$source_list" | \
  119. egrep '(mmx|sse2|sse3|ssse3|sse4|avx|avx2|avx512).c$')
  120. # Select all neon files ending in C but only when building in RTCD mode
  121. if [ "libvpx_srcs_arm_neon_cpu_detect" == "$2" ]; then
  122. # Select all arm neon files ending in _neon.c and all asm files.
  123. # The asm files need to be included in the intrinsics target because
  124. # they need the -mfpu=neon flag.
  125. # the pattern may need to be updated if vpx_scale gets intrinsics
  126. local intrinsic_list=$(echo "$source_list" | \
  127. egrep 'neon.*(\.c|\.asm)$')
  128. fi
  129. # Remove these files from the main list.
  130. source_list=$(comm -23 <(echo "$source_list") <(echo "$intrinsic_list"))
  131. local x86_list=$(echo "$source_list" | egrep '/x86/')
  132. # Write a single .gni file that includes all source files for all archs.
  133. if [ 0 -ne ${#x86_list} ]; then
  134. local c_sources=$(echo "$source_list" | egrep '\.c$')
  135. local c_headers=$(echo "$source_list" | egrep '\.h$')
  136. local assembly_sources=$(echo "$source_list" | egrep '\.asm$')
  137. local mmx_sources=$(echo "$intrinsic_list" | grep '_mmx\.c$')
  138. local sse2_sources=$(echo "$intrinsic_list" | grep '_sse2\.c$')
  139. local sse3_sources=$(echo "$intrinsic_list" | grep '_sse3\.c$')
  140. local ssse3_sources=$(echo "$intrinsic_list" | grep '_ssse3\.c$')
  141. local sse4_1_sources=$(echo "$intrinsic_list" | grep '_sse4\.c$')
  142. local avx_sources=$(echo "$intrinsic_list" | grep '_avx\.c$')
  143. local avx2_sources=$(echo "$intrinsic_list" | grep '_avx2\.c$')
  144. local avx512_sources=$(echo "$intrinsic_list" | grep '_avx512\.c$')
  145. write_gni c_sources $2 "$BASE_DIR/libvpx_srcs.gni"
  146. write_gni c_headers $2_headers "$BASE_DIR/libvpx_srcs.gni"
  147. write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni"
  148. write_gni mmx_sources $2_mmx "$BASE_DIR/libvpx_srcs.gni"
  149. write_gni sse2_sources $2_sse2 "$BASE_DIR/libvpx_srcs.gni"
  150. write_gni sse3_sources $2_sse3 "$BASE_DIR/libvpx_srcs.gni"
  151. write_gni ssse3_sources $2_ssse3 "$BASE_DIR/libvpx_srcs.gni"
  152. write_gni sse4_1_sources $2_sse4_1 "$BASE_DIR/libvpx_srcs.gni"
  153. write_gni avx_sources $2_avx "$BASE_DIR/libvpx_srcs.gni"
  154. write_gni avx2_sources $2_avx2 "$BASE_DIR/libvpx_srcs.gni"
  155. write_gni avx512_sources $2_avx512 "$BASE_DIR/libvpx_srcs.gni"
  156. else
  157. local c_sources=$(echo "$source_list" | egrep '\.c$')
  158. local c_headers=$(echo "$source_list" | egrep '\.h$')
  159. local assembly_sources=$(echo -e "$source_list\n$intrinsic_list" | \
  160. egrep '\.asm$')
  161. local neon_sources=$(echo "$intrinsic_list" | grep '_neon\.c$')
  162. write_gni c_sources $2 "$BASE_DIR/libvpx_srcs.gni"
  163. write_gni c_headers $2_headers "$BASE_DIR/libvpx_srcs.gni"
  164. write_gni assembly_sources $2_assembly "$BASE_DIR/libvpx_srcs.gni"
  165. if [ 0 -ne ${#neon_sources} ]; then
  166. write_gni neon_sources $2_neon "$BASE_DIR/libvpx_srcs.gni"
  167. fi
  168. fi
  169. }
  170. # Clean files from previous make.
  171. function make_clean {
  172. make clean > /dev/null
  173. rm -f libvpx_srcs.txt
  174. }
  175. # Lint a pair of vpx_config.h and vpx_config.asm to make sure they match.
  176. # $1 - Header file directory.
  177. function lint_config {
  178. # mips and native client do not contain any assembly so the headers do not
  179. # need to be compared to the asm.
  180. if [[ "$1" != *mipsel && "$1" != *mips64el && "$1" != nacl ]]; then
  181. $BASE_DIR/lint_config.sh \
  182. -h $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \
  183. -a $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.asm
  184. fi
  185. }
  186. # Print the configuration.
  187. # $1 - Header file directory.
  188. function print_config {
  189. $BASE_DIR/lint_config.sh -p \
  190. -h $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \
  191. -a $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.asm
  192. }
  193. # Print the configuration from Header file.
  194. # This function is an abridged version of print_config which does not use
  195. # lint_config and it does not require existence of vpx_config.asm.
  196. # $1 - Header file directory.
  197. function print_config_basic {
  198. combined_config="$(cat $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \
  199. | grep -E ' +[01] *$')"
  200. combined_config="$(echo "$combined_config" | grep -v DO1STROUNDING)"
  201. combined_config="$(echo "$combined_config" | sed 's/[ \t]//g')"
  202. combined_config="$(echo "$combined_config" | sed 's/.*define//')"
  203. combined_config="$(echo "$combined_config" | sed 's/0$/=no/')"
  204. combined_config="$(echo "$combined_config" | sed 's/1$/=yes/')"
  205. echo "$combined_config" | sort | uniq
  206. }
  207. # Generate *_rtcd.h files.
  208. # $1 - Header file directory.
  209. # $2 - Architecture.
  210. # $3 - Optional - any additional arguments to pass through.
  211. function gen_rtcd_header {
  212. echo "Generate $LIBVPX_CONFIG_DIR/$1/*_rtcd.h files."
  213. format="clang-format -i -style=Chromium"
  214. rm -rf $BASE_DIR/$TEMP_DIR/libvpx.config
  215. if [[ "$2" == "mipsel" || "$2" == "mips64el" || "$2" == nacl ]]; then
  216. print_config_basic $1 > $BASE_DIR/$TEMP_DIR/libvpx.config
  217. else
  218. $BASE_DIR/lint_config.sh -p \
  219. -h $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \
  220. -a $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.asm \
  221. -o $BASE_DIR/$TEMP_DIR/libvpx.config
  222. fi
  223. $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
  224. --arch=$2 \
  225. --sym=vp8_rtcd $DISABLE_AVX512 $3 \
  226. --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
  227. $BASE_DIR/$LIBVPX_SRC_DIR/vp8/common/rtcd_defs.pl \
  228. > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp8_rtcd.h
  229. ${format} $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp8_rtcd.h
  230. $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
  231. --arch=$2 \
  232. --sym=vp9_rtcd $DISABLE_AVX512 $3 \
  233. --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
  234. $BASE_DIR/$LIBVPX_SRC_DIR/vp9/common/vp9_rtcd_defs.pl \
  235. > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp9_rtcd.h
  236. ${format} $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp9_rtcd.h
  237. $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
  238. --arch=$2 \
  239. --sym=vpx_scale_rtcd $DISABLE_AVX512 $3 \
  240. --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
  241. $BASE_DIR/$LIBVPX_SRC_DIR/vpx_scale/vpx_scale_rtcd.pl \
  242. > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_scale_rtcd.h
  243. ${format} $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_scale_rtcd.h
  244. $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
  245. --arch=$2 \
  246. --sym=vpx_dsp_rtcd $DISABLE_AVX512 $3 \
  247. --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
  248. $BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp/vpx_dsp_rtcd_defs.pl \
  249. > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_dsp_rtcd.h
  250. ${format} $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_dsp_rtcd.h
  251. rm -rf $BASE_DIR/$TEMP_DIR/libvpx.config
  252. }
  253. # Generate Config files. "--enable-external-build" must be set to skip
  254. # detection of capabilities on specific targets.
  255. # $1 - Header file directory.
  256. # $2 - Config command line.
  257. function gen_config_files {
  258. ./configure $2 > /dev/null
  259. # Disable HAVE_UNISTD_H as it causes vp8 to try to detect how many cpus
  260. # available, which doesn't work from inside a sandbox on linux.
  261. sed -i.bak -e 's/\(HAVE_UNISTD_H[[:space:]]*\)1/\10/' vpx_config.h
  262. # Maintain old ARCH_ defines to avoid build errors because assembly file
  263. # dependencies are incorrect.
  264. sed -i.bak -e 's/\(#define \)VPX_\(ARCH_[_0-9A-Z]\+ [01]\)/&\n\1\2/' vpx_config.h
  265. rm vpx_config.h.bak
  266. # Use the correct ads2gas script.
  267. if [[ "$1" == linux* ]]; then
  268. local ASM_CONV=ads2gas.pl
  269. else
  270. local ASM_CONV=ads2gas_apple.pl
  271. fi
  272. # Generate vpx_config.asm. Do not create one for mips or native client.
  273. if [[ "$1" != *mipsel && "$1" != *mips64el && "$1" != nacl ]]; then
  274. if [[ "$1" == *x64* ]] || [[ "$1" == *ia32* ]]; then
  275. egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print "%define " $2 " " $3}' > vpx_config.asm
  276. else
  277. egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print $2 " EQU " $3}' | perl $BASE_DIR/$LIBVPX_SRC_DIR/build/make/$ASM_CONV > vpx_config.asm
  278. fi
  279. fi
  280. mkdir -p $BASE_DIR/$LIBVPX_CONFIG_DIR/$1
  281. cp vpx_config.* $BASE_DIR/$LIBVPX_CONFIG_DIR/$1
  282. make_clean
  283. rm -rf vpx_config.*
  284. }
  285. function update_readme {
  286. local IFS=$'\n'
  287. # Split git log output '<date>\n<commit hash>' on the newline to produce 2
  288. # array entries.
  289. local vals=($(git --no-pager log -1 --format="%cd%n%H" \
  290. --date=format:"%A %B %d %Y"))
  291. sed -E -i.bak \
  292. -e "s/^(Date:)[[:space:]]+.*$/\1 ${vals[0]}/" \
  293. -e "s/^(Revision:)[[:space:]]+[a-f0-9]{40}/\1 ${vals[1]}/" \
  294. ${BASE_DIR}/README.chromium
  295. rm ${BASE_DIR}/README.chromium.bak
  296. cat <<EOF
  297. README.chromium updated with:
  298. Date: ${vals[0]}
  299. Revision: ${vals[1]}
  300. EOF
  301. }
  302. find_duplicates
  303. echo "Create temporary directory."
  304. TEMP_DIR="$LIBVPX_SRC_DIR.temp"
  305. rm -rf $TEMP_DIR
  306. cp -R $LIBVPX_SRC_DIR $TEMP_DIR
  307. cd $TEMP_DIR
  308. echo "Generate config files."
  309. all_platforms="--enable-external-build"
  310. all_platforms+=" --enable-postproc"
  311. all_platforms+=" --enable-multi-res-encoding"
  312. all_platforms+=" --enable-temporal-denoising"
  313. all_platforms+=" --enable-vp9-temporal-denoising"
  314. all_platforms+=" --enable-vp9-postproc"
  315. all_platforms+=" --size-limit=16384x16384"
  316. all_platforms+=" --enable-realtime-only"
  317. all_platforms+=" --disable-install-docs"
  318. all_platforms+=" --disable-libyuv"
  319. x86_platforms="--enable-pic --as=yasm $DISABLE_AVX512 $HIGHBD"
  320. gen_config_files linux/ia32 "--target=x86-linux-gcc ${all_platforms} ${x86_platforms}"
  321. gen_config_files linux/x64 "--target=x86_64-linux-gcc ${all_platforms} ${x86_platforms}"
  322. gen_config_files linux/arm "--target=armv7-linux-gcc --disable-neon ${all_platforms}"
  323. gen_config_files linux/arm-neon "--target=armv7-linux-gcc ${all_platforms}"
  324. gen_config_files linux/arm-neon-cpu-detect "--target=armv7-linux-gcc --enable-runtime-cpu-detect ${all_platforms}"
  325. gen_config_files linux/arm64 "--target=armv8-linux-gcc ${all_platforms}"
  326. gen_config_files linux/arm-neon-highbd "--target=armv7-linux-gcc ${all_platforms} ${HIGHBD}"
  327. gen_config_files linux/arm64-highbd "--target=armv8-linux-gcc ${all_platforms} ${HIGHBD}"
  328. gen_config_files linux/mipsel "--target=mips32-linux-gcc ${all_platforms}"
  329. gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
  330. gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
  331. gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
  332. gen_config_files win/arm64 "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
  333. gen_config_files win/ia32 "--target=x86-win32-vs14 ${all_platforms} ${x86_platforms}"
  334. gen_config_files win/x64 "--target=x86_64-win64-vs14 ${all_platforms} ${x86_platforms}"
  335. gen_config_files mac/ia32 "--target=x86-darwin9-gcc ${all_platforms} ${x86_platforms}"
  336. gen_config_files mac/x64 "--target=x86_64-darwin9-gcc ${all_platforms} ${x86_platforms}"
  337. gen_config_files ios/arm-neon "--target=armv7-linux-gcc ${all_platforms}"
  338. gen_config_files ios/arm64 "--target=armv8-linux-gcc ${all_platforms}"
  339. gen_config_files nacl "--target=generic-gnu $HIGHBD ${all_platforms}"
  340. echo "Remove temporary directory."
  341. cd $BASE_DIR
  342. rm -rf $TEMP_DIR
  343. echo "Lint libvpx configuration."
  344. lint_config linux/ia32
  345. lint_config linux/x64
  346. lint_config linux/arm
  347. lint_config linux/arm-neon
  348. lint_config linux/arm-neon-cpu-detect
  349. lint_config linux/arm64
  350. lint_config linux/arm-neon-highbd
  351. lint_config linux/arm64-highbd
  352. lint_config linux/mipsel
  353. lint_config linux/mips64el
  354. lint_config linux/ppc64
  355. lint_config linux/generic
  356. lint_config win/arm64
  357. lint_config win/ia32
  358. lint_config win/x64
  359. lint_config mac/ia32
  360. lint_config mac/x64
  361. lint_config ios/arm-neon
  362. lint_config ios/arm64
  363. lint_config nacl
  364. echo "Create temporary directory."
  365. TEMP_DIR="$LIBVPX_SRC_DIR.temp"
  366. rm -rf $TEMP_DIR
  367. cp -R $LIBVPX_SRC_DIR $TEMP_DIR
  368. cd $TEMP_DIR
  369. # chromium has required sse2 for x86 since 2014
  370. require_sse2="--require-mmx --require-sse --require-sse2"
  371. gen_rtcd_header linux/ia32 x86 "${require_sse2}"
  372. gen_rtcd_header linux/x64 x86_64
  373. gen_rtcd_header linux/arm armv7 "--disable-neon --disable-neon_asm"
  374. gen_rtcd_header linux/arm-neon armv7
  375. gen_rtcd_header linux/arm-neon-cpu-detect armv7
  376. gen_rtcd_header linux/arm64 armv8
  377. gen_rtcd_header linux/arm-neon-highbd armv7
  378. gen_rtcd_header linux/arm64-highbd armv8
  379. gen_rtcd_header linux/mipsel mipsel
  380. gen_rtcd_header linux/mips64el mips64el
  381. gen_rtcd_header linux/ppc64 ppc
  382. gen_rtcd_header linux/generic generic
  383. gen_rtcd_header win/arm64 armv8
  384. gen_rtcd_header win/ia32 x86 "${require_sse2}"
  385. gen_rtcd_header win/x64 x86_64
  386. gen_rtcd_header mac/ia32 x86 "${require_sse2}"
  387. gen_rtcd_header mac/x64 x86_64
  388. gen_rtcd_header ios/arm-neon armv7
  389. gen_rtcd_header ios/arm64 armv8
  390. gen_rtcd_header nacl nacl
  391. echo "Prepare Makefile."
  392. ./configure --target=generic-gnu > /dev/null
  393. make_clean
  394. if [ -z $ONLY_CONFIGS ]; then
  395. # Remove existing .gni file.
  396. rm -rf $BASE_DIR/libvpx_srcs.gni
  397. write_license $BASE_DIR/libvpx_srcs.gni
  398. echo "Generate X86 source list."
  399. config=$(print_config linux/ia32)
  400. make_clean
  401. make libvpx_srcs.txt target=libs $config > /dev/null
  402. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86
  403. # Copy vpx_version.h. The file should be the same for all platforms.
  404. clang-format -i -style=Chromium vpx_version.h
  405. cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR
  406. echo "Generate X86_64 source list."
  407. # Windows needs float_control_word.asm for Windows. This was previously
  408. # emms_mmx.asm but a refactoring pulled out the cross platform bits. Because
  409. # of this, use the win/x64 configuration as the reference. The empty asm
  410. # object should not perturb the other builds.
  411. config=$(print_config win/x64)
  412. make_clean
  413. make libvpx_srcs.txt target=libs $config > /dev/null
  414. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86_64
  415. echo "Generate ARM source list."
  416. config=$(print_config linux/arm)
  417. make_clean
  418. make libvpx_srcs.txt target=libs $config > /dev/null
  419. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm
  420. echo "Generate ARM NEON source list."
  421. config=$(print_config linux/arm-neon)
  422. make_clean
  423. make libvpx_srcs.txt target=libs $config > /dev/null
  424. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon
  425. echo "Generate ARM NEON CPU DETECT source list."
  426. config=$(print_config linux/arm-neon-cpu-detect)
  427. make_clean
  428. make libvpx_srcs.txt target=libs $config > /dev/null
  429. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon_cpu_detect
  430. echo "Generate ARM64 source list."
  431. config=$(print_config linux/arm64)
  432. make_clean
  433. make libvpx_srcs.txt target=libs $config > /dev/null
  434. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm64
  435. echo "Generate ARM NEON HighBD source list."
  436. config=$(print_config linux/arm-neon-highbd)
  437. make_clean
  438. make libvpx_srcs.txt target=libs $config > /dev/null
  439. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon_highbd
  440. echo "Generate ARM64 HighBD source list."
  441. config=$(print_config linux/arm64-highbd)
  442. make_clean
  443. make libvpx_srcs.txt target=libs $config > /dev/null
  444. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm64_highbd
  445. echo "ARM64 Windows and Mac use the ARM64 Linux HighBD source list. No need to generate it."
  446. echo "Generate MIPS source list."
  447. config=$(print_config_basic linux/mipsel)
  448. make_clean
  449. make libvpx_srcs.txt target=libs $config > /dev/null
  450. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_mips
  451. echo "MIPS64 source list is identical to MIPS source list. No need to generate it."
  452. echo "Generate ppc64 source list."
  453. config=$(print_config_basic linux/ppc64)
  454. make_clean
  455. make libvpx_srcs.txt target=libs $config > /dev/null
  456. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_ppc64
  457. echo "Generate NaCl source list."
  458. config=$(print_config_basic nacl)
  459. make_clean
  460. make libvpx_srcs.txt target=libs $config > /dev/null
  461. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_nacl
  462. echo "Generate GENERIC source list."
  463. config=$(print_config_basic linux/generic)
  464. make_clean
  465. make libvpx_srcs.txt target=libs $config > /dev/null
  466. convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic
  467. fi
  468. echo "Remove temporary directory."
  469. cd $BASE_DIR
  470. rm -rf $TEMP_DIR
  471. gn format --in-place $BASE_DIR/BUILD.gn
  472. gn format --in-place $BASE_DIR/libvpx_srcs.gni
  473. cd $BASE_DIR/$LIBVPX_SRC_DIR
  474. update_readme
  475. cd $BASE_DIR