From 5b55310443cafb1df5e611b75561055d936e096d Mon Sep 17 00:00:00 2001 From: "bradnelson@google.com" Date: Tue, 11 Aug 2009 00:46:25 +0000 Subject: [PATCH] Fixing up hammer script to work in the nacl and o3d trees. BUG=None TEST=None Review URL: http://codereview.chromium.org/164099 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@22990 0039d316-1c4b-4281-b951-d872f2087c98 --- hammer | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/hammer b/hammer index a95774dd39..129c68d57e 100755 --- a/hammer +++ b/hammer @@ -1,8 +1,27 @@ #!/bin/sh +# +# Copyright (c) 2006-2008 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. + +# A script to invoke scons in gyp generated projects. + +# Find the 'src' directory by looking for the site_scons directory. +# This method allows trees that don't use the name src to use this script. +# Explicitly skip site_scons directories that are from the 'software +# construction toolkit', since these are not gyp compatible. +SRC_DIR=`pwd` +while `test ! -d "${SRC_DIR}/site_scons" -o \ + -e "${SRC_DIR}/site_scons/site_tools/component_setup.py"`; do + PARENT_DIR="$(dirname ${SRC_DIR})" + if `test "${SRC_DIR}" == "${PARENT_DIR}"`; then + echo "ERROR: hammer must be run in a directory with site_scons under" >&2 + echo " the root of the project tree." >&2 + exit 1 + fi + SRC_DIR="${PARENT_DIR}" +done -# The first expression catches when we're actually in the /src directory. -# The second expressions strips everything after the last /src occurrence. -SRC_DIR=`pwd | sed -e '\;/src$;q' -e 's;\(.*/src\)/.*;\1;'` SCONS="${SRC_DIR}/third_party/scons/scons.py" SITE_SCONS="${SRC_DIR}/site_scons"