aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn/ar.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn/ar.py')
-rw-r--r--gn/ar.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/gn/ar.py b/gn/ar.py
index dc3ae8d948..c7ffb04f67 100644
--- a/gn/ar.py
+++ b/gn/ar.py
@@ -15,4 +15,16 @@ ar, output, rspfile = sys.argv[1:]
if os.path.exists(output):
os.remove(output)
-sys.exit(subprocess.call([ar, "rcs", output, "@" + rspfile]))
+
+if sys.platform != 'darwin':
+ sys.exit(subprocess.call([ar, "rcs", output, "@" + rspfile]))
+
+# Mac ar doesn't support @rspfile syntax.
+objects = open(rspfile).read().split()
+# It also spams stderr with warnings about objects having no symbols.
+pipe = subprocess.Popen([ar, "rcs", output] + objects, stderr=subprocess.PIPE)
+_, err = pipe.communicate()
+for line in err.splitlines():
+ if 'has no symbols' not in line:
+ sys.stderr.write(line + '\n')
+sys.exit(pipe.returncode)