parro-it / libui-napi

Experimental bindings for libui using n-api
MIT License
36 stars 5 forks source link

Tool for prebuilt binaries #61

Open mischnic opened 5 years ago

mischnic commented 5 years ago

In this issue https://github.com/kusti8/proton-native/issues/179#issuecomment-438338650 develar mentioned that for "cross-packaging" (for a different platform) we should use https://www.npmjs.com/package/prebuild (so the platform/arch to download binaries for can be set via an environment variable by electron-builder (here).

parro-it commented 5 years ago

I don't see the reason why, we need only one version of the binaries, that's because we use N-API that has ABI compatibility

mischnic commented 5 years ago

An example: I want to package an app on macOS for all three platforms. For that, electron-builder needs the respective binaries (this is about platform/architecture, not the node version). The requested platform is specified by the env variables in the electron-builder code I referenced (list of options here: https://github.com/mapbox/node-pre-gyp#options)

parro-it commented 5 years ago

But we already have the binaries published for the different OS... they're the ones downloaded to avoid compilation. Does electron-builder needs some different naming scheme for them? Sorry, the it's probably just me not understanding the problem...

mischnic commented 5 years ago

they're the ones downloaded to avoid compilation. Does electron-builder needs some different naming scheme for them?

No, it't just that electron-builder needs to download a binary for Windows if I'm creating a Windows package on my Mac. There is currently no way to do that.

parro-it commented 5 years ago

No, it't just that electron-builder needs to download a binary for Windows if I'm creating a Windows package on my Mac. There is currently no way to do that.

If it's not a problem about the name of the packages, so what exactly? Nothing on our side prevents electron-builder to download whatever platform of the binaries it want, from whatever platform it's running...

mischnic commented 5 years ago

If it's not a problem about the name of the packages, so what exactly? Nothing on our side prevents electron-builder to download whatever platform of the binaries it want, from whatever platform it's running...

There has to be a way for a packaging tool to tell the libui-napi download tool which version it should download.

Nothing on our side prevents electron-builder to download whatever platform of the binaries it want, from whatever platform it's running...

No, because electron-builder doesn't download the binaries. libui-napi/tools/libui-download.js and libui-napi/tools/ibui-napi-download.js do.

parro-it commented 5 years ago

Maybe electron-builder does prefer another site to host the binaries?

mischnic commented 5 years ago

Maybe electron-builder does prefer another site to host the binaries?

No, that is fine as it is.

There just has to be a way (by using process.env.npm_config_platform if it's specified) to override the os selection in the download tools of libui-napi:

https://github.com/parro-it/libui-napi/blob/aa7e275cfdfbeaf766da091df72179f61a51ce70/tools/libui-download.js#L24

parro-it commented 5 years ago

No, because electron-builder doesn't download the binaries. libui-napi/tools/libui-download.js and libui-napi/tools/ibui-napi-download.js do.

😝😝 I taked my time, but finally I understand what you mean!! Ok, so I remember there is already an arch and os arguments in the download tools to allow to force a different architecture/os .

It's probably not working becuase noone never used it... I'll give it a shot tonight and report here...