Skip to content

Commit 1f56c03

Browse files
committed
chore: update build script
1 parent 084f972 commit 1f56c03

File tree

1 file changed

+26
-46
lines changed

1 file changed

+26
-46
lines changed

scripts/build_skia.ts

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,64 +18,44 @@ const $ = (cmd: string | URL, ...args: string[]) => {
1818
};
1919

2020
if (Deno.env.get("SKIA_FROM_SOURCE") !== "1") {
21-
const toDownload = `brotli
22-
compression_utils_portable
23-
expat
24-
freetype2
25-
harfbuzz
26-
icu
27-
icudtl.dat
28-
libjpeg
29-
libpng
30-
libwebp
31-
libwebp_sse41
32-
particles
33-
pathkit
34-
skcms
35-
skia
36-
skparagraph
37-
skresources
38-
skshaper
39-
sktext
40-
skunicode
41-
svg
42-
wuffs
43-
zlib`
44-
.split("\n").map((e) => e.trim());
45-
let relName = `skia-${CURRENT_HASH_SHORT}-`;
21+
const relName = `skia-${CURRENT_HASH_SHORT}`;
22+
let os = "";
4623
switch (Deno.build.os) {
4724
case "windows":
48-
relName += "Windows";
25+
os = "Windows";
4926
break;
5027
case "darwin":
51-
relName += "macOS";
28+
os = "macOS";
5229
break;
5330
case "linux":
54-
relName += "Linux";
31+
os = "Linux";
5532
break;
5633
}
34+
if (Deno.build.arch === "aarch64") {
35+
os += "-aarch64";
36+
}
5737
try {
5838
Deno.mkdirSync("./out/Release", { recursive: true });
5939
// deno-lint-ignore no-empty
6040
} catch (_) {}
61-
for (const name of toDownload) {
62-
let file = name;
63-
if (!name.includes(".")) {
64-
file = `${Deno.build.os === "windows" ? "" : "lib"}${file}`;
65-
file += `.${Deno.build.os === "windows" ? "lib" : "a"}`;
66-
}
67-
const data = await fetch(
68-
`https://github.com/DjDeveloperr/skia_builds/releases/download/${relName}/${file}`,
69-
)
70-
.then((res) => res.arrayBuffer())
71-
.then((buffer) => new Uint8Array(buffer));
72-
await Deno.writeFile(
73-
new URL(`../skia/out/Release/${file}`, import.meta.url),
74-
data,
75-
);
76-
console.log(`Downloaded ${file}`);
77-
}
78-
console.log(`Downloaded prebuild binaries (${relName})`);
41+
console.log("Downloading zip");
42+
const data = await fetch(
43+
`https://github.com/DjDeveloperr/skia_builds/releases/download/${relName}/skia-${os}.zip`,
44+
)
45+
.then((res) => res.arrayBuffer())
46+
.then((buffer) => new Uint8Array(buffer));
47+
await Deno.writeFile(
48+
new URL(`../skia/out/Release/prebuilt.zip`, import.meta.url),
49+
data,
50+
);
51+
$(
52+
"unzip",
53+
"-o",
54+
"-d",
55+
"out/Release",
56+
new URL(`../skia/out/Release/prebuilt.zip`, import.meta.url).pathname,
57+
);
58+
console.log(`Downloaded prebuilt binaries (${relName}, ${os})`);
7959
Deno.exit(0);
8060
}
8161

0 commit comments

Comments
 (0)