Index: build/toolchain/gcc_ar_wrapper_aix.py |
diff --git a/build/toolchain/gcc_ar_wrapper_aix.py b/build/toolchain/gcc_ar_wrapper_aix.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..5f47e2c36db67bd57bc28fff5a899f32cd09b865 |
--- /dev/null |
+++ b/build/toolchain/gcc_ar_wrapper_aix.py |
@@ -0,0 +1,67 @@ |
+#!/usr/bin/env python |
+# Copyright 2015 The Chromium Authors. All rights reserved. |
Michael Achenbach
2017/04/18 13:46:04
nit: 2017
|
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+"""Runs the 'ar' command after removing its output file first. |
+ |
+This script is invoked like: |
+ python gcc_ar_wrapper.py --ar=$AR --output=$OUT $OP $INPUTS |
+to do the equivalent of: |
+ rm -f $OUT && $AR $OP $OUT $INPUTS |
+""" |
+ |
+import argparse |
+import os |
+import subprocess |
+import sys |
+ |
+import wrapper_utils |
+ |
+ |
+def main(): |
+ parser = argparse.ArgumentParser(description=__doc__) |
+ parser.add_argument('--ar', |
+ required=True, |
+ help='The ar binary to run', |
+ metavar='PATH') |
+ parser.add_argument('--output', |
+ required=True, |
+ help='Output archive file', |
+ metavar='ARCHIVE') |
+ parser.add_argument('--plugin', |
+ help='Load plugin') |
+ parser.add_argument('--resource-whitelist', |
Michael Achenbach
2017/04/18 13:46:04
nit: This is unused. Not sure if relevant. The ori
|
+ help='Merge all resource whitelists into a single file.', |
+ metavar='PATH') |
+ parser.add_argument('operation', |
+ help='Operation on the archive') |
+ parser.add_argument('inputs', nargs='+', |
+ help='Input files') |
+ args = parser.parse_args() |
+ |
+# The @file feature is not avaliable on ar for AIX. For linux (and other posix |
+# like systems), the @file_name option reads the contents of file_name as |
+# command line arguments. For AIX we must parse these (rsp files) manually. |
+# read rspfile. |
+ parsed_as_command_line_inputs = wrapper_utils.ResolveRspLinks(args.inputs) |
+ command = [args.ar, '-X64', args.operation] |
+ |
+ if args.plugin is not None: |
+ command += ['--plugin', args.plugin] |
+ command.append(args.output) |
+ command += parsed_as_command_line_inputs |
+ |
+ # Remove the output file first. |
+ try: |
+ os.remove(args.output) |
+ except OSError as e: |
+ if e.errno != os.errno.ENOENT: |
+ raise |
+ |
+ # Now just run the ar command. |
+ return subprocess.call(wrapper_utils.CommandToRun(command)) |
+ |
+ |
+if __name__ == "__main__": |
+ sys.exit(main()) |