Skip to content

Commit c114ca1

Browse files
authored
Merge pull request #171 from kelvinhammond/upgrade_9.4.0
Upgrade to libzim 9.4.0
2 parents 02c8fb7 + 2ec85e8 commit c114ca1

26 files changed

Lines changed: 1839 additions & 1250 deletions

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
LIBZIM_VERSION=9.3.0
1+
LIBZIM_VERSION=9.4.0

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ubuntu-22.04, ubuntu-22.04-arm, ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-14, macos-15]
17+
os: [ubuntu-22.04, ubuntu-22.04-arm, ubuntu-24.04, ubuntu-24.04-arm, macos-14, macos-15, macos-15-intel]
1818
node: [20, 22, 24]
1919
runs-on: ${{ matrix.os }}
2020

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,44 @@ import { Archive, SuggestionSearcher, Searcher } from "@openzim/libzim";
9696
delete archive;
9797
})();
9898

99+
## Local Development
100+
101+
### Important Files
102+
`.env` - Set environment variables for local development. Only LIBZIM_VERSION for now
103+
`bindings.gyp` - Node-gyp build configuration file
104+
`src/` - Source code for the Node.js bindings
105+
`test/` - Test cases
106+
107+
### Setup
108+
109+
```bash
110+
git clone git@github.com:openzim/node-libzim.git
111+
cd node-libzim
112+
113+
# Will install dependencies, download libzim binary and build the bindings
114+
npm run install
115+
116+
# Required in order for local binding and tests to work.
117+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/download/lib/x86_64-linux-gnu
118+
```
119+
120+
### Iterating during development
121+
122+
Make your changes in `src/` and then run:
123+
```bash
124+
node-gyp rebuild --debug -v && npx jest ./test/zim.test.ts
99125
```
100126

127+
### Updating libzim version
128+
To update the libzim version used, change the `LIBZIM_VERSION` variable in
129+
`.env` file to the desired version and run:
130+
```bash
131+
npm run install
132+
```
133+
134+
If you are upgrading libzim from a major version you will need to edit the `bundle-libzim.js` file
135+
and change the `libzim.so*` file names to match the new version.
136+
101137
## License
102138

103139
[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see

binding.gyp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
],
3535
"libraries": [
3636
"-Wl,-rpath,'$$ORIGIN'",
37-
"-L<(libzim_dir)/lib/aarch64-linux-gnu",
38-
"<(libzim_dir)/lib/aarch64-linux-gnu/libzim.so.9",
37+
"-L<(libzim_dir)/lib/aarch64-rpi3-linux-gnu",
38+
"<(libzim_dir)/lib/aarch64-rpi3-linux-gnu/libzim.so.9",
3939
],
4040
}],
4141
["libzim_local!='true' and OS=='linux' and target_arch=='arm'", {

bundle-libzim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (isLinux) {
1919
const rawArch = os.arch();
2020
let libDir;
2121
if (rawArch === "arm64") {
22-
libDir = "aarch64-linux-gnu";
22+
libDir = "aarch64-rpi3-linux-gnu";
2323
} else if (rawArch === "arm") {
2424
libDir = "arm-linux-gnueabihf";
2525
} else {

download-libzim.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { mkdirp } from "mkdirp";
55
import exec from "exec-then";
66
import os from "os";
77
import fs from "fs";
8-
import urlParser from "url";
98

109
mkdirp.sync("./download");
1110

@@ -46,7 +45,7 @@ const urls = [
4645

4746
for (let url of urls) {
4847
console.info(`Downloading Libzim from: `, url);
49-
const filename = urlParser.parse(url).pathname.split("/").slice(-1)[0];
48+
const filename = new URL(url).pathname.split("/").slice(-1)[0];
5049
const dlFile = `./download/${filename}`;
5150

5251
try {

0 commit comments

Comments
 (0)