-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
bundle-libzim.js
33 lines (29 loc) · 1.16 KB
/
bundle-libzim.js
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
import dotenv from "dotenv";
dotenv.config();
import { mkdirp } from "mkdirp";
import exec from "exec-then";
import os from "os";
mkdirp.sync("./build/Release");
const isMacOS = os.type() === "Darwin";
const isLinux = os.type() === "Linux";
if (!isMacOS && !isLinux) {
console.warn(
"\x1b[41m\n================================ README \n\nlibzim bundle with prebuilt binaries only available for macOS and Linux:\n\n\thttps://github.com/openzim/libzim/\n\n================================\x1b[0m\n",
);
}
if (isLinux) {
console.info("Copying libzim.so.9 to build folder");
exec(
"cp download/lib/x86_64-linux-gnu/libzim.so.9 build/Release/libzim.so.9",
);
exec("ln -sf build/Release/libzim.so.9 build/Release/libzim.so"); // convienience only, not required
}
if (isMacOS) {
console.info("Copying libzim.9.dylib to build folder");
exec("cp download/lib/libzim.9.dylib build/Release/libzim.9.dylib");
exec("ln -sf build/Release/libzim.9.dylib build/Release/libzim.dylib"); // convienience only, not required
console.info("Fixing rpath");
exec(
"install_name_tool -change libzim.9.dylib @loader_path/libzim.9.dylib build/Release/zim_binding.node",
);
}