In this question about compiling c code in a Module::Build module, it was suggested to use c_source
to specify the location of the c/c++ source code.
This configuration option results in compiling the source to object files, and adding the directory to the linker's search path.
I would like to know if a similar configuration can be achieved, where all .c
files are compiled to standalone executables, and installed next to the bin/
scripts.
Since version 5.005, Perl has shipped with a module capable of inspecting the optimized parse tree ( B ), and this has been used to write many useful utilities, including a module that lets you turn your Perl into C source code that can be compiled into an native executable.
The compiler allows you to distribute Perl programs in binary form, which enables easy packaging of Perl-based programs without having to depend on the source machine having the correct version of Perl and the correct modules installed.
Interpreted Languages like Perl require the interpreter and other modules on the system to run the program. Thankfully, there are options available for compiling perl scripts into binaries. PAR is an excellent cross-platform package that can accomplish this goal.
You could check out the Alien:: set of modules, which do a superset of what you want I think. It looks like https://metacpan.org/pod/Alien::Base::Authoring is a good place to start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With