Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / ffmpeg / chromium / scripts / build_ffmpeg.sh
index e8c0b44..0a5a53f 100755 (executable)
@@ -20,6 +20,7 @@ if [ "$3" = "" ]; then
   echo "  $0 [TARGET_OS] [TARGET_ARCH] [path/to/ffmpeg] [config-only]"
   echo
   echo "Valid combinations are linux       [ia32|x64|mipsel|arm|arm-neon]"
+  echo "                       linux-noasm x64"
   echo "                       win         [ia32|x64]"
   echo "                       win-vs2013  [ia32|x64]"
   echo "                       mac         [ia32|x64]"
@@ -55,10 +56,11 @@ CONFIG_ONLY=$4
 
 # Check TARGET_OS (TARGET_ARCH is checked during configuration).
 if [[ "$TARGET_OS" != "linux" &&
+      "$TARGET_OS" != "linux-noasm" &&
       "$TARGET_OS" != "mac" &&
       "$TARGET_OS" != "win" &&
       "$TARGET_OS" != "win-vs2013" ]]; then
-  echo "Valid target OSes are: linux, mac, win, win-vs2013"
+  echo "Valid target OSes are: linux, linux-noasm, mac, win, win-vs2013"
   exit 1
 fi
 
@@ -75,7 +77,7 @@ LIBAVFORMAT_VERSION_MAJOR=55
 LIBAVUTIL_VERSION_MAJOR=52
 
 case $(uname -sm) in
-  Linux\ i386)
+  Linux\ i?86)
     HOST_OS=linux
     HOST_ARCH=ia32
     JOBS=$(grep processor /proc/cpuinfo | wc -l)
@@ -85,6 +87,11 @@ case $(uname -sm) in
     HOST_ARCH=x64
     JOBS=$(grep processor /proc/cpuinfo | wc -l)
     ;;
+  Linux\ arm*)
+    HOST_OS=linux
+    HOST_ARCH=arm
+    JOBS=$(grep processor /proc/cpuinfo | wc -l)
+    ;;
   Darwin\ i386)
     HOST_OS=mac
     HOST_ARCH=ia32
@@ -117,14 +124,6 @@ echo "JOBS        = $JOBS"
 echo "LD          = $(ld --version | head -n1)"
 echo
 
-# As of this writing gold 2.20.1-system.20100303 is unable to link FFmpeg.
-if ld --version | grep -q gold; then
-  echo "gold is unable to link FFmpeg"
-  echo
-  echo "Switch /usr/bin/ld to the regular binutils ld and try again"
-  exit 1
-fi
-
 # We want to use a sufficiently recent version of yasm on Windows.
 if [[ "$TARGET_OS" == "win" || "$TARGET_OS" == "win-vs2013" ]]; then
   if !(which yasm 2>&1 > /dev/null); then
@@ -282,7 +281,7 @@ add_flag_common --enable-demuxer=ogg,matroska,wav
 add_flag_common --enable-parser=vp3,vorbis,vp8
 
 # Linux only.
-if [ "$TARGET_OS" = "linux" ]; then
+if [[ "$TARGET_OS" = "linux" || "$TARGET_OS" = "linux-noasm" ]]; then
   if [ "$TARGET_ARCH" = "x64" ]; then
     # Nothing to add for now.
     add_flag_common ""
@@ -292,14 +291,16 @@ if [ "$TARGET_OS" = "linux" ]; then
     add_flag_common --extra-cflags=-m32
     add_flag_common --extra-ldflags=-m32
   elif [ "$TARGET_ARCH" = "arm" ]; then
-    # This if-statement essentially is for chroot tegra2.
-    add_flag_common --enable-cross-compile
-
-    # Location is for CrOS chroot. If you want to use this, enter chroot
-    # and copy ffmpeg to a location that is reachable.
-    add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
-    add_flag_common --target-os=linux
-    add_flag_common --arch=arm
+    if [ "$HOST_ARCH" != "arm" ]; then
+      # This if-statement essentially is for chroot tegra2.
+      add_flag_common --enable-cross-compile
+
+      # Location is for CrOS chroot. If you want to use this, enter chroot
+      # and copy ffmpeg to a location that is reachable.
+      add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
+      add_flag_common --target-os=linux
+      add_flag_common --arch=arm
+    fi
 
     # TODO(ihf): ARM compile flags are tricky. The final options
     # overriding everything live in chroot /build/*/etc/make.conf
@@ -322,11 +323,13 @@ if [ "$TARGET_OS" = "linux" ]; then
     # NOTE: softfp/hardfp selected at gyp time.
     add_flag_common --extra-cflags=-mfloat-abi=hard
   elif [ "$TARGET_ARCH" = "arm-neon" ]; then
-    # This if-statement is for chroot arm-generic.
-    add_flag_common --enable-cross-compile
-    add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
-    add_flag_common --target-os=linux
-    add_flag_common --arch=arm
+    if [ "$HOST_ARCH" != "arm" ]; then
+      # This if-statement is for chroot arm-generic.
+      add_flag_common --enable-cross-compile
+      add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
+      add_flag_common --target-os=linux
+      add_flag_common --arch=arm
+    fi
     add_flag_common --enable-armv6
     add_flag_common --enable-armv6t2
     add_flag_common --enable-vfp
@@ -355,6 +358,16 @@ if [ "$TARGET_OS" = "linux" ]; then
   fi
 fi
 
+if [ "$TARGET_OS" = "linux-noasm" ]; then
+  if [ "$TARGET_ARCH" = "x64" ]; then
+    add_flag_common --disable-asm
+    add_flag_common --disable-inline-asm
+  else
+    echo "Error: Unknown TARGET_ARCH=$TARGET_ARCH for TARGET_OS=$TARGET_OS!"
+    exit 1
+  fi
+fi
+
 # Should be run on Windows.
 if [ "$TARGET_OS" = "win" ]; then
   if [ "$HOST_OS" = "win" ]; then
@@ -386,7 +399,6 @@ if [ "$TARGET_OS" = "mac" ]; then
     add_flag_common --enable-yasm
     add_flag_common --cc=clang
     add_flag_common --cxx=clang++
-    add_flag_common --cpu=pentium-m
     if [ "$TARGET_ARCH" = "ia32" ]; then
       add_flag_common --arch=i686
       add_flag_common --extra-cflags=-m32