[standalone v8] Support gbs build for generating v8 rpm package
authorYoungcheol Kang <ychul.kang@samsung.com>
Fri, 3 Jun 2016 08:57:31 +0000 (17:57 +0900)
committerYoungcheol Kang <ychul.kang@samsung.com>
Fri, 3 Jun 2016 08:59:46 +0000 (17:59 +0900)
This CL supports gbs build for generating v8 rpm package
with armv7l, aarhc64, and i586(emulator) architectures
on tv, mobile, ivi, and common profiles.

1) The v8 needs to be packed as rpm package by using v8.spec.
   And v8 static library information comes from command
   |$ pkg-config --libs v8|.

2) Utility script build_{profile}.sh is provided
   and building test is disabled by default via the script.

3) The ninja binaries are added to support various
   architectures.

4) On tizen, the option '-m32', and '-m64' are not supported.

Bug: http://suprem.sec.samsung.net/jira/browse/TWF-1131

Change-Id: I483617532179f54da8ef99aed5918b447e56eb47
Signed-off-by: Youngcheol Kang <ychul.kang@samsung.com>
21 files changed:
.gitignore
.gitmodules [new file with mode: 0644]
build/all.gyp
build/build_common.sh [new file with mode: 0755]
build/build_ivi.sh [new file with mode: 0755]
build/build_mobile.sh [new file with mode: 0755]
build/build_tv.sh [new file with mode: 0755]
build/build_wearable.sh [new file with mode: 0755]
build/common.sh [new file with mode: 0644]
build/gbs.conf [new file with mode: 0755]
build/gyp_v8.sh [new file with mode: 0755]
build/prebuild/ninja/ninja [new file with mode: 0755]
build/prebuild/ninja/ninja.arm [new file with mode: 0755]
build/prebuild/ninja/ninja.arm64 [new file with mode: 0755]
build/toolchain.gypi
packaging/v8.manifest [new file with mode: 0644]
packaging/v8.pc [new file with mode: 0644]
packaging/v8.spec [new file with mode: 0644]
third_party/icu/icu.gyp [new file with mode: 0644]
tools/clang/scripts/update.sh [new file with mode: 0755]
tools/gyp/v8.gyp

index 337a553..7741b0a 100644 (file)
@@ -39,7 +39,6 @@ shell
 shell_g
 /_*
 /build/Debug
-/build/gyp
 /build/ipch/
 /build/Release
 /buildtools
@@ -71,8 +70,6 @@ shell_g
 /test/test262-es6/tc39-test262-*
 /testing/gmock
 /testing/gtest
-/third_party
-/third_party/icu
 /third_party/llvm
 /third_party/llvm-build
 /tools/clang
@@ -95,3 +92,4 @@ gtags.files
 turbo*.cfg
 turbo*.dot
 turbo*.json
+build_result.txt
diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..7c31903
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "build/gyp"]
+       path = build/gyp
+       url = https://chromium.googlesource.com/external/gyp.git
index 4aeb507..aa3ac4c 100644 (file)
@@ -7,11 +7,13 @@
     {
       'target_name': 'All',
       'type': 'none',
+      'variables': {
+        'enable_test%': 1,
+        'building_for_tizen%': 0,
+      },
       'dependencies': [
         '../samples/samples.gyp:*',
         '../src/d8.gyp:d8',
-        '../test/cctest/cctest.gyp:*',
-        '../test/unittests/unittests.gyp:*',
       ],
       'conditions': [
         ['component!="shared_library"', {
             '../tools/parser-shell.gyp:parser-shell',
           ],
         }],
+        ['enable_test==1', {
+          'dependencies': [
+            '../test/cctest/cctest.gyp:*',
+            '../test/unittests/unittests.gyp:*',
+          ],
+        }],
       ]
     }
   ]
