Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: third_party/libvpx/generate_gypi.sh

Issue 2318053003: Remove gyp support from libvpx (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libvpx/generate_gni.sh ('k') | third_party/libvpx/libvpx.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/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 # $3 - Optional - any additional arguments to pass through.
386 function gen_rtcd_header {
387 echo "Generate $LIBVPX_CONFIG_DIR/$1/*_rtcd.h files."
388
389 rm -rf $BASE_DIR/$TEMP_DIR/libvpx.config
390 if [[ "$2" == "mipsel" || "$2" == "mips64el" ]]; then
391 print_config_basic $1 > $BASE_DIR/$TEMP_DIR/libvpx.config
392 else
393 $BASE_DIR/lint_config.sh -p \
394 -h $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.h \
395 -a $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_config.asm \
396 -o $BASE_DIR/$TEMP_DIR/libvpx.config
397 fi
398
399 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
400 --arch=$2 \
401 --sym=vp8_rtcd $DISABLE_AVX $3 \
402 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
403 $BASE_DIR/$LIBVPX_SRC_DIR/vp8/common/rtcd_defs.pl \
404 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp8_rtcd.h
405
406 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
407 --arch=$2 \
408 --sym=vp9_rtcd $DISABLE_AVX $3 \
409 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
410 $BASE_DIR/$LIBVPX_SRC_DIR/vp9/common/vp9_rtcd_defs.pl \
411 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vp9_rtcd.h
412
413 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
414 --arch=$2 \
415 --sym=vpx_scale_rtcd $DISABLE_AVX $3 \
416 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
417 $BASE_DIR/$LIBVPX_SRC_DIR/vpx_scale/vpx_scale_rtcd.pl \
418 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_scale_rtcd.h
419
420 $BASE_DIR/$LIBVPX_SRC_DIR/build/make/rtcd.pl \
421 --arch=$2 \
422 --sym=vpx_dsp_rtcd $DISABLE_AVX $3 \
423 --config=$BASE_DIR/$TEMP_DIR/libvpx.config \
424 $BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp/vpx_dsp_rtcd_defs.pl \
425 > $BASE_DIR/$LIBVPX_CONFIG_DIR/$1/vpx_dsp_rtcd.h
426
427 rm -rf $BASE_DIR/$TEMP_DIR/libvpx.config
428 }
429
430 # Generate Config files. "--enable-external-build" must be set to skip
431 # detection of capabilities on specific targets.
432 # $1 - Header file directory.
433 # $2 - Config command line.
434 function gen_config_files {
435 ./configure $2 > /dev/null
436
437 # Disable HAVE_UNISTD_H as it causes vp8 to try to detect how many cpus
438 # available, which doesn't work from iniside a sandbox on linux.
439 ( echo '/HAVE_UNISTD_H/s/[01]/0/' ; echo 'w' ; echo 'q' ) | ed -s vpx_config.h
440
441 # Generate vpx_config.asm. Do not create one for mips.
442 if [[ "$1" != *mipsel && "$1" != *mips64el ]]; then
443 if [[ "$1" == *x64* ]] || [[ "$1" == *ia32* ]]; then
444 egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print "%define " $2 " " $3}' > vpx_config.asm
445 else
446 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
447 fi
448 fi
449
450 cp vpx_config.* $BASE_DIR/$LIBVPX_CONFIG_DIR/$1
451 make_clean
452 rm -rf vpx_config.*
453 }
454
455 function update_readme {
456 local IFS=$'\n'
457 # Split git log output '<date>\n<commit hash>' on the newline to produce 2
458 # array entries.
459 local vals=($(git --no-pager log -1 --format="%cd%n%H" \
460 --date=format:"%A %B %d %Y"))
461 sed -E -i.bak \
462 -e "s/^(Date:)[[:space:]]+.*$/\1 ${vals[0]}/" \
463 -e "s/^(Commit:)[[:space:]]+[a-f0-9]{40}/\1 ${vals[1]}/" \
464 ${BASE_DIR}/README.chromium
465 rm ${BASE_DIR}/README.chromium.bak
466 cat <<EOF
467
468 README.chromium updated with:
469 Date: ${vals[0]}
470 Commit: ${vals[1]}
471 EOF
472 }
473
474 find_duplicates
475
476 echo "Create temporary directory."
477 TEMP_DIR="$LIBVPX_SRC_DIR.temp"
478 rm -rf $TEMP_DIR
479 cp -R $LIBVPX_SRC_DIR $TEMP_DIR
480 cd $TEMP_DIR
481
482 echo "Generate config files."
483 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"
484 gen_config_files linux/ia32 "--target=x86-linux-gcc --disable-ccache --enable-pi c --enable-realtime-only ${all_platforms}"
485 gen_config_files linux/x64 "--target=x86_64-linux-gcc --disable-ccache --enable- pic --enable-realtime-only ${all_platforms}"
486 gen_config_files linux/arm "--target=armv7-linux-gcc --enable-pic --enable-realt ime-only --disable-install-bins --disable-install-libs --disable-neon ${all_plat forms}"
487 gen_config_files linux/arm-neon "--target=armv7-linux-gcc --enable-pic --enable- realtime-only ${all_platforms}"
488 gen_config_files linux/arm-neon-cpu-detect "--target=armv7-linux-gcc --enable-pi c --enable-realtime-only --enable-runtime-cpu-detect ${all_platforms}"
489 gen_config_files linux/arm64 "--force-target=armv8-linux-gcc --enable-pic --enab le-realtime-only ${all_platforms}"
490 gen_config_files linux/mipsel "--target=mips32-linux-gcc ${all_platforms}"
491 gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
492 gen_config_files linux/generic "--target=generic-gnu --enable-pic --enable-realt ime-only ${all_platforms}"
493 gen_config_files win/ia32 "--target=x86-win32-vs12 --enable-realtime-only ${all_ platforms}"
494 gen_config_files win/x64 "--target=x86_64-win64-vs12 --enable-realtime-only ${al l_platforms}"
495 gen_config_files mac/ia32 "--target=x86-darwin9-gcc --enable-pic --enable-realti me-only ${all_platforms}"
496 gen_config_files mac/x64 "--target=x86_64-darwin9-gcc --enable-pic --enable-real time-only ${all_platforms}"
497 gen_config_files nacl "--target=generic-gnu --enable-pic --enable-realtime-only ${all_platforms}"
498
499 echo "Remove temporary directory."
500 cd $BASE_DIR
501 rm -rf $TEMP_DIR
502
503 echo "Lint libvpx configuration."
504 lint_config linux/ia32
505 lint_config linux/x64
506 lint_config linux/arm
507 lint_config linux/arm-neon
508 lint_config linux/arm-neon-cpu-detect
509 lint_config linux/arm64
510 lint_config linux/mipsel
511 lint_config linux/mips64el
512 lint_config linux/generic
513 lint_config win/ia32
514 lint_config win/x64
515 lint_config mac/ia32
516 lint_config mac/x64
517 lint_config nacl
518
519 echo "Create temporary directory."
520 TEMP_DIR="$LIBVPX_SRC_DIR.temp"
521 rm -rf $TEMP_DIR
522 cp -R $LIBVPX_SRC_DIR $TEMP_DIR
523 cd $TEMP_DIR
524
525 gen_rtcd_header linux/ia32 x86
526 gen_rtcd_header linux/x64 x86_64
527 gen_rtcd_header linux/arm armv7 "--disable-neon --disable-neon_asm"
528 gen_rtcd_header linux/arm-neon armv7
529 gen_rtcd_header linux/arm-neon-cpu-detect armv7
530 gen_rtcd_header linux/arm64 armv8
531 gen_rtcd_header linux/mipsel mipsel
532 gen_rtcd_header linux/mips64el mips64el
533 gen_rtcd_header linux/generic generic
534 gen_rtcd_header win/ia32 x86
535 gen_rtcd_header win/x64 x86_64
536 gen_rtcd_header mac/ia32 x86
537 gen_rtcd_header mac/x64 x86_64
538 gen_rtcd_header nacl nacl
539
540 echo "Prepare Makefile."
541 ./configure --target=generic-gnu > /dev/null
542 make_clean
543
544 if [ -z $ONLY_CONFIGS ]; then
545 # Remove existing .gni file.
546 rm -rf $BASE_DIR/libvpx_srcs.gni
547 write_license $BASE_DIR/libvpx_srcs.gni
548
549 echo "Generate X86 source list."
550 config=$(print_config linux/ia32)
551 make_clean
552 make libvpx_srcs.txt target=libs $config > /dev/null
553 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86
554
555 # Copy vpx_version.h. The file should be the same for all platforms.
556 cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR
557
558 echo "Generate X86_64 source list."
559 config=$(print_config linux/x64)
560 make_clean
561 make libvpx_srcs.txt target=libs $config > /dev/null
562 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_x86_64
563
564 echo "Generate ARM source list."
565 config=$(print_config linux/arm)
566 make_clean
567 make libvpx_srcs.txt target=libs $config > /dev/null
568 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm
569
570 echo "Generate ARM NEON source list."
571 config=$(print_config linux/arm-neon)
572 make_clean
573 make libvpx_srcs.txt target=libs $config > /dev/null
574 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon
575
576 echo "Generate ARM NEON CPU DETECT source list."
577 config=$(print_config linux/arm-neon-cpu-detect)
578 make_clean
579 make libvpx_srcs.txt target=libs $config > /dev/null
580 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm_neon_cpu_detect
581
582 echo "Generate ARM64 source list."
583 config=$(print_config linux/arm64)
584 make_clean
585 make libvpx_srcs.txt target=libs $config > /dev/null
586 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_arm64
587
588 echo "Generate MIPS source list."
589 config=$(print_config_basic linux/mipsel)
590 make_clean
591 make libvpx_srcs.txt target=libs $config > /dev/null
592 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_mips
593
594 echo "MIPS64 source list is identical to MIPS source list. No need to generate it."
595
596 echo "Generate NaCl source list."
597 config=$(print_config_basic nacl)
598 make_clean
599 make libvpx_srcs.txt target=libs $config > /dev/null
600 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_nacl
601
602 echo "Generate GENERIC source list."
603 config=$(print_config_basic linux/generic)
604 make_clean
605 make libvpx_srcs.txt target=libs $config > /dev/null
606 convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_generic
607 fi
608
609 echo "Remove temporary directory."
610 cd $BASE_DIR
611 rm -rf $TEMP_DIR
612
613 gn format --in-place $BASE_DIR/BUILD.gn
614 gn format --in-place $BASE_DIR/libvpx_srcs.gni
615
616 cd $BASE_DIR/$LIBVPX_SRC_DIR
617 update_readme
618
619 cd $BASE_DIR
620
621 # TODO(fgalligan): Can we turn on "--enable-realtime-only" for mipsel?
OLDNEW
« no previous file with comments | « third_party/libvpx/generate_gni.sh ('k') | third_party/libvpx/libvpx.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698