Home | History | Annotate | Download | only in tools
      1 #!/bin/bash
      2 
      3 # Copyright (c) 2012 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 # Build a tarball distribution of the Virtual Me2Me host for Linux.
      8 # This script should be run from the top-level "src" directory - the output
      9 # tarball will be created in the parent directory (to avoid accidentally
     10 # committing it if "git commit -a" is typed).
     11 # To do a clean build, remove the out/Release directory before running this
     12 # script.
     13 
     14 set -eu
     15 
     16 MERGE_BASE="$(git merge-base HEAD origin/git-svn)"
     17 REVISION="$(git svn find-rev "$MERGE_BASE")"
     18 if [ -z "$REVISION" ]; then
     19   echo "svn revision number not found"
     20   REVISION_SUFFIX=""
     21 else
     22   REVISION_SUFFIX="_r$REVISION"
     23 fi
     24 
     25 echo "Building..."
     26 make -j25 BUILDTYPE=Release remoting_host_keygen remoting_me2me_host
     27 
     28 FILES="\
     29   remoting/tools/gaia_auth.py \
     30   remoting/tools/keygen.py \
     31   remoting/tools/me2me_virtual_host.py \
     32   out/Release/remoting_host_keygen \
     33   out/Release/remoting_me2me_host \
     34 "
     35 
     36 TEMP_DIR="$(mktemp -d)"
     37 trap 'rm -rf "$TEMP_DIR"' EXIT
     38 
     39 TARBALL_DIR="virtual_me2me"
     40 mkdir "$TEMP_DIR/$TARBALL_DIR"
     41 
     42 for file in $FILES; do
     43   cp "$file" "$TEMP_DIR/$TARBALL_DIR"
     44   strip "$TEMP_DIR/$TARBALL_DIR/$file" 2>/dev/null || true
     45 done
     46 
     47 TARBALL="../virtual_me2me$REVISION_SUFFIX.tgz"
     48 
     49 tar -zcf "$TARBALL" -C "$TEMP_DIR" "$TARBALL_DIR"
     50 
     51 echo "Tarball built: $TARBALL"
     52