OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Builds Chromium, Google Chrome and *OS FFmpeg binaries. | 7 # Builds Chromium, Google Chrome and *OS FFmpeg binaries. |
8 # | 8 # |
9 # For Windows it assumes being run from a MinGW shell with Visual Studio | 9 # For Windows it assumes being run from a MinGW shell with Visual Studio |
10 # environment (i.e., lib.exe and editbin.exe are in $PATH). | 10 # environment (i.e., lib.exe and editbin.exe are in $PATH). |
11 # | 11 # |
12 # Instructions for setting up a MinGW/MSYS shell can be found here: | 12 # Instructions for setting up a MinGW/MSYS shell can be found here: |
13 # http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/mingw/README.chro
mium | 13 # http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/mingw/README.chro
mium |
14 | 14 |
15 if [ "$3" = "" ]; then | 15 if [ "$3" = "" -o "$4" != "" ]; then |
16 echo "Usage:" | 16 echo "Usage:" |
17 echo " $0 [TARGET_OS] [TARGET_ARCH] [third_party BASE_PATH]" | 17 echo " $0 [TARGET_OS] [TARGET_ARCH] [path/to/third_party/ffmpeg]" |
18 echo | 18 echo |
19 echo "Valid combinations are linux [ia32|x64|arm|arm-neon]" | 19 echo "Valid combinations are linux [ia32|x64|arm|arm-neon]" |
20 echo " win ia32" | 20 echo " win [ia32]" |
21 echo " mac ia32" | 21 echo " mac [ia32]" |
22 echo | 22 echo |
23 echo " linux ia32/x64 - script can be run on a normal Ubuntu box." | 23 echo " linux ia32/x64 - script can be run on a normal Ubuntu box." |
24 echo " linux arm/arm-neon should be run inside of CrOS chroot." | 24 echo " linux arm/arm-neon should be run inside of CrOS chroot." |
25 echo " mac and win have to be run on Mac and Windows 7 (under mingw)." | 25 echo " mac and win have to be run on Mac and Windows 7 (under mingw)." |
26 echo | 26 echo |
27 echo "The base path should be absolute and point at the Chromium copies of FFm
peg" | 27 echo "The path should be absolute and point at Chromium's copy of FFmpeg." |
28 echo "and libvpx. This corresponds to:" | 28 echo "This corresponds to:" |
29 echo " chrome/trunk/deps/third_party/" | 29 echo " chrome/trunk/deps/third_party/ffmpeg" |
30 echo "It is assumbed that ffmpeg and libvpx reside in this directory." | |
31 echo | 30 echo |
32 echo "Resulting binaries will be placed in:" | 31 echo "Resulting binaries will be placed in:" |
33 echo " ffmpeg/build.TARGET_ARCH.TARGET_OS/Chromium/out/" | 32 echo " build.TARGET_ARCH.TARGET_OS/Chromium/out/" |
34 echo " ffmpeg/build.TARGET_ARCH.TARGET_OS/Chrome/out/" | 33 echo " build.TARGET_ARCH.TARGET_OS/Chrome/out/" |
35 echo " ffmpeg/build.TARGET_ARCH.TARGET_OS/ChromiumOS/out/" | 34 echo " build.TARGET_ARCH.TARGET_OS/ChromiumOS/out/" |
36 echo " ffmpeg/build.TARGET_ARCH.TARGET_OS/ChromeOS/out/" | 35 echo " build.TARGET_ARCH.TARGET_OS/ChromeOS/out/" |
37 exit | 36 exit |
38 fi | 37 fi |
39 | 38 |
40 TARGET_OS=$1 | 39 TARGET_OS=$1 |
41 TARGET_ARCH=$2 | 40 TARGET_ARCH=$2 |
42 BASE_PATH=$3 | 41 FFMPEG_PATH=$3 |
43 FFMPEG_PATH="$3/ffmpeg" | |
44 LIBVPX_PATH="$3/libvpx" | |
45 | 42 |
46 echo $0 $TARGET_OS $TARGET_ARCH $BASE_PATH | 43 # Check TARGET_OS (TARGET_ARCH is checked during configuration). |
| 44 if [[ "$TARGET_OS" != "linux" && |
| 45 "$TARGET_OS" != "mac" && |
| 46 "$TARGET_OS" != "win" ]]; then |
| 47 echo "Valid target OSes are: linux, mac, win" |
| 48 exit 1 |
| 49 fi |
| 50 |
| 51 # Check FFMPEG_PATH to contain this script. |
| 52 if [ ! -f "$FFMPEG_PATH/$0" ]; then |
| 53 echo "$FFMPEG_PATH doesn't appear to contain FFmpeg" |
| 54 exit 1 |
| 55 fi |
47 | 56 |
48 # If configure & make works but this script doesn't, make sure to grep for these
. | 57 # If configure & make works but this script doesn't, make sure to grep for these
. |
49 LIBAVCODEC_VERSION_MAJOR=53 | 58 LIBAVCODEC_VERSION_MAJOR=53 |
50 LIBAVFORMAT_VERSION_MAJOR=53 | 59 LIBAVFORMAT_VERSION_MAJOR=53 |
51 LIBAVUTIL_VERSION_MAJOR=51 | 60 LIBAVUTIL_VERSION_MAJOR=51 |
52 | 61 |
53 case $(uname -sm) in | 62 case $(uname -sm) in |
54 Linux\ i386) | 63 Linux\ i386) |
55 HOST_OS=linux | 64 HOST_OS=linux |
56 HOST_ARCH=ia32 | 65 HOST_ARCH=ia32 |
57 JOBS=$(grep processor /proc/cpuinfo | wc -l) | 66 JOBS=$(grep processor /proc/cpuinfo | wc -l) |
58 ;; | 67 ;; |
59 Linux\ x86_64) | 68 Linux\ x86_64) |
60 HOST_OS=linux | 69 HOST_OS=linux |
61 HOST_ARCH=x64 | 70 HOST_ARCH=x64 |
62 JOBS=$(grep processor /proc/cpuinfo | wc -l) | 71 JOBS=$(grep processor /proc/cpuinfo | wc -l) |
63 ;; | 72 ;; |
64 Darwin*) | 73 Darwin*) |
65 HOST_OS=mac | 74 HOST_OS=mac |
66 HOST_ARCH=ia32 | 75 HOST_ARCH=ia32 |
67 JOBS=$(sysctl -n hw.ncpu) | 76 JOBS=$(sysctl -n hw.ncpu) |
68 ;; | 77 ;; |
69 MINGW*) | 78 MINGW*) |
70 HOST_OS=win | 79 HOST_OS=win |
71 HOST_ARCH=ia32 | 80 HOST_ARCH=ia32 |
72 JOBS=$NUMBER_OF_PROCESSORS | 81 JOBS=$NUMBER_OF_PROCESSORS |
73 ;; | 82 ;; |
74 *) | 83 *) |
75 echo "Unrecognized TARGET_OS: $(uname)" | 84 echo "Unrecognized HOST_OS: $(uname)" |
76 echo "Patches welcome!" | 85 echo "Patches welcome!" |
77 exit 1 | 86 exit 1 |
78 ;; | 87 ;; |
79 esac | 88 esac |
80 | 89 |
81 # Print out system information. | 90 # Print out system information. |
82 echo "System information:" | 91 echo "System information:" |
83 echo "HOST_OS = $HOST_OS" | 92 echo "HOST_OS = $HOST_OS" |
84 echo "TARGET_OS = $TARGET_OS" | 93 echo "TARGET_OS = $TARGET_OS" |
85 echo "HOST_ARCH = $HOST_ARCH" | 94 echo "HOST_ARCH = $HOST_ARCH" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 add_flag_common --disable-everything | 224 add_flag_common --disable-everything |
216 add_flag_common --enable-fft | 225 add_flag_common --enable-fft |
217 add_flag_common --enable-rdft | 226 add_flag_common --enable-rdft |
218 add_flag_common --disable-network | 227 add_flag_common --disable-network |
219 add_flag_common --disable-bzlib | 228 add_flag_common --disable-bzlib |
220 add_flag_common --disable-zlib | 229 add_flag_common --disable-zlib |
221 add_flag_common --disable-swscale | 230 add_flag_common --disable-swscale |
222 add_flag_common --disable-amd3dnow | 231 add_flag_common --disable-amd3dnow |
223 add_flag_common --disable-amd3dnowext | 232 add_flag_common --disable-amd3dnowext |
224 add_flag_common --enable-shared | 233 add_flag_common --enable-shared |
225 add_flag_common --enable-libvpx | 234 |
226 add_flag_common --enable-decoder=theora,vorbis,libvpx | 235 # Common codecs. |
227 # libvpx needed by remoting. | 236 add_flag_common --enable-decoder=theora,vorbis,vp8 |
228 add_flag_common --enable-encoder=libvpx | |
229 add_flag_common --enable-decoder=pcm_u8,pcm_s16le,pcm_f32le | 237 add_flag_common --enable-decoder=pcm_u8,pcm_s16le,pcm_f32le |
230 add_flag_common --enable-demuxer=ogg,matroska,wav | 238 add_flag_common --enable-demuxer=ogg,matroska,wav |
| 239 add_flag_common --enable-parser=vp8 |
231 | 240 |
232 # Linux only. | 241 # Linux only. |
233 if [ "$TARGET_OS" = "linux" ]; then | 242 if [ "$TARGET_OS" = "linux" ]; then |
234 if [ "$TARGET_ARCH" = "x64" ]; then | 243 if [ "$TARGET_ARCH" = "x64" ]; then |
235 # Nothing to add for now. | 244 # Nothing to add for now. |
236 add_flag_common "" | 245 add_flag_common "" |
237 elif [ "$TARGET_ARCH" = "ia32" ]; then | 246 elif [ "$TARGET_ARCH" = "ia32" ]; then |
238 add_flag_common --arch=i686 | 247 add_flag_common --arch=i686 |
239 add_flag_common --enable-yasm | 248 add_flag_common --enable-yasm |
240 add_flag_common --extra-cflags=-m32 | 249 add_flag_common --extra-cflags=-m32 |
241 # Adding fPIC since revision 53745. | 250 # Adding fPIC since revision 53745. |
242 add_flag_common --extra-cflags=-fPIC | 251 add_flag_common --extra-cflags=-fPIC |
243 add_flag_common --extra-ldflags=-m32 | 252 add_flag_common --extra-ldflags=-m32 |
244 elif [ "$TARGET_ARCH" = "arm" ]; then | 253 elif [ "$TARGET_ARCH" = "arm" ]; then |
245 add_flag_common --enable-cross-compile | 254 add_flag_common --enable-cross-compile |
246 add_flag_common --arch=arm | 255 add_flag_common --arch=arm |
247 add_flag_common --target-os=linux | 256 add_flag_common --target-os=linux |
248 add_flag_common --enable-armv6 | 257 add_flag_common --enable-armv6 |
249 add_flag_common --enable-armv6t2 | 258 add_flag_common --enable-armv6t2 |
250 add_flag_common --enable-armvfp | 259 add_flag_common --enable-armvfp |
251 add_flag_common --disable-neon | 260 add_flag_common --disable-neon |
252 # Location is for CrOS chroot. If you want to use this, enter chroot | 261 # Location is for CrOS chroot. If you want to use this, enter chroot |
253 # and copy ffmpeg and libvpx to a location that is reachable. | 262 # and copy ffmpeg to a location that is reachable. |
254 add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi- | 263 add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi- |
255 add_flag_common --extra-cflags=-march=armv7-a | 264 add_flag_common --extra-cflags=-march=armv7-a |
256 add_flag_common --extra-cflags=-mtune=cortex-a8 | 265 add_flag_common --extra-cflags=-mtune=cortex-a8 |
257 add_flag_common --extra-cflags=-mfpu=vfp | 266 add_flag_common --extra-cflags=-mfpu=vfp |
258 add_flag_common --extra-cflags=-mfloat-abi=softfp | 267 add_flag_common --extra-cflags=-mfloat-abi=softfp |
259 elif [ "$TARGET_ARCH" = "arm-neon" ]; then | 268 elif [ "$TARGET_ARCH" = "arm-neon" ]; then |
260 # not really tested (defunct), just taken from old config files | 269 # not really tested (defunct), just taken from old config files |
261 add_flag_common --enable-cross-compile | 270 add_flag_common --enable-cross-compile |
262 add_flag_common --arch=arm | 271 add_flag_common --arch=arm |
263 add_flag_common --target-os=linux | 272 add_flag_common --target-os=linux |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 fi | 309 fi |
301 | 310 |
302 # Should be run on Mac. | 311 # Should be run on Mac. |
303 if [ "$TARGET_OS" = "mac" ]; then | 312 if [ "$TARGET_OS" = "mac" ]; then |
304 if [ "$HOST_OS" = "mac" ]; then | 313 if [ "$HOST_OS" = "mac" ]; then |
305 if [ "$TARGET_ARCH" = "ia32" ]; then | 314 if [ "$TARGET_ARCH" = "ia32" ]; then |
306 add_flag_common --arch=i686 | 315 add_flag_common --arch=i686 |
307 add_flag_common --enable-yasm | 316 add_flag_common --enable-yasm |
308 add_flag_common --extra-cflags=-m32 | 317 add_flag_common --extra-cflags=-m32 |
309 add_flag_common --extra-ldflags=-m32 | 318 add_flag_common --extra-ldflags=-m32 |
310 echo "" | |
311 else | 319 else |
312 echo "Error: Unknown TARGET_ARCH=$TARGET_ARCH for TARGET_OS=$TARGET_OS!" | 320 echo "Error: Unknown TARGET_ARCH=$TARGET_ARCH for TARGET_OS=$TARGET_OS!" |
313 exit | 321 exit |
314 fi | 322 fi |
315 else | 323 else |
316 echo "Script should be run on a Mac host. If this is not possible try a " | 324 echo "Script should be run on a Mac host. If this is not possible try a " |
317 echo "merge of config files with new linux ia32 config.h by hand." | 325 echo "merge of config files with new linux ia32 config.h by hand." |
318 exit | 326 exit |
319 fi | 327 fi |
320 fi | 328 fi |
321 | 329 |
322 # Location of the precompiled libvpx binary. | |
323 add_flag_common --extra-cflags=-I$LIBVPX_PATH/include | |
324 add_flag_common --extra-ldflags=-L$LIBVPX_PATH/lib/${TARGET_OS}/${TARGET_ARCH} | |
325 | |
326 # Chromium & ChromiumOS specific configuration. | 330 # Chromium & ChromiumOS specific configuration. |
327 # (nothing at the moment) | 331 # (nothing at the moment) |
328 | 332 |
329 # Google Chrome & ChromeOS specific configuration. | 333 # Google Chrome & ChromeOS specific configuration. |
330 add_flag_chrome --enable-decoder=aac,h264,mp3 | 334 add_flag_chrome --enable-decoder=aac,h264,mp3 |
331 add_flag_chrome --enable-demuxer=mp3,mov | 335 add_flag_chrome --enable-demuxer=mp3,mov |
332 add_flag_chrome --enable-parser=mpegaudio | 336 add_flag_chrome --enable-parser=mpegaudio |
333 add_flag_chrome --enable-bsf=h264_mp4toannexb | 337 add_flag_chrome --enable-bsf=h264_mp4toannexb |
334 | 338 |
335 # ChromiumOS specific configuration. | 339 # ChromiumOS specific configuration. |
336 # Warning: do *NOT* add avi, aac, h264, mp3, mp4, amr* | 340 # Warning: do *NOT* add avi, aac, h264, mp3, mp4, amr* |
337 # Increase performance over libvpx. | |
338 add_flag_chromiumos --enable-decoder=vp8 | |
339 add_flag_chromiumos --enable-parser=vp8 | |
340 # Flac support. | 341 # Flac support. |
341 add_flag_chromiumos --enable-demuxer=flac | 342 add_flag_chromiumos --enable-demuxer=flac |
342 add_flag_chromiumos --enable-decoder=flac | 343 add_flag_chromiumos --enable-decoder=flac |
343 | 344 |
344 # Google ChromeOS specific configuration. | 345 # Google ChromeOS specific configuration. |
345 # We want to make sure to play everything Android generates and plays. | 346 # We want to make sure to play everything Android generates and plays. |
346 # http://developer.android.com/guide/appendix/media-formats.html | 347 # http://developer.android.com/guide/appendix/media-formats.html |
347 # Enable playing avi files. | 348 # Enable playing avi files. |
348 add_flag_chromeos --enable-decoder=mpeg4 | 349 add_flag_chromeos --enable-decoder=mpeg4 |
349 add_flag_chromeos --enable-demuxer=avi | 350 add_flag_chromeos --enable-demuxer=avi |
350 add_flag_chromeos --enable-bsf=mpeg4video_es | 351 add_flag_chromeos --enable-bsf=mpeg4video_es |
351 # Enable playing Android 3gp files. | 352 # Enable playing Android 3gp files. |
352 add_flag_chromeos --enable-demuxer=amr | 353 add_flag_chromeos --enable-demuxer=amr |
353 add_flag_chromeos --enable-decoder=amrnb,amrwb | 354 add_flag_chromeos --enable-decoder=amrnb,amrwb |
354 # Increase performance over libvpx. | |
355 add_flag_chromeos --enable-decoder=vp8 | |
356 add_flag_chromeos --enable-parser=vp8 | |
357 # Flac support. | 355 # Flac support. |
358 add_flag_chromeos --enable-demuxer=flac | 356 add_flag_chromeos --enable-demuxer=flac |
359 add_flag_chromeos --enable-decoder=flac | 357 add_flag_chromeos --enable-decoder=flac |
360 | 358 |
361 echo "Chromium configure/build:" | 359 echo "Chromium configure/build:" |
362 build Chromium $FLAGS_COMMON $FLAGS_CHROMIUM | 360 build Chromium $FLAGS_COMMON $FLAGS_CHROMIUM |
363 echo "Chrome configure/build:" | 361 echo "Chrome configure/build:" |
364 build Chrome $FLAGS_COMMON $FLAGS_CHROME | 362 build Chrome $FLAGS_COMMON $FLAGS_CHROME |
365 | 363 |
366 if [ "$TARGET_OS" = "linux" ]; then | 364 if [ "$TARGET_OS" = "linux" ]; then |
367 echo "ChromiumOS configure/build:" | 365 echo "ChromiumOS configure/build:" |
368 build ChromiumOS $FLAGS_COMMON $FLAGS_CHROMIUM $FLAGS_CHROMIUMOS | 366 build ChromiumOS $FLAGS_COMMON $FLAGS_CHROMIUM $FLAGS_CHROMIUMOS |
369 echo "ChromeOS configure/build:" | 367 echo "ChromeOS configure/build:" |
370 build ChromeOS $FLAGS_COMMON $FLAGS_CHROME $FLAGS_CHROMEOS | 368 build ChromeOS $FLAGS_COMMON $FLAGS_CHROME $FLAGS_CHROMEOS |
371 fi | 369 fi |
372 | 370 |
373 echo "Done. If desired you may copy config.h/config.asm into the source/config t
ree using copy_config.sh." | 371 echo "Done. If desired you may copy config.h/config.asm into the source/config t
ree using copy_config.sh." |
OLD | NEW |