summaryrefslogtreecommitdiffstats
path: root/base/allocator
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 17:06:56 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 17:06:56 +0000
commit69dda955a73ad2908ba94126e0a3fe940473f93d (patch)
tree07ffdd94d6dc0307cd0f81438c6646192525f466 /base/allocator
parent011cfc7db8473b172cf92db23329506c1264b2ff (diff)
downloadchromium_src-69dda955a73ad2908ba94126e0a3fe940473f93d.zip
chromium_src-69dda955a73ad2908ba94126e0a3fe940473f93d.tar.gz
chromium_src-69dda955a73ad2908ba94126e0a3fe940473f93d.tar.bz2
Replace prep_libc.sh with prep_libc.py, and quiet the output
Towards addressing two semi-related problems in the linked bugs. One is that the cygwin-run steps are unreliable, especially on Win8, so move away from using shell scripts in gyp actions. The other is that the .sh file let 'lib' echo its arguments, which adds unnecessary noise to the build, especially the quieter ninja build. R=jar@chromium.org BUG=126483,123026 Review URL: https://chromiumcodereview.appspot.com/10388215 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/allocator')
-rw-r--r--base/allocator/allocator.gyp6
-rw-r--r--base/allocator/prep_libc.py55
-rwxr-xr-xbase/allocator/prep_libc.sh39
3 files changed, 59 insertions, 41 deletions
diff --git a/base/allocator/allocator.gyp b/base/allocator/allocator.gyp
index 71f227c..bfd9ec0 100644
--- a/base/allocator/allocator.gyp
+++ b/base/allocator/allocator.gyp
@@ -458,16 +458,18 @@
{
'action_name': 'libcmt',
'inputs': [
- 'prep_libc.sh',
+ 'prep_libc.py',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib',
],
'action': [
- './prep_libc.sh',
+ 'python',
+ 'prep_libc.py',
'$(VCInstallDir)lib',
'<(SHARED_INTERMEDIATE_DIR)/allocator',
],
+ 'msvs_cygwin_shell': '0',
},
],
},
diff --git a/base/allocator/prep_libc.py b/base/allocator/prep_libc.py
new file mode 100644
index 0000000..7390356
--- /dev/null
+++ b/base/allocator/prep_libc.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+# 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 takes libcmt.lib for VS2005/08/10 and removes the allocation
+# related functions from it.
+#
+# Usage: prep_libc.py <VCInstallDir> <OutputDir>
+#
+# VCInstallDir is the path where VC is installed, something like:
+# C:\Program Files\Microsoft Visual Studio 8\VC\
+#
+# OutputDir is the directory where the modified libcmt file should be stored.
+
+import os
+import shutil
+import subprocess
+import sys
+
+def run(command, filter=None):
+ """Run |command|, removing any lines that match |filter|. The filter is
+ to remove the echoing of input filename that 'lib' does."""
+ popen = subprocess.Popen(
+ command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ out, _ = popen.communicate()
+ for line in out.splitlines():
+ if filter and line.strip() != filter:
+ print line
+ return popen.returncode
+
+def main():
+ vs_install_dir = sys.argv[1]
+ outdir = sys.argv[2]
+ output_lib = os.path.join(outdir, 'libcmt.lib')
+ shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.lib'), output_lib)
+ shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.pdb'),
+ os.path.join(outdir, 'libcmt.pdb'))
+ vspaths = [
+ 'build\\intel\\mt_obj\\',
+ 'f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\'
+ ]
+ objfiles = ['malloc', 'free', 'realloc', 'new', 'delete', 'new2', 'delete2',
+ 'align', 'msize', 'heapinit', 'expand', 'heapchk', 'heapwalk',
+ 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl',
+ 'new_mode', 'newopnt']
+ for obj in objfiles:
+ for vspath in vspaths:
+ cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' %
+ (vspath, obj, output_lib))
+ run(cmd, obj + '.obj')
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/base/allocator/prep_libc.sh b/base/allocator/prep_libc.sh
deleted file mode 100755
index d1ceb80..0000000
--- a/base/allocator/prep_libc.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# 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 takes libcmt.lib for VS2005 and removes the allocation related
-# functions from it.
-#
-# Usage: prep_libcmt.bat <VCInstallDir> <OutputFile>
-#
-# VCInstallDir is the path where VC is installed, typically:
-# C:\Program Files\Microsoft Visual Studio 8\VC\
-#
-# OutputFile is the directory where the modified libcmt file should be stored.
-#
-
-LIBCMT="${1}\\libcmt.lib"
-LIBCMTPDB="${1}\\libcmt.pdb"
-OUTDIR=$2
-OUTCMT="${2}\\libcmt.lib"
-
-mkdir -p $OUTDIR
-cp "$LIBCMT" "$OUTDIR"
-cp "$LIBCMTPDB" "$OUTDIR"
-
-
-# We'll remove the symbols based on paths found in either the VS2005 or VS2008
-# libcmt.lib files.
-LIBCMTSRCPATHVS2005="build\\intel\\mt_obj\\"
-LIBCMTSRCPATHVS2008="f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\"
-
-OBJFILES="malloc.obj free.obj realloc.obj new.obj delete.obj new2.obj delete2.obj align.obj msize.obj heapinit.obj expand.obj heapchk.obj heapwalk.obj heapmin.obj sbheap.obj calloc.obj recalloc.obj calloc_impl.obj new_mode.obj newopnt.obj"
-
-for FILE in $OBJFILES
-do
- echo ${FILE}
- LIB /NOLOGO /IGNORE:4006,4014,4221 /REMOVE:${LIBCMTSRCPATHVS2005}${FILE} $OUTCMT
- LIB /NOLOGO /IGNORE:4006,4014,4221 /REMOVE:${LIBCMTSRCPATHVS2008}${FILE} $OUTCMT
-done