ezra-bible-app / node-sword-interface

JavaScript (N-API) interface to SWORD library
GNU General Public License v2.0
22 stars 2 forks source link

ARM and Homebrew #31

Closed swils closed 2 years ago

swils commented 2 years ago

Homebrew on M1 Macbooks installs its ARM-specific packages under /opt/homebrew rather than /usr/local/opt. But the following dependencies are hardcoded in binding.gyp:

'/usr/local/opt/icu4c/lib/libicudata.a',
'/usr/local/opt/icu4c/lib/libicuuc.a',
'/usr/local/opt/icu4c/lib/libicui18n.a',
'/usr/local/opt/icu4c/lib/libicuio.a'

This causes the build of node-sword-interface to fail on my laptop.

Sadly, we also can't simply use pkg-config similar to what is done for libcurl, because Homebrew puts libicu in a Cellar, which is excluded from pkg-config by default, unless you specify PKG_CONFIG_PATH.

I think my Homebrew setup is rather standard, so I expect other people wishing to compile node-sword-interface on an M1 MacBook will run into the same problems. Do you have a preferred way of resolving this?

tobias-klein commented 2 years ago

Hi @swils!

Thank you for reporting this issue! I suppose we must somehow differentiate between M1 macs and Intel macs? There are already some other cases where a separate shell script is used to determine the value of include paths or libraries (e.g. scripts/get_sword_include_path.sh)

If you go the separate script route, you would have to check in the script whether you are running on Intel or ARM ... or you check implicitly via the existence of the folders you mentioned above?

Could you imagine to contribute a PR to resolve this?