OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 |
| 3 # Copyright (c) 2010 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 import os |
| 7 import subprocess |
| 8 import sys |
| 9 |
| 10 # This python script wraps gcc-mp-4.X so it can handle |
| 11 # compilation options memcheck uses on Mac, including: |
| 12 # a) skip "-arch XXX" |
| 13 # b) define empty "__private_extern__" macro so it doesn't bark |
| 14 # on mac-specific code using this keyword. |
| 15 # c) skip "-mno-dynamic-no-pic" and "-mdynamic-no-pic" |
| 16 # This may not be a very clean solution in general but it works. |
| 17 |
| 18 # The gcc command should be passes as an environment variable, |
| 19 # e.g. GCC_BINARY_MASK=/opt/local/bin/XXX-mp-4.4 |
| 20 assert os.environ.has_key("GCC_BINARY_MASK") |
| 21 gcc_binary_mask = os.environ["GCC_BINARY_MASK"] |
| 22 gcc = gcc_binary_mask.replace("XXX", sys.argv[1]) |
| 23 |
| 24 gcc_command = [gcc, "-D__private_extern__="] |
| 25 skip = 0 |
| 26 for arg in sys.argv[2:]: |
| 27 if skip > 0: |
| 28 skip -= 1 |
| 29 continue |
| 30 if arg == "-arch": |
| 31 skip = 1 |
| 32 continue |
| 33 if arg == "-mno-dynamic-no-pic": |
| 34 continue |
| 35 if arg == "-mdynamic-no-pic": |
| 36 continue |
| 37 gcc_command.append(arg) |
| 38 |
| 39 subprocess.call(gcc_command) |
OLD | NEW |