forked from homuler/MediaPipeUnityPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemsdk_bitcode_support.diff
More file actions
313 lines (304 loc) · 14.2 KB
/
Copy pathemsdk_bitcode_support.diff
File metadata and controls
313 lines (304 loc) · 14.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
diff --git a/emscripten_deps.bzl b/emscripten_deps.bzl
index 2189360..3eb6d55 100644
--- a/emscripten_deps.bzl
+++ b/emscripten_deps.bzl
@@ -31,6 +31,8 @@ def emscripten_deps(emscripten_version = "latest"):
url = emscripten_url.format("linux", revision.hash, "tbz2"),
sha256 = revision.sha_linux,
build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD",
+ patch_args = ["-p1"],
+ patches = revision.patches,
type = "tar.bz2",
)
@@ -41,6 +43,8 @@ def emscripten_deps(emscripten_version = "latest"):
url = emscripten_url.format("mac", revision.hash, "tbz2"),
sha256 = revision.sha_mac,
build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD",
+ patch_args = ["-p1"],
+ patches = revision.patches,
type = "tar.bz2",
)
@@ -51,6 +55,8 @@ def emscripten_deps(emscripten_version = "latest"):
url = emscripten_url.format("win", revision.hash, "zip"),
sha256 = revision.sha_win,
build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD",
+ patch_args = ["-p1"],
+ patches = revision.patches,
type = "zip",
)
diff --git a/emscripten_toolchain/emar.sh b/emscripten_toolchain/emar.sh
index e4279f1..10858fd 100755
--- a/emscripten_toolchain/emar.sh
+++ b/emscripten_toolchain/emar.sh
@@ -2,4 +2,29 @@
source external/emsdk/emscripten_toolchain/env.sh
-exec python3 $EMSCRIPTEN/emar.py "$@"
+# Dirty hack to avoid warnings:
+# archive file contains duplicate entries. This is not supported by emscripten.
+# Only the last member with a given name will be linked in which can result in undefined symbols.
+#
+# If you get this warning, some symbols will actually not be resolved.
+
+param_file_path=${1:1} # remove @
+emar_opts=`head -1 "${param_file_path}"`
+
+tmp_param_file_path=${param_file_path}.tmp
+cp "${param_file_path}" "${tmp_param_file_path}"
+
+sed -i -e '1d' "${tmp_param_file_path}" # remove emar_opts
+output_path=`head -1 "${tmp_param_file_path}"`
+sed -i -e 1's/.*/-o &.bc/' "${tmp_param_file_path}"
+
+bc_param_file_path="${output_path}.bc-2.params"
+mv "${tmp_param_file_path}" "${bc_param_file_path}"
+
+$EMSCRIPTEN/../bin/llvm-link "@${bc_param_file_path}"
+
+# Output the expected file with the expected format
+python3 $EMSCRIPTEN/emar.py "${emar_opts}" "${output_path}" "${output_path}.bc"
+
+rm ${output_path}.bc
+rm ${bc_param_file_path}
diff --git a/emscripten_toolchain/link_wrapper.py b/emscripten_toolchain/link_wrapper.py
index d6b715d..b68e638 100644
--- a/emscripten_toolchain/link_wrapper.py
+++ b/emscripten_toolchain/link_wrapper.py
@@ -68,6 +68,9 @@ if oformat is not None:
elif base_name_split[1] == '.' + oformat:
base_name = base_name_split[0]
+ elif oformat == 'object' and (base_name_split[1] == '.bc' or base_name_split[1] == '.o'):
+ base_name = base_name_split[0]
+
# If the output name does have an extension and it does not match the output
# format, change the base_name so it doesn't have an extension and rename
# the output_file so it has the proper extension.
@@ -81,6 +84,8 @@ if oformat is not None:
files = []
extensions = [
+ '.bc',
+ '.o',
'.js',
'.wasm',
'.wasm.map',
@@ -159,8 +164,9 @@ if not len(files):
sys.exit(1)
# cc_binary must output exactly one file; put all the output files in a tarball.
-cmd = ['tar', 'cf', 'tmp.tar'] + files
-subprocess.check_call(cmd, cwd=outdir)
-os.rename(os.path.join(outdir, 'tmp.tar'), output_file)
+if oformat != 'object':
+ cmd = ['tar', 'cf', 'tmp.tar'] + files
+ subprocess.check_call(cmd, cwd=outdir)
+ os.rename(os.path.join(outdir, 'tmp.tar'), output_file)
sys.exit(0)
diff --git a/revisions.bzl b/revisions.bzl
index 468ffb7..deb0b3e 100644
--- a/revisions.bzl
+++ b/revisions.bzl
@@ -7,149 +7,206 @@ EMSCRIPTEN_TAGS = {
sha_linux = "0714344e32e244e6d44d9ea75937633ab1338e417a232fb66d6dcd7d4b704e8c",
sha_mac = "f6c1cad729ed799e1df09eacf5aa80cce9861d69ec6d9581c17e4ba8d9b064ce",
sha_win = "756c41cbcab4ae6077cca30834d16151392b8c19ab186c13d42d7d05d6d727cc",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"3.0.1": struct(
hash = "91b7a67a486d2430e73423a38d950d8a550826ed",
sha_linux = "25fd430268596229c4ac38e188d7c2b31f75c2ec8172b1351d763e37c830c6af",
sha_mac = "52ec2204115b727cc4de38b5eeae147eead12b299b98e5a88653d12958cae4d4",
sha_win = "0e072736b471c9a07cdf534ba4da46b3b6545b63c8a6cbb0ef7d544251e15092",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"3.0.0": struct(
hash = "7fbe748230f2ce99abbf975d9ad997699efb3153",
sha_linux = "10646b64daea15354f14f89f7e79937f420b77f31bda7c4b174de2474835950f",
sha_mac = "ebb17bc91c6a72ca06d17337d27aa1a2be4c9af4c68644c221712123f663b8ab",
sha_win = "0d4f2ff5d88a8eef5ed769ee4ffc5d5574143911d2e0079325cdc5206c9e9bb1",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.34": struct(
hash = "d8fc1b92dbc0ce8d740a7adb937c5137ba4755e0",
sha_linux = "a6304e3a52c172eb178c6f9817d74aa3ee411e97ef00bcae0884377799c49954",
sha_mac = "975ae11000100362baf19d161fec04d82e1f7c9fb7d43c43864ddd65a47f1780",
sha_win = "8167a44bb895a0fdc153836bed91bf387be57f2dc1b8f103bf70e68923b61d39",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.33": struct(
hash = "cef8850d57278271766fb2163eebcb07354018e7",
sha_linux = "958a0f4b1533e877c1a5ed3c13cb8baabc80e791d45858c2c94ac62325ada953",
sha_mac = "8ecb248653d44c3748e23c089cb9f0e3d4eee7cda13fdec27ec0113b896e34c4",
sha_win = "6b6b2831f8b338488f787b4a8c34700277bf3988358dbb54426f017155603ac9",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.32": struct(
hash = "74646397e3c5010824ad60d1de86c6bcbe334dff",
sha_linux = "236b3954e71d3bb30d347c655b9f47f2a091aa2e61046e1912c8da90152f4ca1",
sha_mac = "6a03267574534948e3b041e5d3e31bd757751ef17912eb6e90b96a47da03afb6",
sha_win = "2f8fbf0db097d67d0c364946faceec27c569c5c2d7b22068eef8db55645aba36",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.31": struct(
hash = "597724ca3f6cd6e84bea73f1f519a3953b5c273d",
sha_linux = "ef70c7733aa0df41cb4c812f5a89bf6b2ed13ca8aa252872396c0be271156d9e",
sha_mac = "77e57c3e98758488ef676f8f58a85faa0bd65a1d326a91771ad83d7cb0e373ca",
sha_win = "541605b740afccd08a39f5ae815978f699f350d621a1b2dfba0763970b56aee4",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.30": struct(
hash = "c69458f1bbf3ef5b8da4e934de210659cc9bca04",
sha_linux = "ee1c8270096a728966ae38af548047d1f64c18318e06ba75952e657136f02537",
sha_mac = "574a5819308eba6c8be6a780e26dff415a0e7178d3f44162dd8dca87eb40d4a7",
sha_win = "242d244f4f5f5af08e6e6ac9c143aebf1b7bb2a23fd2992350731e59acfee07c",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.29": struct(
hash = "c2369dc425725fff86ba90a9007a4603ddf7941b",
sha_linux = "7df4a8f3e25820becadfa7f1fe0d78e764102ec3ee50c474ca1634ed90d48890",
sha_mac = "d998521ba95882a27792f0113ea2c972fbb891c240649f4c994f0260c0e1a213",
sha_win = "c64aa3f2af6503f6711b2322986a45784e00d7c7fe13ec3f5c4f740472d065a0",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.28": struct(
hash = "866055ea639d64dfedc625d28ec981e47ce37168",
sha_linux = "7dca7704eb14e367bb67e9abc9eaf59e75f59b74e32422e04556de10897a9a86",
sha_mac = "370f76493e3805e2538290b698a381f04b6d78a77771e48fc0099cf89dad985f",
sha_win = "e913c50ea5f196d36971f7cf5b1cf9a9ca27ce0818aba56be3a66e31e95c0e5b",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.27": struct(
hash = "1ac46e3b84955231ab4a4f4cbe0c7ac28c86b8cc",
sha_linux = "3e124e278de168cf22e03b93b2f14a65a86777e428cdaab7e5e1c2289eb41605",
sha_mac = "388262b9e1042ef9a3a1945d5a23dcd634c8042a225e8fdf80bcc2c1cb7e05cc",
sha_win = "762276a332432e717afb988310d21ae10e36facc1e05bfd77042a364fb43cc3c",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.26": struct(
hash = "823d37b15d1ab61bc9ac0665ceef6951d3703842",
sha_linux = "996e16d368a99dd4dd12126acbcb8bea9a607b5257cc7b747c4afc2f036fd8cf",
sha_mac = "8b2d7e84cc449531e88034beb31da89a0b61ccaeaa1584ffb6da7842c6348fdc",
sha_win = "095e772764d7f8c0f8228bda4b8500ae43aac2303567da5cdc9f8623f70a5743",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.25": struct(
hash = "f6f001b08fbb67935379cf13d17fd9bfdbaff791",
sha_linux = "06d8e2f3d4f4b35a57de9c15e62a559c941cfba1dd7ec02353d815904d912c3b",
sha_mac = "6541bf3a648aae7df84de424ff392dd1513ab5450203c84f72a6a03e321a301b",
sha_win = "267fbfa809ec0eb911c1962b1b9768675cb82228e694a5f9ef570232ee71db76",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.24": struct(
hash = "6ab7fc5622a67e6111d07c4ba61c8d3c8fc33ed2",
sha_linux = "e5daa0e87f3afd2197e7975297cb0cd4c245edccb964ca5f1f32ee7d985bf440",
sha_mac = "e4b7f2a7b71d6ac4610ee7b14743570e0dfba3668dc6b4f984cbe7a135888527",
sha_win = "db2aad422a3ca2295be6101b0151eeee55dcea29ba1f31b4594c02ba46591cbe",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.23": struct(
hash = "77b065ace39e6ab21446e13f92897f956c80476a",
sha_linux = "7713a9a5572d839aea9eaa84a7c4779d11c6c8818ee64a0f443b62081fae6d47",
sha_mac = "b793087462d581e25c8c267fca9d30519619e3272480862a56cc316a32c7afab",
sha_win = "b8885cbb41a39e4734861462e05ee58c7ff7562016a842bcee2603f229940e8b",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.22": struct(
hash = "6465a9acb820207acf7da44661a7de52d0a1ae3c",
sha_linux = "c079781124e763c53c9fc73781fcee40296ce3314276836bc694f07bd331a859",
sha_mac = "ab95574dfc685b0300e37bea36aba413045bbfa2ab06b93eceb881670489eec1",
sha_win = "ba142e7e380596cba763e3a414de6511bcb86de48e4b48cf393b1ea449a24aaa",
+ patches = [
+ "@//third_party:emscripten_extract_archive_fixes.diff",
+ ],
),
"2.0.21": struct(
hash = "72f4ec97fbc7ec16c15ae68a75b0a257b2835160",
sha_linux = "741264f33f96ba4b785ed0b133861ebdfefbaefab76ddcfe7bde6522829d6f70",
sha_mac = "b07c0d65ee7e2799170c6f3b2aacebfe070c2e4975088bcd1b3a4140fecd8418",
sha_win = "dc3cbf47aa4be52a92526f1790a013734ecbd407f7f36286ed0283c96355999a",
+ patches = [],
),
"2.0.20": struct(
hash = "e0c15cd14170f407a9eb27fcbad22931dc67feb7",
sha_linux = "a196504fd1095836ca3961208338ff9e292be7729ea529bc19800aa7c966d34a",
sha_mac = "6cdbf17ed61486b38ea79d3f31d74483e7388d1e7468518dccba3f24e0ddd4c4",
sha_win = "4d22a32c219dbe18c55b635d014b9eaf7da60536171b7af37d9a8099fd33794b",
+ patches = [],
),
"2.0.19": struct(
hash = "9b9ff2dabfb4a7fbacbc004c0bead12a60f9d05c",
sha_linux = "bd7c2a38ac88d219a1ab5003ddbf8fdc66a6ba55bc69f99077346edf2753b4ea",
sha_mac = "6cc44029c9052855a55938eb6496b5659da4b1ce9cb34502b740af5993a94f93",
sha_win = "a1fa8b1c387b9307f9b87c43dc83c0ff1bc04b9f29fbe4f39aff2dd946ca4b70",
+ patches = [],
),
"2.0.18": struct(
hash = "c2ac7520fad29a7937ed60ab6a95b08eb374c7ba",
sha_linux = "e9f777de592f606b10104b2efe5179a7a8f44e3a9dffa1e3aaf73e05eb8893d7",
sha_mac = "86b1dd62e424e3788bf132292a694a25ca9b0875d06f50d0f5d424593697452c",
sha_win = "49ce07bda6be070251db44a08fcc05cae21ffdbd7522423a0c79bde635e87e28",
+ patches = [],
),
"2.0.17": struct(
hash = "f5c45e60392b82f603e3a8039c62db294fab02d2",
sha_linux = "b40a4874057e4cace600f8ee9787dcbe236e3dc5b2fff5c2ecb0e867e426f99c",
sha_mac = "081f61abf7d5ac0ec31aaffc5550013d4093ea4ea39520b7a32b7448d2a6ee70",
sha_win = "45d06e597e6a1185a76200bd0481495e7298800a4805045d9cdbcce6311c91b2",
+ patches = [],
),
"2.0.16": struct(
hash = "80d9674f2fafa6b9346d735c42d5c52b8cc8aa8e",
sha_linux = "e527638b224d9a30dc7e5fa4b9bd2eb2ab76ad306739ba8cacf5a5e333933a2a",
sha_mac = "061020eb0e3ee0611dc5a0008ccc7778168a4f838d49ca41c0aad8c52c1a01c9",
sha_win = "99364ed0388f928e0594f790662bf3a30c2894b0eff81797e1b64f62128561cb",
+ patches = [],
),
"2.0.15": struct(
hash = "89202930a98fe7f9ed59b574469a9471b0bda7dd",
sha_linux = "7ff49fc63adf29970f6e7af1df445d7f554bdbbb2606db1cb5d3567ce69df1db",
sha_mac = "e35cced1514ad0da40584f8dd6f76aabf847ce0fa82c6dc8dd9442fb74ed6d0d",
sha_win = "31d5f8107c87833cea57edc57613bba4b36b16152772f744c5ad204594b4e666",
+ patches = [],
),
"2.0.14": struct(
hash = "fc5562126762ab26c4757147a3b4c24e85a7289e",
sha_linux = "e466cd47ddd4bf0acd645412fdf08eda6d232484e48e5a2643e08062a7a4cf56",
sha_mac = "1c554c08459b7025638ca4eddba0d35babe8c26b202a70a74e9442d577896211",
sha_win = "428bc6094671937af96f26d803871fc5cd83d4d2b1c1df45fa6873a9bc5cac51",
+ patches = [],
),
"2.0.13": struct(
hash = "ce0e4a4d1cab395ee5082a60ebb4f3891a94b256",
sha_linux = "8986ed886e111c661099c5147126b8a379a4040aab6a1f572fe01f0f9b99a343",
sha_mac = "88c91332c8c76fed14ebf0edc9a08f586012f54f04ad61e5b1b6d02bf96bdeab",
sha_win = "9fb3b945b7bd56e34d17ec04de4cce475f26c49d161aee9d9c0b8b1434591f88",
+ patches = [],
),
}