OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """cups-config wrapper. | 6 """cups-config wrapper. |
7 | 7 |
8 cups-config, at least on Ubuntu Lucid and Natty, dumps all | 8 cups-config, at least on Ubuntu Lucid and Natty, dumps all |
9 cflags/ldflags/libs when passed the --libs argument. gyp would like | 9 cflags/ldflags/libs when passed the --libs argument. gyp would like |
10 to keep these separate: cflags are only needed when compiling files | 10 to keep these separate: cflags are only needed when compiling files |
(...skipping 28 matching lines...) Expand all Loading... |
39 elif (flag.startswith('-L') or flag.startswith('-Wl,')): | 39 elif (flag.startswith('-L') or flag.startswith('-Wl,')): |
40 flag_mode = '--ldflags' | 40 flag_mode = '--ldflags' |
41 elif (flag.startswith('-I') or flag.startswith('-D')): | 41 elif (flag.startswith('-I') or flag.startswith('-D')): |
42 flag_mode = '--cflags' | 42 flag_mode = '--cflags' |
43 | 43 |
44 # Be conservative: for flags where we don't know which mode they | 44 # Be conservative: for flags where we don't know which mode they |
45 # belong in, always include them. | 45 # belong in, always include them. |
46 if flag_mode is None or flag_mode == mode: | 46 if flag_mode is None or flag_mode == mode: |
47 flags_subset.append(flag) | 47 flags_subset.append(flag) |
48 | 48 |
| 49 # Note: cross build is confused by the option, and may trigger linker |
| 50 # warning causing build error. |
| 51 if '-lgnutls' in flags_subset: |
| 52 flags_subset.remove('-lgnutls') |
| 53 |
49 return flags_subset | 54 return flags_subset |
50 | 55 |
51 | 56 |
52 def main(): | 57 def main(): |
53 if len(sys.argv) != 2: | 58 if len(sys.argv) != 2: |
54 usage() | 59 usage() |
55 return 1 | 60 return 1 |
56 | 61 |
57 mode = sys.argv[1] | 62 mode = sys.argv[1] |
58 if mode not in ('--cflags', '--libs', '--ldflags'): | 63 if mode not in ('--cflags', '--libs', '--ldflags'): |
59 usage() | 64 usage() |
60 return 1 | 65 return 1 |
61 flags = run_cups_config(mode) | 66 flags = run_cups_config(mode) |
62 print ' '.join(flags) | 67 print ' '.join(flags) |
63 return 0 | 68 return 0 |
64 | 69 |
65 | 70 |
66 if __name__ == '__main__': | 71 if __name__ == '__main__': |
67 sys.exit(main()) | 72 sys.exit(main()) |
OLD | NEW |