diff --git a/build/build_common.sh b/build/build_common.sh
new file mode 100755 (executable)
index 0000000..b51d446
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. `dirname $0`/common.sh
+trap 'exit 1' ERR SIGINT SIGTERM SIGQUIT
+
+setupAndExecuteTargetBuild common "$@"
diff --git a/build/build_ivi.sh b/build/build_ivi.sh
new file mode 100755 (executable)
index 0000000..241debd
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. `dirname $0`/common.sh
+trap 'exit 1' ERR SIGINT SIGTERM SIGQUIT
+
+setupAndExecuteTargetBuild ivi "$@"
diff --git a/build/build_mobile.sh b/build/build_mobile.sh
new file mode 100755 (executable)
index 0000000..78fb712
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. `dirname $0`/common.sh
+trap 'exit 1' ERR SIGINT SIGTERM SIGQUIT
+
+setupAndExecuteTargetBuild mobile "$@"
diff --git a/build/build_tv.sh b/build/build_tv.sh
new file mode 100755 (executable)
index 0000000..bdfc1e8
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. `dirname $0`/common.sh
+trap 'exit 1' ERR SIGINT SIGTERM SIGQUIT
+
+setupAndExecuteTargetBuild tv "$@"
diff --git a/build/build_wearable.sh b/build/build_wearable.sh
new file mode 100755 (executable)
index 0000000..15f1bd5
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. `dirname $0`/common.sh
+trap 'exit 1' ERR SIGINT SIGTERM SIGQUIT
+
+setupAndExecuteTargetBuild wearable "$@"
diff --git a/build/common.sh b/build/common.sh
new file mode 100644 (file)
index 0000000..ad10b79
--- /dev/null
@@ -0,0 +1,116 @@
+#!/bin/bash
+
+export SCRIPTDIR=$(readlink -e $(dirname $0))
+export TOPDIR=$(readlink -f "${SCRIPTDIR}/..")
+
+trap 'error_report $0 $LINENO' ERR SIGINT SIGTERM SIGQUIT
+
+function error_report() {
+  echo "Error: File:$1 Line:$2"
+  exit 1
+}
+
+function getHostArch() {
+  echo $(uname -m | sed -e \
+      's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/;s/aarch64/arm64/')
+}
+
+function setupAndExecuteTargetBuild() {
+  local platform="$1"
+  shift
+
+  local PROFILE
+  local ARCHITECTURE
+  local CONF_FLAG
+  local -a ARGS
+
+  # "|| :" means "or always succeeding built-in command"
+  PROFILE=$(echo "$@" | grep -Po "(?<=\-P\s)[^\s]*" || :)
+  ARCHITECTURE=$(echo "$@" | grep -Po "(?<=\-A\s)[^\s]*" || :)
+
+  if [ "$PROFILE" == "" ]; then
+    if [[ $platform == "mobile" ]]; then
+      PROFILE=tzmb_v3.0_arm64-wayland
+    elif [[ $platform == "tv" ]]; then
+      PROFILE=tztv_v3.0_arm-wayland
+    elif [[ $platform == "wearable" ]]; then
+      PROFILE=tzwr_v3.0_arm-wayland
+    elif [[ $platform == "ivi" ]]; then
+      PROFILE=tzivi_v3.0_arm
+    elif [[ $platform == "common" ]]; then
+      PROFILE=tzcommon_v3.0_arm-wayland
+    else
+      echo "Cannot set default PROFILE for platform=${platform}"
+      exit 1
+    fi
+  fi
+  echo "Set the profile : $PROFILE"
+
+  if [ "$ARCHITECTURE" == "" ]; then
+    if [[ $platform == "mobile" ]]; then
+      ARCHITECTURE=aarch64
+    elif [[ $platform == "tv" ]]; then
+      ARCHITECTURE=armv7l
+    elif [[ $platform == "wearable" ]]; then
+      ARCHITECTURE=armv7l
+    elif [[ $platform == "ivi" ]]; then
+      ARCHITECTURE=armv7l
+    elif [[ $platform == "common" ]]; then
+      ARCHITECTURE=armv7l
+    else
+      echo "Cannot set default ARCHITECTURE for platform=${platform}"
+      exit 1
+    fi
+  fi
+  echo "Set the architecture : $ARCHITECTURE"
+
+  if [ "$USE_GLOBAL_GBS_CONF" == "" ]; then
+    CONF_FLAG="--conf ${SCRIPTDIR}/gbs.conf"
+  fi
+
+  local count=0
+  while [[ $# > 0 ]]; do
+    count=$(( $count + 1 ))
+    case "$1" in
+    --test)
+        ARGS[$count]=--define
+        count=$(( $count + 1 ))
+        ARGS[$count]="_enable_test 1"
+    ;;
+    *)
+      ARGS[$count]="$1"
+    ;;
+    esac
+    shift;
+  done
+
+  cd $TOPDIR
+
+  # 500 error can be occurred due to server side issue, then build needs to be run again.
+  gbsBuildWithout500Error
+}
+
+function gbsBuildWithout500Error() {
+  # NETSTED while statement does not allow to share variable with outer scope.
+  # So, temporal file is used to share build status between outer and inner while scope.
+  while
+    echo "0" > $SCRIPTDIR/build_result.txt
+    gbs $CONF_FLAG build -P $PROFILE --spec v8.spec --include-all -A $ARCHITECTURE "${ARGS[@]}" $BUILD_CONF_OPTS --incremental | \
+    while read LINE; do
+      echo -e "$LINE"
+      if [ "`echo "$LINE" | grep "read timeout"`" != "" ]; then
+        echo "500" > $SCRIPTDIR/build_result.txt
+      fi
+      if [ "`echo "$LINE" | grep "build failed"`" != "" ]; then
+        echo "1" > $SCRIPTDIR/build_result.txt
+      fi
+    done
+  [ `cat $SCRIPTDIR/build_result.txt` == "500" ]
+  do :; done
+  if [ `cat $SCRIPTDIR/build_result.txt` == "1" ]; then
+    rm -f $SCRIPTDIR/build_result.txt
+    echo "ERROR: build failed !!"
+    exit 1
+  fi
+  rm -f $SCRIPTDIR/build_result.txt
+}
diff --git a/build/gbs.conf b/build/gbs.conf
new file mode 100755 (executable)
index 0000000..65f64df
--- /dev/null
@@ -0,0 +1,524 @@
+###############################################
+#
+# Tizen v2.4 for mobile
+#
+[profile.tizenmb_v2.4]
+obs = obs.tizenmb
+# The order is IMPORTANT!
+repos = repo.tizenmb_supplement_v2.4, repo.devel_gcc49_base_standard, repo.spin_2.4_mobile_target_tm1
+buildroot = ~/GBS-ROOT-V8-2.4-DEV
+
+[repo.spin_2.4_mobile_target_tm1]
+url = http://168.219.209.55/download/snapshots/2.4-mobile/common/latest/repos/target-TM1/packages/
+
+[repo.devel_gcc49_base_standard]
+url = http://168.219.209.55/download/snapshots/2.4-base/common/latest/repos/standard/packages/
+
+[repo.tizenmb_supplement_v2.4]
+url = http://10.113.138.88/tizenrepo/eur-open/supplement_mobile_v2.4/
+
+###############################################
+#
+# Tizen v2.4 for emulator(i586)
+#
+[profile.tizen_emulator_v2.4]
+obs = obs.tizenmb
+# The order is IMPORTANT!
+repos = repo.spin_2.4_mobile_emulator, repo.devel_gcc49_base_emulator
+buildroot = ~/GBS-ROOT-V8-2.4-DEV
+
+[repo.spin_2.4_mobile_emulator]
+url = http://168.219.209.55/download/snapshots/2.4-mobile/common/latest/repos/emulator/packages/
+
+[repo.devel_gcc49_base_emulator]
+url = http://168.219.209.55/download/live/devel:/gcc49:/Base/emulator/
+
+###############################################
+#
+# Tizen v2.3 for mobile
+#
+[profile.tizenmb_v2.3]
+obs = obs.tizenmb
+# The order is IMPORTANT!
+repos = repo.tizenmb_supplement_v2.3, repo.tizenmb_supplement_chromium_v2.3, repo.tizenmb_base_v2.3
+buildroot = ~/GBS-ROOT-V8-2.3-DEV
+
+[repo.tizenmb_supplement_v2.3]
+url = http://10.113.138.88/tizenrepo/eur-open/supplement_v2.3
+
+[repo.tizenmb_base_v2.3]
+url = http://10.113.138.88/tizenrepo/eur-open/PtnZ910FXX_20141020.002
+
+# Supplementary repo for chromium
+[repo.tizenmb_supplement_chromium_v2.3]
+url = http://10.113.138.88/tizenrepo/eur-open/supplement_mobile_chromium_orange_v2.3_1
+
+###############################################
+#
+# Tizen v2.1 for mobile
+#
+[profile.tizenmb_v2.1]
+passwdx =
+obs = obs.tizenmb
+# The order is IMPORTANT!
+repos = repo.tizenmb_supplement, repo.tizenmb_base
+buildroot = ~/GBS-ROOT-V8
+
+[obs.tizenmb]
+url = http://slp-build.sec.samsung.net:81
+
+# base repo
+[repo.tizenmb_base]
+url = http://10.113.138.88/tizenrepo/jpn-dcm/Redwood8974JPNDCM_20131218.006
+
+# Supplementary repo for additional rpms packages required in gbs build
+[repo.tizenmb_supplement]
+url = http://10.113.138.88/tizenrepo/jpn-dcm/supplement
+
+#############################################
+#
+# Tizen v2.4 for product tv (HawkP armv7l)
+#
+[profile.tztv_v2.4_product]
+obs = obs.tztv_v2.4_product
+repos = repo.supplement, repo.product_2016, repo.base_2016
+buildroot = ~/GBS-ROOT-V8-2.4-TV-PRODUCT-ARM-X11
+
+[repo.base_2016]
+url=http://168.219.244.109/tizen-rsa/tztv-2.4-base-main2016/standard/latest/repos/base/armv7l/packages/
+
+[repo.product_2016]
+url=http://168.219.244.109/releases/tztv-2.4-product-main2016/product/Hawk-P/latest/repos/product/armv7l/packages/
+
+[repo.supplement]
+url=http://10.113.138.88/tizenrepo/tv_repo/supplement_tizen_v2.4_product/
+
+[obs.tztv_v2.4_product]
+url = https://168.219.241.169:81
+user = obs_viewer
+passwdx = obs_viewer_169
+
+###############################################
+#
+# Tizen v3.0
+#
+[obs.tizen_v3.0]
+url = https://api.tizen.org
+
+[obs.tizen_v3.0_tv_product]
+url = https://168.219.243.64/api
+user = obs_viewer
+passwdx = obs_viewer_64
+
+###############################################
+#
+# Tizen v3.0 for tv (arm-wayland)
+#
+[profile.tztv_v3.0_arm-wayland]
+obs = obs.tizen_v3.0
+repos = repo.tztv_v3.0_split_modules, repo.public_3.0_base_arm, repo.tztv_v3.0_arm-wayland
+buildroot = ~/GBS-ROOT-V8-3.0-TV-ARM-WAYLAND
+
+[repo.public_3.0_base_arm]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/
+
+[repo.tztv_v3.0_arm-wayland]
+url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/arm-wayland/packages/
+
+[repo.tztv_v3.0_split_modules]
+url = http://10.113.138.88/tizenrepo/tv_repo/supplement_tizen_v3.0_split_modules/
+
+###############################################
+#
+# Tizen v3.0 for tv (arm-wayland) spin-hawkp used outside of Suwon
+#
+[obs.spin]
+url = http://10.113.136.32:81
+
+[profile.tztv_v3.0_arm-hawkp]
+obs = obs.spin
+repos = repo.tztv_v3.0_split_modules, repo.spin_3.0_base_arm, repo.spin.tizen-3.0-TV-target
+buildroot = ~/GBS-ROOT-V8-3.0-TV-ARM-HAWKP
+
+[repo.spin_3.0_base_arm]
+url = http://10.113.136.32/download/snapshots/tizen/base/latest/repos/arm/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.spin.tizen-3.0-TV-target]
+url = http://10.113.136.32/download/snapshots/tizen/3.0-tv/latest/repos/target/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for tv (arm-wayland) spin-hawkp used in Suwon
+#
+[obs.spin-suwon]
+url = http://165.213.149.200:81
+
+[profile.tztv_v3.0_arm-hawkp-suwon]
+obs = obs.spin-suwon
+repos = repo.spin_3.0_base_arm-suwon, repo.spin.tizen-3.0-TV-target-suwon
+buildroot = ~/GBS-ROOT-V8-3.0-TV-ARM-HAWKP
+
+[repo.spin_3.0_base_arm-suwon]
+url = http://165.213.149.200/download/snapshots/tizen/base/latest/repos/arm/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.spin.tizen-3.0-TV-target-suwon]
+url = http://165.213.149.200/download/snapshots/tizen/3.0-tv/latest/repos/target/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for tv (arm-wayland), Mirroring Server for HQ developers
+#
+[profile.tztv_v3.0_arm-wayland_mirror]
+obs = obs.tizen_v3.0
+repos = repo.tztv_v3.0_split_modules, repo.public_3.0_base_arm_mirror, repo.tztv_v3.0_arm-wayland_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-TV-ARM-WAYLAND
+
+[repo.public_3.0_base_arm_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/arm/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tztv_v3.0_arm-wayland_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/tv/latest/repos/arm-wayland/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tztv_v3.0_split_modules]
+url = http://10.113.138.88/tizenrepo/tv_repo/supplement_tizen_v3.0_split_modules/
+
+###############################################
+#
+# Tizen v3.0 for tv (emulator32-wayland)
+#
+[profile.tztv_v3.0_emulator-wayland]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_emulator32, repo.tztv_v3.0_emul-wayland
+buildroot = ~/GBS-ROOT-V8-3.0-TV-EMUL-WAYLAND
+
+[repo.public_3.0_base_emulator32]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/emulator32/packages/
+
+[repo.tztv_v3.0_emul-wayland]
+url = http://download.tizen.org/snapshots/tizen/tv/latest/repos/emulator32-wayland/packages/
+
+#############################################
+#
+# Tizen v3.0 for product tv (JazzM armv7l)
+#
+[profile.tztv_v3.0_arm-jazzm]
+obs = obs.tizen_v3.0_tv_product
+repos = repo.tv_product_3.0_jazzm, repo.tv_product_3.0_base_jazzm
+buildroot = ~/GBS-ROOT-V8-3.0-TV-PRODUCT-JAZZM
+
+[repo.tv_product_3.0_base_jazzm]
+url=http://168.219.244.109/64svr/base/adv-tizen-3.0-base-migration/standard/latest/repos/base/armv7l/packages/
+
+[repo.tv_product_3.0_jazzm]
+url=http://168.219.244.109/releases/adv-tizen-3.0-product-migration/product/JazzM/latest/repos/product/armv7l/packages/
+
+
+#############################################
+#
+# Tizen v3.0 for product tv overseas (JazzM armv7l)
+#
+[profile.tztv_v3.0_arm-jazzm_overseas]
+obs = obs.tizen_v3.0_tv_product
+repos = repo.tv_product_3.0_jazzm_overseas, repo.tv_product_3.0_base_jazzm_overseas
+buildroot = ~/GBS-ROOT-V8-3.0-TV-PRODUCT-JAZZM
+
+[repo.tv_product_3.0_base_jazzm_overseas]
+url=http://10.103.211.119/64svr/base/adv-tizen-3.0-base-migration/standard/latest/repos/base/armv7l/packages/
+
+[repo.tv_product_3.0_jazzm_overseas]
+url=http://10.103.211.119/releases/adv-tizen-3.0-product-migration/product/JazzM/latest/repos/product/armv7l/packages/
+
+###############################################
+#
+# Tizen v3.0 for mobile (arm-wayland)
+#
+[profile.tzmb_v3.0_arm-wayland]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_arm, repo.tzmb_v3.0_arm-wayland
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-ARM-WAYLAND
+
+[repo.public_3.0_base_arm]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/
+
+[repo.tzmb_v3.0_arm-wayland]
+url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm-wayland/packages/
+
+###############################################
+#
+# Tizen v3.0 for mobile (arm-wayland), Mirroring Server for HQ developers
+#
+[profile.tzmb_v3.0_arm-wayland_mirror]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_arm_mirror, repo.tzmb_v3.0_arm-wayland_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-ARM-WAYLAND
+
+[repo.public_3.0_base_arm_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/arm/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tzmb_v3.0_arm-wayland_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/mobile/latest/repos/arm-wayland/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for mobile (arm64-wayland)
+#
+[profile.tzmb_v3.0_arm64-wayland]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_arm64, repo.tzmb_v3.0_arm64-wayland
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-ARM64-WAYLAND
+
+[repo.public_3.0_base_arm64]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm64/packages/
+
+[repo.tzmb_v3.0_arm64-wayland]
+url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm64-wayland/packages/
+
+###############################################
+#
+# Tizen v3.0 for mobile (arm64-wayland), Mirroring Server for HQ developers
+#
+[profile.tzmb_v3.0_arm64-wayland_mirror]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_arm64_mirror, repo.tzmb_v3.0_arm64-wayland_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-ARM64-WAYLAND
+
+[repo.public_3.0_base_arm64_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/arm64/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tzmb_v3.0_arm64-wayland_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/mobile/latest/repos/arm64-wayland/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for mobile (emulator-wayland)
+#
+[profile.tzmb_v3.0_emulator-wayland]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_emulator32, repo.tzmb_v3.0_emul-wayland
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-EMUL-WAYLAND
+
+[repo.public_3.0_base_emulator32]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/emulator32/packages/
+
+[repo.tzmb_v3.0_emul-wayland]
+url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/emulator32-wayland/packages/
+
+###############################################
+#
+# Tizen v3.0 for mobile (emulator64-wayland)
+#
+[profile.tzmb_v3.0_emulator64-wayland]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_emulator64, repo.tzmb_v3.0_emul64-wayland
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-EMUL64-WAYLAND
+
+[repo.public_3.0_base_emulator64]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/emulator64/packages/
+
+[repo.tzmb_v3.0_emul64-wayland]
+url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/emulator64-wayland/packages/
+
+###############################################
+#
+# Tizen v3.0 for mobile (armv7l-wayland TM1)
+#
+[profile.tzmb_v3.0_TM1]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_arm, repo.tzmb_v3.0_TM1
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-TM1
+
+[repo.public_3.0_base_arm]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/
+
+[repo.tzmb_v3.0_TM1]
+url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/target-TM1/packages/
+
+###############################################
+#
+# Tizen v3.0 for mobile (armv7l-wayland TM1), Mirroring Server for HQ developers
+#
+[profile.tzmb_v3.0_TM1_mirror]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_arm_mirror, repo.tzmb_v3.0_TM1_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-MOBILE-TM1
+
+[repo.public_3.0_base_arm_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/arm/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tzmb_v3.0_TM1_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/mobile/latest/repos/target-TM1/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for wearable (emulator32-wayland)
+#
+[profile.tzwr_v3.0_emulator-wayland]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_emulator, repo.tzwr_v3.0_emulator
+buildroot = ~/GBS-ROOT-V8-3.0-WEARABLE-EMUL
+
+[repo.public_3.0_base_emulator]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/emulator32/packages/
+
+[repo.tzwr_v3.0_emulator]
+url = http://download.tizen.org/snapshots/tizen/wearable/latest/repos/emulator32-wayland/packages/
+
+###############################################
+#
+# Tizen v3.0 for wearable (emulator32-wayland), Mirroring Server for HQ developers
+#
+[profile.tzwr_v3.0_emulator-wayland_mirror]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_emulator_mirror, repo.tzwr_v3.0_emulator_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-WEARABLE-EMUL
+
+[repo.public_3.0_base_emulator_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/emulator32/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tzwr_v3.0_emulator_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/wearable/latest/repos/emulator32-wayland/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+##############################################
+#
+# Tizen v3.0 for wearable (target-circle)
+#
+[profile.tzwr_v3.0_target-circle]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_arm, repo.tzwr_v3.0_target-circle
+buildroot = ~/GBS-ROOT-V8-3.0-WEARABLE-TARGET-CIRCLE
+
+[repo.public_3.0_base_arm]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/
+
+[repo.tzwr_v3.0_target-circle]
+url = http://download.tizen.org/snapshots/tizen/wearable/latest/repos/target-circle/packages/
+
+###############################################
+#
+# Tizen v3.0 for wearable (target-circle), Mirroring Server for HQ developers
+#
+[profile.tzwr_v3.0_target-circle_mirror]
+obs = obs.tizen_v3.0
+repos = repo.public_3.0_base_arm_mirror, repo.tzwr_v3.0_arm-target-circle_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-WEARABLE-TARGET-CIRCLE
+
+[repo.public_3.0_base_arm_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/arm/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tzwr_v3.0_arm-target-circle_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/wearable/latest/repos/target-circle/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for wearable (emulator-circle)
+#
+[profile.tzwr_v3.0_emulator-circle]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_emulator, repo.tzwr_v3.0_emulator-circle
+buildroot = ~/GBS-ROOT-V8-3.0-WEARABLE-EMUL-CIRCLE
+
+[repo.public_3.0_base_emulator]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/emulator32/packages/
+
+[repo.tzwr_v3.0_emulator-circle]
+url = http://download.tizen.org/snapshots/tizen/wearable/latest/repos/emulator-circle/packages/
+
+###############################################
+#
+# Tizen v3.0 for wearable (emulator-circle), Mirroring Server for HQ developers
+#
+[profile.tzwr_v3.0_emulator-circle_mirror]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_emulator_mirror, repo.tzwr_v3.0_emulator-circle_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-WEARABLE-EMUL-CIRCLE
+
+[repo.public_3.0_base_emulator_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/emulator32/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tzwr_v3.0_emulator-circle_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/wearable/latest/repos/emulator-circle/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for common (armv7l)
+#
+[profile.tzcommon_v3.0_arm-wayland]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_arm, repo.tzcommon_v3.0_arm-wayland
+buildroot = ~/GBS-ROOT-V8-3.0-COMMON
+
+[repo.public_3.0_base_arm]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/
+
+[repo.tzcommon_v3.0_arm-wayland]
+url = http://download.tizen.org/snapshots/tizen/common/latest/repos/arm-wayland/packages/
+
+###############################################
+#
+# Tizen v3.0 for common (armv7l), Mirroring Server for HQ developers
+#
+[profile.tzcommon_v3.0_arm-wayland_mirror]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_arm_mirror, repo.tzcommon_v3.0_arm-wayland_mirror
+buildroot = ~/GBS-ROOT-V8-3.0-COMMON
+
+[repo.public_3.0_base_arm_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/base/latest/repos/arm/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+[repo.tzcommon_v3.0_arm-wayland_mirror]
+url = http://165.213.149.200/download/public_mirror/tizen/common/latest/repos/arm-wayland/packages/
+user = blinkbot
+passwdx = QlpoOTFBWSZTWd0JOhUAAACBAABgIAAhAIIjF3JFOFCQ3Qk6FQ==
+
+###############################################
+#
+# Tizen v3.0 for ivi (armv7l)
+#
+[profile.tzivi_v3.0_arm]
+obs = obs.tizen_v3.0
+repos =  repo.public_3.0_base_arm, repo.tzivi_v3.0_arm
+buildroot = ~/GBS-ROOT-V8-3.0-IVI-ARM
+
+[repo.public_3.0_base_arm]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/
+
+[repo.tzivi_v3.0_arm]
+url = http://download.tizen.org/snapshots/tizen/ivi/latest/repos/arm/packages/
diff --git a/build/gyp_v8.sh b/build/gyp_v8.sh
new file mode 100755 (executable)
index 0000000..32d1697
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+source $(dirname $0)/common.sh
+
+EXTRA_GYP_ARGS="$@"
+
+ADDITIONAL_GYP_PARAMETERS="-Dclang=0
+                           -Dv8_target_arch=$(getHostArch)
+                           -Dbuilding_for_tizen=1
+                          "
+
+_GYP_ARGS="$EXTRA_GYP_ARGS
+           $ADDITIONAL_GYP_PARAMETERS
+          "
+
+echo "GYP_ARGUMENTS:"
+for arg in $_GYP_ARGS; do
+  printf "    * ${arg##-D}\n"
+done
+
+./build/gyp_v8 ${_GYP_ARGS}
diff --git a/build/prebuild/ninja/ninja b/build/prebuild/ninja/ninja
new file mode 100755 (executable)
index 0000000..cab5668
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+OS="$(uname -s)"
+THIS_DIR="$(dirname "${0}")"
+
+function print_help() {
+cat <<-EOF
+No prebuilt ninja binary was found for this system.
+Try building your own binary by doing:
+  cd ~
+  git clone https://github.com/martine/ninja.git -b v1.5.3
+  cd ninja && ./configure.py --bootstrap
+Then add ~/ninja/ to your PATH.
+EOF
+}
+
+case "$OS" in
+  Linux)
+    MACHINE=$(uname -m)
+    case "$MACHINE" in
+      i?86|x86_64)
+        LONG_BIT=$(getconf LONG_BIT)
+        # We know we are on x86 but we need to use getconf to determine
+        # bittage of the userspace install (e.g. when runing 32-bit userspace
+        # on x86_64 kernel)
+        exec "${THIS_DIR}/ninja-linux${LONG_BIT}" "$@";;
+      *)
+        echo Unknown architecture \($MACHINE\) -- unable to run ninja.
+        print_help
+        exit 1;;
+    esac
+    ;;
+  Darwin)    exec "${THIS_DIR}/ninja-mac" "$@";;
+  CYGWIN*)   exec cmd.exe /c $(cygpath -t windows $0).exe "$@";;
+  MINGW32*)  cmd.exe //c $0.exe "$@";;
+  *)         echo "Unsupported OS ${OS}"
+             print_help
+             exit 1;;
+esac
diff --git a/build/prebuild/ninja/ninja.arm b/build/prebuild/ninja/ninja.arm
new file mode 100755 (executable)
index 0000000..cb4c3ec
Binary files /dev/null and b/build/prebuild/ninja/ninja.arm differ
diff --git a/build/prebuild/ninja/ninja.arm64 b/build/prebuild/ninja/ninja.arm64
new file mode 100755 (executable)
index 0000000..ab58341
Binary files /dev/null and b/build/prebuild/ninja/ninja.arm64 differ
index cba6098..4d6caf5 100644 (file)
         'target_conditions': [
           ['_toolset=="host"', {
             'conditions': [
-              ['host_cxx_is_biarch==1', {
+              ['host_cxx_is_biarch==1 and building_for_tizen!=1', {
                 'cflags': [ '-m32' ],
                 'ldflags': [ '-m32' ]
               }],
           }],
           ['_toolset=="target"', {
             'conditions': [
-              ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
+              ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64" and building_for_tizen!=1', {
                 'cflags': [ '-m32' ],
                 'ldflags': [ '-m32' ],
               }],
         ],
       }],
       ['(OS=="linux" or OS=="android") and \
-        (v8_target_arch=="x64" or v8_target_arch=="arm64" or \
+        (v8_target_arch=="x64" or (v8_target_arch=="arm64" and building_for_tizen!=1) or \
          v8_target_arch=="ppc64")', {
         'target_conditions': [
           ['_toolset=="host"', {
diff --git a/packaging/v8.manifest b/packaging/v8.manifest
new file mode 100644 (file)
index 0000000..41a9320
--- /dev/null
@@ -0,0 +1,6 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
+
diff --git a/packaging/v8.pc b/packaging/v8.pc
new file mode 100644 (file)
index 0000000..1a0fed2
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib/v8
+includedir=${prefix}/include
+
+Name: chromium-efl
+Description: This is v8 library
+Version: 4.7.83
+
+Libs: -L${libdir} ${libdir}/libv8_base.a ${libdir}/libv8_external_snapshot.a ${libdir}/libv8_libbase.a ${libdir}/libv8_libplatform.a ${libdir}/libv8_nosnapshot.a
+Cflags: -I${includedir}/v8/include
diff --git a/packaging/v8.spec b/packaging/v8.spec
new file mode 100644 (file)
index 0000000..47d2773
--- /dev/null
@@ -0,0 +1,161 @@
+Name:          v8
+Summary:       This is v8 library.
+Version:       4.7.83
+Release:       0
+Group:         Web Framework/Web Engine
+License:       LGPL-2.1 or BSD-2-Clause
+Source0:       %{name}-%{version}.tar.gz
+Source1:       v8.manifest
+
+# Conditions for OBS build
+# The OBS build does not support running script 'build_{target}.sh'.
+# TODO: There is a bug regarding mismatched versions from repository.
+#       So, the versions need to be considered as originally intended versions,
+#       until those versions are fixed by platform team.
+#       1) The value '2.3' of macro 'tizen' should be '2.4'.
+#       2) The value '2.0' of macro 'tizen' should be '2.3'.
+%if "%{tizen}" == "3.0"
+%define chromium_efl_tizen_version 3.0
+%endif
+%if "%{tizen}" == "2.3" || "%{tizen}" == "2.4"
+%define chromium_efl_tizen_version 2.4
+%endif
+%if "%{tizen}" == "2.0"
+%define chromium_efl_tizen_version 2.3
+%endif
+
+%if %{!?TIZEN_PROFILE_TV:0}%{?TIZEN_PROFILE_TV:1} || "%{?profile}" == "tv"
+%define chromium_efl_tizen_profile tv
+%endif
+%if "%{!?profile:0}%{?profile}" == "mobile"
+%define chromium_efl_tizen_profile mobile
+%endif
+%if "%{!?profile:0}%{?profile}" == "wearable"
+%define chromium_efl_tizen_profile wearable
+%endif
+%if "%{!?profile:0}%{?profile}" == "common"
+%define chromium_efl_tizen_profile common
+%endif
+%if "%{!?profile:0}%{?profile}" == "ivi"
+%define chromium_efl_tizen_profile ivi
+%endif
+
+BuildRequires: python, python-xml, git
+%ifarch armv7l
+BuildRequires: python-accel-armv7l-cross-arm
+%endif
+%ifarch aarch64
+BuildRequires: python-accel-aarch64-cross-aarch64
+# TODO(youngsoo): The binutils-gold crashes mini_browser on the Tizen v3.0 ARM 64 bit images.
+#                 Once fixed, use binutils-gold for all targets on Tizen v3.0.
+%if "%{chromium_efl_tizen_version}" == "3.0"
+BuildRequires: binutils-gold
+%endif
+%endif
+
+BuildRequires: pkgconfig(icu-i18n)
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+This is v8 library.
+
+%package devel
+Summary:  v8 library (Development)
+Group:    System/Development
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+This is v8 library.
+%devel_desc
+
+%prep
+%setup -q
+
+%build
+if [ ! -d %{buildroot}/../../OTHER/ -a -f /opt/testing/bin/rpmlint ]; then
+  mkdir -p %{buildroot}/../../OTHER/
+fi
+
+git submodule update --init
+pushd build/gyp; git reset --hard 08429da7; popd;
+
+%ifarch aarhc64
+  export ADDITION_OPTION=" -finline-limit=64 -foptimize-sibling-calls -fno-unwind-tables -fno-exceptions -Os"
+%endif
+%ifarch %{arm}
+  export ADDITION_OPTION=" -finline-limit=64 -foptimize-sibling-calls -fno-unwind-tables -fno-exceptions -Os -mthumb"
+%endif
+%ifarch %{arm} aarch64
+  export CFLAGS="$CFLAGS $ADDITION_OPTION"
+  export CXXFLAGS="$CXXFLAGS $ADDITION_OPTION"
+  export FFLAGS="$FFLAGS $ADDITION_OPTION"
+
+  export CFLAGS="$(echo $CFLAGS | sed 's/-mfpu=[a-zA-Z0-9-]*/-mfpu=neon/g')"
+  export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-mfpu=[a-zA-Z0-9-]*/-mfpu=neon/g')"
+  export FFLAGS="$(echo $FFLAGS | sed 's/-mfpu=[a-zA-Z0-9-]*/-mfpu=neon/g')"
+%else
+  export CFLAGS="$(echo $CFLAGS | sed 's/-Wl,--as-needed//g')"
+  export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-Wl,--as-needed//g')"
+%endif
+
+export GYP_GENERATORS=ninja
+
+%define OUTPUT_BASE_FOLDER out.tz_v%{chromium_efl_tizen_version}.%{chromium_efl_tizen_profile}.%{_repository}
+export GYP_GENERATOR_OUTPUT=$PWD/%{OUTPUT_BASE_FOLDER}
+export GYP_GENERATOR_FLAGS="output_dir=${GYP_GENERATOR_OUTPUT}"
+
+#set build mode
+%if 0%{?_debug_mode}
+%global OUTPUT_FOLDER %{OUTPUT_BASE_FOLDER}/Debug
+%else
+%global OUTPUT_FOLDER %{OUTPUT_BASE_FOLDER}/Release
+%endif
+
+./build/gyp_v8.sh \
+%if %{!?_enable_test:0}%{?_enable_test:1}
+    -Denable_test=1
+%else
+    -Denable_test=0
+%endif
+
+%ifarch %{arm}
+./build/prebuild/ninja/ninja.arm %{?_smp_mflags} -C%{OUTPUT_FOLDER}
+%else
+%ifarch aarch64
+./build/prebuild/ninja/ninja.arm64 %{?_smp_mflags} -C%{OUTPUT_FOLDER}
+%else
+./build/prebuild/ninja/ninja %{?_smp_mflags} -C%{OUTPUT_FOLDER}
+%endif
+%endif
+
+%install
+install -d %{buildroot}%{_libdir}/pkgconfig
+install -d %{buildroot}%{_libdir}/v8
+install -d %{buildroot}%{_includedir}/v8/include
+install -d %{buildroot}%{_includedir}/v8/include/libplatform
+install -m 0755 ./out/Release/*.a %{buildroot}%{_libdir}/v8
+install -m 0755 ./out/Release/natives_blob.bin %{buildroot}%{_libdir}/v8
+install -m 0755 ./out/Release/snapshot_blob.bin %{buildroot}%{_libdir}/v8
+install -m 0644 ./packaging/v8.pc %{buildroot}%{_libdir}/pkgconfig/
+install -m 0644 ./include/*.h %{buildroot}%{_includedir}/v8/include
+install -m 0644 ./include/libplatform/*.h %{buildroot}%{_includedir}/v8/include/libplatform
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest packaging/v8.manifest
+%{_libdir}/v8/libv8*.a
+%{_libdir}/v8/natives_blob.bin
+%{_libdir}/v8/snapshot_blob.bin
+
+%files devel
+%manifest packaging/v8.manifest
+%{_libdir}/v8/libv8*.a
+%{_libdir}/v8/natives_blob.bin
+%{_libdir}/v8/snapshot_blob.bin
+%{_libdir}/pkgconfig/v8.pc
+%{_includedir}/v8/include
diff --git a/third_party/icu/icu.gyp b/third_party/icu/icu.gyp
new file mode 100644 (file)
index 0000000..16c36df
--- /dev/null
@@ -0,0 +1,248 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+  'targets': [
+    {
+      'target_name': 'icudata',
+      'type': 'none',
+      'direct_dependent_settings': {
+        'cflags': [
+          '<!@(pkg-config --cflags icu-uc)',
+        ],
+        'defines': [
+          'U_USING_ICU_NAMESPACE=0',
+        ],
+      },
+      'link_settings': {
+        'ldflags': [
+          '<!@(pkg-config --libs-only-L --libs-only-other icu-uc)',
+        ],
+        'libraries': [
+          '<!@(pkg-config --libs-only-l icu-uc)',
+        ],
+      },
+    },
+    {
+      'target_name': 'icui18n',
+      'type': 'none',
+      'toolsets': ['host', 'target'],
+      'direct_dependent_settings': {
+        'cflags': [
+          '<!@(pkg-config --cflags icu-i18n)',
+        ],
+        'defines': [
+          'U_USING_ICU_NAMESPACE=0',
+        ],
+      },
+      'link_settings': {
+        'ldflags': [
+          '<!@(pkg-config --libs-only-L --libs-only-other icu-i18n)',
+        ],
+        'libraries': [
+          '<!@(pkg-config --libs-only-l icu-i18n)',
+        ],
+      },
+      'variables': {
+        'headers_root_path': 'source/i18n',
+        'header_filenames': [
+          # This list can easily be updated using the command below:
+          # find third_party/icu/source/i18n/unicode -iname '*.h' \
+          # -printf "'%p',\n" | \
+          # sed -e 's|third_party/icu/source/i18n/||' | sort -u
+          'unicode/basictz.h',
+          'unicode/bmsearch.h',
+          'unicode/bms.h',
+          'unicode/calendar.h',
+          'unicode/choicfmt.h',
+          'unicode/coleitr.h',
+          'unicode/colldata.h',
+          'unicode/coll.h',
+          'unicode/curramt.h',
+          'unicode/currpinf.h',
+          'unicode/currunit.h',
+          'unicode/datefmt.h',
+          'unicode/dcfmtsym.h',
+          'unicode/decimfmt.h',
+          'unicode/dtfmtsym.h',
+          'unicode/dtitvfmt.h',
+          'unicode/dtitvinf.h',
+          'unicode/dtptngen.h',
+          'unicode/dtrule.h',
+          'unicode/fieldpos.h',
+          'unicode/fmtable.h',
+          'unicode/format.h',
+          'unicode/fpositer.h',
+          'unicode/gregocal.h',
+          'unicode/locdspnm.h',
+          'unicode/measfmt.h',
+          'unicode/measunit.h',
+          'unicode/measure.h',
+          'unicode/msgfmt.h',
+          'unicode/numfmt.h',
+          'unicode/numsys.h',
+          'unicode/plurfmt.h',
+          'unicode/plurrule.h',
+          'unicode/rbnf.h',
+          'unicode/rbtz.h',
+          'unicode/regex.h',
+          'unicode/search.h',
+          'unicode/selfmt.h',
+          'unicode/simpletz.h',
+          'unicode/smpdtfmt.h',
+          'unicode/sortkey.h',
+          'unicode/stsearch.h',
+          'unicode/tblcoll.h',
+          'unicode/timezone.h',
+          'unicode/tmunit.h',
+          'unicode/tmutamt.h',
+          'unicode/tmutfmt.h',
+          'unicode/translit.h',
+          'unicode/tzrule.h',
+          'unicode/tztrans.h',
+          'unicode/ucal.h',
+          'unicode/ucoleitr.h',
+          'unicode/ucol.h',
+          'unicode/ucsdet.h',
+          'unicode/ucurr.h',
+          'unicode/udat.h',
+          'unicode/udatpg.h',
+          'unicode/uldnames.h',
+          'unicode/ulocdata.h',
+          'unicode/umsg.h',
+          'unicode/unirepl.h',
+          'unicode/unum.h',
+          'unicode/uregex.h',
+          'unicode/usearch.h',
+          'unicode/uspoof.h',
+          'unicode/utmscale.h',
+          'unicode/utrans.h',
+          'unicode/vtzone.h',
+        ],
+      },
+      'includes': [
+        '../../build/shim_headers.gypi',
+      ],
+    },
+    {
+      'target_name': 'icuuc',
+      'type': 'none',
+      'toolsets': ['host', 'target'],
+      'direct_dependent_settings': {
+        'cflags': [
+          '<!@(pkg-config --cflags icu-uc)',
+        ],
+        'defines': [
+          'U_USING_ICU_NAMESPACE=0',
+        ],
+      },
+      'link_settings': {
+        'ldflags': [
+          '<!@(pkg-config --libs-only-L --libs-only-other icu-uc)',
+        ],
+        'libraries': [
+          '<!@(pkg-config --libs-only-l icu-uc)',
+        ],
+      },
+      'variables': {
+        'headers_root_path': 'source/common',
+        'header_filenames': [
+          # This list can easily be updated using the command below:
+          # find third_party/icu/source/common/unicode -iname '*.h' \
+          # -printf "'%p',\n" | \
+          # sed -e 's|third_party/icu/source/common/||' | sort -u
+          'unicode/brkiter.h',
+          'unicode/bytestream.h',
+          'unicode/caniter.h',
+          'unicode/chariter.h',
+          'unicode/dbbi.h',
+          'unicode/docmain.h',
+          'unicode/dtintrv.h',
+          'unicode/errorcode.h',
+          'unicode/icudataver.h',
+          'unicode/icuplug.h',
+          'unicode/idna.h',
+          'unicode/localpointer.h',
+          'unicode/locid.h',
+          'unicode/normalizer2.h',
+          'unicode/normlzr.h',
+          'unicode/pandroid.h',
+          'unicode/parseerr.h',
+          'unicode/parsepos.h',
+          'unicode/pfreebsd.h',
+          'unicode/plinux.h',
+          'unicode/pmac.h',
+          'unicode/popenbsd.h',
+          'unicode/ppalmos.h',
+          'unicode/ptypes.h',
+          'unicode/putil.h',
+          'unicode/pwin32.h',
+          'unicode/rbbi.h',
+          'unicode/rep.h',
+          'unicode/resbund.h',
+          'unicode/schriter.h',
+          'unicode/std_string.h',
+          'unicode/strenum.h',
+          'unicode/stringpiece.h',
+          'unicode/symtable.h',
+          'unicode/ubidi.h',
+          'unicode/ubrk.h',
+          'unicode/ucasemap.h',
+          'unicode/ucat.h',
+          'unicode/uchar.h',
+          'unicode/uchriter.h',
+          'unicode/uclean.h',
+          'unicode/ucnv_cb.h',
+          'unicode/ucnv_err.h',
+          'unicode/ucnv.h',
+          'unicode/ucnvsel.h',
+          'unicode/uconfig.h',
+          'unicode/udata.h',
+          'unicode/udeprctd.h',
+          'unicode/udraft.h',
+          'unicode/uenum.h',
+          'unicode/uidna.h',
+          'unicode/uintrnal.h',
+          'unicode/uiter.h',
+          'unicode/uloc.h',
+          'unicode/umachine.h',
+          'unicode/umisc.h',
+          'unicode/unifilt.h',
+          'unicode/unifunct.h',
+          'unicode/unimatch.h',
+          'unicode/uniset.h',
+          'unicode/unistr.h',
+          'unicode/unorm2.h',
+          'unicode/unorm.h',
+          'unicode/uobject.h',
+          'unicode/uobslete.h',
+          'unicode/urename.h',
+          'unicode/urep.h',
+          'unicode/ures.h',
+          'unicode/uscript.h',
+          'unicode/uset.h',
+          'unicode/usetiter.h',
+          'unicode/ushape.h',
+          'unicode/usprep.h',
+          'unicode/ustring.h',
+          'unicode/usystem.h',
+          'unicode/utext.h',
+          'unicode/utf16.h',
+          'unicode/utf32.h',
+          'unicode/utf8.h',
+          'unicode/utf.h',
+          'unicode/utf_old.h',
+          'unicode/utrace.h',
+          'unicode/utypeinfo.h',
+          'unicode/utypes.h',
+          'unicode/uvernum.h',
+          'unicode/uversion.h',
+        ],
+      },
+      'includes': [
+        '../../build/shim_headers.gypi',
+      ],
+    },
+  ],
+}
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
new file mode 100755 (executable)
index 0000000..ba126e3
--- /dev/null
@@ -0,0 +1,672 @@
+#!/usr/bin/env bash
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script will check out llvm and clang into third_party/llvm and build it.
+
+# Do NOT CHANGE this if you don't know what you're doing -- see
+# https://code.google.com/p/chromium/wiki/UpdatingClang
+# Reverting problematic clang rolls is safe, though.
+CLANG_REVISION=247874
+
+# This is incremented when pushing a new build of Clang at the same revision.
+CLANG_SUB_REVISION=1
+
+PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}"
+
+THIS_DIR="$(dirname "${0}")"
+LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
+LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts"
+COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt"
+LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
+LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install"
+CLANG_DIR="${LLVM_DIR}/tools/clang"
+COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt"
+LIBCXX_DIR="${LLVM_DIR}/projects/libcxx"
+LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi"
+ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk"
+STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
+CHROMIUM_TOOLS_DIR="${THIS_DIR}/.."
+BINUTILS_DIR="${THIS_DIR}/../../../third_party/binutils"
+
+ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}"
+ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}"
+ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}"
+ABS_LLVM_DIR="${PWD}/${LLVM_DIR}"
+ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}"
+ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}"
+ABS_BINUTILS_DIR="${PWD}/${BINUTILS_DIR}"
+
+# ${A:-a} returns $A if it's set, a else.
+LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project}
+
+CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang
+if [[ -n "$GS_HOST" ]]; then
+  CDS_URL=http://$GS_HOST/chromium-browser-clang
+fi
+
+if [[ -z "$GYP_DEFINES" ]]; then
+  GYP_DEFINES=
+fi
+if [[ -z "$GYP_GENERATORS" ]]; then
+  GYP_GENERATORS=
+fi
+if [[ -z "$LLVM_DOWNLOAD_GOLD_PLUGIN" ]]; then
+  LLVM_DOWNLOAD_GOLD_PLUGIN=
+fi
+
+
+# Die if any command dies, error on undefined variable expansions.
+set -eu
+
+
+if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then
+  # Use a real revision number rather than HEAD to make sure that the stamp file
+  # logic works.
+  CLANG_REVISION=$(svn info "$LLVM_REPO_URL" \
+      | grep 'Revision:' | awk '{ printf $2; }')
+  PACKAGE_VERSION="${CLANG_REVISION}-0"
+fi
+
+OS="$(uname -s)"
+
+# Parse command line options.
+if_needed=
+force_local_build=
+run_tests=
+bootstrap=
+with_android=yes
+chrome_tools="plugins;blink_gc_plugin"
+gcc_toolchain=
+with_patches=yes
+
+if [[ "${OS}" = "Darwin" ]]; then
+  with_android=
+fi
+
+while [[ $# > 0 ]]; do
+  case $1 in
+    --bootstrap)
+      bootstrap=yes
+      ;;
+    --if-needed)
+      if_needed=yes
+      ;;
+    --force-local-build)
+      force_local_build=yes
+      ;;
+    --print-revision)
+      if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then
+        svn info "$LLVM_DIR" | grep 'Revision:' | awk '{ printf $2; }'
+      else
+        echo $PACKAGE_VERSION
+      fi
+      exit 0
+      ;;
+    --run-tests)
+      run_tests=yes
+      ;;
+    --without-android)
+      with_android=
+      ;;
+    --without-patches)
+      with_patches=
+      ;;
+    --with-chrome-tools)
+      shift
+      if [[ $# == 0 ]]; then
+        echo "--with-chrome-tools requires an argument."
+        exit 1
+      fi
+      chrome_tools=$1
+      ;;
+    --gcc-toolchain)
+      shift
+      if [[ $# == 0 ]]; then
+        echo "--gcc-toolchain requires an argument."
+        exit 1
+      fi
+      if [[ -x "$1/bin/gcc" ]]; then
+        gcc_toolchain=$1
+      else
+        echo "Invalid --gcc-toolchain: '$1'."
+        echo "'$1/bin/gcc' does not appear to be valid."
+        exit 1
+      fi
+      ;;
+
+    --help)
+      echo "usage: $0 [--force-local-build] [--if-needed] [--run-tests] "
+      echo "--bootstrap: First build clang with CC, then with itself."
+      echo "--force-local-build: Don't try to download prebuilt binaries."
+      echo "--if-needed: Download clang only if the script thinks it is needed."
+      echo "--run-tests: Run tests after building. Only for local builds."
+      echo "--print-revision: Print current clang revision and exit."
+      echo "--without-android: Don't build ASan Android runtime library."
+      echo "--with-chrome-tools: Select which chrome tools to build." \
+           "Defaults to plugins;blink_gc_plugin."
+      echo "    Example: --with-chrome-tools plugins;empty-string"
+      echo "--gcc-toolchain: Set the prefix for which GCC version should"
+      echo "    be used for building. For example, to use gcc in"
+      echo "    /opt/foo/bin/gcc, use '--gcc-toolchain '/opt/foo"
+      echo "--without-patches: Don't apply local patches."
+      echo
+      exit 1
+      ;;
+    *)
+      echo "Unknown argument: '$1'."
+      echo "Use --help for help."
+      exit 1
+      ;;
+  esac
+  shift
+done
+
+if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then
+  force_local_build=yes
+
+  # Skip local patches when using HEAD: they probably don't apply anymore.
+  with_patches=
+
+  if ! [[ "$GYP_DEFINES" =~ .*OS=android.* ]]; then
+    # Only build the Android ASan rt when targetting Android.
+    with_android=
+  fi
+
+  LLVM_BUILD_TOOLS_DIR="${ABS_LLVM_DIR}/../llvm-build-tools"
+
+  if [[ "${OS}" == "Linux" ]] && [[ -z "${gcc_toolchain}" ]]; then
+    if [[ $(gcc -dumpversion) < "4.7.0" ]]; then
+      # We need a newer GCC version.
+      if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/gcc482" ]]; then
+        echo "Downloading pre-built GCC 4.8.2..."
+        mkdir -p "${LLVM_BUILD_TOOLS_DIR}"
+        curl --fail -L "${CDS_URL}/tools/gcc482.tgz" | \
+          tar zxf - -C "${LLVM_BUILD_TOOLS_DIR}"
+        echo Done
+      fi
+      gcc_toolchain="${LLVM_BUILD_TOOLS_DIR}/gcc482"
+    else
+      # Always set gcc_toolchain; llvm-symbolizer needs the bundled libstdc++.
+      gcc_toolchain="$(dirname $(dirname $(which gcc)))"
+    fi
+  fi
+
+  if [[ "${OS}" == "Linux" || "${OS}" == "Darwin" ]]; then
+    if [[ $(cmake --version | grep -Eo '[0-9.]+') < "3.0" ]]; then
+      # We need a newer CMake version.
+      if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/cmake310" ]]; then
+        echo "Downloading pre-built CMake 3.10..."
+        mkdir -p "${LLVM_BUILD_TOOLS_DIR}"
+        curl --fail -L "${CDS_URL}/tools/cmake310_${OS}.tgz" | \
+          tar zxf - -C "${LLVM_BUILD_TOOLS_DIR}"
+        echo Done
+      fi
+      export PATH="${LLVM_BUILD_TOOLS_DIR}/cmake310/bin:${PATH}"
+    fi
+  fi
+
+  echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}"
+fi
+
+if [[ -n "$if_needed" ]]; then
+  if [[ "${OS}" == "Darwin" ]]; then
+    # clang is always used on Mac.
+    true
+  elif [[ "${OS}" == "Linux" ]]; then
+    # clang is also aways used on Linux.
+    true
+  elif [[ "$GYP_DEFINES" =~ .*(clang|tsan|asan|lsan|msan)=1.* ]]; then
+    # clang requested via $GYP_DEFINES.
+    true
+  elif [[ -d "${LLVM_BUILD_DIR}" ]]; then
+    # clang previously downloaded, keep it up-to-date.
+    # If you don't want this, delete third_party/llvm-build on your machine.
+    true
+  else
+    # clang wasn't needed, not doing anything.
+    exit 0
+  fi
+fi
+
+
+# Check if there's anything to be done, exit early if not.
+if [[ -f "${STAMP_FILE}" ]]; then
+  PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
+  if [[ -z "$force_local_build" ]] && \
+       [[ "${PREVIOUSLY_BUILT_REVISON}" = \
+          "${PACKAGE_VERSION}" ]]; then
+    echo "Clang already at ${PACKAGE_VERSION}"
+    exit 0
+  fi
+fi
+# To always force a new build if someone interrupts their build half way.
+rm -f "${STAMP_FILE}"
+
+
+if [[ -z "$force_local_build" ]]; then
+  # Check if there's a prebuilt binary and if so just fetch that. That's faster,
+  # and goma relies on having matching binary hashes on client and server too.
+  CDS_FILE="clang-${PACKAGE_VERSION}.tgz"
+  CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX)
+  CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}"
+  if [ "${OS}" = "Linux" ]; then
+    CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}"
+  elif [ "${OS}" = "Darwin" ]; then
+    CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}"
+  fi
+  echo Trying to download prebuilt clang
+  if which curl > /dev/null; then
+    curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \
+        rm -rf "${CDS_OUT_DIR}"
+  elif which wget > /dev/null; then
+    wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}"
+  else
+    echo "Neither curl nor wget found. Please install one of these."
+    exit 1
+  fi
+  if [ -f "${CDS_OUTPUT}" ]; then
+    rm -rf "${LLVM_BUILD_DIR}"
+    mkdir -p "${LLVM_BUILD_DIR}"
+    tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
+    echo clang "${PACKAGE_VERSION}" unpacked
+    echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
+    rm -rf "${CDS_OUT_DIR}"
+    # Download the gold plugin if requested to by an environment variable.
+    # This is used by the CFI ClusterFuzz bot.
+    if [[ -n "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]]; then
+      ${THIS_DIR}/../../../build/download_gold_plugin.py
+    fi
+    exit 0
+  else
+    echo Did not find prebuilt clang "${PACKAGE_VERSION}", building
+  fi
+fi
+
+if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
+  echo "Android NDK not found at ${ANDROID_NDK_DIR}"
+  echo "The Android NDK is needed to build a Clang whose -fsanitize=address"
+  echo "works on Android. See "
+  echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how"
+  echo "to install the NDK, or pass --without-android."
+  exit 1
+fi
+
+# Check that cmake and ninja are available.
+if ! which cmake > /dev/null; then
+  echo "CMake needed to build clang; please install"
+  exit 1
+fi
+if ! which ninja > /dev/null; then
+  echo "ninja needed to build clang, please install"
+  exit 1
+fi
+
+echo Reverting previously patched files
+for i in \
+      "${CLANG_DIR}/test/Index/crash-recovery-modules.m" \
+      "${CLANG_DIR}/unittests/libclang/LibclangTest.cpp" \
+      "${COMPILER_RT_DIR}/lib/asan/asan_rtl.cc" \
+      "${COMPILER_RT_DIR}/test/asan/TestCases/Linux/new_array_cookie_test.cc" \
+      "${LLVM_DIR}/test/DebugInfo/gmlt.ll" \
+      "${LLVM_DIR}/lib/CodeGen/SpillPlacement.cpp" \
+      "${LLVM_DIR}/lib/CodeGen/SpillPlacement.h" \
+      "${LLVM_DIR}/lib/Transforms/Instrumentation/MemorySanitizer.cpp" \
+      "${CLANG_DIR}/test/Driver/env.c" \
+      "${CLANG_DIR}/lib/Frontend/InitPreprocessor.cpp" \
+      "${CLANG_DIR}/test/Frontend/exceptions.c" \
+      "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \
+      "${LLVM_DIR}/test/Bindings/Go/go.test" \
+      "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \
+      "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \
+      "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \
+      "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \
+      "${CLANG_DIR}/test/SemaCXX/default2.cpp" \
+      "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \
+      "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc" \
+      "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \
+      "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \
+      "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \
+      "${COMPILER_RT_DIR}/CMakeLists.txt" \
+      "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \
+      ; do
+  if [[ -e "${i}" ]]; then
+    rm -f "${i}"  # For unversioned files.
+    svn revert "${i}"
+  fi;
+done
+
+echo Remove the Clang tools shim dir
+CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools
+rm -rfv ${CHROME_TOOLS_SHIM_DIR}
+
+echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
+if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
+                    "${LLVM_DIR}"; then
+  echo Checkout failed, retrying
+  rm -rf "${LLVM_DIR}"
+  svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}"
+fi
+
+echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}"
+svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}"
+
+# We have moved from building compiler-rt in the LLVM tree, to a separate
+# directory. Nuke any previous checkout to avoid building it.
+rm -rf "${LLVM_DIR}/projects/compiler-rt"
+
+echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}"
+svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \
+               "${COMPILER_RT_DIR}"
+
+# clang needs a libc++ checkout, else -stdlib=libc++ won't find includes
+# (i.e. this is needed for bootstrap builds).
+if [ "${OS}" = "Darwin" ]; then
+  echo Getting libc++ r"${CLANG_REVISION}" in "${LIBCXX_DIR}"
+  svn co --force "${LLVM_REPO_URL}/libcxx/trunk@${CLANG_REVISION}" \
+                 "${LIBCXX_DIR}"
+fi
+
+# While we're bundling our own libc++ on OS X, we need to compile libc++abi
+# into it too (since OS X 10.6 doesn't have libc++abi.dylib either).
+if [ "${OS}" = "Darwin" ]; then
+  echo Getting libc++abi r"${CLANG_REVISION}" in "${LIBCXXABI_DIR}"
+  svn co --force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \
+                 "${LIBCXXABI_DIR}"
+fi
+
+if [[ -n "$with_patches" ]]; then
+  # No patches.
+  true
+fi
+
+# Echo all commands.
+set -x
+
+# Set default values for CC and CXX if they're not set in the environment.
+CC=${CC:-cc}
+CXX=${CXX:-c++}
+
+if [[ -n "${gcc_toolchain}" ]]; then
+  # Use the specified gcc installation for building.
+  CC="$gcc_toolchain/bin/gcc"
+  CXX="$gcc_toolchain/bin/g++"
+  # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler,
+  # etc.) find the .so.
+  export LD_LIBRARY_PATH="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))"
+fi
+
+CFLAGS=""
+CXXFLAGS=""
+LDFLAGS=""
+
+# LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
+# needed, on OS X it requires libc++. clang only automatically links to libc++
+# when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on
+# OS X versions as old as 10.7.
+# TODO(thakis): Some bots are still on 10.6 (nacl...), so for now bundle
+# libc++.dylib.  Remove this once all bots are on 10.7+, then use
+# -DLLVM_ENABLE_LIBCXX=ON and change deployment_target to 10.7.
+deployment_target=""
+
+if [ "${OS}" = "Darwin" ]; then
+  # When building on 10.9, /usr/include usually doesn't exist, and while
+  # Xcode's clang automatically sets a sysroot, self-built clangs don't.
+  CFLAGS="-isysroot $(xcrun --show-sdk-path)"
+  CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}"
+
+  if [[ -n "${bootstrap}" ]]; then
+    deployment_target=10.6
+  fi
+fi
+
+# Build bootstrap clang if requested.
+if [[ -n "${bootstrap}" ]]; then
+  ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}"
+  echo "Building bootstrap compiler"
+  mkdir -p "${LLVM_BOOTSTRAP_DIR}"
+  pushd "${LLVM_BOOTSTRAP_DIR}"
+
+  cmake -GNinja \
+      -DCMAKE_BUILD_TYPE=Release \
+      -DLLVM_ENABLE_ASSERTIONS=ON \
+      -DLLVM_TARGETS_TO_BUILD=host \
+      -DLLVM_ENABLE_THREADS=OFF \
+      -DCMAKE_INSTALL_PREFIX="${ABS_INSTALL_DIR}" \
+      -DCMAKE_C_COMPILER="${CC}" \
+      -DCMAKE_CXX_COMPILER="${CXX}" \
+      -DCMAKE_C_FLAGS="${CFLAGS}" \
+      -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
+      ../llvm
+
+  ninja
+  if [[ -n "${run_tests}" ]]; then
+    ninja check-all
+  fi
+
+  ninja install
+  if [[ -n "${gcc_toolchain}" ]]; then
+    # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap
+    # compiler can start.
+    cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \
+      "${ABS_INSTALL_DIR}/lib/"
+  fi
+
+  popd
+  CC="${ABS_INSTALL_DIR}/bin/clang"
+  CXX="${ABS_INSTALL_DIR}/bin/clang++"
+
+  if [[ -n "${gcc_toolchain}" ]]; then
+    # Tell the bootstrap compiler to use a specific gcc prefix to search
+    # for standard library headers and shared object files.
+    CFLAGS="--gcc-toolchain=${gcc_toolchain}"
+    CXXFLAGS="--gcc-toolchain=${gcc_toolchain}"
+  fi
+
+  echo "Building final compiler"
+fi
+
+# Build clang (in a separate directory).
+# The clang bots have this path hardcoded in built/scripts/slave/compile.py,
+# so if you change it you also need to change these links.
+mkdir -p "${LLVM_BUILD_DIR}"
+pushd "${LLVM_BUILD_DIR}"
+
+# Build libc++.dylib while some bots are still on OS X 10.6.
+if [ "${OS}" = "Darwin" ]; then
+  rm -rf libcxxbuild
+  LIBCXXFLAGS="-O3 -std=c++11 -fstrict-aliasing"
+
+  # libcxx and libcxxabi both have a file stdexcept.cpp, so put their .o files
+  # into different subdirectories.
+  mkdir -p libcxxbuild/libcxx
+  pushd libcxxbuild/libcxx
+  ${CXX:-c++} -c ${CXXFLAGS} ${LIBCXXFLAGS} "${ABS_LIBCXX_DIR}"/src/*.cpp
+  popd
+
+  mkdir -p libcxxbuild/libcxxabi
+  pushd libcxxbuild/libcxxabi
+  ${CXX:-c++} -c ${CXXFLAGS} ${LIBCXXFLAGS} "${ABS_LIBCXXABI_DIR}"/src/*.cpp -I"${ABS_LIBCXXABI_DIR}/include"
+  popd
+
+  pushd libcxxbuild
+  ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \
+    -nodefaultlibs -current_version 1 -compatibility_version 1 \
+    -lSystem -install_name @executable_path/libc++.dylib \
+    -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \
+    -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \
+    -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp
+  ln -sf libc++.1.dylib libc++.dylib
+  popd
+  LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild"
+
+  if [[ -n "${bootstrap}" ]]; then
+    # Now that the libc++ headers have been installed and libc++.dylib is built,
+    # delete the libc++ checkout again so that it's not part of the main
+    # build below -- the libc++(abi) tests don't pass on OS X in bootstrap
+    # builds (http://llvm.org/PR24068)
+    rm -rf "${ABS_LIBCXX_DIR}"
+    rm -rf "${ABS_LIBCXXABI_DIR}"
+    CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_INSTALL_DIR}/include/c++/v1 ${CFLAGS}"
+  fi
+fi
+
+# Find the binutils include dir for the gold plugin.
+BINUTILS_INCDIR=""
+if [ "${OS}" = "Linux" ]; then
+  BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include"
+fi
+
+
+# If building at head, define a macro that plugins can use for #ifdefing
+# out code that builds at head, but not at CLANG_REVISION or vice versa.
+if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then
+  CFLAGS="${CFLAGS} -DLLVM_FORCE_HEAD_REVISION"
+  CXXFLAGS="${CXXFLAGS} -DLLVM_FORCE_HEAD_REVISION"
+fi
+
+# Hook the Chromium tools into the LLVM build. Several Chromium tools have
+# dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools
+# in the tools subdirectory, so install a shim CMakeLists.txt that forwards to
+# the real directory for the Chromium tools.
+# Note that the shim directory name intentionally has no _ or _. The implicit
+# tool detection logic munges them in a weird way.
+mkdir -v ${CHROME_TOOLS_SHIM_DIR}
+cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF
+# Since tools/clang isn't actually a subdirectory, use the two argument version
+# to specify where build artifacts go. CMake doesn't allow reusing the same
+# binary dir for multiple source dirs, so the build artifacts have to go into a
+# subdirectory...
+add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a)
+EOF
+rm -fv CMakeCache.txt
+MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DLLVM_ENABLE_ASSERTIONS=ON \
+    -DLLVM_ENABLE_THREADS=OFF \
+    -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \
+    -DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \
+    -DCMAKE_C_COMPILER="${CC}" \
+    -DCMAKE_CXX_COMPILER="${CXX}" \
+    -DCMAKE_C_FLAGS="${CFLAGS}" \
+    -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
+    -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
+    -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
+    -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
+    -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \
+    -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \
+    -DCHROMIUM_TOOLS="${chrome_tools}" \
+    "${ABS_LLVM_DIR}"
+env
+
+if [[ -n "${gcc_toolchain}" ]]; then
+  # Copy in the right stdlibc++.so.6 so clang can start.
+  mkdir -p lib
+  cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" lib/
+fi
+
+ninja
+# If any Chromium tools were built, install those now.
+if [[ -n "${chrome_tools}" ]]; then
+  ninja cr-install
+fi
+
+STRIP_FLAGS=
+if [ "${OS}" = "Darwin" ]; then
+  # See http://crbug.com/256342
+  STRIP_FLAGS=-x
+
+  cp libcxxbuild/libc++.1.dylib bin/
+fi
+strip ${STRIP_FLAGS} bin/clang
+popd
+
+# Build compiler-rt out-of-tree.
+mkdir -p "${COMPILER_RT_BUILD_DIR}"
+pushd "${COMPILER_RT_BUILD_DIR}"
+
+rm -fv CMakeCache.txt
+MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DLLVM_ENABLE_ASSERTIONS=ON \
+    -DLLVM_ENABLE_THREADS=OFF \
+    -DCMAKE_C_COMPILER="${CC}" \
+    -DCMAKE_CXX_COMPILER="${CXX}" \
+    -DSANITIZER_MIN_OSX_VERSION="10.7" \
+    -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
+    "${ABS_COMPILER_RT_DIR}"
+
+ninja
+
+# Copy selected output to the main tree.
+# Darwin doesn't support cp --parents, so pipe through tar instead.
+CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \
+     sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p')
+ABS_LLVM_CLANG_LIB_DIR="${ABS_LLVM_BUILD_DIR}/lib/clang/${CLANG_VERSION}"
+tar -c *blacklist.txt | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
+tar -c include/sanitizer | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
+if [[ "${OS}" = "Darwin" ]]; then
+  tar -c lib/darwin | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
+else
+  tar -c lib/linux | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
+fi
+
+popd
+
+if [[ -n "${with_android}" ]]; then
+  # Make a standalone Android toolchain.
+  ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
+      --platform=android-19 \
+      --install-dir="${LLVM_BUILD_DIR}/android-toolchain-arm" \
+      --system=linux-x86_64 \
+      --stl=stlport \
+      --toolchain=arm-linux-androideabi-4.9
+
+  # Do the same for x86.
+  ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
+      --platform=android-19 \
+      --install-dir="${LLVM_BUILD_DIR}/android-toolchain-i686" \
+      --system=linux-x86_64 \
+      --stl=stlport \
+      --toolchain=x86-4.9
+
+  for target_arch in "arm" "i686"; do
+    # Android NDK r9d copies a broken unwind.h into the toolchain, see
+    # http://crbug.com/357890
+    rm -v "${LLVM_BUILD_DIR}"/android-toolchain-${target_arch}/include/c++/*/unwind.h
+
+    # Build ASan runtime for Android in a separate build tree.
+    mkdir -p ${LLVM_BUILD_DIR}/android-${target_arch}
+    pushd ${LLVM_BUILD_DIR}/android-${target_arch}
+    rm -fv CMakeCache.txt
+    MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
+        -DCMAKE_BUILD_TYPE=Release \
+        -DLLVM_ENABLE_ASSERTIONS=ON \
+        -DLLVM_ENABLE_THREADS=OFF \
+        -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
+        -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
+        -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
+        -DCMAKE_C_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=${PWD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-${target_arch}" \
+        -DCMAKE_CXX_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=${PWD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-${target_arch}" \
+        -DANDROID=1 \
+        "${ABS_COMPILER_RT_DIR}"
+    ninja libclang_rt.asan-${target_arch}-android.so
+
+    # And copy it into the main build tree.
+    cp "$(find -name libclang_rt.asan-${target_arch}-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/lib/linux/"
+    popd
+  done
+fi
+
+if [[ -n "$run_tests" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then
+  # Run Chrome tool tests.
+  ninja -C "${LLVM_BUILD_DIR}" cr-check-all
+fi
+if [[ -n "$run_tests" ]]; then
+  # Run the LLVM and Clang tests.
+  ninja -C "${LLVM_BUILD_DIR}" check-all
+fi
+
+# After everything is done, log success for this revision.
+echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
index bcb5801..336a33a 100644 (file)
     {
       'target_name': 'v8_snapshot',
       'type': 'static_library',
+      'standalone_static_library': 1,
       'conditions': [
         ['want_separate_host_toolset==1', {
           'toolsets': ['host', 'target'],
     {
       'target_name': 'v8_nosnapshot',
       'type': 'static_library',
+      'standalone_static_library': 1,
       'dependencies': [
         'v8_base',
       ],
     {
       'target_name': 'v8_external_snapshot',
       'type': 'static_library',
+      'standalone_static_library': 1,
       'conditions': [
         [ 'v8_use_external_startup_data==1', {
           'conditions': [
     {
       'target_name': 'v8_base',
       'type': 'static_library',
+      'standalone_static_library': 1,
       'dependencies': [
         'v8_libbase',
       ],
     {
       'target_name': 'v8_libbase',
       'type': 'static_library',
+      'standalone_static_library': 1,
       'variables': {
         'optimize': 'max',
       },
     {
       'target_name': 'v8_libplatform',
       'type': 'static_library',
+      'standalone_static_library': 1,
       'variables': {
         'optimize': 'max',
       },