Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pre-build Binaries #12

Closed
wants to merge 31 commits into from
Closed

Add Pre-build Binaries #12

wants to merge 31 commits into from

Conversation

rafaelmaeuer
Copy link

@rafaelmaeuer rafaelmaeuer commented Jun 21, 2022

Adding prebuilt binaries avoids requiring Rust tooling everywhere.

In the attempt to solve this I played around with napi-rs (see rafaelmaeuer/node-crc/tree/dev/napi) unless I found out, that cargo already produces the prebuild-binary: index.node.

After learning about the necessity of cross-platform binaries (invalid ELF header in Github actions) I ended up writing a build-script based on cross-rs and rustup/cross-compilation which can produce binaries for following platforms (inspired by sharp):

  • macOS x64
  • macOS ARM64
  • Linux x64 (gnu/musl)
  • Linux x86 (gnu/musl)
  • Linux ARM64 (gnu/musl)
  • Windows x64
  • Windows x86

I slightly modified the lib to load the correct binary on each platform and Mocca-Tests are still passing:

  CRC-8 Family
    ✔ should calculate CRC-8(CRC-8-ATM)
    ✔ should calculate CRC-8-CDMA

  CRC-16 Family
    ✔ should calculate CRC-16(CRC-16-IBM)
    ✔ should calculate CRC-16-CCITT(CRC-CCITT)

  CRC-24 Family
    ✔ should calculate CRC-24
    ✔ should calculate CRC-24 (using poly)

  CRC-32 Family
    ✔ should calculate CRC-32(CRC-32-IEEE) which is also called crc32b in mhash library
    ✔ should calculate crc32 according to the mhash library
    ✔ should calculate CRC-32-C

  CRC-64 Family
    ✔ should calculate CRC-64(CRC-64-ECMA)
    ✔ should calculate CRC-64-ISO
    ✔ should calculate CRC-64-WE
    ✔ should calculate CRC-64-JONES


  13 passing (9ms)

I also created a changelog file from the git history, therefore this PR closes #7, closes #8 and closes #9.

A next step would be to let github-actions produce the binaries and download them from github-artifacts on install.

@rafaelmaeuer rafaelmaeuer changed the title Add Pre-build Binary Add Pre-build Binaries Jun 27, 2022
@rafaelmaeuer
Copy link
Author

@magiclen is there any possibility to approve this PR in the nearer future?

@gemwuu
Copy link

gemwuu commented Nov 22, 2022

IMHO, these binaries should be published as an external assets, instead of being committed into the repo.

@magiclen is there any possibility to approve this PR in the nearer future?

@fengmk2
Copy link

fengmk2 commented Nov 22, 2022

Hope the pr will be merged and release to npm.

@rafaelmaeuer
Copy link
Author

Today I did some further maintenance on this project, including updates of dependencies and the build-CI. It resulted in an update v2.1.0, feel free to use it until this PR gets merged sometime. @gemwuu we do like the idea of prebuild-binaries being generated in CI and uploaded to release assets, we appreciate any help with swrlab#13.

@rafaelmaeuer rafaelmaeuer deleted the branch magiclen:master January 17, 2023 21:40
@rafaelmaeuer rafaelmaeuer deleted the master branch January 17, 2023 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants