1#!/bin/sh
2# Copyright (c) 2009 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5#
6# This script takes libcmt.lib for VS2005 and removes the allocation related
7# functions from it.
8#
9# Usage: prep_libcmt.bat <VCInstallDir> <OutputFile>
10#
11# VCInstallDir is the path where VC is installed, typically:
12#    C:\Program Files\Microsoft Visual Studio 8\VC\
13#
14# OutputFile is the directory where the modified libcmt file should be stored.
15#
16
17LIBCMT="${1}\\libcmt.lib"
18LIBCMTPDB="${1}\\libcmt.pdb"
19OUTDIR=$2
20OUTCMT="${2}\\libcmt.lib"
21
22mkdir -p $OUTDIR
23cp "$LIBCMT" "$OUTDIR"
24cp "$LIBCMTPDB" "$OUTDIR"
25
26
27# We'll remove the symbols based on paths found in either the VS2005 or VS2008
28# libcmt.lib files.
29LIBCMTSRCPATHVS2005="build\\intel\\mt_obj\\"
30LIBCMTSRCPATHVS2008="f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\"
31
32OBJFILES="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"
33
34for FILE in $OBJFILES
35do
36  echo ${FILE}
37  LIB /NOLOGO /IGNORE:4006,4014,4221 /REMOVE:${LIBCMTSRCPATHVS2005}${FILE} $OUTCMT
38  LIB /NOLOGO /IGNORE:4006,4014,4221 /REMOVE:${LIBCMTSRCPATHVS2008}${FILE} $OUTCMT
39done
40