Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / native_client / pnacl / driver / pnacl-ar.py
1 #!/usr/bin/python
2 # Copyright (c) 2012 The Native Client 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 import driver_tools
7 from driver_env import env
8
9 EXTRA_ENV = {
10   'ARGS':    '',
11   'COMMAND': ''
12 }
13 # just pass all args through to 'ARGS' and eventually to the underlying tool
14 PATTERNS = [ ( '(.*)',  "env.append('ARGS', $0)") ]
15
16 def main(argv):
17   if len(argv) ==  0:
18     print get_help(argv)
19     return 1
20
21   env.update(EXTRA_ENV)
22   driver_tools.ParseArgs(argv, PATTERNS)
23
24   # Note: --plugin must come after the command flags, but before the filename.
25   #       (definitely confirmed that it cannot go before the command)
26   #       for now assume command is just the very first args
27   args = env.get('ARGS')
28   command = args.pop(0)
29   env.set('COMMAND', command)
30   env.set('ARGS', *args)
31   driver_tools.Run('"${AR}" ${COMMAND} --plugin=${GOLD_PLUGIN_SO} ${ARGS}')
32   # only reached in case of no errors
33   return 0
34
35
36 def get_help(unused_argv):
37   return """
38 Usage: %s [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [member-name] [count] archive-file file...
39  commands:
40   d            - delete file(s) from the archive
41   m[ab]        - move file(s) in the archive
42   p            - print file(s) found in the archive
43   q[f]         - quick append file(s) to the archive
44   r[ab][f][u]  - replace existing or insert new file(s) into the archive
45   s            - act as ranlib
46   t            - display contents of archive
47   x[o]         - extract file(s) from the archive
48  command specific modifiers:
49   [a]          - put file(s) after [member-name]
50   [b]          - put file(s) before [member-name] (same as [i])
51   [D]          - use zero for timestamps and uids/gids
52   [N]          - use instance [count] of name
53   [f]          - truncate inserted file names
54   [P]          - use full path names when matching
55   [o]          - preserve original dates
56   [u]          - only replace files that are newer than current archive contents
57  generic modifiers:
58   [c]          - do not warn if the library had to be created
59   [s]          - create an archive index (cf. ranlib)
60   [S]          - do not build a symbol table
61   [T]          - make a thin archive
62   [v]          - be verbose
63   [V]          - display the version number
64   @<file>      - read options from <file>
65 """ % env.getone('SCRIPT_NAME')