Make node-libzim packageable for GNU/Linux distributions
The libzim package is already provided on Alpine Linux distribution. I would like to use that binary.
Is it possible to do not download libzim and made use of already installed package?
@OTLabs My short answer would be: theoretically yes, practically no.
@kelson42 Ok. Thank you.
Would it be possible to modify node-libzim so the rpath for .so will not include /home/... (it would be perfect to have an option to strip/prefix rpath, something like /usr/... would be great)?
I am building the mwoffliner package for Alpine Linux and post-check complains for rpath having /home/... so no flight. I already have libzim[-dev] package build right but it's no flight also.
@OTLabs I think future versions of libzim binaries (new one to be released soon) won't use any rpath. @mgautierfr could you confirm?
Thank you.
@OTLabs This is technically a simple change, the only thing is gyp is a horrible build system and it makes the config much more complicated.
The file that would need modifying is build/native/binding.gyp, and would need something like this added:
'conditions': [
['libzim =="external"',
{
'libraries': [
"-lzim"
],
},
[
[
"OS=='linux'",
{
"libraries": [
"-Wl,-rpath,<(libzim_dir)",
"-L<(libzim_dir)",
"<(libzim_dir)/libzim.so.4",
],
}
],
[
"OS=='mac'",
{
"libraries": [
"-lzim"
]
}
],
]
]
]
@OTLabs If you can write up something that creates a variable called libzim_external which takes into account an external flag and falls back to the current linux/mac behaviour I'd be really happy to merge it :)
@ISNIT0 I really appreciate a lot your kind answer.
It would be my real pleasure to submit corresponding PR as I am so exited with all openzim software but I have no any experience with gyp and what I have seen about it makes me think that the task to add an above mentioned variable is far beyond my current skills.
Meanwhile I have tried to hack build/native/binding.gyp making configuration for linux and mac identical. It was not enough as download-libzim.js is called anyway. I made a change to this file too: I put const isLinux = false; but the only effect of this change is to trigger a warning message printed to console.
I also tried to run npm run build:native ... instead of npm install ... without much luck so far.
I very hope the next release will make possible to pack mwoffliner for Alpine Linux. Meanwhile I will try more ideas.