2019-03-14 13:17:48 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Copyright 2019 the V8 project 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 package a built gcmole plugin together with the
|
|
|
|
# corresponding clang binary into an archive which can be used on the
|
|
|
|
# buildbot infrastructure to be run against V8 checkouts.
|
|
|
|
|
|
|
|
THIS_DIR="$(readlink -f "$(dirname "${0}")")"
|
|
|
|
|
2020-11-16 11:19:54 +00:00
|
|
|
PACKAGE_DIR="${THIS_DIR}/gcmole-tools"
|
|
|
|
PACKAGE_FILE="${THIS_DIR}/gcmole-tools.tar.gz"
|
|
|
|
PACKAGE_SUM="${THIS_DIR}/gcmole-tools.tar.gz.sha1"
|
|
|
|
BUILD_DIR="${THIS_DIR}/bootstrap/build"
|
2019-03-14 13:17:48 +00:00
|
|
|
|
|
|
|
# Echo all commands
|
|
|
|
set -x
|
|
|
|
|
2020-11-16 11:19:54 +00:00
|
|
|
# Clean out any old files
|
|
|
|
if [ -e "${PACKAGE_DIR:?}/bin" ] ; then
|
|
|
|
rm -rf "${PACKAGE_DIR:?}/bin"
|
|
|
|
fi
|
|
|
|
if [ -e "${PACKAGE_DIR:?}/lib" ] ; then
|
|
|
|
rm -rf "${PACKAGE_DIR:?}/lib"
|
|
|
|
fi
|
|
|
|
|
2019-03-14 13:17:48 +00:00
|
|
|
# Copy all required files
|
|
|
|
mkdir -p "${PACKAGE_DIR}/bin"
|
|
|
|
cp "${BUILD_DIR}/bin/clang++" "${PACKAGE_DIR}/bin"
|
|
|
|
mkdir -p "${PACKAGE_DIR}/lib"
|
|
|
|
cp -r "${BUILD_DIR}/lib/clang" "${PACKAGE_DIR}/lib"
|
|
|
|
cp "${THIS_DIR}/libgcmole.so" "${PACKAGE_DIR}"
|
|
|
|
|
2021-10-26 08:19:41 +00:00
|
|
|
# Generate the archive. Set some flags on tar to make the output more
|
|
|
|
# deterministic (e.g. not dependent on timestamps by using the timestamp of
|
|
|
|
# gcmole.cc for all files)
|
2019-03-14 13:17:48 +00:00
|
|
|
cd "$(dirname "${PACKAGE_DIR}")"
|
2021-10-26 08:19:41 +00:00
|
|
|
tar \
|
|
|
|
--sort=name \
|
|
|
|
--owner=root:0 \
|
|
|
|
--group=root:0 \
|
|
|
|
--mtime="${THIS_DIR}/gcmole.cc" \
|
|
|
|
--create \
|
|
|
|
"$(basename "${PACKAGE_DIR}")" | gzip --no-name >"${PACKAGE_FILE}"
|
2019-03-14 13:17:48 +00:00
|
|
|
|
|
|
|
# Generate checksum
|
|
|
|
sha1sum "${PACKAGE_FILE}" | awk '{print $1}' > "${PACKAGE_SUM}"
|
|
|
|
|
|
|
|
set +x
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo You can find a packaged version of gcmole here:
|
|
|
|
echo
|
|
|
|
echo $(readlink -f "${PACKAGE_FILE}")
|
|
|
|
echo
|
2021-01-12 09:35:12 +00:00
|
|
|
echo Upload the update package to the chrome infra:
|
|
|
|
echo
|
|
|
|
echo 'gsutil.py cp tools/gcmole/gcmole-tools.tar.gz gs://chrome-v8-gcmole/$(cat tools/gcmole/gcmole-tools.tar.gz.sha1)'
|
|
|
|
echo
|
|
|
|
echo Run bootstrap.sh in chroot if glibc versions mismatch with bots:
|
|
|
|
echo '# Create chroot'
|
|
|
|
echo 'mkdir -p $CHROOT_DIR'
|
|
|
|
echo 'sudo debootstrap $DEBIAN_VERSION $CHROOT_DIR'
|
|
|
|
echo 'sudo chroot $CHROOT_DIR apt install g++ cmake python git'
|
|
|
|
echo '# Mount ./depot_tools and ./v8 dirs in the chroot:'
|
|
|
|
echo 'sudo chroot $CHROOT_DIR mkdir /docs'
|
|
|
|
echo 'sudo mount --bind /path/to/workspace /docs'
|
|
|
|
echo '# Build gcmole'
|
|
|
|
echo "sudo chroot \$CHROOT_DIR bash -c 'PATH=/docs/depot_tools:\$PATH; /docs/v8/v8/tools/gcmole/bootstrap.sh'"
|
|
|
|
echo
|
2019-03-14 13:17:48 +00:00
|
|
|
echo You can now run gcmole using this command:
|
|
|
|
echo
|
2020-11-18 10:36:23 +00:00
|
|
|
echo CLANG_BIN=\"tools/gcmole/gcmole-tools/bin\" python tools/gcmole/gcmole.py
|
2019-03-14 13:17:48 +00:00
|
|
|
echo
|