| OLD | NEW |
| (Empty) | |
| 1 #!/bin/bash |
| 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # This script creates a patched FFmpeg tree suitable for using to build |
| 8 # the FFmpeg needed by chromium. It takes an |output_dir| where the |
| 9 # final source tree will reside, and |patches_dir| containing patches |
| 10 # to apply to the pristine source. |
| 11 # |
| 12 # The pristine source is contained in: |
| 13 # |
| 14 # ffmpeg-mt.tar.gz |
| 15 # |
| 16 # After unpacking these files into the |output_dir|, all files inside |
| 17 # the directory tree at |patch_dir| matching the pattern *.patch will be |
| 18 # applied to the output directory in lexicographic order. |
| 19 |
| 20 set -e |
| 21 |
| 22 if [ $# -ne 3 ]; then |
| 23 echo "Usage: $0 <tarball> <output directory> <directory with patches>" |
| 24 exit 1 |
| 25 fi |
| 26 |
| 27 tarball="${1}" |
| 28 output_dir="${2}" |
| 29 patches_dir="${3}" |
| 30 |
| 31 if [ ! -d "$patches_dir" ]; then |
| 32 echo "$patches_dir is not a directory." |
| 33 exit 1 |
| 34 fi |
| 35 |
| 36 if [ -e "$output_dir" ]; then |
| 37 echo "$output_dir exists. Do you want to continue? [y/N]" |
| 38 read confirm |
| 39 if [ "$confirm" != "y" ]; then |
| 40 exit 1; |
| 41 fi |
| 42 fi |
| 43 |
| 44 # Unpack the pristine ffmpeg sources into the target directory. |
| 45 mkdir -p "$output_dir" |
| 46 tar -xzf "$tarball" --strip 1 -C "$output_dir" |
| 47 |
| 48 # Get a list of all patches in |patches_dir|. Sort them in by the filename |
| 49 # regardless of path. |
| 50 reverse_paths() { |
| 51 perl -lne "print join '/', reverse split '/'" |
| 52 } |
| 53 patches=`find "$patches_dir" -name '*.patch' -type f | |
| 54 reverse_paths | sort | reverse_paths` |
| 55 |
| 56 # Apply the patches. |
| 57 for p in $patches; do |
| 58 echo Apply patch `basename $p` to $output_dir |
| 59 patch -p1 -d "$output_dir" < "$p" |
| 60 done |
| OLD | NEW |