Redo removing annoying link messages

From mac's man libtool
   Libtool with -static is intended to replace ar(5) and ranlib

Libtool allows RSP files, and has -no_warning_for_no_symbols

Change-Id: I1d61095db02ae83fdf491c26eae7d9d4cefc2d17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250337
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index 5d05f39..9461e86 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -117,6 +117,10 @@
   }
 }
 
+if (is_mac || is_ios) {
+  ar = "libtool"
+}
+
 if (target_os == "win") {
   # By default we look for 2017 (Enterprise, Pro, and Community), then 2015. If MSVC is installed in a
   # non-default location, you can set win_vc to inform us where it is.
diff --git a/gn/ar.py b/gn/ar.py
deleted file mode 100644
index c7ffb04..0000000
--- a/gn/ar.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2016 Google Inc.
-#
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import subprocess
-import sys
-
-# Equivalent to: rm -f $2 && $1 rcs $2 @$3
-
-ar, output, rspfile = sys.argv[1:]
-
-if os.path.exists(output):
-  os.remove(output)
-
-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)
diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
index 8ecf965..96e3176 100644
--- a/gn/toolchain/BUILD.gn
+++ b/gn/toolchain/BUILD.gn
@@ -255,10 +255,15 @@
     }
 
     tool("alink") {
-      rspfile = "{{output}}.rsp"
-      rspfile_content = "{{inputs}}"
-      ar_py = rebase_path("../ar.py")
-      command = "python $ar_py $ar {{output}} $rspfile"
+      if (is_mac || is_ios) {
+        command =
+            "$ar -static -o {{output}} -no_warning_for_no_symbols {{inputs}}"
+      } else {
+        rspfile = "{{output}}.rsp"
+        rspfile_content = "{{inputs}}"
+        command = "$ar rcs {{output}} @$rspfile"
+      }
+
       outputs = [
         "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
       ]