-
Notifications
You must be signed in to change notification settings - Fork 3
/
compile-libmp3lame.mjs
60 lines (54 loc) · 1.32 KB
/
compile-libmp3lame.mjs
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
import { execSync } from "child_process";
import fs, {
copyFileSync,
existsSync,
mkdirSync,
rmSync,
unlinkSync,
writeFileSync,
} from "fs";
import path from "path";
import { PREFIX } from "./const.mjs";
export const enableLibMp3Lame = (isWindows) => {
if (!fs.existsSync("libmp3lame")) {
// Using newer than 3.100 because it has support for aarch64
execSync("unzip libmp3lame.zip -d libmp3lame", {
stdio: "inherit",
});
}
execSync(
[
path.posix.join(
process.cwd().replace(/\\/g, "/"),
"libmp3lame",
"configure"
),
`--prefix=${path.join(process.cwd(), "libmp3lame", PREFIX)}`,
"--enable-static",
"--with-pic",
"--disable-shared",
"--disable-frontend",
isWindows ? "--host=x86_64-w64-mingw32" : null,
"--disable-decoder",
"--enable-nasm",
"--disable-rpath",
]
.filter(Boolean)
.join(" "),
{
cwd: "libmp3lame",
stdio: "inherit",
}
);
execSync("make", {
cwd: "libmp3lame",
stdio: "inherit",
});
execSync("make install", {
cwd: "libmp3lame",
stdio: "inherit",
});
unlinkSync("libmp3lame/remotion/lib/libmp3lame.la");
rmSync("libmp3lame/remotion/share", { recursive: true });
execSync(`cp -r ${PREFIX} ../`, { cwd: "libmp3lame", stdio: "inherit" });
};