Title: [269076] trunk
Revision
269076
Author
[email protected]
Date
2020-10-27 14:54:25 -0700 (Tue, 27 Oct 2020)

Log Message

Fix "usage" message when invoking `ar -V`
https://bugs.webkit.org/show_bug.cgi?id=218255
<rdar://problem/70735674>

Reviewed by Fujii Hironori.

The Mac/BSD version of `ar` does not support the -V flag. This flag is
used unconditionally in OptionsCommon.cmake when trying to determine
if the installed `ar` supports the thinning of archives, leading to a
"usage" message being emitted on macOS.

Avoid this message by capturing the error-output. Examine the output
to see if it's a "usage" message. If so, then treat the `ar` as one
that does not support thinning. Any other error-output is printed as a
warning. If there is no error-output, continue processing as normal.

* Source/cmake/OptionsCommon.cmake:

Modified Paths

Diff

Modified: trunk/ChangeLog (269075 => 269076)


--- trunk/ChangeLog	2020-10-27 21:49:38 UTC (rev 269075)
+++ trunk/ChangeLog	2020-10-27 21:54:25 UTC (rev 269076)
@@ -1,3 +1,23 @@
+2020-10-27  Keith Rollin  <[email protected]>
+
+        Fix "usage" message when invoking `ar -V`
+        https://bugs.webkit.org/show_bug.cgi?id=218255
+        <rdar://problem/70735674>
+
+        Reviewed by Fujii Hironori.
+
+        The Mac/BSD version of `ar` does not support the -V flag. This flag is
+        used unconditionally in OptionsCommon.cmake when trying to determine
+        if the installed `ar` supports the thinning of archives, leading to a
+        "usage" message being emitted on macOS.
+
+        Avoid this message by capturing the error-output. Examine the output
+        to see if it's a "usage" message. If so, then treat the `ar` as one
+        that does not support thinning. Any other error-output is printed as a
+        warning. If there is no error-output, continue processing as normal.
+
+        * Source/cmake/OptionsCommon.cmake:
+
 2020-10-27  Brian Burg  <[email protected]>
 
         Web Inspector: add ENABLE(INSPECTOR_EXTENSIONS) to feature defines

Modified: trunk/Source/cmake/OptionsCommon.cmake (269075 => 269076)


--- trunk/Source/cmake/OptionsCommon.cmake	2020-10-27 21:49:38 UTC (rev 269075)
+++ trunk/Source/cmake/OptionsCommon.cmake	2020-10-27 21:54:25 UTC (rev 269076)
@@ -7,8 +7,13 @@
 
 option(USE_THIN_ARCHIVES "Produce all static libraries as thin archives" ON)
 if (USE_THIN_ARCHIVES)
-    execute_process(COMMAND ${CMAKE_AR} -V OUTPUT_VARIABLE AR_VERSION)
-    if ("${AR_VERSION}" MATCHES "^GNU ar")
+    execute_process(COMMAND ${CMAKE_AR} -V OUTPUT_VARIABLE AR_VERSION ERROR_VARIABLE AR_ERROR)
+    if ("${AR_ERROR}" MATCHES "^usage:")
+        # This `ar` doesn't understand "-V". Ignore the error and treat this as
+        # an unsupported `ar`. TODO: Determine BSD or Xcode equivalent.
+    elseif ("${AR_ERROR}")
+        message(WARNING "Error from `ar`: ${AR_ERROR}")
+    elseif ("${AR_VERSION}" MATCHES "^GNU ar")
         set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
         set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
         set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> rT <TARGET> <LINK_FLAGS> <OBJECTS>")
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to