occt-gltf-addon-linux-x64 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -1
- package/postinstall.js +62 -0
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occt-gltf-addon-linux-x64",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Prebuilt linux-x64 binary for occt-gltf-addon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"postinstall": "node postinstall.js"
|
|
9
|
+
},
|
|
7
10
|
"os": [
|
|
8
11
|
"linux"
|
|
9
12
|
],
|
|
@@ -15,6 +18,7 @@
|
|
|
15
18
|
},
|
|
16
19
|
"files": [
|
|
17
20
|
"index.js",
|
|
21
|
+
"postinstall.js",
|
|
18
22
|
"occt_gltf_addon.node",
|
|
19
23
|
"lib/**",
|
|
20
24
|
"resources/**",
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
// Recreate SONAME symlinks for bundled shared libraries.
|
|
3
|
+
//
|
|
4
|
+
// npm pack/publish does not reliably preserve symlinks in package tarballs, but
|
|
5
|
+
// many ELF binaries depend on SONAMEs like:
|
|
6
|
+
// libTKDESTEP.so.8.0 (NEEDED by occt_gltf_addon.node)
|
|
7
|
+
// while we ship the real file as:
|
|
8
|
+
// libTKDESTEP.so.8.0.0
|
|
9
|
+
//
|
|
10
|
+
// This script recreates:
|
|
11
|
+
// libFoo.so.X.Y -> libFoo.so.X.Y.Z
|
|
12
|
+
// (and also libFoo.so -> libFoo.so.X.Y when missing)
|
|
13
|
+
//
|
|
14
|
+
// It runs on install of the prebuilt package (linux-x64 only).
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
function safeSymlink(targetRel, linkPathAbs) {
|
|
20
|
+
try {
|
|
21
|
+
if (fs.existsSync(linkPathAbs)) return;
|
|
22
|
+
fs.symlinkSync(targetRel, linkPathAbs);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
// Don't fail install for symlink issues; instead, let dlopen error show
|
|
25
|
+
// up later (it will be clearer on the target machine).
|
|
26
|
+
if (process.env.OCCT_GLTF_ADDON_DEBUG_INSTALL === '1') {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.warn('[occt-gltf-addon-linux-x64] symlink failed:', linkPathAbs, '->', targetRel, String(e && (e.message || e)));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function main() {
|
|
34
|
+
const libDir = path.join(__dirname, 'lib');
|
|
35
|
+
if (!fs.existsSync(libDir)) return;
|
|
36
|
+
|
|
37
|
+
const entries = fs.readdirSync(libDir);
|
|
38
|
+
for (const name of entries) {
|
|
39
|
+
// Match: libXXX.so.8.0.0
|
|
40
|
+
const m = /^(.*\.so)\.(\d+)\.(\d+)\.(\d+)$/.exec(name);
|
|
41
|
+
if (!m) continue;
|
|
42
|
+
|
|
43
|
+
const base = m[1]; // libXXX.so
|
|
44
|
+
const major = m[2];
|
|
45
|
+
const minor = m[3];
|
|
46
|
+
// const patch = m[4];
|
|
47
|
+
|
|
48
|
+
const fullAbs = path.join(libDir, name);
|
|
49
|
+
if (!fs.statSync(fullAbs).isFile()) continue;
|
|
50
|
+
|
|
51
|
+
const soname = `${base}.${major}.${minor}`; // libXXX.so.8.0
|
|
52
|
+
const sonameAbs = path.join(libDir, soname);
|
|
53
|
+
safeSymlink(name, sonameAbs);
|
|
54
|
+
|
|
55
|
+
// Optional: base -> soname (helps some tooling; not strictly required for dlopen).
|
|
56
|
+
const baseAbs = path.join(libDir, base);
|
|
57
|
+
safeSymlink(soname, baseAbs);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
main();
|
|
62
|
+
|