webrtc-mac.patch 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. From df1a0923f1534a238e9773000dd03dd7b55e2c72 Mon Sep 17 00:00:00 2001
  2. From: David Fifield <david@bamsoftware.com>
  3. Date: Mon, 3 Dec 2018 21:03:16 -0700
  4. Subject: [PATCH 1/6] Disable assertions that prevent cross-compiling for mac.
  5. ---
  6. config/BUILDCONFIG.gn | 4 ++--
  7. toolchain/mac/BUILD.gn | 2 +-
  8. 2 files changed, 3 insertions(+), 3 deletions(-)
  9. diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
  10. index 48ed140c7..15e06808c 100644
  11. --- a/build/config/BUILDCONFIG.gn
  12. +++ b/build/config/BUILDCONFIG.gn
  13. @@ -238,8 +238,8 @@ if (target_os == "android") {
  14. } else if (target_os == "ios") {
  15. _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu"
  16. } else if (target_os == "mac") {
  17. - assert(host_os == "mac", "Mac cross-compiles are unsupported.")
  18. - _default_toolchain = host_toolchain
  19. + # assert(host_os == "mac", "Mac cross-compiles are unsupported.")
  20. + _default_toolchain = "//build/toolchain/mac:clang_$host_cpu"
  21. } else if (target_os == "win") {
  22. # On Windows we use the same toolchain for host and target by default.
  23. # Beware, win cross builds mostly don't work yet, see docs/win_cross.md
  24. diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn
  25. index fc113d6a3..7a0171700 100644
  26. --- a/build/toolchain/mac/BUILD.gn
  27. +++ b/build/toolchain/mac/BUILD.gn
  28. @@ -14,7 +14,7 @@ if (is_ios) {
  29. import("//build/config/mac/mac_sdk.gni")
  30. import("//build/config/mac/symbols.gni")
  31. -assert(host_os == "mac")
  32. +# assert(host_os == "mac")
  33. import("//build/toolchain/cc_wrapper.gni")
  34. import("//build/toolchain/clang_static_analyzer.gni")
  35. --
  36. 2.11.0
  37. From c9cdc59ebb986392367115105ecbc1f5b511130d Mon Sep 17 00:00:00 2001
  38. From: David Fifield <david@bamsoftware.com>
  39. Date: Mon, 3 Dec 2018 21:04:26 -0700
  40. Subject: [PATCH 2/6] Hardcode cross-compiling flags in config/mac/BUILD.gn.
  41. The build system doesn't provide a general way to set flags externally.
  42. "No way to provide extra CFLAGS/CXXFLAGS/LDFLAGS"
  43. https://bugs.chromium.org/p/chromium/issues/detail?id=595653
  44. ---
  45. config/mac/BUILD.gn | 5 +++++
  46. 1 file changed, 5 insertions(+)
  47. diff --git a/build/config/mac/BUILD.gn b/build/config/mac/BUILD.gn
  48. index 4c681e88c..26fbcac2b 100644
  49. --- a/build/config/mac/BUILD.gn
  50. +++ b/build/config/mac/BUILD.gn
  51. @@ -57,6 +57,11 @@ config("runtime_library") {
  52. "-isysroot",
  53. rebase_path(sysroot, root_build_dir),
  54. "-mmacosx-version-min=$mac_deployment_target",
  55. + "-target",
  56. + "x86_64-apple-darwin11",
  57. + "-Wno-unknown-warning-option",
  58. + "-B",
  59. + "/var/tmp/dist/macosx-toolchain/cctools/bin",
  60. ]
  61. asmflags = common_flags
  62. --
  63. 2.11.0
  64. From 86d0882084c8b0595d693cce43e96b01182814b7 Mon Sep 17 00:00:00 2001
  65. From: David Fifield <david@bamsoftware.com>
  66. Date: Tue, 4 Dec 2018 07:37:42 +0000
  67. Subject: [PATCH 3/6] Remove -instcombine-lower-dbg-declare=0 from cflags.
  68. Not supported in our current version of llvm:
  69. clang (LLVM option parsing): Unknown command line argument '-instcombine-lower-dbg-declare=0'. Try: 'clang (LLVM option parsing) -help'
  70. clang (LLVM option parsing): Did you mean '-combiner-use-tbaa=0'?
  71. ---
  72. config/compiler/BUILD.gn | 8 ++++----
  73. 1 file changed, 4 insertions(+), 4 deletions(-)
  74. diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
  75. index a6ba4ea6..e775f9f5 100644
  76. --- a/build/config/compiler/BUILD.gn
  77. +++ b/build/config/compiler/BUILD.gn
  78. @@ -427,10 +427,10 @@ config("compiler") {
  79. if (is_clang && !is_nacl && current_toolchain == host_toolchain &&
  80. target_os != "chromeos") {
  81. cflags += [
  82. - "-Xclang",
  83. - "-mllvm",
  84. - "-Xclang",
  85. - "-instcombine-lower-dbg-declare=0",
  86. + # "-Xclang",
  87. + # "-mllvm",
  88. + # "-Xclang",
  89. + # "-instcombine-lower-dbg-declare=0",
  90. ]
  91. }
  92. --
  93. 2.11.0
  94. From 96d243466006263e99b08ebf8b6085c60b736ccc Mon Sep 17 00:00:00 2001
  95. From: David Fifield <david@bamsoftware.com>
  96. Date: Mon, 3 Dec 2018 21:06:06 -0700
  97. Subject: [PATCH 4/6] Port build/config/mac/plist_util.py to biplist.
  98. So as not to require the plutil command. plutil was only being used to
  99. convert between XML and binary plist formats, because versions of the
  100. plistlib module before Python 3.4 only support the XML format. The
  101. biplist library handles both formats natively.
  102. FAILED: gen/webrtc/examples/AppRTCMobile_info_plist_merged.plist
  103. python ../../build/config/mac/plist_util.py merge -f=xml1 -o=gen/webrtc/examples/AppRTCMobile_info_plist_merged.plist ../../build/config/mac/BuildInfo.plist ../../webrtc/examples/objc/AppRTCMobile/mac/Info.plist
  104. Traceback (most recent call last):
  105. File "../../build/config/mac/plist_util.py", line 254, in <module>
  106. sys.exit(Main())
  107. File "../../build/config/mac/plist_util.py", line 250, in Main
  108. args.func(args)
  109. File "../../build/config/mac/plist_util.py", line 207, in _Execute
  110. data = MergePList(data, LoadPList(filename))
  111. File "../../build/config/mac/plist_util.py", line 121, in LoadPList
  112. subprocess.check_call(['plutil', '-convert', 'xml1', '-o', name, path])
  113. File "/usr/lib/python2.7/subprocess.py", line 535, in check_call
  114. retcode = call(*popenargs, **kwargs)
  115. File "/usr/lib/python2.7/subprocess.py", line 522, in call
  116. return Popen(*popenargs, **kwargs).wait()
  117. File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
  118. errread, errwrite)
  119. File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
  120. raise child_exception
  121. OSError: [Errno 2] No such file or directory
  122. ---
  123. config/mac/plist_util.py | 4 +++-
  124. 1 file changed, 3 insertions(+), 1 deletion(-)
  125. diff --git a/build/config/mac/plist_util.py b/build/config/mac/plist_util.py
  126. index bba0208a5..019dcf918 100644
  127. --- a/build/config/mac/plist_util.py
  128. +++ b/build/config/mac/plist_util.py
  129. @@ -3,7 +3,7 @@
  130. # found in the LICENSE file.
  131. import argparse
  132. -import plistlib
  133. +import biplist
  134. import os
  135. import re
  136. import subprocess
  137. @@ -89,6 +89,7 @@ def Interpolate(value, substitutions):
  138. def LoadPList(path):
  139. """Loads Plist at |path| and returns it as a dictionary."""
  140. + return biplist.readPlist(path)
  141. fd, name = tempfile.mkstemp()
  142. try:
  143. subprocess.check_call(['plutil', '-convert', 'xml1', '-o', name, path])
  144. @@ -100,6 +101,7 @@ def LoadPList(path):
  145. def SavePList(path, format, data):
  146. """Saves |data| as a Plist to |path| in the specified |format|."""
  147. + return biplist.writePlist(data, path, {"xml1": False, "binary1": True}[format]) # doesn't handle "json" format
  148. fd, name = tempfile.mkstemp()
  149. try:
  150. # "plutil" does not replace the destination file but update it in place,
  151. --
  152. 2.11.0
  153. From eb3787dd670900cc2c3020c9323a9d95983c8887 Mon Sep 17 00:00:00 2001
  154. From: David Fifield <david@bamsoftware.com>
  155. Date: Tue, 4 Dec 2018 05:16:04 +0000
  156. Subject: [PATCH 5/6] Override use_system_xcode=true.
  157. ---
  158. build_overrides/build.gni | 2 ++
  159. 1 file changed, 2 insertions(+)
  160. diff --git a/build_overrides/build.gni b/build_overrides/build.gni
  161. index 81cb3e73ae..b683ea850c 100644
  162. --- a/build_overrides/build.gni
  163. +++ b/build_overrides/build.gni
  164. @@ -46,3 +46,5 @@ if (host_os == "mac") {
  165. "hermetic toolchain if the minimum OS version is not met.")
  166. use_system_xcode = _result == 0
  167. }
  168. +
  169. +use_system_xcode = true
  170. --
  171. 2.11.0
  172. From 5df71ea8f31fd25a05c6b6b881c8126b25b5475c Mon Sep 17 00:00:00 2001
  173. From: David Fifield <david@bamsoftware.com>
  174. Date: Mon, 3 Dec 2018 21:11:14 -0700
  175. Subject: [PATCH 6/6] Disable the desktop_capture module.
  176. It's causing an error related to CoreGraphics.h and hopefully we don't
  177. need it.
  178. ---
  179. modules/BUILD.gn | 1 -
  180. 1 file changed, 1 deletion(-)
  181. diff --git a/modules/BUILD.gn b/modules/BUILD.gn
  182. index 465f32d3c4..578cdbd57e 100644
  183. --- a/modules/BUILD.gn
  184. +++ b/modules/BUILD.gn
  185. @@ -17,7 +17,6 @@ group("modules") {
  186. "audio_processing",
  187. "bitrate_controller",
  188. "congestion_controller",
  189. - "desktop_capture",
  190. "media_file",
  191. "pacing",
  192. "remote_bitrate_estimator",
  193. --
  194. 2.11.0