rurban / perl-compiler

B::C - Moved over from googlecode
https://code.google.com/p/perl-compiler/
Other
63 stars 23 forks source link

support -cross=/pathto/config.sh #428

Open rurban opened 5 years ago

rurban commented 5 years ago

Small devices often do not have enough memory or not even an installed compiler to compile a perl script. In this case you need the target config.sh on your filesystem, and pass it as -cross=pathto/target-config.sh option to the compiler. Several host config values will then be replaced by its target values, so that it can be run on the target system with the target configuration. Esp. for the target specific @INC, which must find run-time modules in its path. Note that the basic architecture must still match, i.e. the perl version and the settings for usemultiplicity and useithreads must be the same as on the host. It's is strongly recommended to also have the same byteorder, ivsize and nvsize settings on the native host.

cross targets need different config keys in the C file. easier than a --target=triple or perlbinary arg seems to be a path to the cross config.sh file.

e.g. @INC needs to be different for run-time require calls, but all system relevant config settings need to be set. B::C::Config is generated. Override differing values from the cross config, and use $Config{perlpath} and $Config{osname} instead of $^X and $^O. Generate an adequate @INC to resolve run-time require's, but leave %INC untouched.

For the time being demand equal version, multiplicity and ithreads settings, but theoretically even this could be taken from the cross target.

Support --cross PATH for perlcc, -cross=PATH for the backends.