Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I bundle the C source in a Raku distribution that uses NativeCall? [closed]

I'm writing Raku bindings to a C library, but rather than require the users of the Raku code to install the C library on their own, I'd like to bundle the C code as part of the distribution (it's not such a widely distributed library).

I've read about a distribution's %?RESOURCES, and that seems like it would be useful. But I'm hazy on the specifics of how to apply it for this.

Can I bundle the C source code in the distribution, and specify some way for it to get compiled as part of the installation (eg. with zef)? Or would I need to bundle precompiled versions of the library, and get the code to choose the right one depending on the platform?

Or is this simply impossible, and I should just give users instructions on how to install the library separately?

like image 453
jja Avatar asked Feb 19 '20 21:02

jja


1 Answers

It's possible, and there exists a module LibraryMake to ease the process.

For an example of a module using it, see Digest::SHA1::Native.

like image 100
Jonathan Worthington Avatar answered Nov 03 '22 20:11

Jonathan Worthington