media/webrtc/trunk/tools/clang/scripts/package.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #!/bin/bash
michael@0 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 3 # Use of this source code is governed by a BSD-style license that can be
michael@0 4 # found in the LICENSE file.
michael@0 5
michael@0 6 # This script will check out llvm and clang, and then package the results up
michael@0 7 # to a tgz file.
michael@0 8
michael@0 9 THIS_DIR="$(dirname "${0}")"
michael@0 10 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
michael@0 11 LLVM_BOOTSTRAP_DIR="${THIS_DIR}/../../../third_party/llvm-bootstrap"
michael@0 12 LLVM_BUILD_DIR="${THIS_DIR}/../../../third_party/llvm-build"
michael@0 13 LLVM_BIN_DIR="${LLVM_BUILD_DIR}/Release+Asserts/bin"
michael@0 14 LLVM_LIB_DIR="${LLVM_BUILD_DIR}/Release+Asserts/lib"
michael@0 15
michael@0 16 echo "Diff in llvm:" | tee buildlog.txt
michael@0 17 svn stat "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt
michael@0 18 svn diff "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt
michael@0 19 echo "Diff in llvm/tools/clang:" | tee -a buildlog.txt
michael@0 20 svn stat "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt
michael@0 21 svn diff "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt
michael@0 22 echo "Diff in llvm/projects/compiler-rt:" | tee -a buildlog.txt
michael@0 23 svn stat "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt
michael@0 24 svn diff "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt
michael@0 25
michael@0 26 echo "Starting build" | tee -a buildlog.txt
michael@0 27
michael@0 28 set -ex
michael@0 29
michael@0 30 # Do a clobber build.
michael@0 31 rm -rf "${LLVM_BOOTSTRAP_DIR}"
michael@0 32 rm -rf "${LLVM_BUILD_DIR}"
michael@0 33 "${THIS_DIR}"/update.sh --run-tests --bootstrap --force-local-build 2>&1 | \
michael@0 34 tee -a buildlog.txt
michael@0 35
michael@0 36 R=$("${LLVM_BIN_DIR}/clang" --version | \
michael@0 37 sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p')
michael@0 38
michael@0 39 PDIR=clang-$R
michael@0 40 rm -rf $PDIR
michael@0 41 mkdir $PDIR
michael@0 42 mkdir $PDIR/bin
michael@0 43 mkdir $PDIR/lib
michael@0 44
michael@0 45 # Copy buildlog over.
michael@0 46 cp buildlog.txt $PDIR/
michael@0 47
michael@0 48 # Copy clang into pdir, symlink clang++ to it.
michael@0 49 cp "${LLVM_BIN_DIR}/clang" $PDIR/bin/
michael@0 50 (cd $PDIR/bin && ln -sf clang clang++ && cd -)
michael@0 51
michael@0 52 # Copy plugins. Some of the dylibs are pretty big, so copy only the ones we
michael@0 53 # care about.
michael@0 54 if [ "$(uname -s)" = "Darwin" ]; then
michael@0 55 cp "${LLVM_LIB_DIR}/libFindBadConstructs.dylib" $PDIR/lib
michael@0 56 else
michael@0 57 cp "${LLVM_LIB_DIR}/libFindBadConstructs.so" $PDIR/lib
michael@0 58 fi
michael@0 59
michael@0 60 # Copy built-in headers (lib/clang/3.2/include).
michael@0 61 # libcompiler-rt puts all kinds of libraries there too, but we want only ASan.
michael@0 62 if [ "$(uname -s)" = "Darwin" ]; then
michael@0 63 # Keep only Release+Asserts/lib/clang/3.2/lib/darwin/libclang_rt.asan_osx.a
michael@0 64 find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/darwin*' | grep -v asan | \
michael@0 65 xargs rm
michael@0 66 else
michael@0 67 # Keep only
michael@0 68 # Release+Asserts/lib/clang/3.2/lib/linux/libclang_rt.{asan,tsan}-x86_64.a
michael@0 69 # TODO(thakis): Make sure the 32bit version of ASan runtime is kept too once
michael@0 70 # that's built. TSan runtime exists only for 64 bits.
michael@0 71 find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' | \
michael@0 72 grep -v "asan\|tsan" | xargs rm
michael@0 73 fi
michael@0 74
michael@0 75 cp -R "${LLVM_LIB_DIR}/clang" $PDIR/lib
michael@0 76
michael@0 77 tar zcf $PDIR.tgz -C $PDIR bin lib buildlog.txt
michael@0 78
michael@0 79 if [ "$(uname -s)" = "Darwin" ]; then
michael@0 80 PLATFORM=Mac
michael@0 81 else
michael@0 82 PLATFORM=Linux_x64
michael@0 83 fi
michael@0 84
michael@0 85 echo To upload, run:
michael@0 86 echo gsutil cp -a public-read $PDIR.tgz \
michael@0 87 gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz

mercurial