在 CPAN 上部署 xs 模块

deploying xs module on CPAN

我正在查看不同的 xs cpan 模块,但它们不包含它们绑定的库的实际源代码,

例如在这个图书馆 https://st.aticpan.org/source/NANIS/Net-Sharktools-0.009/ the xs module :https://st.aticpan.org/source/NANIS/Net-Sharktools-0.009/Sharktools.xs

有“#include "sharktools_core.h" 但是如果我浏览 metacpan 上的文件我没有找到这个文件。

此模块存在相同问题:https://metacpan.org/pod/Crypt::OpenSSL::RSA .xs 文件包含不同 openssl 文件的#include,但这些文件不在分发版中。

当这样的 xs 模块安装时,如果它们不是分发的一部分,它如何包含头文件和编译 C 文件?

这些发行版希望这些库在它们要安装到的系统上可用。因此,例如对于 Crypt::OpenSSL::RSA 它期望您为您的系统安装 openssl-dev 或等效的软件包。制作不需要这个的发行版的一个选项是(单独)释放一个 Alien distribution, and the easiest way to do this now is with Alien::Build. An Alien distribution represents either using the existing installed library or installing the library within Perl's library directories, either way it is made available for Perl to use. For example both Alien::OpenSSL and Alien::LibreSSL 存在并且可以被想要确保 SSL 库可用的发行版使用。您的 XS 发行版会将 Alien 发行版添加为依赖项,然后可以通过它使用该库。