Skip to content

Commit 3104f25

Browse files
committed
FIXED: #186 Skip download and symlink when using libzim_local
1 parent 3c92e4b commit 3104f25

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Unreleased
22

3+
* FIXED: #186 Skip download and symlink when using libzim_local
4+
35
4.2.0
46
* NEW: Use libzim 9.7.0
57
* NEW: Add addAlias method to Creator

bundle-libzim.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import dotenv from "dotenv";
22
dotenv.config();
3+
import fs from "fs";
34
import { mkdirp } from "mkdirp";
45
import exec from "exec-then";
56
import os from "os";
67

78
mkdirp.sync("./build/Release");
89

10+
const bindingGypText = fs.readFileSync("binding.gyp", { encoding: "utf8" });
11+
if (bindingGypText.match(/"libzim_local"\s*:\s*"true"/)) {
12+
console.log("the build is using system libzim -> not bundling libzim, skipping download and copy steps");
13+
process.exit();
14+
}
15+
916
const isMacOS = os.type() === "Darwin";
1017
const isLinux = os.type() === "Linux";
1118

@@ -30,6 +37,7 @@ if (isLinux) {
3037
exec(`cp download/${libDir}/libzim.so.9 build/Release/libzim.so.9`);
3138
exec("ln -sf build/Release/libzim.so.9 build/Release/libzim.so"); // convenience only, not required
3239
}
40+
3341
if (isMacOS) {
3442
console.info("Copying libzim.9.dylib to build folder");
3543
exec("cp download/lib/libzim.9.dylib build/Release/libzim.9.dylib");

0 commit comments

Comments
 (0)